Browse Source

refactor: 重构任务模块并优化图片预览功能

- 将任务相关页面从`pages/personalCenter`迁移至`pages_order/task`子包中,提升模块化
- 优化订单详情页的图片预览功能,支持点击图片放大查看
- 调整任务列表页的UI,增加任务状态标签和操作按钮
- 更新`pages.json`配置,支持子包预加载
master
前端-胡立永 1 week ago
parent
commit
1a74ee8e5c
11 changed files with 1041 additions and 358 deletions
  1. +41
    -19
      pages.json
  2. +113
    -2
      pages/companionPetList/couponList.vue
  3. +25
    -4
      pages/personalCenter/index.vue
  4. +54
    -34
      pages/personalCenter/orderDetailImage.vue
  5. +0
    -298
      pages/personalCenter/taskList.vue
  6. BIN
      pages_order/static/Group 213084@2x.png
  7. BIN
      pages_order/static/Group@2x.png
  8. +0
    -0
      pages_order/task/taskDetail.vue
  9. +540
    -0
      pages_order/task/taskList.vue
  10. +267
    -0
      pages_order/task/taskUpload.vue
  11. +1
    -1
      utils/getUrl.js

+ 41
- 19
pages.json View File

@ -150,7 +150,7 @@
}
},
{
"path": "pages/personalCenter/orderDetail",
"path": "pages/personalCenter/orderDetailImage",
"style": {
"navigationBarTitleText": "当前订单",
"navigationBarBackgroundColor": "#FFBF60",
@ -302,24 +302,6 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/personalCenter/taskList",
"style": {
"navigationBarTitleText": "任务中心",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/personalCenter/taskDetail",
"style": {
"navigationBarTitleText": "任务详情",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/personalCenter/userInfo",
"style": {
@ -330,6 +312,46 @@
}
}
],
"preloadRule": {
"pages/personalCenter/index": {
"network": "all",
"packages": ["pages_order"]
}
},
"subPackages": [
{
"root": "pages_order",
"pages": [
{
"path": "task/taskList",
"style": {
"navigationBarTitleText": "任务中心",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
},
{
"path": "task/taskDetail",
"style": {
"navigationBarTitleText": "任务详情",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
},
{
"path": "task/taskUpload",
"style": {
"navigationBarTitleText": "任务上传",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
}
]
}
],
"tabBar": {
"color": "#999",
"selectedColor": "#333",


+ 113
- 2
pages/companionPetList/couponList.vue View File

@ -3,7 +3,11 @@
<view v-for="(item,index) in couponData" style="padding:20rpx;" :key="index">
<view>
<view class="card">
<view class="card-left">{{switchType(item.stockType)}}</view>
<view class="card-left">
<view class="">
{{switchType(item.stockType)}}
</view>
</view>
<view class="card-center">
<view class="card-center-top"></view>
<view class="card-center-bottom"></view>
@ -14,6 +18,7 @@
<view class="card-type">可用于
<text class="card-type-text">专业喂养</text>
<text class="card-type-text">专业遛狗</text>
<!-- <text class="card-type-text">{{ item.goodsName }}</text> -->
</view>
<view class="card-time">有效期至: {{item.availableEndTime.slice(0, 16)}}</view>
</view>
@ -29,12 +34,42 @@
<view class="card-bottom-text">
优惠券不可兑换现金
</view>
<view class="card-bottom-text">
<view class="card-bottom-text" @click="showRulePopup(item)">
查看详细规则>
</view>
</view>
</view>
</view>
<!-- 优惠券详细规则弹窗 -->
<uni-popup ref="rulePopup" type="center">
<view class="rule-popup">
<view class="rule-popup-title">优惠券详细规则</view>
<view class="rule-popup-content">
<view class="rule-item">
<view class="rule-label">名称</view>
<view class="rule-value">{{currentCoupon.stockName}}</view>
</view>
<view class="rule-item">
<view class="rule-label">折扣</view>
<view class="rule-value">{{getDiscountText(currentCoupon)}}</view>
</view>
<view class="rule-item">
<view class="rule-label">使用规则</view>
<view class="rule-value">可用于专业喂养和专业遛狗服务</view>
</view>
<view class="rule-item">
<view class="rule-label">有效日期</view>
<view class="rule-value">{{currentCoupon.availableEndTime ? currentCoupon.availableEndTime.slice(0, 16) : ''}}</view>
</view>
<view class="rule-item">
<view class="rule-label">特别说明</view>
<view class="rule-value">单笔订单仅限使用1张优惠券优惠券仅限用户本人使用不可赠送不可提现不得找零</view>
</view>
</view>
<view class="rule-popup-close" @click="closeRulePopup">关闭</view>
</view>
</uni-popup>
</view>
</template>
<script>
@ -46,6 +81,7 @@
data() {
return {
couponData: [],
currentCoupon: {}, //
}
},
onLoad() {
@ -87,6 +123,31 @@
this.$modal.showToast('领取优惠券失败')
}
})
},
//
showRulePopup(item) {
this.currentCoupon = item || {};
this.$refs.rulePopup.open();
},
//
closeRulePopup() {
this.$refs.rulePopup.close();
},
//
getDiscountText(coupon) {
if (!coupon || !coupon.stockType) return '';
if (coupon.stockType === 'PNORMAL') {
return '满100可减10元';
} else if (coupon.stockType === 'PDISCOUNT') {
return '打8折';
} else if (coupon.stockType === 'PTRAIL') {
return '免费体验一次';
}
return '';
}
}
}
@ -94,6 +155,56 @@
<style lang="scss">
.coupon-list {
/* 优惠券规则弹窗样式 */
.rule-popup {
width: 600rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
overflow: hidden;
}
.rule-popup-title {
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
background-color: #FFAA48;
}
.rule-popup-content {
padding: 30rpx;
}
.rule-item {
display: flex;
margin-bottom: 20rpx;
}
.rule-label {
width: 140rpx;
font-size: 28rpx;
color: #666666;
flex-shrink: 0;
}
.rule-value {
flex: 1;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
}
.rule-popup-close {
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-size: 30rpx;
color: #FFAA48;
border-top: 1px solid #EEEEEE;
}
.card {
display: flex;
align-items: center;


+ 25
- 4
pages/personalCenter/index.vue View File

@ -110,7 +110,15 @@
当前订单
</view>
<uni-steps :options="orderStatus" active-icon="checkbox" :active="active" active-color='#ffaa48'
@clickStep="handleStepClick" />
/>
<view class="uni-steps-btns">
<u-button
type="primary"
shape="circle"
color="#FFAA48"
text="查看图片"
@click="handleStepClick"></u-button>
</view>
</view>
<view class="personal-order-footer" slot="actions">
<view class="personal-order-footer-text">
@ -361,7 +369,7 @@
toRegister(){
this.$modal.showToast('敬请期待');
},
handleStepClick(e) {
handleStepClick(orderInfo = {}) {
// if(!this.isMember){
// this.$modal.showToast('');
// return;
@ -371,7 +379,7 @@
// if (e.index === 2 && this.active === 2) {
//
uni.navigateTo({
url: `/pages/personalCenter/orderDetail`
url: `/pages/personalCenter/orderDetailImage?orderId=${orderInfo.id}`
});
// }
},
@ -444,7 +452,7 @@
}
case 'taskList':{
uni.navigateTo({
url: `/pages/personalCenter/taskList`
url: `/pages_order/task/taskList`
});
break;
}
@ -586,6 +594,19 @@
}
}
}
.uni-steps-btns{
display: flex;
justify-content: center;
.u-button{
width: 160rpx;
height: 55rpx;
margin-right: 155rpx;
.u-button__text{
font-size: 22rpx !important;
}
}
}
.personal-order{
width: 100%;
.personal-order-title{


pages/personalCenter/orderDetail.vue → pages/personalCenter/orderDetailImage.vue View File

@ -3,7 +3,7 @@
<!-- 日期信息 -->
<view class="order-date">
<view class="order-date-icon">
<u-icon name="calendar" color="#FFAA48" size="20"></u-icon>
<u-icon name="calendar" color="#FFAA48" size="22"></u-icon>
</view>
<view class="order-date-text">{{ orderDate }}</view>
</view>
@ -15,13 +15,13 @@
<view class="order-image-item">
<view class="order-image-label">手套照片 (共2张)</view>
<view class="order-image-container">
<image class="order-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/gloves.jpg" mode="aspectFill"></image>
<image class="order-image" src="/static/images/personal/used.png" mode="aspectFill" @click="previewImage('/static/images/personal/used.png')"></image>
</view>
</view>
<view class="order-image-item">
<view class="order-image-label">鞋套照片 (共2张)</view>
<view class="order-image-container">
<image class="order-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/shoes.jpg" mode="aspectFill"></image>
<image class="order-image" src="/static/images/personal/invalid.png" mode="aspectFill" @click="previewImage('/static/images/personal/invalid.png')"></image>
</view>
</view>
</view>
@ -35,7 +35,7 @@
<view class="pet-name">{{ pet.name }} ({{ pet.photoCount }})</view>
<view class="pet-images">
<view class="pet-image-container" v-for="(photo, photoIndex) in pet.photos" :key="photoIndex">
<image class="pet-image" :src="photo" mode="aspectFill"></image>
<image class="pet-image" :src="photo" mode="aspectFill" @click="previewImage(photo)"></image>
</view>
</view>
</view>
@ -51,11 +51,11 @@
<view class="service-comparison">
<view class="service-before-after">
<view class="service-image-container">
<image class="service-image" :src="service.beforeImage" mode="aspectFill"></image>
<image class="service-image" :src="service.beforeImage" mode="aspectFill" @click="previewImage(service.beforeImage)"></image>
<view class="service-image-label"></view>
</view>
<view class="service-image-container">
<image class="service-image" :src="service.afterImage" mode="aspectFill"></image>
<image class="service-image" :src="service.afterImage" mode="aspectFill" @click="previewImage(service.afterImage)"></image>
<view class="service-image-label"></view>
</view>
</view>
@ -72,16 +72,16 @@
<view class="custom-service-item">
<view class="custom-service-name">遛狗 (5-30分钟)</view>
<view class="custom-service-images">
<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog1.jpg" mode="aspectFill"></image>
<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog2.jpg" mode="aspectFill"></image>
<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog3.jpg" mode="aspectFill"></image>
<image class="custom-service-image" src="/static/images/tabBar/dog.png" mode="aspectFill" @click="previewImage('/static/images/tabBar/dog.png')"></image>
<image class="custom-service-image" src="/static/images/tabBar/dog_.png" mode="aspectFill" @click="previewImage('/static/images/tabBar/dog_.png')"></image>
<image class="custom-service-image" src="/static/images/tabBar/home.png" mode="aspectFill" @click="previewImage('/static/images/tabBar/home.png')"></image>
</view>
</view>
<view class="custom-service-item">
<view class="custom-service-name">梳毛 (5-30分钟)</view>
<view class="custom-service-images">
<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat1.jpg" mode="aspectFill"></image>
<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat2.jpg" mode="aspectFill"></image>
<image class="custom-service-image" src="/static/images/tabBar/cat.png" mode="aspectFill" @click="previewImage('/static/images/tabBar/cat.png')"></image>
<image class="custom-service-image" src="/static/images/tabBar/cat_.png" mode="aspectFill" @click="previewImage('/static/images/tabBar/cat_.png')"></image>
</view>
</view>
</view>
@ -101,34 +101,34 @@
name: '小汪',
photoCount: 2,
photos: [
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog1.jpg',
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog2.jpg'
'/static/images/tabBar/dog.png',
'/static/images/tabBar/dog_.png'
]
},
{
name: 'Billion',
photoCount: 2,
photos: [
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat1.jpg',
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat2.jpg'
'/static/images/tabBar/cat.png',
'/static/images/tabBar/cat_.png'
]
}
],
services: [
{
name: '猫粮前后对比',
beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/food_before.jpg',
afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/food_after.jpg'
beforeImage: '/static/images/personal/invalid.png',
afterImage: '/static/images/personal/used.png'
},
{
name: '水碗前后对比',
beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/water_before.jpg',
afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/water_after.jpg'
beforeImage: '/static/images/personal/invalid.png',
afterImage: '/static/images/personal/used.png'
},
{
name: '猫砂盆 厚度前后对比',
beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/litter_before.jpg',
afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/litter_after.jpg'
beforeImage: '/static/images/personal/invalid.png',
afterImage: '/static/images/personal/used.png'
}
]
}
@ -153,6 +153,16 @@
}
});
*/
},
//
previewImage(urls, current) {
// uni-appAPI
uni.previewImage({
urls,
current,
indicator: 'number',
loop: true
});
}
}
}
@ -168,19 +178,29 @@
.order-date {
display: flex;
align-items: center;
padding: 10px 15px;
background-color: #fff;
border-radius: 8px;
justify-content: center;
padding: 12px 16px;
background-color: #FFF9EF;
border-radius: 10px;
margin-bottom: 15px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
.order-date-icon {
margin-right: 10px;
margin-right: 12px;
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background-color: rgba(255, 170, 72, 0.1);
border-radius: 50%;
}
.order-date-text {
color: #333;
color: #A94F20;
font-size: 16px;
font-weight: 500;
letter-spacing: 0.5px;
}
}
@ -230,8 +250,8 @@
gap: 10px;
.order-image {
width: 100px;
height: 100px;
width: 80px;
height: 80px;
border-radius: 4px;
object-fit: cover;
}
@ -255,8 +275,8 @@
.pet-image-container {
.pet-image {
width: 100px;
height: 100px;
width: 80px;
height: 80px;
border-radius: 4px;
object-fit: cover;
}
@ -283,8 +303,8 @@
position: relative;
.service-image {
width: 120px;
height: 120px;
width: 80px;
height: 80px;
border-radius: 4px;
object-fit: cover;
}
@ -321,8 +341,8 @@
gap: 10px;
.custom-service-image {
width: 100px;
height: 100px;
width: 80px;
height: 80px;
border-radius: 4px;
object-fit: cover;
}

+ 0
- 298
pages/personalCenter/taskList.vue View File

@ -1,298 +0,0 @@
<template>
<view class="task-center">
<u-subsection :list="tabList"
active-color="#ffaa48"
bg-color="#fff"
inactive-color="#aaaaaa"
font-size="16"
:current="curNow"
@change="sectionChange"></u-subsection>
<!-- <view class="container-tabs">
<up-tabs :list="tabList" lineWidth="68rpx" :activeStyle="{
color: '#ffaa48',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#555',
transform: 'scale(1)'
}" :itemStyle="{height:'88rpx',padding:'0 52rpx'}" lineColor="#ffaa48" @click="sectionChange"></up-tabs>
</view> -->
<view v-for="(item,index) in pendingTasks" style="padding:28rpx 36rpx 0;" :key="index">
<view class="task-card">
<view class="task-header">
<view class="task-image">
<image src="" mode="heightFix"></image>
<image src="" mode="heightFix"></image>
</view>
<view class="task-type">{{item.taskType}}</view>
<view class="task-reward">酬劳 <text> ¥{{item.reward}}</text> </view>
</view>
<view class="task-content">
<view class="task-icon">
<image :src="item.icon" style="width: 120rpx; height: 120rpx;" mode="aspectFill"></image>
</view>
<view class="task-info">
<view class="task-title">{{item.title}}</view>
<view class="task-desc">{{item.description}}</view>
<view class="task-deadline">任务截止日期: {{item.deadline}}</view>
</view>
</view>
<view class="task-footer" v-if="true">
<u-button shape="circle" plain text="查看详情" @click="viewTaskDetail(item)"></u-button>
<u-button shape="circle" color="#ffaa48" text="立即上传" @click="uploadTask(item)"></u-button>
</view>
<view class="task-footer" v-else>
<u-button shape="circle" plain text="查看详情" @click="viewTaskDetail(item)"></u-button>
<view class="task-status">已接受</view>
</view>
</view>
</view>
<view v-if="pendingTasks.length === 0" class="empty-tip">
<text>暂无待接受任务</text>
</view>
</view>
</template>
<script>
import {
getTaskList,
acceptTask,
submitTask,
getTaskDetail
} from "@/api/system/task.js"
export default {
data() {
return {
tabList: [
{
name: '待接受',
badge: {
value: 1,
}
},
{
name: '已接受',
badge: {
value: 0,
}
},
],
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: '2',
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png',
title: '发布小红书宣传笔记',
description: '主题: 猫狗狗食使用感受&体验',
deadline: '2025-03-28'
},
{
id: 3,
taskType: '悬赏任务',
reward: '2',
icon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png',
title: '发布小红书宣传笔记',
description: '主题: 猫狗狗食使用感受&体验',
deadline: '2025-03-28'
}
],
acceptedTasks: []
}
},
onLoad() {
//
this.getTaskList()
},
methods: {
sectionChange(index) {
this.curNow = index;
},
getTaskList() {
// API
// API使
//
/*
getTaskList().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=="ACCEPTED")
}
})
*/
// 使
console.log('加载任务列表')
},
viewTaskDetail(task) {
//
uni.navigateTo({
url: `/pages/personalCenter/taskDetail?id=${task.id}`
});
},
uploadTask(task) {
//
uni.showToast({
title: '上传任务: ' + task.title,
icon: 'none'
});
//
/*
submitTask({
taskId: task.id,
content: '任务提交内容'
}).then(res => {
if (res && res.code === 200) {
uni.showToast({
title: '任务提交成功',
icon: 'success'
});
//
this.getTaskList();
}
});
*/
//
const index = this.pendingTasks.findIndex(item => item.id === task.id);
if (index !== -1) {
const acceptedTask = {
...this.pendingTasks[index]
};
this.acceptedTasks.push(acceptedTask);
this.pendingTasks.splice(index, 1);
}
}
}
}
</script>
<style lang="scss">
.task-center {
background-color: #f5f5f7;
min-height: 100vh;
.task-card {
background-color: #FFFFFF;
border-radius: 16rpx;
margin-bottom: 30rpx;
overflow: hidden;
.task-header {
display: flex;
align-items: center;
margin-bottom: 20rpx;
background-color: #FFF4E599;
padding: 15rpx;
.task-image {
margin-right: 30rpx;
display: flex;
align-items: center;
image {
height: 50rpx;
width: 50rpx;
}
}
.task-type {
color: #A94F20;
font-size: 26rpx;
background-color: #FFF4E5;
padding: 10rpx 30rpx;
border-radius: 30rpx;
}
.task-reward {
font-size: 26rpx;
margin-left: auto;
text {
color: #FF5722;
font-weight: bold;
margin-left: 10rpx;
font-size: 30rpx;
}
}
}
.task-content {
display: flex;
margin-bottom: 30rpx;
padding: 0 30rpx 0 30rpx;
.task-icon {
margin-right: 30rpx;
}
.task-info {
flex: 1;
.task-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.task-desc {
font-size: 28rpx;
color: #666;
margin-bottom: 10rpx;
}
.task-deadline {
font-size: 24rpx;
color: #999;
}
}
}
.task-footer {
padding-bottom: 30rpx;
display: flex;
justify-content: center;
align-items: flex-end;
gap: 20rpx;
.u-button {
width: 250rpx;
height: 60rpx;
font-size: 28rpx;
}
.task-status {
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
width: 250rpx;
color: #ffaa48;
font-size: 28rpx;
}
}
}
.empty-tip {
text-align: center;
padding: 60rpx 0;
color: #999;
font-size: 28rpx;
}
}
</style>

