From 4e069fd2c9469702f03b5a7280bfa9cede0ae239 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 24 七月 2024 19:21:45 +0800
Subject: [PATCH] ''

---
 wechat_staff/pages/detailDis/case.js          |    2 
 wechat_staff/pages/kefu/fond.js               |  110 +++++++++++++++++++++++----
 wechat_staff/pages/detailDis/realpic.js       |    2 
 wechat_staff/pages/kefu/select.wxss           |    1 
 wechat_staff/pages/kefu/fond.wxss             |    7 +
 wechat_staff/pages/detailDis/product.wxml     |    2 
 wechat_staff/pages/kefu/fond.wxml             |   15 ++-
 wechat_staff/pages/kefu/select.less           |    1 
 wechat_staff/project.private.config.json      |    2 
 wechat_staff/pages/kefu/select.wxml           |    4 
 wechat_staff/pages/detailDis/product.js       |    2 
 wechat_staff/api/index.js                     |    6 
 wechat_staff/pages/kefu/select.js             |   37 +++++----
 wechat_staff/pages/kefu/fond.less             |    5 +
 wechat_staff/components/detailFooter/index.js |    8 +
 15 files changed, 150 insertions(+), 54 deletions(-)

diff --git a/wechat_staff/api/index.js b/wechat_staff/api/index.js
index 924f405..d183f79 100644
--- a/wechat_staff/api/index.js
+++ b/wechat_staff/api/index.js
@@ -142,9 +142,10 @@
     data
   })
 }
-export const getUserCard = (data) => {
+// 鎵归噺娣诲姞鍠滄缁欏鎴�
+export const batchAddLike = (data) => {
   return request({
-    url: '/web/personnel/getUserCard',
+    url: '/web/personnel/batchAddLike',
     method: "POST",
     data
   })
@@ -308,7 +309,6 @@
     data
   })
 }
