Skip to content

Let's use AI to Earn!

style: 样式

牛文政13d7a3de87c7
diff --git a/commont/types/apiServer.ts b/commont/types/apiServer.ts
index d7f63517..aec5bcc6 100644
--- a/commont/types/apiServer.ts
+++ b/commont/types/apiServer.ts
@@ -6,6 +6,6 @@
* @Description:
*/
export interface TimeTemp {
- createTime: Date;
- updateTime: Date;
+ createTime: string;
+ updateTime: string;
}
diff --git a/commont/types/task.ts b/commont/types/task.ts
index bd7ec0e2..e6488d96 100644
--- a/commont/types/task.ts
+++ b/commont/types/task.ts
@@ -43,6 +43,8 @@ export interface TaskProduct extends TaskData {
price: number;
sales?: number;
}
+
+export type TaskDataInfo = TaskProduct | TaskPromotion | TaskVideo;
export interface Task<T extends TaskProduct | TaskPromotion | TaskVideo>
extends TimeTemp {
id: string;
@@ -55,7 +57,7 @@ export interface Task<T extends TaskProduct | TaskPromotion | TaskVideo>
requiresShoppingCart: boolean; // 是否需要挂购物车
maxRecruits: number; // 最大招募人数
currentRecruits: number; // 当前招募人数
- deadline: Date; // 任务截止时间
+ deadline: string; // 任务截止时间
firstTimeBonus: number; // 首次任务奖励
reward: number; // 任务奖励金额
status: TaskStatus; // 'active' | 'completed' | 'cancelled'
diff --git a/src/views/task/carTask.module.css b/src/views/task/carTask.module.css
deleted file mode 100644
index 551ed48e..00000000
--- a/src/views/task/carTask.module.css
+++ /dev/null
@@ -1,24 +0,0 @@
-.task-list-container {
- display: flex;
- flex-wrap: wrap;
- gap: 16px; /* 卡片之间的间距 */
-}
-
-.task-card {
- width: calc(33.33% - 16px); /* 默认每行3个,减去间距 */
- box-sizing: border-box; /* 确保宽度计算包含边框和内边距 */
-}
-
-/* 响应式规则:屏幕宽度小于1200px时,每行显示2个 */
-@media (max-width: 1200px) {
- .task-card {
- width: calc(50% - 16px);
- }
-}
-
-/* 响应式规则:屏幕宽度小于768px时,每行显示1个 */
-@media (max-width: 768px) {
- .task-card {
- width: 100%;
- }
-}
\ No newline at end of file
diff --git a/src/views/task/components/carInfo.tsx b/src/views/task/components/carInfo.tsx
index 4ed0fa43..413e2892 100644
--- a/src/views/task/components/carInfo.tsx
+++ b/src/views/task/components/carInfo.tsx
@@ -14,6 +14,7 @@ import {
} from '@@/types/task';
import { forwardRef, useImperativeHandle, useState } from 'react';
import { taskApi } from '@/api/task';
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
export interface TaskInfoRef {
init: (pubRecord: Task<TaskPromotion>) => Promise<void>;
@@ -50,7 +51,7 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
return (
<>
<Modal
- title="Basic Modal"
+ title="商品任务"
open={isModalOpen}
onCancel={handleCancel}
footer={[
@@ -68,7 +69,13 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
<p>任务标题:{taskInfo.title}</p>
<p>任务描述:{taskInfo.description}</p>
<p>任务类型:{TaskTypeName.get(taskInfo.type)}</p>
- <p>任务图片:{taskInfo.imageUrl}</p>
+
+ <img
+ src={`${FILE_BASE_URL}${taskInfo.imageUrl}`}
+ alt=""
+ className="w-full h-full"
+ />
+
<p>任务奖励金额:{taskInfo.reward}</p>
<p>任务状态:{TaskStatusName.get(taskInfo.status)}</p>
</div>
diff --git a/src/views/task/mineTask.tsx b/src/views/task/mineTask.tsx
index 29967ccd..56e16235 100644
--- a/src/views/task/mineTask.tsx
+++ b/src/views/task/mineTask.tsx
@@ -9,7 +9,7 @@ import { Button, Card } from 'antd';
import { useState, useEffect, useRef } from 'react';
import { taskApi } from '@/api/task';
import { UserTask, UserTaskStatus } from '@/api/types/task';
-import { Task } from '@@/types/task';
+import { Task, TaskDataInfo } from '@@/types/task';
import MineTaskInfo, { MineTaskInfoRef } from './components/mineInfo';
import { WithdrawRef } from './components/withdraw';
import Withdraw from './components/withdraw';
@@ -26,7 +26,7 @@ const UserTaskStatusNameMap = new Map<UserTaskStatus, string>([
]);
export default function Page() {
- const [taskList, setTaskList] = useState<UserTask<Task>[]>([]);
+ const [taskList, setTaskList] = useState<UserTask<Task<TaskDataInfo>>[]>([]);
const [pageInfo, setPageInfo] = useState({
pageSize: 10,
pageNo: 1,
@@ -46,18 +46,22 @@ export default function Page() {
const Ref_MineTaskInfo = useRef<MineTaskInfoRef>(null);
const Ref_Withdraw = useRef<WithdrawRef>(null);
- async function withdraw(task: UserTask<Task>) {
+ async function withdraw(task: UserTask<Task<TaskDataInfo>>) {
Ref_Withdraw.current?.init(task);
}
return (
- <div>
+ <div className="p-4">
<MineTaskInfo ref={Ref_MineTaskInfo} />
<Withdraw ref={Ref_Withdraw} />
- <div>
+ <div className="flex flex-wrap gap-4">
{taskList.map((v) => {
return (
- <Card key={v.id} title={v.taskId.title}>
+ <Card
+ key={v.id}
+ title={v.taskId.title}
+ className="box-border w-full p-4 sm:w-1/2 md:w-1/3"
+ >
<div>
<p>任务描述: {v.taskId.description}</p>
<p>状态: {UserTaskStatusNameMap.get(v.status)}</p>
diff --git a/src/views/task/popTask.tsx b/src/views/task/popTask.tsx
index d6db3245..28e31be2 100644
--- a/src/views/task/popTask.tsx
+++ b/src/views/task/popTask.tsx
@@ -5,12 +5,13 @@
* @LastEditors: nevin
* @Description: 推广任务
*/
-import { Button } from 'antd';
+import { Button, Card, Col, Row } from 'antd';
import { useState, useEffect, useRef } from 'react';
import { Task, TaskPromotion, TaskType } from '@@/types/task';
import { taskApi } from '@/api/task';
import { TaskInfoRef } from './components/popInfo';
import TaskInfo from './components/popInfo';
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
export default function Page() {
const [taskList, setTaskList] = useState<Task<TaskPromotion>[]>([]);
@@ -35,20 +36,58 @@ export default function Page() {
}, []);
return (
- <div>
+ <div className="p-4">
<TaskInfo ref={Ref_TaskInfo} />
- <div>
+ <div className="flex flex-wrap gap-4">
{taskList.map((v) => {
return (
- <div key={v.id}>
- {v.title}
- <Button
- type="primary"
- onClick={() => Ref_TaskInfo.current?.init(v)}
- >
- 查看
- </Button>
- </div>
+ <Card
+ key={v.id}
+ className="box-border w-full p-4 sm:w-1/2 md:w-1/3"
+ >
+ <Row>
+ <Col span={12}>
+ <div>
+ <img
+ src={`${FILE_BASE_URL}${v.imageUrl}`}
+ alt=""
+ className="w-full h-full"
+ />
+ </div>
+ </Col>
+ <Col span={12}>
+ <h3>{v.title}</h3>
+ <Row>
+ <Col span={12}>
+ {!v.dataInfo ? (
+ <div>暂无数据</div>
+ ) : (
+ <>
+ <p> {v.dataInfo.title}</p>
+ </>
+ )}
+ </Col>
+ <Col span={12}>
+ <p>招募人数: {v.maxRecruits}</p>
+ <p>截至日期: {v.deadline}</p>
+ </Col>
+ </Row>
+ </Col>
+ </Row>
+ <Row>
+ <Row>
+ <Col span={12}>-----</Col>
+ <Col span={12}>
+ <Button
+ type="primary"
+ onClick={() => Ref_TaskInfo.current?.init(v)}
+ >
+ 查看
+ </Button>
+ </Col>
+ </Row>
+ </Row>
+ </Card>
);
})}
</div>
diff --git a/src/views/task/videoTask.tsx b/src/views/task/videoTask.tsx
index 6d1d3aed..35bb6706 100644
--- a/src/views/task/videoTask.tsx
+++ b/src/views/task/videoTask.tsx
@@ -5,12 +5,14 @@
* @LastEditors: nevin
* @Description: 视频任务
*/
-import { Button } from 'antd';
+import { Button, Card, Col, Row } from 'antd';
import { useState, useEffect, useRef } from 'react';
import { Task, TaskType, TaskVideo } from '@@/types/task';
import { taskApi } from '@/api/task';
import { TaskInfoRef } from './components/popInfo';
import TaskInfo from './components/videoInfo';
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
+
export default function Page() {
const [taskList, setTaskList] = useState<Task<TaskVideo>[]>([]);
const [pageInfo, setPageInfo] = useState({
@@ -34,20 +36,57 @@ export default function Page() {
}, []);
return (
- <div>
+ <div className="p-4">
<TaskInfo ref={Ref_TaskInfo} />
- <div>
+ <div className="flex flex-wrap gap-4">
{taskList.map((v) => {
return (
- <div key={v.id}>
- {v.title}
- <Button
- type="primary"
- onClick={() => Ref_TaskInfo.current?.init(v)}
- >
- 查看
- </Button>
- </div>
+ <Card
+ key={v.id}
+ className="box-border w-full p-4 sm:w-1/2 md:w-1/3"
+ >
+ <Row>
+ <Col span={12}>
+ <div>
+ <img
+ src={`${FILE_BASE_URL}${v.imageUrl}`}
+ alt=""
+ className="w-full h-full"
+ />
+ </div>
+ </Col>
+ <Col span={12}>
+ <h3>{v.title}</h3>
+ <Row>
+ <Col span={12}>
+ {!v.dataInfo ? (
+ <div>暂无数据</div>
+ ) : (
+ <>
+ <p> {v.dataInfo.title}</p>
+ </>
+ )}
+ </Col>
+ <Col span={12}>
+ <p>招募人数: {v.maxRecruits}</p>
+ </Col>
+ </Row>
+ </Col>
+ </Row>
+ <Row>
+ <Row>
+ <Col span={12}>-----</Col>
+ <Col span={12}>
+ <Button
+ type="primary"
+ onClick={() => Ref_TaskInfo.current?.init(v)}
+ >
+ 查看
+ </Button>
+ </Col>
+ </Row>
+ </Row>
+ </Card>
);
})}
</div>