BIN
pages_order/static/Group 213084@2x.png View File

Before After
Width: 59  |  Height: 54  |  Size: 4.6 KiB

BIN
pages_order/static/Group@2x.png View File

Before After
Width: 129  |  Height: 39  |  Size: 5.8 KiB

pages/personalCenter/taskDetail.vue → pages_order/task/taskDetail.vue View File


+ 540
- 0
pages_order/task/taskList.vue View File

@ -0,0 +1,540 @@
<template>
<view class="task-center">
<u-subsection :list="tabList"
active-color="#ffaa48"
bg-color="#fff"
inactive-color="#aaaaaa"
font-size="16"
:current="curNow"
@change="sectionChange"></u-subsection>
<!-- <view class="container-tabs">
<up-tabs :list="tabList" lineWidth="68rpx" :activeStyle="{
color: '#ffaa48',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#555',
transform: 'scale(1)'
}" :itemStyle="{height:'88rpx',padding:'0 52rpx'}" lineColor="#ffaa48" @click="sectionChange"></up-tabs>
</view> -->
<!-- 待接受任务列表 -->
<view v-if="curNow === 0">
<view v-for="(item,index) in pendingTasks" style="padding:28rpx 36rpx 0;" :key="index">
<view class="task-card">
<view class="task-header">
<view class="task-image">
<image src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png" mode="heightFix"></image>
</view>
<view class="task-type">{{item.taskType}}</view>
<view class="task-reward">酬劳 <text> ¥{{item.reward}}</text> </view>
</view>
<view class="task-content">
<view class="task-icon">
<image :src="item.icon" style="width: 120rpx; height: 120rpx;" mode="aspectFill"></image>
</view>
<view class="task-info">
<view class="task-title">{{item.title}}</view>
<view class="task-desc">{{item.description}}</view>
<view class="task-deadline">任务截止日期: {{item.deadline}}</view>
</view>
</view>
<view class="task-footer">
<u-button shape="circle" plain text="查看详情" @click="viewTaskDetail(item)"></u-button>
<u-button shape="circle" color="#ffaa48" text="立即接受" @click="acceptTaskHandler(item)"></u-button>
</view>
</view>
</view>
<view v-if="pendingTasks.length === 0" class="empty-tip">
<text>暂无待接受任务</text>
</view>
</view>
<!-- 已接收任务列表 -->
<view v-else>
<view v-for="(item,index) in acceptedTasks" style="padding:28rpx 36rpx 0;" :key="index">
<view class="task-card">
<view class="task-header">
<view class="task-image">
<image src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png" mode="heightFix"></image>
</view>
<view class="task-type">{{item.taskType}}</view>
<view class="task-reward">酬劳 <text> ¥{{item.reward}}</text> </view>
</view>
<view class="task-content">
<view class="task-icon">
<image :src="item.icon" style="width: 120rpx; height: 120rpx;" mode="aspectFill"></image>
</view>
<view class="task-info">
<view class="task-title">{{item.title}}</view>
<view class="task-desc">{{item.description}}</view>
<view class="task-deadline">任务截止日期: {{item.deadline}}</view>
<view class="task-status-tag" :class="{'status-pending': item.status === 'ACCEPTED', 'status-reviewing': item.status === 'SUBMITTED', 'status-rejected': item.status === 'REJECTED', 'status-approved': item.status === 'APPROVED'}">{{getStatusText(item.status)}}</view>
</view>
</view>
<view class="task-footer">
<u-button shape="circle" plain text="查看详情" @click="viewTaskDetail(item)"></u-button>
<u-button v-if="item.status === 'REJECTED'" shape="circle" type="error" text="驳回原因" @click="showRejectReason(item)"></u-button>
<u-button v-if="item.status === 'ACCEPTED'" shape="circle" color="#ffaa48" text="立即上传" @click="uploadTask(item)"></u-button>
<u-button v-if="item.status === 'SUBMITTED'" shape="circle" disabled text="审核中"></u-button>
<u-button v-if="item.status === 'REJECTED'" shape="circle" color="#ffaa48" text="重新上传" @click="uploadTask(item)"></u-button>
<view v-if="item.status === 'APPROVED'" class="task-status task-status-approved">已通过</view>
</view>
</view>
</view>
<view v-if="acceptedTasks.length === 0" class="empty-tip">
<text>暂无已接收任务</text>
</view>
</view>
</view>
</template>
<script>
import {
getTaskList,
acceptTask,
submitTask,
getTaskDetail
} from "@/api/system/task.js"
export default {
data() {
return {
tabList: [
{
name: '待接受',
badge: {
value: 1,
}
},
{
name: '已接受',
badge: {
value: 0,
}
},
],
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'
}
]
}
},
onLoad() {
//
this.getTaskList()
//
this.updateBadgeCount()
},
methods: {
sectionChange(index) {
this.curNow = index;
},
getTaskList() {
// API
// API使
//
/*
getTaskList().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")
this.updateBadgeCount()
}
})
*/
// 使
console.log('加载任务列表')
//
this.updateBadgeCount()
},
updateBadgeCount() {
//
this.tabList[0].badge.value = this.pendingTasks.length
this.tabList[1].badge.value = this.acceptedTasks.length
},
viewTaskDetail(task) {
//
uni.navigateTo({
url: `/pages_order/task/taskDetail?id=${task.id}`
});
},
acceptTaskHandler(task) {
//
uni.showModal({
title: '接受任务',
content: `确定接受任务: ${task.title}`,
success: res => {
if (res.confirm) {
//
/*
acceptTask(task.id).then(res => {
if (res && res.code === 200) {
uni.showToast({
title: '任务接受成功',
icon: 'success'
});
//
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'
});
}
}
}
});
},
uploadTask(task) {
//
uni.navigateTo({
url: `/pages_order/task/taskUpload?id=${task.id}&status=${task.status}`
});
},
showRejectReason(task) {
//
if (task.rejectReason) {
uni.showModal({
title: '驳回原因',
content: task.rejectReason,
showCancel: false
});
} else {
uni.showToast({
title: '暂无驳回原因',
icon: 'none'
});
}
},
getStatusText(status) {
//
const statusMap = {
'ACCEPTED': '待上传',
'SUBMITTED': '审核中',
'REJECTED': '未通过',
'APPROVED': '已通过'
};
return statusMap[status] || status;
},
getStatusClass(status) {
//
const classMap = {
'ACCEPTED': 'status-pending',
'SUBMITTED': 'status-reviewing',
'REJECTED': 'status-rejected',
'APPROVED': 'status-approved'
};
return classMap[status] || '';
}
}
}
</script>
<style lang="scss">
.task-center {
background-color: #f5f5f7;
min-height: 100vh;
.task-card {
background-color: #FFFFFF;
border-radius: 16rpx;
margin-bottom: 30rpx;
overflow: hidden;
.task-header {
display: flex;
align-items: center;
margin-bottom: 20rpx;
background-color: #FFF4E599;
padding: 15rpx;
.task-image {
margin-right: 30rpx;
display: flex;
align-items: center;
image {
height: 50rpx;
width: 50rpx;
}
}
.task-type {
color: #A94F20;
font-size: 26rpx;
background-color: #FFF4E5;
padding: 10rpx 30rpx;
border-radius: 30rpx;
}
.task-reward {
font-size: 26rpx;
margin-left: auto;
text {
color: #FF5722;
font-weight: bold;
margin-left: 10rpx;
font-size: 30rpx;
}
}
}
.task-content {
display: flex;
margin-bottom: 30rpx;
padding: 0 30rpx 0 30rpx;
.task-icon {
margin-right: 30rpx;
}
.task-info {
flex: 1;
position: relative;
.task-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.task-desc {
font-size: 28rpx;
color: #666;
margin-bottom: 10rpx;
}
.task-deadline {
font-size: 24rpx;
color: #999;
margin-bottom: 10rpx;
}
.task-status-tag {
display: inline-block;
font-size: 24rpx;
padding: 6rpx 20rpx;
border-radius: 20rpx;
margin-top: 10rpx;
&.status-pending {
background-color: #E6F7FF;
color: #1890FF;
}
&.status-reviewing {
background-color: #FFF7E6;
color: #FA8C16;
}
&.status-rejected {
background-color: #FFF1F0;
color: #F5222D;
}
&.status-approved {
background-color: #F6FFED;
color: #52C41A;
}
}
}
}
.task-footer {
padding-bottom: 30rpx;
display: flex;
justify-content: center;
align-items: flex-end;
gap: 20rpx;
flex-wrap: wrap;
.u-button {
width: 200rpx;
height: 60rpx;
font-size: 28rpx;
}
.task-status {
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
width: 200rpx;
font-size: 28rpx;
&.task-status-approved {
color: #52C41A;
}
}
}
}
.empty-tip {
text-align: center;
padding: 60rpx 0;
color: #999;
font-size: 28rpx;
}
}
</style>

+ 267
- 0
pages_order/task/taskUpload.vue View File

@ -0,0 +1,267 @@
<template>
<view class="task-upload">
<!-- 驳回原因提示 -->
<view class="reject-tip" v-if="isRejected">
<text>拒绝原因:{{taskInfo.rejectReason || '部分任务要求不符合'}}</text>
</view>
<!-- 任务头部信息 -->
<view class="task-header">
<view class="task-title">{{taskInfo.title}}</view>
<view class="task-deadline">请于{{taskInfo.deadline}}之前上传任务超时将自动取消</view>
</view>
<!-- 上传表单 -->
<view class="upload-form">
<view class="form-title">任务完成凭证</view>
<!-- 笔记链接 -->
<view class="form-item">
<view class="item-label">笔记链接</view>
<view class="item-content">
<u-textarea v-model="formData.noteLink" placeholder="猫妈狗爸" maxlength="300" height="120"></u-textarea>
<view class="word-count">{{formData.noteLink.length || 0}}/300</view>
</view>
</view>
<!-- 笔记截图 -->
<view class="form-item">
<view class="item-label">笔记截图 <text class="required">*</text></view>
<view class="item-content">
<u-upload
:fileList="fileList"
@afterRead="afterRead"
@delete="deletePic"
:maxCount="6"
name="1"
:multiple="true"
:maxSize="10 * 1024 * 1024"
></u-upload>
<view class="upload-tips">请上传任务完成的截图凭证最多6张每张不超过10MB</view>
</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-btn">
<u-button type="primary" color="#ffaa48" text="确认上传" @click="submitTaskHandler"></u-button>
</view>
</view>
</template>
<script>
import { getTaskDetail, submitTask } from "@/api/system/task.js"
export default {
data() {
return {
taskId: null,
taskStatus: '',
isRejected: false,
taskInfo: {
id: 0,
title: '',
deadline: '',
rejectReason: ''
},
formData: {
noteLink: '',
images: []
},
fileList: []
}
},
onLoad(options) {
if (options.id) {
this.taskId = options.id
this.taskStatus = options.status || ''
this.isRejected = this.taskStatus === 'REJECTED'
this.getTaskDetail()
} else {
uni.showToast({
title: '任务ID不存在',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
},
methods: {
getTaskDetail() {
//
//
/*
getTaskDetail(this.taskId).then(res => {
if (res && res.code === 200) {
this.taskInfo = res.data
}
})
*/
//
const mockData = {
id: this.taskId,
title: '发布小红书宣传笔记',
deadline: '2025-03-28',
rejectReason: this.isRejected ? '图片不清晰,请重新上传高清图片' : ''
}
this.taskInfo = mockData
},
afterRead(event) {
//
const { file } = event
this.fileList.push({
url: file.url,
status: 'success',
message: '上传成功',
name: file.name
})
this.formData.images.push(file.url)
},
deletePic(event) {
//
const index = event.index
this.fileList.splice(index, 1)
this.formData.images.splice(index, 1)
},
submitTaskHandler() {
//
if (this.formData.images.length === 0) {
uni.showToast({
title: '请上传任务完成凭证',
icon: 'none'
})
return
}
//
/*
submitTask({
taskId: this.taskId,
noteLink: this.formData.noteLink,
images: this.formData.images
}).then(res => {
if (res && res.code === 200) {
uni.showToast({
title: '任务提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
*/
//
uni.showLoading({
title: '提交中...'
})
setTimeout(() => {
uni.hideLoading()
uni.showToast({
title: '任务提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}, 1500)
}
}
}
</script>
<style lang="scss">
.task-upload {
background-color: #f5f5f7;
min-height: 100vh;
padding-bottom: 120rpx;
.reject-tip {
background-color: #FFF1F0;
padding: 20rpx 30rpx;
text {
color: #FF5722;
font-size: 28rpx;
}
}
.task-header {
background-color: #FFFFFF;
padding: 30rpx;
.task-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
}
.task-deadline {
font-size: 26rpx;
color: #999;
}
}
.upload-form {
background-color: #FFFFFF;
margin-top: 20rpx;
padding: 30rpx;
.form-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 30rpx;
border-left: 8rpx solid #ffaa48;
padding-left: 20rpx;
}
.form-item {
margin-bottom: 30rpx;
.item-label {
font-size: 28rpx;
color: #333;
margin-bottom: 20rpx;
.required {
color: #f56c6c;
margin-left: 4rpx;
}
}
.item-content {
position: relative;
.word-count {
position: absolute;
bottom: 10rpx;
right: 10rpx;
font-size: 24rpx;
color: #999;
}
.upload-tips {
font-size: 24rpx;
color: #999;
margin-top: 20rpx;
}
}
}
}
.submit-btn {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #FFFFFF;
padding: 20rpx 30rpx;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
}
}
</style>

+ 1
- 1
utils/getUrl.js View File

@ -5,7 +5,7 @@ current = accountInfo.miniProgram.envVersion;
const api={
// develop:"http://h5.xzaiyp.top/prod-api",
// develop:"http://h5.xzaiyp.top",
develop:"https://api-test.catmdogd.com/test-api",
trial:"https://api-test.catmdogd.com/test-api",
release:"https://api.catmdogd.com/prod-api",


Loading…
Cancel
Save