-// 灏忕▼搴忔敞閿�
 export const getCrmAuthUrl = (data) => {
   return request({
     url: '/web/customer/getCrmAuthUrl',
diff --git a/wechat_staff/components/detailFooter/index.js b/wechat_staff/components/detailFooter/index.js
index f2ffc03..996192b 100644
--- a/wechat_staff/components/detailFooter/index.js
+++ b/wechat_staff/components/detailFooter/index.js
@@ -95,11 +95,15 @@
       })
     },
     batchDown() {
+      console.log('鐐硅В浜嗕笅杞�');
+      this.triggerEvent('down')
       setTimeout(() => {
         eventBus.emit('batchDown', [1,2,3])
       }, 1000)
-      wx.navigateTo({
-        url: '/pages/download/index',
+      setTimeout(() => {
+        wx.navigateTo({
+          url: '/pages/download/index',
+        }, 1000)
       })
     },
     closeCard() {
diff --git a/wechat_staff/pages/detailDis/case.js b/wechat_staff/pages/detailDis/case.js
index 9f82fd2..8766e9a 100644
--- a/wechat_staff/pages/detailDis/case.js
+++ b/wechat_staff/pages/detailDis/case.js
@@ -63,7 +63,7 @@
         this.setData({ info })
         enjoyList.push({
           ...info,
-          joinType: 'product',
+          joinType: '1',
           timestamp: new Date().getTime()
         })
       }else{
diff --git a/wechat_staff/pages/detailDis/product.js b/wechat_staff/pages/detailDis/product.js
index 7458b00..e15213f 100644
--- a/wechat_staff/pages/detailDis/product.js
+++ b/wechat_staff/pages/detailDis/product.js
@@ -49,7 +49,7 @@
         this.setData({ info })
         enjoyList.push({
           ...info,
-          joinType: 'product',
+          joinType: '0',
           timestamp: new Date().getTime()
         })
       }else{
diff --git a/wechat_staff/pages/detailDis/product.wxml b/wechat_staff/pages/detailDis/product.wxml
index 57266a5..8553484 100644
--- a/wechat_staff/pages/detailDis/product.wxml
+++ b/wechat_staff/pages/detailDis/product.wxml
@@ -1,6 +1,6 @@
 <view class="main_app">
   <buoyClient showPurpose="1" />
-  <detailFooter bindenjoy="handleEnjoy" path="0" info="{{info}}" />
+  <detailFooter binddown="handleDown" bindenjoy="handleEnjoy" path="0" info="{{info}}" />
   <!-- banner杞挱 -->
   <swiper class="banner_swiper" circular indicator-dots autoplay style="height:{{bannerHeight}}rpx" duration>
     <block wx:for="{{ info.bannerImgList }}">
diff --git a/wechat_staff/pages/detailDis/realpic.js b/wechat_staff/pages/detailDis/realpic.js
index 6795a0e..0e9fa5f 100644
--- a/wechat_staff/pages/detailDis/realpic.js
+++ b/wechat_staff/pages/detailDis/realpic.js
@@ -56,7 +56,7 @@
         this.setData({ info })
         enjoyList.push({
           ...info,
-          joinType: 'product',
+          joinType: '2',
           timestamp: new Date().getTime()
         })
       }else{
diff --git a/wechat_staff/pages/kefu/fond.js b/wechat_staff/pages/kefu/fond.js
index cb63da1..bedb67d 100644
--- a/wechat_staff/pages/kefu/fond.js
+++ b/wechat_staff/pages/kefu/fond.js
@@ -1,4 +1,5 @@
 import moment from "moment";
+import { getContentShareImg } from '../../api/index'
 Page({
 
   /**
@@ -6,6 +7,7 @@
    */
   data: {
     bottomLift: 0,
+    checkAll: false,
     enjoyList: []
   },
 
@@ -17,6 +19,11 @@
     this.setData({
       bottomLift: app.bottomLift
     })
+    let enjoyList = wx.getStorageSync('enjoyList') || []
+    enjoyList.forEach(item => {
+      item.checked = false
+    })
+    wx.setStorageSync('enjoyList', enjoyList)
     this.initData()
   },
 
@@ -26,10 +33,13 @@
     enjoyList = enjoyList.sort((a,b)=>{
       return b.timestamp - a.timestamp
     })
+    let count = 0
     enjoyList.forEach(item  => {
+      if(item.checked){
+        count++
+      }
       item.joinDate = moment(item.timestamp).format('YYYY骞碝M鏈圖D鏃�')
       item.joinTime = moment(item.timestamp).format('HH:mm')
-      item.checked = false
       const index = temp.findIndex( i => i.joinDate === item.joinDate )
       if(index === -1){
         temp.push({
@@ -39,37 +49,52 @@
       }else{
         temp[index].list.push(item)
       }
-    });
+    })
+    this.setData({ checkAll: count === enjoyList.length })
     this.setData({ enjoyList: temp })
-
-
     console.log('enjoyList', temp);
 
   },
   itemCheck(e){
-    const { enjoyList } = this.data
-    const { index, inde } = e.currentTarget.dataset
-    enjoyList[index].list[inde].check = !enjoyList[index].list[inde].check
-    this.setData({ enjoyList })
+    const enjoyList = wx.getStorageSync('enjoyList') || []
+    const { id } = e.currentTarget.dataset
+    console.log(id);
+    enjoyList.forEach(item => {
+      if(item.id === id){
+        item.checked = !item.checked
+      }
+    })
+    wx.setStorageSync('enjoyList', enjoyList)
+    this.initData()
+  },
+  bind() {
+    wx.navigateTo({
+      url: '/pages/kefu/select',
+    })
   },
   handleDown() {
-    const {
-      info,
-      path
-    } = this.data
+    const { enjoyList } = this.data
+    let obj = {}
+    enjoyList.forEach(item => {
+      item.list.forEach(ite => {
+        if(ite.checked){
+          obj = ite
+        }
+      })
+    })
+    console.log('obj', obj);
     let that = this
     getContentShareImg({
-      articleId: path + '&' + info.id,
+      articleId: obj.id + '&' + obj.joinType,
       type: '1',
       // pageUrl: path,
-      imgurl: info.coverImage,
+      imgurl: obj.coverImage,
     }).then(res => {
       this.setData({
         isShowPoster: true,
         showShare: false,
         posterUrl: res.data
       })
-
     })
   },
   saveCard() {
@@ -108,8 +133,61 @@
   closeCard() {
     this.setData({ isShowPoster: false })
   },
+  itemDel() {
+    let that = this
+    let ids = []
+    let { enjoyList } = this.data
+    enjoyList.forEach(item => {
+      item.list.forEach(ite => {
+        if(ite.checked){
+          ids.push(ite.id)
+        }
+      })
+    })
+    if(ids.length === 0) return wx.showToast({
+      title: '璇峰厛閫夋嫨瑕佸垹闄ょ殑浜у搧',icon: 'none'
+    })
+    wx.showModal({
+      title: '鎻愮ず',
+      content: '浣犵‘璁よ鍒犻櫎璇ヤ骇鍝佸悧',
+      success (res) {
+        if (res.confirm) {
+          let enjoyListTemp = wx.getStorageSync('enjoyList') || []
+          ids.forEach(item => {
+            const index = enjoyListTemp.findIndex(i => i.id == item)
+            console.log('index', index);
+            if(index > -1){
+              enjoyListTemp.splice(index, 1)
+            }
+          })
+          wx.setStorageSync('enjoyList', enjoyListTemp)
+          that.initData()
+        }
+      }
+    })
+    
+  },
+  checkAll() {
+    let enjoyList = wx.getStorageSync('enjoyList') || []
+    enjoyList.forEach(item => {
+      item.checked = !item.checked
+    })
+    wx.setStorageSync('enjoyList', enjoyList)
+    this.initData()
+  },
   openShare() {
-    console.log('鐐瑰嚮鎵撳紑');
+    let count = 0
+    const { enjoyList } = this.data
+    enjoyList.forEach(item => {
+      item.list.forEach(ite => {
+        if(ite.checked){
+          count ++ 
+        }
+      })
+    })
+    if(count != 1) return wx.showToast({
+      title: '鏈変笖鍙兘閫夋嫨涓�涓骇鍝�',icon: 'none'
+    })
     this.setData({
       showShare: true
     })
diff --git a/wechat_staff/pages/kefu/fond.less b/wechat_staff/pages/kefu/fond.less
index 233a079..66841f3 100644
--- a/wechat_staff/pages/kefu/fond.less
+++ b/wechat_staff/pages/kefu/fond.less
@@ -3,6 +3,7 @@
   padding-bottom: 220rpx;
 }
 .date_item{
+  position: relative;
   .date{
     display: flex;
     font-weight: 500;
@@ -71,6 +72,7 @@
       width: 160rpx;
       .icon{
         width: 40rpx;
+        height: 40rpx;
         margin-right: 18rpx;
       }
     }
@@ -107,7 +109,7 @@
   position: fixed;
   bottom: 0;
   width: 100%;
-  z-index: 9999;
+  z-index: 99999;
   background-color: #fff;
   border-radius: 24rpx 24rpx 0rpx 0rpx;
   .btns{
@@ -145,6 +147,7 @@
   width: 100%;
   height: 100%;
   z-index: 1000;
+  z-index: 99;
   background-color: rgba(0,0,0,.5);
 }
 .card_wrap{
diff --git a/wechat_staff/pages/kefu/fond.wxml b/wechat_staff/pages/kefu/fond.wxml
index 5cc3600..80ec8ab 100644
--- a/wechat_staff/pages/kefu/fond.wxml
+++ b/wechat_staff/pages/kefu/fond.wxml
@@ -3,8 +3,8 @@
     <view class="date">{{ day.joinDate }}</view>
     <view class="list">
       <view class="line" wx:for="{{ day.list }}" wx:for-index="inde" wx:for-item="item">
-        <image data-index="{{index}}" data-inde="{{inde}}" bindtap="itemCheck" wx:if="{{ item.check }}" class="icon" src="../../static/icon/ic_select_sel@2x.png"></image>
-        <image data-index="{{index}}" data-inde="{{inde}}" bindtap="itemCheck" wx:else class="icon" src="../../static/icon/ic_select@2x.png"></image>
+        <image data-id="{{item.id}}"  bindtap="itemCheck" wx:if="{{ item.checked }}" class="icon" src="../../static/icon/ic_select_sel@2x.png"></image>
+        <image data-id="{{item.id}}" bindtap="itemCheck" wx:else class="icon" src="../../static/icon/ic_select@2x.png"></image>
         <image class="img" src="{{ item.coverImage }}" mode="aspectFill"></image>
         <view class="content">
           <view class="name">{{ item.title }}</view>
@@ -16,13 +16,14 @@
   <!-- footer -->
   <view class="footer" style="padding-bottom: {{bottomLift}}px;">
     <view class="btns">
-      <view class="all_sel">
-        <image class="icon" src="../../static/icon/ic_select_sel@2x.png" mode="widthFix"></image>
+      <view bindtap="checkAll" class="all_sel">
+        <image wx:if="{{ checkAll }}" class="icon" src="../../static/icon/ic_select_sel@2x.png" mode="widthFix"></image>
+        <image wx:else class="icon" src="../../static/icon/ic_select@2x.png" mode="widthFix"></image>
         <text>鍏ㄩ��</text>
       </view>
       <view class="list">
-        <view class="item">鍒犻櫎</view>
-        <view class="item paina">鍏宠仈</view>
+        <view bindtap="itemDel" class="item">鍒犻櫎</view>
+        <view bindtap="bind" class="item paina">鍏宠仈</view>
         <view bindtap="openShare" class="item primary">鍒嗕韩</view>
       </view>
     </view>
@@ -42,7 +43,7 @@
     </view>
     <view bindtap="onClose" class="cancel">鍙栨秷</view>
   </view>
-  <view wx:if="{{ showShare }}" class="shade" bindtap="onClose"></view>
+  <van-overlay z-index="99998" show="{{ showShare }}" bind:click="onClose" />
 
   <!--  -->
   <view wx:if="{{ isShowPoster }}" class="card_wrap">
diff --git a/wechat_staff/pages/kefu/fond.wxss b/wechat_staff/pages/kefu/fond.wxss
index 72b5026..b7bbad2 100644
--- a/wechat_staff/pages/kefu/fond.wxss
+++ b/wechat_staff/pages/kefu/fond.wxss
@@ -2,6 +2,9 @@
   background-color: #f7f7f7;
   padding-bottom: 220rpx;
 }
+.date_item {
+  position: relative;
+}
 .date_item .date {
   display: flex;
   font-weight: 500;
@@ -72,6 +75,7 @@
 }
 .footer .btns .all_sel .icon {
   width: 40rpx;
+  height: 40rpx;
   margin-right: 18rpx;
 }
 .footer .btns .list {
@@ -105,7 +109,7 @@
   position: fixed;
   bottom: 0;
   width: 100%;
-  z-index: 9999;
+  z-index: 99999;
   background-color: #fff;
   border-radius: 24rpx 24rpx 0rpx 0rpx;
 }
@@ -142,6 +146,7 @@
   width: 100%;
   height: 100%;
   z-index: 1000;
+  z-index: 99;
   background-color: rgba(0, 0, 0, 0.5);
 }
 .card_wrap {
diff --git a/wechat_staff/pages/kefu/select.js b/wechat_staff/pages/kefu/select.js
index 8c8cfdf..a3d2b7b 100644
--- a/wechat_staff/pages/kefu/select.js
+++ b/wechat_staff/pages/kefu/select.js
@@ -1,4 +1,4 @@
-import { getCustomerList, getCrmAuthUrl } from '../../api/index'
+import { getCustomerList, getCrmAuthUrl, batchAddLike } from '../../api/index'
 const { HYEventBus } = require('hy-event-store')
 const eventBus = new HYEventBus()
 Page({
@@ -11,6 +11,7 @@
 
     keyWords: '',
     dataList: [],
+    customer: {},
     total: 0,
     flag: 0,
     page: 1,
@@ -27,12 +28,29 @@
       bottomLift: app.bottomLift
     })
     this.getList()
-  },  
+    
+  }, 
+  handleSub() {
+    const { customer } = this.data
+    const enjoyList = wx.getStorageSync('enjoyList') || []
+    if(!customer.userId) return wx.showToast({
+      title: '璇峰厛閫夋嫨瑕佸叧鑱旂殑瀹㈡埛', icon: 'none'
+    })
+    batchAddLike({
+      articleIds: enjoyList.filter(i => i.checked).map(i => i.id).join(','),
+      customerId: customer.userId
+    })
+  },
   tabsClick(e) {
     const flag = e.currentTarget.dataset.tab
     this.setData({flag})
     this.setData({total: 0,dataList: [], page: 1})
     this.getList()
+  },
+  itemCheck(e) {
+    const item = e.currentTarget.dataset.item
+    console.log('item', item);
+    this.setData({ customer: item })
   },
   reloadList() {
     this.setData({total: 0,dataList: [], page: 1})
@@ -72,21 +90,6 @@
         url: '/pages/webView/index?link=' + res.data,
       })
     }) 
