Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
1122
DESKTOP-ZTS2NQJNA6746a31aef62
diff --git a/src/assets/task/binds.png b/src/assets/task/binds.pngnew file mode 100644index 00000000..a326f327Binary files /dev/null and b/src/assets/task/binds.png differdiff --git a/src/assets/task/fabu.png b/src/assets/task/fabu.pngnew file mode 100644index 00000000..60027d60Binary files /dev/null and b/src/assets/task/fabu.png differdiff --git a/src/assets/task/jiesuan.png b/src/assets/task/jiesuan.pngnew file mode 100644index 00000000..c10b29fdBinary files /dev/null and b/src/assets/task/jiesuan.png differdiff --git a/src/assets/task/qr1.png b/src/assets/task/qr1.pngnew file mode 100644index 00000000..5a59cb94Binary files /dev/null and b/src/assets/task/qr1.png differdiff --git a/src/assets/task/qr2.png b/src/assets/task/qr2.pngnew file mode 100644index 00000000..11be9e90Binary files /dev/null and b/src/assets/task/qr2.png differdiff --git a/src/assets/task/waits.png b/src/assets/task/waits.pngnew file mode 100644index 00000000..17167c64Binary files /dev/null and b/src/assets/task/waits.png differdiff --git a/src/views/task/mineTask.module.scss b/src/views/task/mineTask.module.scssnew file mode 100644index 00000000..6aec6e0e--- /dev/null+++ b/src/views/task/mineTask.module.scss@@ -0,0 +1,233 @@+.mineTaskContainer {+ padding: 16px;+ background-color: #fff;+ border-radius: 8px;+ min-height: 100%;+}++.loadingContainer {+ display: flex;+ justify-content: center;+ align-items: center;+ min-height: 300px;+}++.taskGrid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));+ gap: 16px;+}++.taskCard {+ border-radius: 8px;+ overflow: hidden;+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);+ transition: transform 0.2s;++ &:hover {+ transform: translateY(-3px);+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);+ }+}++.cardTitle {+ display: flex;+ justify-content: space-between;+ align-items: center;+}++.taskStatus {+ font-size: 12px;+ color: #1890ff;+ font-weight: normal;+}++.cardContent {+ display: flex;+ flex-direction: column;+ height: 100%;+}++.taskInfo {+ flex: 1;+}++.taskDescription {+ color: #666;+ margin-bottom: 12px;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+}++.taskDetails {+ margin-top: 16px;+}++.detailItem {+ display: flex;+ margin-bottom: 8px;+ font-size: 12px;+}++.detailLabel {+ color: #999;+ margin-right: 8px;+ min-width: 70px;+}++.detailValue {+ color: #666;+}++.taskActions {+ margin-top: 16px;+ display: flex;+ justify-content: flex-end;+}++.actionButton {+ background-color: #52c41a;+ border-color: #52c41a;++ &:hover {+ background-color: #73d13d;+ border-color: #73d13d;+ }+}++/* 空状态样式 */+.emptyContainer {+ display: flex;+ flex-direction: column;+ align-items: center;+ padding: 40px 20px;+ text-align: center;+}++.emptyImage {+ width: 120px;+ height: 120px;+ margin-bottom: 24px;+}++.emptyText {+ margin-bottom: 40px;++ h3 {+ font-size: 16px;+ color: #333;+ margin-bottom: 8px;+ }++ p {+ font-size: 14px;+ color: #999;+ }+}++.guideContainer {+ width: 100%;+ max-width: 800px;+}++.guideStep {+ margin-bottom: 40px;++ h4 {+ font-size: 16px;+ color: #333;+ margin-bottom: 24px;+ text-align: center;+ }+}++.qrCodeContainer {+ display: flex;+ justify-content: center;+ gap: 60px;+}++.qrCodeItem {+ display: flex;+ flex-direction: column;+ align-items: center;+}++.qrCodeWrapper {+ width: 160px;+ height: 160px;+ padding: 8px;+ border: 1px solid #eee;+ margin-bottom: 12px;+}++.qrCode {+ width: 100%;+ height: 100%;+}++.qrCodeText {+ font-size: 14px;+ color: #333;+ margin-bottom: 4px;+}++.qrCodeSubtext {+ font-size: 12px;+ color: #999;+}++.processContainer {+ margin-top: 40px;+}++.processTitle {+ font-size: 16px;+ color: #333;+ margin-bottom: 24px;+ text-align: center;+}++.processSteps {+ display: flex;+ justify-content: center;+ align-items: center;+}++.processStep {+ display: flex;+ flex-direction: column;+ align-items: center;+ width: 120px;+}++.processIcon {+ width: 60px;+ height: 60px;+ background-color: #f5f5f5;+ border-radius: 50%;+ display: flex;+ justify-content: center;+ align-items: center;+ margin-bottom: 12px;+}++.stepIcon {+ width: 30px;+ height: 30px;+}++.stepText {+ font-size: 12px;+ color: #666;+ text-align: center;+}++.processDivider {+ width: 60px;+ height: 1px;+ background-color: #e8e8e8;+ margin: 0 8px;+}\ No newline at end of filediff --git a/src/views/task/mineTask.tsx b/src/views/task/mineTask.tsxindex c687c09b..6061bff8 100644--- a/src/views/task/mineTask.tsx+++ b/src/views/task/mineTask.tsx@@ -5,7 +5,7 @@* @LastEditors: nevin* @Description: 我的任务列表*/-import { Button, Card } from 'antd';+import { Button, Card, Empty, Spin } from 'antd';import { useState, useEffect, useRef } from 'react';import { taskApi } from '@/api/task';import { UserTask, UserTaskStatus } from '@/api/types/task';@@ -13,6 +13,16 @@ import { Task, TaskDataInfo } from '@@/types/task';import MineTaskInfo, { MineTaskInfoRef } from './components/mineInfo';import { WithdrawRef } from './components/withdraw';import Withdraw from './components/withdraw';+import styles from './mineTask.module.scss';+++import bindTaskImg from '@/assets/task/binds.png';+import checkTaskImg from '@/assets/task/waits.png';+import publishTaskImg from '@/assets/task/fabu.png';+import rewardTaskImg from '@/assets/task/jiesuan.png';+import qr1 from '@/assets/task/qr1.png';+import qr2 from '@/assets/task/qr2.png';+const UserTaskStatusNameMap = new Map<UserTaskStatus, string>([[UserTaskStatus.DODING, '进行中'],@@ -32,12 +42,23 @@ export default function Page() {pageNo: 1,totalCount: 0,});+ const [loading, setLoading] = useState(true);useEffect(() => {const fetchTaskDetails = async () => {- const tasks = await taskApi.getMineTaskList(pageInfo);-- setTaskList(tasks.items);+ setLoading(true);+ try {+ const tasks = await taskApi.getMineTaskList(pageInfo);+ setTaskList(tasks.items);+ setPageInfo(prev => ({+ ...prev,+ totalCount: tasks.totalCount,+ }));+ } catch (error) {+ console.error('获取任务列表失败', error);+ } finally {+ setLoading(false);+ }};fetchTaskDetails();@@ -50,45 +71,157 @@ export default function Page() {Ref_Withdraw.current?.init(task);}+ // 渲染空状态+ const renderEmptyState = () => {+ return (+ <div className={styles.emptyContainer}>+ <div className={styles.emptyText}>+ <h3>接单前请务必先浏览《接单须知与常见问题解答》</h3>+ <p>所有关于接单的秘诀都在这里,请不要错过</p>+ </div>++ <div className={styles.guideContainer}>+ <div className={styles.guideStep}>+ <h4>接单前完成以下步骤,接单快人一步</h4>++ <div className={styles.qrCodeContainer}>+ <div className={styles.qrCodeItem}>+ <div className={styles.qrCodeWrapper}>+ <img src={qr1} alt="扫码加入账号招募群" className={styles.qrCode} />+ </div>+ <p className={styles.qrCodeText}>扫码加入账号招募群</p>+ <p className={styles.qrCodeSubtext}>不可在群内天打扰他人</p>+ </div>++ <div className={styles.qrCodeItem}>+ <div className={styles.qrCodeWrapper}>+ <img src={qr2} alt="扫码开启更多权益" className={styles.qrCode} />+ </div>+ <p className={styles.qrCodeText}>扫码开启更多权益</p>+ <p className={styles.qrCodeSubtext}>手机发文付打款通知</p>+ </div>+ </div>+ </div>++ <div className={styles.processContainer}>+ <h4 className={styles.processTitle}>接单流程</h4>++ <div className={styles.processSteps}>+ <div className={styles.processStep}>+ <div className={styles.processIcon}>+ <img src={bindTaskImg} alt="前往管理中心绑定账号" className={styles.stepIcon} />+ </div>+ <p className={styles.stepText}>前往管理中心绑定账号</p>+ </div>++ <div className={styles.processDivider}></div>++ <div className={styles.processStep}>+ <div className={styles.processIcon}>+ <img src={checkTaskImg} alt="等待平台验证通过" className={styles.stepIcon} />+ </div>+ <p className={styles.stepText}>等待平台验证通过</p>+ </div>++ <div className={styles.processDivider}></div>++ <div className={styles.processStep}>+ <div className={styles.processIcon}>+ <img src={publishTaskImg} alt="一键发文" className={styles.stepIcon} />+ </div>+ <p className={styles.stepText}>一键发文</p>+ </div>++ <div className={styles.processDivider}></div>++ <div className={styles.processStep}>+ <div className={styles.processIcon}>+ <img src={rewardTaskImg} alt="成功发文等待结算" className={styles.stepIcon} />+ </div>+ <p className={styles.stepText}>成功发文等待结算</p>+ </div>+ </div>+ </div>+ </div>+ </div>+ );+ };+return (- <div>+ <div className={styles.mineTaskContainer}><MineTaskInfo ref={Ref_MineTaskInfo} /><Withdraw ref={Ref_Withdraw} />- <div className="flex flex-wrap gap-4">- {taskList.map((v) => {- return (++ {loading ? (+ <div className={styles.loadingContainer}>+ <Spin size="large" />+ </div>+ ) : taskList.length > 10 ? (+ <div className={styles.taskGrid}>+ {taskList.map((task) => (<Card- key={v.id}- title={v.taskId.title}- className="box-border w-full p-4 sm:w-1/2 md:w-1/3"+ key={task.id}+ className={styles.taskCard}+ title={+ <div className={styles.cardTitle}>+ <span>{task.taskId.title}</span>+ <span className={styles.taskStatus}>+ {UserTaskStatusNameMap.get(task.status)}+ </span>+ </div>+ }>- <div>- <p>任务描述: {v.taskId.description}</p>- <p>状态: {UserTaskStatusNameMap.get(v.status)}</p>- <p>接受时间: {v.createTime}</p>- <p>提交时间: {v.submissionTime}</p>- <p>完成时间: {v.rewardTime}</p>- </div>- <div>- {v.status === UserTaskStatus.DODING && (- <Button- type="primary"- onClick={() => Ref_MineTaskInfo.current?.init(v)}- >- 去完成- </Button>- )}+ <div className={styles.cardContent}>+ <div className={styles.taskInfo}>+ <p className={styles.taskDescription}>{task.taskId.description}</p>+ <div className={styles.taskDetails}>+ <div className={styles.detailItem}>+ <span className={styles.detailLabel}>接受时间:</span>+ <span className={styles.detailValue}>{task.createTime}</span>+ </div>+ {task.submissionTime && (+ <div className={styles.detailItem}>+ <span className={styles.detailLabel}>提交时间:</span>+ <span className={styles.detailValue}>{task.submissionTime}</span>+ </div>+ )}+ {task.rewardTime && (+ <div className={styles.detailItem}>+ <span className={styles.detailLabel}>完成时间:</span>+ <span className={styles.detailValue}>{task.rewardTime}</span>+ </div>+ )}+ </div>+ </div>++ <div className={styles.taskActions}>+ {task.status === UserTaskStatus.DODING && (+ <Button+ type="primary"+ className={styles.actionButton}+ onClick={() => Ref_MineTaskInfo.current?.init(task)}+ >+ 去完成+ </Button>+ )}- {v.status === UserTaskStatus.APPROVED && (- <Button type="primary" onClick={() => withdraw(v)}>- 提现- </Button>- )}+ {task.status === UserTaskStatus.APPROVED && (+ <Button+ type="primary"+ className={styles.actionButton}+ onClick={() => withdraw(task)}+ >+ 提现+ </Button>+ )}+ </div></div></Card>- );- })}- </div>+ ))}+ </div>+ ) : (+ renderEmptyState()+ )}</div>);}