|
|
@ -94,10 +94,9 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getTaskList, |
|
|
|
acceptTask, |
|
|
|
submitTask, |
|
|
|
getTaskDetail |
|
|
|
} from "@/api/system/task.js" |
|
|
|
getTaskDetail, |
|
|
|
acceptTask |
|
|
|
} from "@/api/order/task.js" |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -116,181 +115,65 @@ |
|
|
|
}, |
|
|
|
], |
|
|
|
curNow: 0, |
|
|
|
pendingTasks: [{ |
|
|
|
id: 1, |
|
|
|
taskType: '悬赏任务', |
|
|
|
reward: '2', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '发布小红书宣传笔记', |
|
|
|
description: '主题: 猫狗狗食使用感受&体验', |
|
|
|
deadline: '2025-03-28' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 2, |
|
|
|
taskType: '体验任务', |
|
|
|
reward: '3', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '狗狗玩具测评', |
|
|
|
description: '测试新款狗狗玩具并提供使用反馈', |
|
|
|
deadline: '2025-04-05' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 3, |
|
|
|
taskType: '推广任务', |
|
|
|
reward: '5', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '抖音短视频拍摄', |
|
|
|
description: '拍摄宠物使用产品的有趣短视频', |
|
|
|
deadline: '2025-04-10' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 13, |
|
|
|
taskType: '问卷调查', |
|
|
|
reward: '1', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '宠物食品偏好调查', |
|
|
|
description: '完成一份关于宠物食品偏好的问卷调查', |
|
|
|
deadline: '2025-03-30' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 14, |
|
|
|
taskType: '社区任务', |
|
|
|
reward: '4', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '宠物社区话题讨论', |
|
|
|
description: '在指定宠物社区参与话题讨论并获得5个以上回复', |
|
|
|
deadline: '2025-04-15' |
|
|
|
} |
|
|
|
], |
|
|
|
acceptedTasks: [ |
|
|
|
{ |
|
|
|
id: 4, |
|
|
|
taskType: '悬赏任务', |
|
|
|
reward: '3', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '发布小红书宣传笔记', |
|
|
|
description: '主题: 猫狗狗食使用感受&体验', |
|
|
|
deadline: '2025-03-28', |
|
|
|
status: 'ACCEPTED' // 已接受,待上传 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 5, |
|
|
|
taskType: '悬赏任务', |
|
|
|
reward: '3', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '发布小红书宣传笔记', |
|
|
|
description: '主题: 猫狗狗食使用感受&体验', |
|
|
|
deadline: '2025-03-28', |
|
|
|
status: 'SUBMITTED' // 已提交,审核中 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 6, |
|
|
|
taskType: '悬赏任务', |
|
|
|
reward: '3', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '发布小红书宣传笔记', |
|
|
|
description: '主题: 猫狗狗食使用感受&体验', |
|
|
|
deadline: '2025-03-28', |
|
|
|
status: 'REJECTED', // 已驳回 |
|
|
|
rejectReason: '图片不清晰,请重新上传高清图片' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 7, |
|
|
|
taskType: '悬赏任务', |
|
|
|
reward: '3', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '发布小红书宣传笔记', |
|
|
|
description: '主题: 猫狗狗食使用感受&体验', |
|
|
|
deadline: '2025-03-28', |
|
|
|
status: 'APPROVED' // 已通过 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 8, |
|
|
|
taskType: '体验任务', |
|
|
|
reward: '5', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '猫咪零食体验测评', |
|
|
|
description: '体验新品猫咪零食并提供详细测评报告', |
|
|
|
deadline: '2025-04-15', |
|
|
|
status: 'ACCEPTED', // 已接受,待上传 |
|
|
|
receiveTime: '2025-03-10' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 9, |
|
|
|
taskType: '推广任务', |
|
|
|
reward: '8', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '朋友圈分享宠物用品', |
|
|
|
description: '在朋友圈分享指定宠物用品并获取5个以上点赞', |
|
|
|
deadline: '2025-03-25', |
|
|
|
status: 'SUBMITTED', // 已提交,审核中 |
|
|
|
submitTime: '2025-03-20' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 10, |
|
|
|
taskType: '视频任务', |
|
|
|
reward: '10', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '拍摄宠物使用产品视频', |
|
|
|
description: '拍摄15秒宠物使用我们产品的有趣视频', |
|
|
|
deadline: '2025-04-10', |
|
|
|
status: 'REJECTED', // 已驳回 |
|
|
|
rejectReason: '视频时长不足,请确保视频至少15秒且清晰可见' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 11, |
|
|
|
taskType: '问卷调查', |
|
|
|
reward: '2', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '宠物主人消费习惯调查', |
|
|
|
description: '完成一份关于宠物主人消费习惯的问卷调查', |
|
|
|
deadline: '2025-03-30', |
|
|
|
status: 'APPROVED', // 已通过 |
|
|
|
approveTime: '2025-03-18' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 12, |
|
|
|
taskType: '社区任务', |
|
|
|
reward: '6', |
|
|
|
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: '参与线下宠物活动', |
|
|
|
description: '参加指定城市的线下宠物主题活动并拍照记录', |
|
|
|
deadline: '2025-05-01', |
|
|
|
status: 'SUBMITTED', // 已提交,审核中 |
|
|
|
submitTime: '2025-04-25' |
|
|
|
} |
|
|
|
] |
|
|
|
pendingTasks: [], |
|
|
|
acceptedTasks: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onShow() { |
|
|
|
// 加载任务列表数据 |
|
|
|
this.getTaskList() |
|
|
|
// 更新标签页的徽标数量 |
|
|
|
this.updateBadgeCount() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
sectionChange(index) { |
|
|
|
this.curNow = index; |
|
|
|
this.getTaskList() |
|
|
|
}, |
|
|
|
getTaskList() { |
|
|
|
// 调用API获取任务列表 |
|
|
|
// 由于后端API可能尚未实现,这里先使用模拟数据 |
|
|
|
// 实际项目中取消注释下面的代码 |
|
|
|
/* |
|
|
|
getTaskList().then(res=>{ |
|
|
|
getTaskList({ |
|
|
|
status : this.curNow |
|
|
|
}).then(res=>{ |
|
|
|
if (res && res.code === 200) { |
|
|
|
let rows = res.rows || [] |
|
|
|
console.log(rows) |
|
|
|
this.pendingTasks = rows.filter(item=>item.status=="PENDING") |
|
|
|
this.acceptedTasks = rows.filter(item=>item.status!="PENDING") |
|
|
|
// 根据status字段分类:0为待接受,1为已接受 |
|
|
|
this.pendingTasks = rows.filter(item => item.status === 0).map(item => this.formatTaskItem(item)) |
|
|
|
this.acceptedTasks = rows.filter(item => item.status === 1).map(item => this.formatTaskItem(item)) |
|
|
|
this.updateBadgeCount() |
|
|
|
} |
|
|
|
}) |
|
|
|
*/ |
|
|
|
// 使用模拟数据 |
|
|
|
console.log('加载任务列表') |
|
|
|
// 更新标签页的徽标数量 |
|
|
|
this.updateBadgeCount() |
|
|
|
}, |
|
|
|
// 格式化任务项 |
|
|
|
formatTaskItem(item) { |
|
|
|
return { |
|
|
|
id: item.id, |
|
|
|
taskType: item.taskName || '任务', |
|
|
|
reward: item.taskMoney || '0', |
|
|
|
icon: item.taskIcon || 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png', |
|
|
|
title: item.title || '', |
|
|
|
description: item.theme || '', |
|
|
|
deadline: item.taskEndTime ? this.formatDate(item.taskEndTime) : '', |
|
|
|
status: this.getTaskStatus(item.taskState, item.examineState), |
|
|
|
rejectReason: item.examineText || '' |
|
|
|
} |
|
|
|
}, |
|
|
|
// 根据任务进度和审核状态获取任务状态 |
|
|
|
getTaskStatus(taskState, examineState) { |
|
|
|
// taskState: 任务进度,examineState: 审核状态 |
|
|
|
if (taskState === 0) return 'ACCEPTED'; // 待上传 |
|
|
|
if (taskState === 1 && examineState === 0) return 'SUBMITTED'; // 审核中 |
|
|
|
if (taskState === 1 && examineState === 1) return 'APPROVED'; // 已通过 |
|
|
|
if (taskState === 1 && examineState === 2) return 'REJECTED'; // 驳回 |
|
|
|
return 'ACCEPTED'; // 默认状态 |
|
|
|
}, |
|
|
|
// 格式化日期 |
|
|
|
formatDate(dateStr) { |
|
|
|
if (!dateStr) return ''; |
|
|
|
let date = new Date(dateStr); |
|
|
|
let year = date.getFullYear(); |
|
|
|
let month = (date.getMonth() + 1).toString().padStart(2, '0'); |
|
|
|
let day = date.getDate().toString().padStart(2, '0'); |
|
|
|
return `${year}-${month}-${day}`; |
|
|
|
}, |
|
|
|
updateBadgeCount() { |
|
|
|
// 更新标签页的徽标数量 |
|
|
@ -310,9 +193,7 @@ |
|
|
|
content: `确定接受任务: ${task.title}?`, |
|
|
|
success: res => { |
|
|
|
if (res.confirm) { |
|
|
|
// 实际项目中取消注释下面的代码 |
|
|
|
/* |
|
|
|
acceptTask(task.id).then(res => { |
|
|
|
acceptTask({id : task.id}).then(res => { |
|
|
|
if (res && res.code === 200) { |
|
|
|
uni.showToast({ |
|
|
|
title: '任务接受成功', |
|
|
@ -322,24 +203,6 @@ |
|
|
|
this.getTaskList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
*/ |
|
|
|
|
|
|
|
// 模拟接受任务 |
|
|
|
const index = this.pendingTasks.findIndex(item => item.id === task.id); |
|
|
|
if (index !== -1) { |
|
|
|
const acceptedTask = { |
|
|
|
...this.pendingTasks[index], |
|
|
|
status: 'ACCEPTED' |
|
|
|
}; |
|
|
|
this.acceptedTasks.push(acceptedTask); |
|
|
|
this.pendingTasks.splice(index, 1); |
|
|
|
this.updateBadgeCount(); |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
title: '任务接受成功', |
|
|
|
icon: 'success' |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -374,16 +237,6 @@ |
|
|
|
'APPROVED': '已通过' |
|
|
|
}; |
|
|
|
return statusMap[status] || status; |
|
|
|
}, |
|
|
|
getStatusClass(status) { |
|
|
|
// 获取状态样式类 |
|
|
|
const classMap = { |
|
|
|
'ACCEPTED': 'status-pending', |
|
|
|
'SUBMITTED': 'status-reviewing', |
|
|
|
'REJECTED': 'status-rejected', |
|
|
|
'APPROVED': 'status-approved' |
|
|
|
}; |
|
|
|
return classMap[status] || ''; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|