Просмотр исходного кода

feat:保存用户头像和openid,替换任务列表的头像

xyh 5 месяцев назад
Родитель
Сommit
17d43b6667

+ 1 - 0
src/api/shop.js

@@ -10,6 +10,7 @@ export function getShopType(data) {
 }
 // 积分商品列表
 export function getPointShopList(data) {
+    console.log(data)
     // 模拟数据返回
     return new Promise((resolve, reject) => {
         setTimeout(() => {

+ 1 - 0
src/pages/my/my.vue

@@ -209,6 +209,7 @@ export default {
 				if (res.data.code == 200) {
 					this.userInfo = res.data.data;
 					uni.setStorageSync('wx_copenid', res.data.data.cOpenid);
+          uni.setStorageSync('wx_cIcon', res.data.data.cIcon);
 				}
 			})
 		},

+ 2 - 1
src/points/components/product-list/product-list.vue

@@ -4,7 +4,7 @@
       <!-- 商品列表头部 -->
       <view class="product-header">
         <view class="title-text" :class="{ 'hide': isSticky }"><text>精选好物</text>兑换</view>
-        <u-search placeholder="搜索" v-model="keyword" :showAction="false" :class="{ 'expand': isSticky }"></u-search>
+        <u-search placeholder="搜索" v-model="keyword" :showAction="false" :class="{ 'expand': isSticky }" @search="loadData"></u-search>
       </view>
     
       <!-- 分类标签 -->
@@ -161,6 +161,7 @@ export default {
       return getPointShopList({
         page: page,
         pageSize: this.pageSize,
+        name:this.keyword,
         category: this.activeCategory,
         sort: this.activeSort,
         sortDirection: this.sortDirection

+ 27 - 9
src/points/components/task-list/task-list.vue

@@ -11,8 +11,8 @@
     <view v-else-if="taskData && taskData.length > 0">
       <view class="task-list">
         <view 
-          v-for="task in taskData"
-          :key="task.activityId"
+          v-for="(task,index) in taskData"
+          :key="index"
           class="task-item">
           <view class="task-item-left">
             <view class="task-icon">
@@ -28,12 +28,13 @@
             </view>
           </view>
           <view class="task-item-right">
+            <text class="progress-text">{{ task.completedCount }}/{{ task.triggerValue }}</text>
             <button 
-              :class="task.completedStatus == 1 ? 'task-btn' : 'no-task-btn'" 
+              :class="Number(task.completedCount) >= Number(task.triggerValue) ? 'task-btn' : 'no-task-btn'"
               @click.stop="handleTask(task)"
-              :disabled="task.completedStatus == 1"
+              :disabled="Number(task.completedCount) >= Number(task.triggerValue)"
             >
-              {{ task.completedStatus == 1 ? '已完成' : '去完成' }}
+              {{Number(task.completedCount) >= Number(task.triggerValue) ? '已完成' : '去完成' }}
             </button>
           </view>
         </view>
@@ -51,7 +52,7 @@
 
 <script>
 import ImageItem from "@/components/swiper/components/image.vue";
-
+import { handleServiceShare } from '@/utils/share'
 export default {
   components: { ImageItem },
   props: {
@@ -98,7 +99,7 @@ export default {
       if (taskName.includes('商户')) return this.taskConfig.merchant.icon;
       if (taskName.includes('动态')) return this.taskConfig.dynamic.icon;
       if (taskName.includes('服务号')) return this.taskConfig.service.icon;
-      if (taskName.includes('账号充值')) return this.taskConfig.recharge.icon;
+      if (taskName.includes('充值')) return this.taskConfig.recharge.icon;
       return '';
     },
 
@@ -114,7 +115,7 @@ export default {
         this.taskConfig.dynamic.action();
       } else if (task.taskName.includes('服务号')) {
         this.taskConfig.service.action();
-      } else if (task.taskName.includes('账号充值')) {
+      } else if (task.taskName.includes('充值')) {
         this.taskConfig.recharge.action();
       }
     },
@@ -140,7 +141,13 @@ export default {
 
     // 处理服务号任务
     handleServiceTask() {
-      // 服务号任务处理逻辑
+      // 调用微信服务号分享功能
+      handleServiceShare({
+        title: '广誉远 - 关注服务号',
+        desc: '关注广誉远服务号,获取更多积分和优惠',
+        link: window.location.href,
+        imgUrl: '/static/points/task_wx.png'
+      });
     },
 
     // 处理账号充值任务
@@ -242,6 +249,17 @@ export default {
       }
       
       .task-item-right {
+        display: flex;
+        flex-direction: row;
+        .progress-text{
+          font-family: PingFang SC, PingFang SC;
+          font-weight: 500;
+          font-size: 28rpx;
+          color: #999999;
+          line-height: 28rpx;
+          margin-right: 8rpx;
+          margin-top: 10rpx;
+        }
         .task-btn {
           height: 48rpx;
           background: #EEEEEE;

+ 7 - 6
src/points/pointInfo/taskList.vue

@@ -4,7 +4,7 @@
     <view class="points-header">
       <view class="points-item">
         <view class="img">
-          <u-avatar size="96rpx" default-url="/static/common/avatar.png" />
+          <u-avatar :src="cIcon" size="96rpx" default-url="/static/common/avatar.png" />
         </view>
       </view>
       <view class="points-item">
@@ -63,11 +63,11 @@
             <view class="task-progress">
               <text class="progress-text">{{ task.completedCount }}/{{ task.triggerValue }}</text>
               <button 
-                :class="task.completedCount >= task.triggerValue ? 'task-btn' : 'no-task-btn'" 
+                :class="Number(task.completedCount) >= Number(task.triggerValue) ? 'task-btn' : 'no-task-btn'"
                 @click.stop="handleTask(task)"
-                :disabled="task.completedCount >= task.triggerValue"
+                :disabled="Number(task.completedCount) >= Number(task.triggerValue)"
               >
-                {{ task.completedCount >= task.triggerValue ? '已完成' : '去完成' }}
+                {{ Number(task.completedCount) >= Number(task.triggerValue) ? '已完成' : '去完成' }}
               </button>
             </view>
           </u-list-item>
@@ -124,6 +124,7 @@ export default {
   },
   data() {
     return {
+      cIcon: uni.getStorageSync('wx_cIcon'),
       // 标签数据
       tabs: [
         { key: '1', name: '新手任务' },
@@ -191,7 +192,7 @@ export default {
         this.taskConfig.dynamic.action();
       } else if (task.taskName.includes('服务号')) {
         this.taskConfig.service.action();
-      } else if (task.taskName.includes('账号充值')) {
+      } else if (task.taskName.includes('充值')) {
         this.taskConfig.recharge.action();
       }
     },
@@ -268,7 +269,7 @@ export default {
       if (taskName.includes('商户')) return this.taskConfig.merchant.icon;
       if (taskName.includes('动态')) return this.taskConfig.dynamic.icon;
       if (taskName.includes('服务号')) return this.taskConfig.service.icon;
-      if (taskName.includes('账号充值')) return this.taskConfig.recharge.icon;
+      if (taskName.includes('充值')) return this.taskConfig.recharge.icon;
       return ''
     }
   }