-  },
-  handleSub() {
-    console.log('鐐瑰嚮楗夸簡');
-    wx.canvasToTempFilePath({
-      x: 100,
-      y: 200,
-      width: 50,
-      height: 50,
-      destWidth: 100,
-      destHeight: 100,
-      canvasId: 'myCanvas',
-      success(res) {
-        console.log(res.tempFilePath)
-      }
-    })
   },
   onReady() {
 
diff --git a/wechat_staff/pages/kefu/select.less b/wechat_staff/pages/kefu/select.less
index b183920..6f4c75e 100644
--- a/wechat_staff/pages/kefu/select.less
+++ b/wechat_staff/pages/kefu/select.less
@@ -98,6 +98,7 @@
     }
     .icon{
       width: 40rpx;
+      height: 40rpx;
       margin-right: 30rpx;
     }
     .avatar{
diff --git a/wechat_staff/pages/kefu/select.wxml b/wechat_staff/pages/kefu/select.wxml
index 917065d..77ed7e9 100644
--- a/wechat_staff/pages/kefu/select.wxml
+++ b/wechat_staff/pages/kefu/select.wxml
@@ -23,8 +23,8 @@
       <view wx:if="{{ flag == 0 }}" class="item">
         <view class="item_content">
           <view class="checked_wrap">
-            <image wx:if="{{ item.checked }}" class="icon" src="../../static/icon/ic_video@2x.png" mode="widthFix"></image>
-            <image wx:else class="icon" src="../../static/icon/ic_select@2x.png" mode="widthFix"></image>
+            <image data-item="{{ item }}" bindtap="itemCheck" wx:if="{{ customer.userId == item.userId }}" class="icon" src="../../static/icon/ic_video@2x.png" mode="widthFix"></image>
+            <image wx:else data-item="{{ item }}" bindtap="itemCheck" class="icon" src="../../static/icon/ic_select@2x.png" mode="widthFix"></image>
             <image class="avatar" src="../../static/images/default_avatar.png"></image>
           </view>
           <!--  -->
diff --git a/wechat_staff/pages/kefu/select.wxss b/wechat_staff/pages/kefu/select.wxss
index f520b5e..673eff5 100644
--- a/wechat_staff/pages/kefu/select.wxss
+++ b/wechat_staff/pages/kefu/select.wxss
@@ -99,6 +99,7 @@
 }
 .list .item .icon {
   width: 40rpx;
+  height: 40rpx;
   margin-right: 30rpx;
 }
 .list .item .avatar {
diff --git a/wechat_staff/project.private.config.json b/wechat_staff/project.private.config.json
index c1097ec..79e21ef 100644
--- a/wechat_staff/project.private.config.json
+++ b/wechat_staff/project.private.config.json
@@ -38,7 +38,7 @@
         },
         {
           "name": "",
-          "pathName": "pages/kefu/select",
+          "pathName": "pages/webView/index",
           "query": "",
           "launchMode": "default",
           "scene": null

--
Gitblit v1.9.3