Skip to content

Let's use AI to Earn!

task 互动任务 处理

daoyian19ce277d8b22
diff --git a/src/router/index.tsx b/src/router/index.tsx
index 5acee57b..7e4fc45c 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -34,7 +34,7 @@ import VideoPage from '@/views/publish/children/videoPage/page';
import ImagePage from '@/views/publish/children/imagePage/page';
import PubRecord from '@/views/publish/children/pubRecord/page';
import Statistics from '@/views/statistics/statistics';
-import Task from '@/views/task';
+import Task from '@/views/task/task';
// import HotTopic from '@/views/trending/hotTopic';
// import CarTask from '@/views/task/carTask';
// import PopTask from '@/views/task/popTask';
@@ -121,12 +121,12 @@ export const router: CustomRouteObject[] = [
{
path: '/reply',
element: <Reply />,
- meta: { name: '评论', icon: MessageOutlined },
+ meta: { name: '作品互动', icon: MessageOutlined },
},
{
path: '/Replyother',
element: <Replyother />,
- meta: { name: '评他人', icon: MessageOutlined },
+ meta: { name: '一键互动', icon: MessageOutlined },
},
{
path: '/statistics',
@@ -147,11 +147,11 @@ export const router: CustomRouteObject[] = [
{ path: 'userWalletAccount', element: <UserWalletAccount /> },
],
},
- {
- path: '/interaction',
- element: <Interaction />,
- meta: { name: '互动', icon: ShopOutlined },
- },
+ // {
+ // path: '/interaction',
+ // element: <Interaction />,
+ // meta: { name: '互动', icon: ShopOutlined },
+ // },
{
path: '/test',
element: <Test />,
diff --git a/src/views/task/articleTask.tsx b/src/views/task/articleTask.tsx
new file mode 100644
index 00000000..e8405f98
--- /dev/null
+++ b/src/views/task/articleTask.tsx
@@ -0,0 +1,307 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-03 10:00:00
+ * @LastEditTime: 2025-03-03 10:00:00
+ * @LastEditors: nevin
+ * @Description: 文章任务组件
+ */
+import { Card, List, Typography, Button, Space, Tag, Spin, Image, Progress, Tooltip, Modal, Descriptions } from 'antd';
+import { FileTextOutlined, ClockCircleOutlined, UserOutlined, CheckCircleOutlined } from '@ant-design/icons';
+import styles from './task.module.scss';
+import { useState, useEffect, useRef } from 'react';
+import { taskApi } from '@/api/task';
+import { TaskArticle, TaskType } from '@@/types/task';
+import dayjs from 'dayjs';
+import { TaskInfoRef } from './components/popInfo';
+// import TaskInfo from './components/articleInfo';
+import ChooseAccountModule from '@/views/publish/components/ChooseAccountModule/ChooseAccountModule';
+import { PubType } from '@@/publish/PublishEnum';
+import { AccountType } from '@@/AccountEnum';
+
+// 导入平台图标
+import KwaiIcon from '@/assets/svgs/account/ks.svg';
+import WxSphIcon from '@/assets/svgs/account/wx-sph.svg';
+import XhsIcon from '@/assets/svgs/account/xhs.svg';
+import DouyinIcon from '@/assets/svgs/account/douyin.svg';
+
+const { Title, Text } = Typography;
+
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
+
+// 平台配置
+const platformConfig = {
+ KWAI: {
+ name: '快手',
+ icon: KwaiIcon,
+ color: '#FF4D4F'
+ },
+ wxSph: {
+ name: '微信视频号',
+ icon: WxSphIcon,
+ color: '#07C160'
+ },
+ xhs: {
+ name: '小红书',
+ icon: XhsIcon,
+ color: '#FF2442'
+ },
+ douyin: {
+ name: '抖音',
+ icon: DouyinIcon,
+ color: '#000000'
+ }
+};
+
+export default function ArticleTask() {
+ const [loading, setLoading] = useState(false);
+ const [taskList, setTaskList] = useState<any[]>([]);
+ const [pageInfo, setPageInfo] = useState({
+ pageNo: 1,
+ pageSize: 10,
+ totalCount: 0,
+ });
+ const [hasMore, setHasMore] = useState(true);
+ const [selectedTask, setSelectedTask] = useState<any>(null);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [chooseAccountOpen, setChooseAccountOpen] = useState(false);
+ const [accountListChoose, setAccountListChoose] = useState<any[]>([]);
+ const [downloading, setDownloading] = useState(false);
+
+ const Ref_TaskInfo = useRef<TaskInfoRef>(null);
+
+ async function getTaskList(isLoadMore = false) {
+ setLoading(true);
+ try {
+ const res = await taskApi.getTaskList<any>({
+ ...pageInfo,
+ type: TaskType.ARTICLE,
+ });
+
+ if (isLoadMore) {
+ setTaskList((prev) => [...prev, ...res.items]);
+ } else {
+ setTaskList(res.items);
+ }
+
+ setPageInfo((prev) => ({
+ ...prev,
+ totalCount: (res as any).totalCount,
+ }));
+
+ setHasMore(pageInfo.pageNo * pageInfo.pageSize < (res as any).totalCount);
+ } catch (error) {
+ console.error('获取任务列表失败', error);
+ } finally {
+ setLoading(false);
+ }
+ }
+
+ useEffect(() => {
+ getTaskList();
+ }, []);
+
+ const formatDate = (date: string) => {
+ return dayjs(date).format('YYYY-MM-DD HH:mm');
+ };
+
+ const getPlatformTags = (accountTypes: string[]) => {
+ return accountTypes.map(type => {
+ const platform = platformConfig[type as keyof typeof platformConfig];
+ if (!platform) return null;
+
+ return (
+ <Tooltip key={type} title={platform.name}>
+ <div
+ className={styles.platformIconWrapper}
+ style={{ backgroundColor: platform.color }}
+ >
+ <img
+ src={platform.icon}
+ className={styles.platformIcon}
+ alt={platform.name}
+ />
+ </div>
+ </Tooltip>
+ );
+ });
+ };
+
+ const handleJoinTask = (task: any) => {
+ setSelectedTask(task);
+ setModalVisible(true);
+ };
+
+ const handleCompleteTask = async () => {
+ if (!selectedTask) return;
+ setModalVisible(false);
+ setChooseAccountOpen(true);
+
+ // try {
+ // // 调用完成任务API
+ // await taskApi.taskDone(selectedTask._id, {
+ // // 这里需要根据实际API要求添加必要的参数
+ // // 例如:截图、链接等
+ // });
+ // // 更新任务状态
+ // setTaskList(prev => prev.map(task =>
+ // task._id === selectedTask._id ? { ...task, isAccepted: true } : task
+ // ));
+ // setModalVisible(false);
+ // } catch (error) {
+ // console.error('完成任务失败', error);
+ // }
+ };
+
+ // 刷新任务列表的函数
+ const refreshTaskList = () => {
+ setPageInfo({
+ pageSize: 10,
+ pageNo: 1,
+ totalCount: 0,
+ });
+ getTaskList();
+ };
+
+ return (
+ <div className={styles.taskList}>
+ {/* <TaskInfo ref={Ref_TaskInfo} onTaskApplied={refreshTaskList} /> */}
+
+ <ChooseAccountModule
+ open={chooseAccountOpen}
+ onClose={() => !downloading && setChooseAccountOpen(false)}
+ platChooseProps={{
+ choosedAccounts: accountListChoose,
+ pubType: PubType.ARTICLE,
+ allowPlatSet: new Set([AccountType.Douyin]),
+ }}
+ onPlatConfirm={async (aList) => {
+ console.log('账号:', aList);
+ setAccountListChoose(aList);
+ console.log('选择的账号:', aList);
+ // 这里可以添加发布文章的逻辑
+ setChooseAccountOpen(false);
+ }}
+ />
+
+ <Spin spinning={loading}>
+ <List
+ grid={{ gutter: 16, column: 3 }}
+ dataSource={taskList}
+ renderItem={(item) => (
+ <List.Item>
+ <Card
+ className={styles.taskCard}
+ cover={
+ <div className={styles.taskImage}>
+ {item.dataInfo?.imageList?.[0] ? (
+ <Image
+ src={`${FILE_BASE_URL}/${item.dataInfo.imageList[0]}`}
+ alt={item.title}
+ preview={false}
+ style={{ width: '100%', height: '200px', objectFit: 'cover' }}
+ />
+ ) : (
+ <FileTextOutlined style={{ fontSize: '48px', color: '#1890ff' }} />
+ )}
+ </div>
+ }
+ actions={[
+ <Space key="recruits">
+ <UserOutlined />
+ <Text>{item.currentRecruits}/{item.maxRecruits}</Text>
+ </Space>,
+ <Space key="time">
+ <ClockCircleOutlined />
+ <Text>{item.keepTime}分钟</Text>
+ </Space>,
+ <Button
+ type="primary"
+ key="join"
+ disabled={item.isAccepted}
+ onClick={() => handleJoinTask(item)}
+ >
+ {item.isAccepted ? '已参与' : '参与任务'}
+ </Button>,
+ ]}
+ >
+ <Card.Meta
+ title={
+ <div className={styles.taskTitle}>
+ <Title level={5}>{item.title}</Title>
+ <Space>
+ <Tag color="green">¥{item.reward}</Tag>
+ <Space size={4}>
+ {getPlatformTags(item.accountTypes)}
+ </Space>
+ </Space>
+ </div>
+ }
+ description={
+ <div className={styles.taskInfo}>
+ <div className={styles.taskProgress}>
+ <Progress
+ percent={Math.round((item.currentRecruits / item.maxRecruits) * 100)}
+ size="small"
+ showInfo={false}
+ />
+ </div>
+ <Text type="secondary">
+ {item.description.replace(/<[^>]+>/g, '')}
+ </Text>
+ <div className={styles.taskDeadline}>
+ <Text type="secondary">截止时间:{formatDate(item.deadline)}</Text>
+ </div>
+ </div>
+ }
+ />
+ </Card>
+ </List.Item>
+ )}
+ />
+ </Spin>
+
+ <Modal
+ title="任务详情"
+ open={modalVisible}
+ onCancel={() => setModalVisible(false)}
+ footer={[
+ <Button key="cancel" onClick={() => setModalVisible(false)}>
+ 取消
+ </Button>,
+ <Button
+ key="complete"
+ type="primary"
+ icon={<CheckCircleOutlined />}
+ onClick={handleCompleteTask}
+ >
+ 一键完成
+ </Button>
+ ]}
+ width={600}
+ >
+ {selectedTask && (
+ <div className={styles.taskDetail}>
+ <Descriptions column={1}>
+ <Descriptions.Item label="任务标题">{selectedTask.title}</Descriptions.Item>
+ <Descriptions.Item label="任务描述">
+ <div dangerouslySetInnerHTML={{ __html: selectedTask.description }} />
+ </Descriptions.Item>
+ <Descriptions.Item label="任务奖励">¥{selectedTask.reward}</Descriptions.Item>
+ <Descriptions.Item label="任务时长">{selectedTask.keepTime}分钟</Descriptions.Item>
+ <Descriptions.Item label="开始时间">{formatDate(selectedTask.createTime)}</Descriptions.Item>
+ <Descriptions.Item label="截止时间">{formatDate(selectedTask.deadline)}</Descriptions.Item>
+ <Descriptions.Item label="参与人数">
+ {selectedTask.currentRecruits}/{selectedTask.maxRecruits}
+ </Descriptions.Item>
+ <Descriptions.Item label="支持平台">
+ <Space size={4}>
+ {getPlatformTags(selectedTask.accountTypes)}
+ </Space>
+ </Descriptions.Item>
+ </Descriptions>
+ </div>
+ )}
+ </Modal>
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/views/task/components/articleInfo.tsx b/src/views/task/components/articleInfo.tsx
new file mode 100644
index 00000000..212911f8
--- /dev/null
+++ b/src/views/task/components/articleInfo.tsx
@@ -0,0 +1,288 @@
+import { Button, Modal, Tag, Divider, Row, Col, message } from 'antd';
+import { Task, TaskStatusName, TaskTypeName, TaskArticle } from '@@/types/task';
+import { PubType } from '@@/publish/PublishEnum';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import { taskApi } from '@/api/task';
+import styles from './articleInfo.module.scss';
+import {
+ ClockCircleOutlined,
+ TeamOutlined,
+ TagOutlined,
+ DollarOutlined,
+ FileTextOutlined,
+ CopyOutlined,
+} from '@ant-design/icons';
+import ChooseAccountModule from '@/views/publish/components/ChooseAccountModule/ChooseAccountModule';
+import { AccountType } from '@@/AccountEnum';
+
+const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
+
+export interface TaskInfoRef {
+ init: (pubRecord: Task<TaskArticle>) => Promise<void>;
+}
+
+interface TaskInfoProps {
+ onTaskApplied?: () => void;
+}
+
+const Com = forwardRef<TaskInfoRef, TaskInfoProps>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [taskInfo, setTaskInfo] = useState<Task<TaskArticle> | null>();
+ const [downloading, setDownloading] = useState(false);
+ const [taskRecord, setTaskRecord] = useState<{
+ _id: string;
+ createTime: string;
+ isFirstTimeSubmission: boolean;
+ status: string;
+ taskId: string;
+ } | null>(null);
+
+ const { onTaskApplied } = props;
+
+ async function init(inTaskInfo: Task<TaskArticle>) {
+ setTaskInfo(inTaskInfo);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ /**
+ * 接受任务
+ */
+ async function taskApply() {
+ if (!taskInfo) return;
+
+ try {
+ const res: any = await taskApi.taskApply<TaskArticle>(taskInfo?._id);
+ if (res.code === 0 && res.data) {
+ setTaskRecord(res.data);
+ message.success('任务接受成功!');
+ setIsModalOpen(false);
+ setChooseAccountOpen(true);
+
+ if (onTaskApplied && typeof onTaskApplied === 'function') {
+ onTaskApplied();
+ }
+ } else {
+ message.error(res.msg || '接受任务失败,请稍后再试?');
+ }
+ } catch (error) {
+ message.error('接受任务失败,请稍后再试');
+ }
+ }
+
+ /**
+ * 完成任务
+ */
+ async function taskDone() {
+ console.log('完成任务', taskInfo, taskRecord);
+ if (!taskInfo || !taskRecord) {
+ message.error('任务信息不完整,无法完成任务');
+ return;
+ }
+
+ try {
+ const res = await taskApi.taskDone(taskRecord._id, {
+ submissionUrl: taskInfo.title,
+ screenshotUrls: [taskInfo.imageUrl],
+ qrCodeScanResult: taskInfo.title,
+ });
+ message.success('任务发布成功!');
+ } catch (error) {
+ message.error('完成任务失败,请稍后再试');
+ }
+ }
+
+ const handleCancel = () => {
+ setIsModalOpen(false);
+ };
+
+ // 复制任务ID
+ const copyTaskId = (id: string) => {
+ navigator.clipboard
+ .writeText(id)
+ .then(() => {
+ message.success('任务ID已复制到剪贴板');
+ })
+ .catch(() => {
+ message.error('复制失败,请手动复制');
+ });
+ };
+
+ // 账户选择弹框显示隐藏状态
+ const [chooseAccountOpen, setChooseAccountOpen] = useState(false);
+ const [accountListChoose, setAccountListChoose] = useState<any[]>([]);
+
+ return (
+ <>
+ <ChooseAccountModule
+ open={chooseAccountOpen}
+ onClose={() => !downloading && setChooseAccountOpen(false)}
+ platChooseProps={{
+ choosedAccounts: accountListChoose,
+ pubType: PubType.ARTICLE,
+ allowPlatSet: new Set([AccountType.Douyin]),
+ }}
+ onPlatConfirm={async (aList) => {
+ console.log('账号:', aList);
+ setAccountListChoose(aList);
+ console.log('选择的账号:', aList);
+ // 这里可以添加发布文章的逻辑
+ setChooseAccountOpen(false);
+ }}
+ />
+
+ <Modal
+ title={null}
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={800}
+ className={styles.taskInfoModal}
+ destroyOnClose
+ >
+ {taskInfo ? (
+ <div className={styles.taskInfoContainer}>
+ <div className={styles.taskInfoHeader}>
+ <h2 className={styles.taskTitle}>
+ {taskInfo.title}
+ <span className={styles.taskId}>
+ ID: {taskInfo._id}
+ <CopyOutlined
+ className={styles.copyIcon}
+ onClick={() => copyTaskId(taskInfo._id)}
+ />
+ </span>
+ </h2>
+ <Tag color="#a66ae4" className={styles.taskTag}>
+ {(taskInfo.dataInfo as any)?.type || '文章任务'}
+ </Tag>
+ </div>
+
+ <div className={styles.taskInfoContent}>
+ <Row gutter={24}>
+ <Col span={12}>
+ <div className={styles.articleContainer}>
+ <div className={styles.taskImageContainer}>
+ <img
+ src={`${FILE_BASE_URL}${taskInfo.imageUrl}`}
+ alt={taskInfo.title}
+ className={styles.taskImage}
+ />
+ </div>
+ <div className={styles.articleCaption}>文章封面预览</div>
+ </div>
+ </Col>
+
+ <Col span={12}>
+ <div className={styles.taskDetails}>
+ <div className={styles.taskDetail}>
+ <TagOutlined className={styles.detailIcon} />
+ <span className={styles.detailLabel}>任务类型:</span>
+ <span className={styles.detailValue}>
+ {TaskTypeName.get(taskInfo.type) || '文章任务'}
+ </span>
+ </div>
+
+ <div className={styles.taskDetail}>
+ <ClockCircleOutlined className={styles.detailIcon} />
+ <span className={styles.detailLabel}>截止时间:</span>
+ <span className={styles.detailValue}>
+ {taskInfo.deadline || '2025/03/17'}
+ </span>
+ </div>
+
+ <div className={styles.taskDetail}>
+ <TeamOutlined className={styles.detailIcon} />
+ <span className={styles.detailLabel}>招募人数:</span>
+ <span className={styles.detailValue}>
+ {taskInfo.maxRecruits || 100}
+ </span>
+ </div>
+
+ <div className={styles.taskDetail}>
+ <DollarOutlined className={styles.detailIcon} />
+ <span className={styles.detailLabel}>任务奖励:</span>
+ <span className={styles.detailValue}>
+ ¥{taskInfo.reward || 5}
+ </span>
+ </div>
+
+ <div className={styles.taskDetail}>
+ <span className={styles.detailLabel}>任务要求:</span>
+ <span className={styles.detailValue}>
+ {taskInfo.requirement || '不许删文'}
+ </span>
+ </div>
+ </div>
+ </Col>
+ </Row>
+
+ <Divider />
+
+ <div className={styles.taskDescription}>
+ <h3 className={styles.sectionTitle}>任务描述</h3>
+ <div
+ className={styles.descriptionContent}
+ dangerouslySetInnerHTML={{
+ __html: taskInfo.description || '暂无描述',
+ }}
+ />
+ </div>
+
+ {taskInfo.dataInfo && (
+ <>
+ <Divider />
+ <div className={styles.articleDetails}>
+ <h3 className={styles.sectionTitle}>文章详情</h3>
+ <div className={styles.articleInfo}>
+ <div className={styles.articleInfoItem}>
+ <span className={styles.articleInfoLabel}>文章标题:</span>
+ <span className={styles.articleInfoValue}>
+ {taskInfo.dataInfo.title || '未知'}
+ </span>
+ </div>
+
+ <div className={styles.articleInfoItem}>
+ <span className={styles.articleInfoLabel}>文章描述:</span>
+ <span className={styles.articleInfoValue}>
+ {taskInfo.dataInfo.desc || '暂无描述'}
+ </span>
+ </div>
+ </div>
+ </div>
+ </>
+ )}
+ </div>
+
+ <div className={styles.taskInfoFooter}>
+ <div className={styles.taskStatus}>
+ <Tag color="#a66ae4">进行中</Tag>
+ </div>
+ <div className={styles.taskActions}>
+ <Button className={styles.cancelButton} onClick={handleCancel}>
+ 取消
+ </Button>
+ <Button
+ type="primary"
+ className={styles.applyButton}
+ onClick={taskApply}
+ >
+ 接受任务
+ </Button>
+ </div>
+ </div>
+ </div>
+ ) : (
+ <div className={styles.noDataContainer}>暂无数据</div>
+ )}
+ </Modal>
+ </>
+ );
+});
+
+Com.displayName = 'ArticleInfo';
+
+export default Com;
\ No newline at end of file
diff --git a/src/views/task/interactionTask.tsx b/src/views/task/interactionTask.tsx
new file mode 100644
index 00000000..e58dc3d1
--- /dev/null
+++ b/src/views/task/interactionTask.tsx
@@ -0,0 +1,87 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-03 10:00:00
+ * @LastEditTime: 2025-03-03 10:00:00
+ * @LastEditors: nevin
+ * @Description: 互动任务组件
+ */
+import { Card, List, Typography, Button, Space, Tag } from 'antd';
+import { CommentOutlined, LikeOutlined, ShareAltOutlined } from '@ant-design/icons';
+import styles from './task.module.scss';
+
+const { Title, Text } = Typography;
+
+export default function InteractionTask() {
+ // 模拟互动任务数据
+ const interactionTasks = [
+ {
+ id: '1',
+ title: '评论互动任务',
+ content: '对指定文章进行有意义的评论和互动...',
+ price: 30,
+ comments: 500,
+ shares: 200,
+ level: '初级',
+ },
+ {
+ id: '2',
+ title: '点赞分享任务',
+ content: '对指定内容进行点赞和分享...',
+ price: 20,
+ comments: 300,
+ shares: 150,
+ level: '初级',
+ },
+ ];
+
+ return (
+ <div className={styles.taskList}>
+ <List
+ grid={{ gutter: 16, column: 3 }}
+ dataSource={interactionTasks}
+ renderItem={(item) => (
+ <List.Item>
+ <Card
+ className={styles.taskCard}
+ cover={
+ <div className={styles.taskImage}>
+ <CommentOutlined style={{ fontSize: '48px', color: '#52c41a' }} />
+ </div>
+ }
+ actions={[
+ <Space key="comments">
+ <CommentOutlined />
+ <Text>{item.comments}</Text>
+ </Space>,
+ <Space key="shares">
+ <ShareAltOutlined />
+ <Text>{item.shares}</Text>
+ </Space>,
+ <Button type="primary" key="join">
+ 参与任务
+ </Button>,
+ ]}
+ >
+ <Card.Meta
+ title={
+ <div className={styles.taskTitle}>
+ <Title level={5}>{item.title}</Title>
+ <Tag color="green">{item.level}</Tag>
+ </div>
+ }
+ description={
+ <div className={styles.taskInfo}>
+ <Text type="secondary">{item.content}</Text>
+ <div className={styles.taskPrice}>
+ <Text strong>¥{item.price}</Text>
+ </div>
+ </div>
+ }
+ />
+ </Card>
+ </List.Item>
+ )}
+ />
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/views/task/task.module.scss b/src/views/task/task.module.scss
index 19d6460d..f8d27fef 100644
--- a/src/views/task/task.module.scss
+++ b/src/views/task/task.module.scss
@@ -30,20 +30,105 @@
}
.taskList {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
- gap: 16px;
+ padding: 24px;
+ background: #f0f2f5;
+ min-height: calc(100vh - 64px);
+
+ :global {
+ .ant-list-items {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px;
+ justify-content: flex-start;
+ }
+
+ .ant-list-item {
+ flex: 0 0 calc(33.333% - 16px);
+ max-width: 350px;
+ margin: 0 !important;
+ }
+
+ .ant-card {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ transition: all 0.3s;
+ max-width: 350px;
+
+ &:hover {
+ transform: translateY(-4px);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+ }
+ }
+
+ .ant-card-cover {
+ height: 180px;
+ overflow: hidden;
+ background: #fafafa;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .ant-card-body {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ padding: 16px;
+ }
+
+ .ant-card-meta {
+ flex: 1;
+ }
+
+ .ant-card-actions {
+ background: #fafafa;
+ padding: 12px 0;
+ }
+ }
}
.taskCard {
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- transition: transform 0.2s;
+ .taskImage {
+ height: 200px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #fafafa;
+ overflow: hidden;
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+ }
- &:hover {
- transform: translateY(-3px);
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+ .taskTitle {
+ margin-bottom: 12px;
+
+ h5 {
+ margin: 0 0 8px 0;
+ font-size: 16px;
+ line-height: 1.4;
+ }
+ }
+
+ .taskInfo {
+ .taskProgress {
+ margin-bottom: 8px;
+ }
+
+ .ant-typography {
+ margin-bottom: 8px;
+ line-height: 1.6;
+ }
+ }
+
+ .taskDeadline {
+ margin-top: auto;
+ padding-top: 8px;
+ border-top: 1px solid #f0f0f0;
}
}
@@ -422,4 +507,50 @@
justify-content: center;
margin-top: 32px;
margin-bottom: 16px;
+}
+
+.platformIconWrapper {
+ width: 24px;
+ height: 24px;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ transition: all 0.3s;
+
+ &:hover {
+ transform: scale(1.1);
+ }
+}
+
+.platformIcon {
+ width: 16px;
+ height: 16px;
+ object-fit: contain;
+}
+
+// 响应式布局
+@media (max-width: 1200px) {
+ .taskList {
+ :global {
+ .ant-list-item {
+ flex: 0 0 calc(50% - 16px);
+ max-width: 350px;
+ }
+ }
+ }
+}
+
+@media (max-width: 768px) {
+ .taskList {
+ padding: 12px;
+
+ :global {
+ .ant-list-item {
+ flex: 0 0 100%;
+ max-width: 350px;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/views/task/index.tsx b/src/views/task/task.tsx
similarity index 77%
rename from src/views/task/index.tsx
rename to src/views/task/task.tsx
index c28472ca..783311fc 100644
--- a/src/views/task/index.tsx
+++ b/src/views/task/task.tsx
@@ -12,6 +12,8 @@ import {
VideoCameraOutlined,
HistoryOutlined,
WalletOutlined,
+ FileTextOutlined,
+ CommentOutlined,
} from '@ant-design/icons';
import styles from './task.module.scss';
@@ -20,6 +22,8 @@ import CarTask from './carTask';
import PopTask from './popTask';
import VideoTask from './videoTask';
import MineTask from './mineTask';
+import ArticleTask from './articleTask';
+import InteractionTask from './interactionTask';
// 任务类型定义
interface Task {
@@ -49,6 +53,10 @@ export default function Task() {
return <VideoTask />;
case 'mine':
return <MineTask />;
+ case 'article':
+ return <ArticleTask />;
+ case 'interaction':
+ return <InteractionTask />;
default:
return <CarTask />;
}
@@ -80,6 +88,20 @@ export default function Task() {
<VideoCameraOutlined />
<span>视频任务</span>
</div>
+ <div
+ className={`${styles.taskButton} ${activeTab === 'article' ? styles.activeTaskButton : ''}`}
+ onClick={() => setActiveTab('article')}
+ >
+ <FileTextOutlined />
+ <span>文章任务</span>
+ </div>
+ <div
+ className={`${styles.taskButton} ${activeTab === 'interaction' ? styles.activeTaskButton : ''}`}
+ onClick={() => setActiveTab('interaction')}
+ >
+ <CommentOutlined />
+ <span>互动任务</span>
+ </div>
<div
className={`${styles.taskButton} ${activeTab === 'mine' ? styles.activeTaskButton : ''}`}
onClick={() => setActiveTab('mine')}