Skip to content

Let's use AI to Earn!

数组中心查看详情和各种样式优化处理 和 任务审核相关流程

DESKTOP-ZTS2NQJNAad0b68d115f2
diff --git a/commont/types/task.ts b/commont/types/task.ts
index b9967412..fd98d73c 100644
--- a/commont/types/task.ts
+++ b/commont/types/task.ts
@@ -9,16 +9,17 @@ import { AccountType } from '../AccountEnum';
import { TimeTemp } from './apiServer';
export enum TaskType {
- PRODUCT = 'product', // 商品任务
+ PRODUCT = 'product', // 挂车市场任务
ARTICLE = 'article', // 文章任务
- PROMOTION = 'promotion', // 拉新任务
- VIDEO = 'video', // 拉新任务
+ PROMOTION = 'promotion', // 推广任务
+ VIDEO = 'video', // 视频任务
}
export const TaskTypeName = new Map([
- [TaskType.PRODUCT, '商品'],
- [TaskType.ARTICLE, '文章'],
- [TaskType.PROMOTION, '拉新'],
+ [TaskType.PRODUCT, '挂车市场任务'],
+ [TaskType.ARTICLE, '文章任务'],
+ [TaskType.PROMOTION, '推广任务'],
+ [TaskType.VIDEO, '视频任务'],
]);
export enum TaskStatus {
diff --git a/src/App.tsx b/src/App.tsx
index 69ca1125..03713586 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -8,9 +8,20 @@
import { RouterProvider } from 'react-router-dom';
import router from '@/router/index';
+import { ConfigProvider } from 'antd';
const App = () => {
- return <RouterProvider router={router} />;
+ return (
+ <ConfigProvider
+ theme={{
+ token: {
+ colorPrimary: '#a66ae4',
+ },
+ }}
+ >
+ <RouterProvider router={router} />
+ </ConfigProvider>
+ );
};
export default App;
diff --git a/src/api/types/task.ts b/src/api/types/task.ts
index a1ab84bc..e7a59426 100644
--- a/src/api/types/task.ts
+++ b/src/api/types/task.ts
@@ -13,9 +13,9 @@ export enum UserTaskStatus {
PENDING = 'pending', // 待审核
APPROVED = 'approved', // 已通过
REJECTED = 'rejected', // 已拒绝
- COMPLETED = 'completed', // 已完成
+ // COMPLETED = 'completed', // 已完成
CANCELLED = 'cancelled', // 已取消
- PENDING_REWARD = 'pending_reward', // 待发放奖励
+ // PENDING_REWARD = 'pending_reward', // 待发放奖励
REWARDED = 'rewarded', // 已发放奖励
}
diff --git a/src/styles/variables.css b/src/styles/variables.css
new file mode 100644
index 00000000..7c9b7aa6
--- /dev/null
+++ b/src/styles/variables.css
@@ -0,0 +1,4 @@
+:root {
+ --primary-color: #a66ae4;
+ --primary-color-hover: #9559d1;
+}
\ No newline at end of file
diff --git a/src/var.css b/src/var.css
index a2905c21..42ec8e3b 100644
--- a/src/var.css
+++ b/src/var.css
@@ -31,5 +31,5 @@
/* 错误色 */
--errerColor: red;
/* 成功色 */
- --successColor: #52c41a;
+ --successColor: #a66ae4;
}
diff --git a/src/views/statistics/index.tsx b/src/views/statistics/index.tsx
index e32ba1f6..f70d09a5 100644
--- a/src/views/statistics/index.tsx
+++ b/src/views/statistics/index.tsx
@@ -49,6 +49,13 @@ const Statistics = () => {
// 添加选中的指标类型
const [selectedMetric, setSelectedMetric] = useState<string>('fans');
+ // 添加状态来控制WebView的显示
+ const [examineVideoData, setExamineVideoData] = useState<{url: string, account: any, open: boolean}>({
+ url: '',
+ account: null,
+ open: false
+ });
+
useEffect(() => {
getAccountStatistics();
}, []);
@@ -416,25 +423,72 @@ const Statistics = () => {
}
};
- const examineVideo = () => {
- console.log('检查视频');
- // 实现检查视频的逻辑
+ // 修改检查视频的函数
+ const examineVideo = (account: any) => {
+ console.log('检查视频', account);
+ // 根据账户类型确定要打开的URL
+ let url = '';
+ switch(account.type) {
+ case 'douyin':
+ url = `https://creator.douyin.com/`;
+ break;
+ case 'xhs':
+ url = `https://www.xiaohongshu.com/`;
+ break;
+ case 'wxSph':
+ url = `https://channels.weixin.qq.com`;
+ break;
+ case 'KWAI':
+ url = `https://id.kuaishou.com/pass/kuaishou/login/passToken?sid=kuaishou.web.cp.api`;
+ break;
+ default:
+ url = '';
+ }
+
+ setExamineVideoData({
+ url,
+ account,
+ open: true
+ });
+ };
+
+ // 关闭WebView
+ const closeWebView = () => {
+ setExamineVideoData(prev => ({...prev, open: false}));
};
return (
<div className="min-h-screen page-container bg-gray-50">
-{/*
-{ open ? (
- <WebView
- url={examineVideo.url}
- cookieParams={{
- cookies: JSON.parse(examineVideo.account.loginCookie),
- }}
- key={examineVideo.url + examineVideo.open}
- />
- ) : (
- ''
- )} */}
+ {/* WebView组件 */}
+ {examineVideoData.open && examineVideoData.account ? (
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50">
+ <div className="relative w-4/5 h-4/5 bg-white rounded-lg overflow-hidden">
+ <button
+ className="absolute top-4 right-4 p-2 bg-white rounded-full shadow-md hover:shadow-lg transition-all duration-300 flex items-center justify-center"
+ style={{
+ zIndex: 1000,
+ width: '36px',
+ height: '36px',
+ color: '#a66ae4',
+ border: '1px solid rgba(166, 106, 228, 0.2)'
+ }}
+ onClick={closeWebView}
+ >
+ <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" strokeWidth="2" fill="none" strokeLinecap="round" strokeLinejoin="round">
+ <line x1="18" y1="6" x2="6" y2="18"></line>
+ <line x1="6" y1="6" x2="18" y2="18"></line>
+ </svg>
+ </button>
+ <WebView
+ url={examineVideoData.url}
+ cookieParams={{
+ cookies: JSON.parse(examineVideoData.account.loginCookie || '{}'),
+ }}
+ key={examineVideoData.url + examineVideoData.open}
+ />
+ </div>
+ </div>
+ ) : null}
<div className="px-6 py-6">
{/* 顶部标题区域 */}
@@ -670,7 +724,8 @@ const Statistics = () => {
<div className="text-center">
<div className="text-sm text-gray-500">粉丝数</div>
<div className="font-medium text-[#a66ae4]">
- {accountData?.fans>0?'+ ':'- ' }{ accountData?.fans || 0}
+ {(accountData?.fans || 0) > 0 ? '+ ' : '- '}
+ {Math.abs(accountData?.fans || 0)}
</div>
</div>
<div className="text-center">
@@ -704,7 +759,13 @@ const Statistics = () => {
</div>
</div>
<div className="text-center">
- <div className="text-sm text-gray-500" style={{marginTop:'10px', color:'#a66ae4', cursor:'pointer'}} >查看详情</div>
+ <div
+ className="text-sm text-gray-500"
+ style={{marginTop:'10px', color:'#a66ae4', cursor:'pointer'}}
+ onClick={() => examineVideo(account)}
+ >
+ 查看详情
+ </div>
</div>
</div>
</div>
diff --git a/src/views/task/components/carInfo.module.scss b/src/views/task/components/carInfo.module.scss
index 6b0fd4eb..4717f0f9 100644
--- a/src/views/task/components/carInfo.module.scss
+++ b/src/views/task/components/carInfo.module.scss
@@ -206,8 +206,8 @@
}
.applyButton {
- background-color: #52c41a;
- border-color: #52c41a;
+ background-color: #a66ae4;
+ border-color: #a66ae4;
padding: 0 32px;
height: 40px;
diff --git a/src/views/task/components/carInfo.tsx b/src/views/task/components/carInfo.tsx
index 88d676cb..1bcf00a3 100644
--- a/src/views/task/components/carInfo.tsx
+++ b/src/views/task/components/carInfo.tsx
@@ -42,16 +42,9 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
setIsModalOpen(false);
// 添加成功提示
- message.success('任务接受成功');
-
- // 跳转到已参与任务选项卡
- const taskTabElement = document.querySelector('[data-tab="mine"]');
- if (taskTabElement) {
- (taskTabElement as HTMLElement).click();
- } else {
- // 如果找不到元素,则使用URL参数方式跳转
- window.location.href = '/task?tab=mine';
- }
+ message.success('任务接受成功,请前往我的任务查看');
+
+
} catch (error) {
console.error('接受任务失败:', error);
message.error('接受任务失败,请重试');
diff --git a/src/views/task/components/mineInfo.module.scss b/src/views/task/components/mineInfo.module.scss
index 8f71f9eb..c46a8047 100644
--- a/src/views/task/components/mineInfo.module.scss
+++ b/src/views/task/components/mineInfo.module.scss
@@ -26,7 +26,7 @@
}
.taskInfoHeader {
- padding: 20px 24px;
+ padding: 15px 24px;
background-color: #f9f9f9;
border-bottom: 1px solid #f0f0f0;
display: flex;
@@ -55,6 +55,7 @@
.statusTag {
font-size: 14px;
+ margin-right: 28px;
}
.taskInfoContent {
diff --git a/src/views/task/components/mineInfo.tsx b/src/views/task/components/mineInfo.tsx
index 97720f94..962ef488 100644
--- a/src/views/task/components/mineInfo.tsx
+++ b/src/views/task/components/mineInfo.tsx
@@ -151,6 +151,8 @@ const Com = forwardRef<MineTaskInfoRef>((props: any, ref) => {
// 判断任务是否可提交
const canSubmitTask = () => {
if (!mineTaskInfo) return false;
+
+ // 只有在进行中或已拒绝状态才允许提交
return SUBMITTABLE_STATUSES.includes(mineTaskInfo.status as UserTaskStatus);
};
@@ -335,11 +337,11 @@ const Com = forwardRef<MineTaskInfoRef>((props: any, ref) => {
<div className={styles.taskInfoFooter}>
<Space>
<Button onClick={handleCancel}>关闭</Button>
- {/* {canSubmitTask() && ( */}
- <Button type="primary" onClick={taskDone} loading={submitting}>
- 提交任务
- </Button>
- {/* )} */}
+ {canSubmitTask() && (
+ <Button type="primary" onClick={taskDone} loading={submitting}>
+ 提交任务
+ </Button>
+ )}
</Space>
</div>
</div>
diff --git a/src/views/task/components/popInfo.module.scss b/src/views/task/components/popInfo.module.scss
index 7f427128..526f3896 100644
--- a/src/views/task/components/popInfo.module.scss
+++ b/src/views/task/components/popInfo.module.scss
@@ -202,8 +202,8 @@
.applyButton {
min-width: 100px;
- background-color: #52c41a;
- border-color: #52c41a;
+ background-color: #a66ae4;
+ border-color: #a66ae4;
&:hover {
background-color: #73d13d;
diff --git a/src/views/task/components/popInfo.tsx b/src/views/task/components/popInfo.tsx
index 0ebffae4..5f9ae0b0 100644
--- a/src/views/task/components/popInfo.tsx
+++ b/src/views/task/components/popInfo.tsx
@@ -99,8 +99,8 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
/>
</span>
</h2>
- <Tag color="#108ee9" className={styles.taskTag}>
- {(taskInfo.dataInfo as any)?.type || 'AI对话APP'}
+ <Tag color="#a66ae4" className={styles.taskTag}>
+ {(taskInfo.dataInfo as any)?.type || '推广APP'}
</Tag>
</div>
@@ -219,6 +219,7 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
type="primary"
onClick={taskApply}
className={styles.applyButton}
+ style={{ backgroundColor: '#a66ae4' }}
>
接受任务
</Button>
diff --git a/src/views/task/components/videoInfo.tsx b/src/views/task/components/videoInfo.tsx
index d8c0b1b9..55823b06 100644
--- a/src/views/task/components/videoInfo.tsx
+++ b/src/views/task/components/videoInfo.tsx
@@ -406,13 +406,14 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
取消
</Button>
<Button
- // disabled={taskInfo.isAccepted}
key="submit"
type="primary"
+ disabled={taskInfo.isAccepted}
onClick={taskApply}
className={styles.applyButton}
+ style={{ backgroundColor: '#a66ae4', borderColor: '#a66ae4' }}
>
- 接受任务
+ {taskInfo.isAccepted ? '已接受任务' : '接受任务'}
</Button>
</div>
</div>
diff --git a/src/views/task/mineTask.module.scss b/src/views/task/mineTask.module.scss
index 546b0fdd..ce3089e7 100644
--- a/src/views/task/mineTask.module.scss
+++ b/src/views/task/mineTask.module.scss
@@ -63,12 +63,33 @@
.taskCardContent {
display: flex;
- align-items: stretch;
+ align-items: flex-start;
+}
+
+.taskImageContainer {
+ width: 128px;
+ height: 128px;
+ border-radius: 8px;
+ overflow: hidden;
+ margin-right: 16px;
+ margin-top: 6px;
+ flex-shrink: 0;
+ background-color: #f0f0f0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.taskImage {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
}
.taskInfo {
flex: 1;
- padding: 16px;
+ min-width: 0;
+ padding: 2px;
display: flex;
flex-direction: column;
text-align: left;
@@ -130,16 +151,22 @@
color: #333;
}
+.tagContainer {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.typeTag {
+ font-size: 12px;
+}
+
.taskAction {
- width: 160px;
- flex-shrink: 0;
+ margin-left: 16px;
display: flex;
flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 16px;
- border-left: 1px solid #f0f0f0;
- gap: 12px;
+ gap: 8px;
+ align-items: flex-end;
}
.withdrawButton {
@@ -154,11 +181,13 @@
}
.viewButton {
- width: 100%;
+ min-width: 100px;
+ color: white;
&:hover {
- color: #1890ff;
- border-color: #1890ff;
+ background-color: #9559d1;
+ border-color: #9559d1;
+ color: white;
}
}
diff --git a/src/views/task/mineTask.tsx b/src/views/task/mineTask.tsx
index 67219abf..ee763d03 100644
--- a/src/views/task/mineTask.tsx
+++ b/src/views/task/mineTask.tsx
@@ -34,6 +34,7 @@ import {
QuestionCircleOutlined,
} from '@ant-design/icons';
import dayjs from 'dayjs';
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
import bindTaskImg from '@/assets/task/binds.png';
import checkTaskImg from '@/assets/task/waits.png';
@@ -47,9 +48,9 @@ const UserTaskStatusNameMap = new Map<UserTaskStatus, string>([
[UserTaskStatus.PENDING, '待审核'],
[UserTaskStatus.APPROVED, '已通过'],
[UserTaskStatus.REJECTED, '已拒绝'],
- [UserTaskStatus.COMPLETED, '已完成'],
+ // [UserTaskStatus.COMPLETED, '已完成'],
[UserTaskStatus.CANCELLED, '已取消'],
- [UserTaskStatus.PENDING_REWARD, '待发放奖励'],
+ // [UserTaskStatus.PENDING_REWARD, '待发放奖励'],
[UserTaskStatus.REWARDED, '已发放奖励'],
]);
@@ -65,6 +66,13 @@ const UserTaskStatusColorMap = new Map<UserTaskStatus, string>([
[UserTaskStatus.REWARDED, 'success'],
]);
+// 在文件顶部添加任务类型映射
+const TASK_TYPE_MAP = {
+ video: { name: '视频任务', color: '#a66ae4' },
+ promotion: { name: '推广任务', color: '#1890ff' },
+ product: { name: '挂车市场任务', color: '#52c41a' },
+};
+
// 渲染空状态
const renderEmptyState = () => {
return (
@@ -330,6 +338,15 @@ export default function Page() {
return (
<Card key={task._id} className={styles.taskCard} bordered={false}>
<div className={styles.taskCardContent}>
+ {/* 添加任务图片显示 */}
+ <div className={styles.taskImageContainer}>
+ <img
+ src={`${FILE_BASE_URL}${task.taskId?.imageUrl || taskDetail.imageUrl || ''}`}
+ alt={taskDetail.title}
+ className={styles.taskImage}
+ />
+ </div>
+
<div className={styles.taskInfo}>
<div className={styles.taskHeader}>
<h3 className={styles.taskTitle}>
@@ -338,18 +355,29 @@ export default function Page() {
订单号: {task._id}
</span>
</h3>
- <Tag
- color={
- UserTaskStatusColorMap.get(
+ <div className={styles.tagContainer}>
+ {/* 添加任务类型标签 */}
+ <Tag
+ color={(TASK_TYPE_MAP as any)[task.taskId?.type]?.color || '#a66ae4'}
+ className={styles.typeTag}
+ >
+ {(TASK_TYPE_MAP as any)[task.taskId?.type]?.name || '视频任务'}
+ </Tag>
+
+ {/* 原有的状态标签 */}
+ <Tag
+ color={
+ UserTaskStatusColorMap.get(
+ task.status as UserTaskStatus,
+ ) || 'default'
+ }
+ className={styles.statusTag}
+ >
+ {UserTaskStatusNameMap.get(
task.status as UserTaskStatus,
- ) || 'default'
- }
- className={styles.statusTag}
- >
- {UserTaskStatusNameMap.get(
- task.status as UserTaskStatus,
- ) || '未知状态'}
- </Tag>
+ ) || '未知状态'}
+ </Tag>
+ </div>
</div>
<div className={styles.taskDetails}>
@@ -396,6 +424,7 @@ export default function Page() {
<Button
className={styles.viewButton}
onClick={() => viewTaskDetail(task)}
+ style={{ backgroundColor: '#a66ae4', borderColor: '#a66ae4', color: 'white' }}
>
查看详情 <RightOutlined />
</Button>
diff --git a/src/views/task/popTask.module.scss b/src/views/task/popTask.module.scss
index 059398a0..dcb454c4 100644
--- a/src/views/task/popTask.module.scss
+++ b/src/views/task/popTask.module.scss
@@ -185,8 +185,8 @@
.viewButton {
width: 100%;
- background-color: #52c41a;
- border-color: #52c41a;
+ background-color: #a66ae4;
+ border-color: #a66ae4;
&:hover {
background-color: #73d13d;
diff --git a/src/views/task/popTask.tsx b/src/views/task/popTask.tsx
index 30a00310..ff95d578 100644
--- a/src/views/task/popTask.tsx
+++ b/src/views/task/popTask.tsx
@@ -123,8 +123,8 @@ export default function Page() {
</Tooltip>
</span>
</h3>
- <Tag color="#108ee9" className={styles.taskTag}>
- {(task.dataInfo as any)?.type || 'AI对话APP'}
+ <Tag color="#a66ae4" className={styles.taskTag}>
+ {(task.dataInfo as any)?.type || '推广APP'}
</Tag>
</div>
@@ -177,6 +177,7 @@ export default function Page() {
type="primary"
className={styles.viewButton}
onClick={() => Ref_TaskInfo.current?.init(task)}
+ style={{ backgroundColor: '#a66ae4' }}
>
去查看 <RightOutlined />
</Button>
diff --git a/src/views/task/task.module.scss b/src/views/task/task.module.scss
index d25392e9..19d6460d 100644
--- a/src/views/task/task.module.scss
+++ b/src/views/task/task.module.scss
@@ -152,8 +152,8 @@
}
.applyButton {
- background-color: #52c41a;
- border-color: #52c41a;
+ background-color: #a66ae4;
+ border-color: #a66ae4;
&:hover {
background-color: #73d13d;
@@ -291,8 +291,8 @@
}
.imageContainer {
- width: 100px;
- height: 100px;
+ width: 128px;
+ height: 128px;
flex-shrink: 0;
margin-right: 12px;
overflow: hidden;
@@ -397,8 +397,8 @@
}
.applyButton {
- background-color: #52c41a;
- border-color: #52c41a;
+ background-color: #a66ae4;
+ border-color: #a66ae4;
&:hover {
background-color: #73d13d;
diff --git a/src/views/task/videoTask.module.scss b/src/views/task/videoTask.module.scss
index e1dc5fac..fcc8be26 100644
--- a/src/views/task/videoTask.module.scss
+++ b/src/views/task/videoTask.module.scss
@@ -215,10 +215,12 @@
.viewButton {
width: 100%;
+ background-color: var(--primary-color);
+ border-color: var(--primary-color);
&:hover {
- background-color: #9559d1;
- border-color: #9559d1;
+ background-color: var(--primary-color-hover);
+ border-color: var(--primary-color-hover);
}
}
diff --git a/src/views/task/videoTask.tsx b/src/views/task/videoTask.tsx
index 39b0f94d..7ac50a4e 100644
--- a/src/views/task/videoTask.tsx
+++ b/src/views/task/videoTask.tsx
@@ -271,6 +271,7 @@ export default function Page() {
type="primary"
className={styles.viewButton}
onClick={() => Ref_TaskInfo.current?.init(task)}
+ style={{ backgroundColor: '#a66ae4', borderColor: '#a66ae4' }}
>
去查看 <RightOutlined />
</Button>