From ebc6e7ee67f13e7aa311e737dfcb4c5caed112ee Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 15 八月 2024 18:23:57 +0800
Subject: [PATCH] ll

---
 wechat_jiaxuan/pages/auth/auth.js         |   17 +-
 wechat_jiaxuan/pages/detailDis/product.js |   10 +
 wechat_jiaxuan/pages/detailDis/case.js    |   10 +
 wechat_staff/pages/promotion/index.js     |  259 ++++++++++++++++++++++++++----------------
 wechat_jiaxuan/pages/detailDis/realpic.js |   17 +-
 wechat_staff/pages/download/index.js      |    4 
 wechat_staff/api/index.js                 |    3 
 wechat_staff/pages/kefu/select.js         |    2 
 8 files changed, 199 insertions(+), 123 deletions(-)

diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 694c102..be2b2d0 100644
--- a/wechat_jiaxuan/pages/auth/auth.js
+++ b/wechat_jiaxuan/pages/auth/auth.js
@@ -9,6 +9,7 @@
    */
   data: {
     agreementFalg: false,
+    tempPath: '',
     primary: '',
     bottomLift: 0,
 
@@ -75,10 +76,9 @@
           phone: res.data
         }).then((res) => {
           if (res.code == 200) {
-            const tempPath = wx.getStorageSync('tempPath') || ''
+            const { tempPath } = this.data
             wx.setStorageSync('member', res.data)
             if (tempPath) {
-              wx.setStorageSync('tempPath', '')
               if (tempPath == '/pages/webView/index') {
                 wx.navigateTo({
                   url: '/pages/webView/index',
@@ -129,23 +129,22 @@
   },
   onLoad(options) {
     var app = getApp().globalData
+    
     this.setData({
       primary: app.primary
     })
     this.initData()
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
   onReady() {
 
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
   onShow() {
+    const tempPath = wx.getStorageSync('tempPath') || ''
+    this.setData({tempPath})
+    setTimeout(() => {
+      wx.setStorageSync('tempPath', '')
+    })
 
   },
 
diff --git a/wechat_jiaxuan/pages/detailDis/case.js b/wechat_jiaxuan/pages/detailDis/case.js
index 22fd0ba..3a5e508 100644
--- a/wechat_jiaxuan/pages/detailDis/case.js
+++ b/wechat_jiaxuan/pages/detailDis/case.js
@@ -82,8 +82,14 @@
       info
     } = this.data
     console.log('鐐瑰嚮浜嗗垎浜�')
-    return {
-      path: '/pages/detailDis/case?id=' + info.id + '&userId=' + info.users.id
+    if(info.users && info.users.id){
+      return {
+        path: '/pages/detailDis/case?id=' + info.id + '&userId=' + info.users.id
+      }
+    }else{
+      return {
+        path: '/pages/detailDis/case?id=' + info.id 
+      }
     }
   },
   handleAction(e) {
diff --git a/wechat_jiaxuan/pages/detailDis/product.js b/wechat_jiaxuan/pages/detailDis/product.js
index cc5c0d8..be08b05 100644
--- a/wechat_jiaxuan/pages/detailDis/product.js
+++ b/wechat_jiaxuan/pages/detailDis/product.js
@@ -167,8 +167,14 @@
   onShareAppMessage: function () {
     let { info } = this.data
     console.log('鐐瑰嚮浜嗗垎浜�')
-    return {
-      path: '/pages/detailDis/product?id=' + info.id + '&userId=' + info.users.id
+    if(info.users && info.users.id){
+      return {
+        path: '/pages/detailDis/product?id=' + info.id + '&userId=' + info.users.id
+      }
+    }else{
+      return {
+        path: '/pages/detailDis/product?id=' + info.id 
+      }
     }
   },
   onClose() {
diff --git a/wechat_jiaxuan/pages/detailDis/realpic.js b/wechat_jiaxuan/pages/detailDis/realpic.js
index bbbe022..1921e9f 100644
--- a/wechat_jiaxuan/pages/detailDis/realpic.js
+++ b/wechat_jiaxuan/pages/detailDis/realpic.js
@@ -149,13 +149,6 @@
     //   this.setData({showShare: false})
     // })
   },
-  // onShareAppMessage: function () {
-  //   // let { productDetail, userInfo } = this.data
-  //   return {
-  //     title: productDetail.title,
-  //     path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0'
-  //   }
-  // },
   onClose() {
     this.setData({
       showShare: false
@@ -214,8 +207,14 @@
       info
     } = this.data
     console.log('鐐瑰嚮浜嗗垎浜�')
-    return {
-      path: '/pages/detailDis/realpic?id=' + info.id + '&userId=' + info.users.id
+    if(info.users && info.users.id){
+      return {
+        path: '/pages/detailDis/realpic?id=' + info.id + '&userId=' + info.users.id
+      }
+    }else{
+      return {
+        path: '/pages/detailDis/realpic?id=' + info.id 
+      }
     }
   },
 })
\ No newline at end of file
diff --git a/wechat_staff/api/index.js b/wechat_staff/api/index.js
index cbca5dc..c6066a2 100644
--- a/wechat_staff/api/index.js
+++ b/wechat_staff/api/index.js
@@ -82,7 +82,8 @@
 export const saveShareRecord = (data) => {
   return request({
     url: '/web/customer/saveShareRecord?id='+data,
-    data
+    data,
+    loading: '0'
   })
 }
 // 浜у搧瑙嗛
diff --git a/wechat_staff/pages/download/index.js b/wechat_staff/pages/download/index.js
index 2c3d458..b840751 100644
--- a/wechat_staff/pages/download/index.js
+++ b/wechat_staff/pages/download/index.js
@@ -121,6 +121,10 @@
                 }
               },
               fail(err) { 
+                item.paddingStatus = 4
+                that.setData({
+                  downloadList
+                })
                 wx.showToast({
                   title: '鍥剧墖涓嬭浇澶辫触',icon: 'none'
                 })
diff --git a/wechat_staff/pages/kefu/select.js b/wechat_staff/pages/kefu/select.js
index 9fcf601..9e287d9 100644
--- a/wechat_staff/pages/kefu/select.js
+++ b/wechat_staff/pages/kefu/select.js
@@ -41,7 +41,7 @@
       customer
     } = this.data
     const enjoyList = wx.getStorageSync('enjoyList') || []
-    if (!customer.customerId) return wx.showToast({
+    if (!customer.platSourceId) return wx.showToast({
       title: '璇峰厛閫夋嫨瑕佸叧鑱旂殑瀹㈡埛',
       icon: 'none'
     })
diff --git a/wechat_staff/pages/promotion/index.js b/wechat_staff/pages/promotion/index.js
index abb2a7c..b7c2019 100644
--- a/wechat_staff/pages/promotion/index.js
+++ b/wechat_staff/pages/promotion/index.js
@@ -1,4 +1,7 @@
-import { newsPage,saveShareRecord } from '../../api/index'
+import {
+  newsPage,
+  saveShareRecord
+} from '../../api/index'
 import moment from "moment";
 Page({
 
@@ -19,23 +22,31 @@
     this.getList()
   },
   getList() {
-    newsPage({capacity:this.data.capacity,
-      page:this.data.page,
-      model:{type:0}})
-      .then(res =>{
-        wx.stopPullDownRefresh()
-        if(this.data.page ==1){
-          this.setData({list:[]})
+    newsPage({
+        capacity: this.data.capacity,
+        page: this.data.page,
+        model: {
+          type: 0
         }
-        if(this.data.page == res.data.page){ 
-          res.data.records.forEach(element => { 
-            element.createDate = moment(element.createDate).format("yyyy/MM/DD")  
+      })
+      .then(res => {
+        wx.stopPullDownRefresh()
+        if (this.data.page == 1) {
+          this.setData({
+            list: []
           })
-          this.setData({list: [...this.data.list, ...res.data.records || []],
-            total:res.data.total})  
-        }          
+        }
+        if (this.data.page == res.data.page) {
+          res.data.records.forEach(element => {
+            element.createDate = moment(element.createDate).format("yyyy/MM/DD")
+          })
+          this.setData({
+            list: [...this.data.list, ...res.data.records || []],
+            total: res.data.total
+          })
+        }
         console.log(this.data)
-    }) 
+      })
   },
   onReady() {
 
@@ -49,105 +60,70 @@
   },
   onReachBottom() {
     console.log('瑙﹀簳浜嬩欢');
-    const { total, list, page } = this.data
-    if(total > list.length){
-      this.setData({ page: page + 1 })
+    const {
+      total,
+      list,
+      page
+    } = this.data
+    if (total > list.length) {
+      this.setData({
+        page: page + 1
+      })
       this.getList()
-    }else{
+    } else {
       wx.showToast({
         title: '鏆傛棤鏇村鏁版嵁',
         icon: 'none'
       })
     }
   },
-  downfile(e){
-    const item =  e.currentTarget.dataset.index;
+  downfile(e) {
+    const item = e.currentTarget.dataset.index;
     saveShareRecord(item.id)
     const files = []
-    if(item.fileType ==1 && item.fileList && item.fileList.length && item.fileList[0].fileurlFull  ){
+    if (item.fileType == 1 && item.fileList && item.fileList.length && item.fileList[0].fileurlFull) {
       files.push(item.fileList[0].fileurlFull)
     }
-    if(item.fileType !=1 && item.fileList && item.fileList.length  ){
-      item.fileList.forEach(ee => { 
-         if(ee.fileurlFull){ 
-           files.push(ee.fileurlFull)
-         }
-      }) 
+    if (item.fileType != 1 && item.fileList && item.fileList.length) {
+      item.fileList.forEach(ee => {
+        if (ee.fileurlFull) {
+          files.push(ee.fileurlFull)
+        }
+      })
     }
-    if(item.fileType ==1){
-      this.downloadVideoFileDo(files,item.title)
-    }else{
-      this.downloadImageFileDo(files,item.title)
-    } 
+    if (item.fileType == 1) {
+      this.downloadVideoFileDo(files, item.title)
+    } else {
+      this.downloadImageFileDo(files, item.title)
+    }
   },
-  downloadImageFileDo(files,title){
+  downloadImageFileDo(files, title) {
     wx.showLoading({
       title: '姝e湪涓嬭浇',
+      mask: true
     })
-   let temp = 0;
-    if(files.length){
-      for(let i = 0;i<files.length;i++){        
-        let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf()+i + '.jpg'  ;
+    let temp = 0;
+    let count = 0;
+    if (files.length) {
+      for (let i = 0; i < files.length; i++) {
+        let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + i + '.jpg';
         wx.downloadFile({
           url: files[i],
           filePath: filePath,
-          timeout:180000,
-          success: function (res) { 
+          timeout: 180000,
+          success: function (res) {
             var tempFp = res.filePath
             wx.saveImageToPhotosAlbum({
               filePath: tempFp,
               success(result) {
-                temp ++;
-                console.log(result) 
-                if(temp == files.length){
-                    wx.hideLoading();
-                    wx.setClipboardData({
-                      data:  title,
-                      success: function (res) {
-                        wx.getClipboardData({
-                          success: function (res) {
-                            wx.showToast({
-                              title: '鏂囨宸插鍒舵垚鍔燂紝鍘诲垎浜惂'
-                            })
-                          }
-                        })
-                      }
-                    })
-                } 
-              }, fail(err) { 
-                wx.showToast({
-                  title: '鍥剧墖涓嬭浇澶辫触鍝�'
-                })
-              }
-            })
-          } , fail(err) { 
-            wx.showToast({
-              title: '鍥剧墖涓嬭浇澶辫触鍝�'
-            })
-          }
-        })
-      } 
-    } 
-  },
-  downloadVideoFileDo(files,title){
-    wx.showLoading({
-      title: '姝e湪涓嬭浇',
-    }) 
-    if(files.length){  
-      let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '0.mp4';
-      wx.downloadFile({
-        url: files[0],
-        filePath: filePath,
-        timeout:180000,
-        success: function (res) { 
-          var tempFp = res.filePath
-          wx.saveVideoToPhotosAlbum({
-            filePath: tempFp,
-            success(result) { 
-              console.log(result)  
-                  wx.hideLoading();
+                temp++;
+                count++;
+                if (count == files.length) {
+                  wx.hideLoading()
+                }
+                if (temp == files.length) {
                   wx.setClipboardData({
-                    data:  title,
+                    data: title,
                     success: function (res) {
                       wx.getClipboardData({
                         success: function (res) {
@@ -157,16 +133,99 @@
                         }
                       })
                     }
-                }) 
-            }, fail(err) { 
+                  })
+                }
+              },
+              fail(err) {
+                count++;
+                if (count == files.length) {
+                  wx.hideLoading()
+                }
+                wx.showToast({
+                  title: '鍥剧墖涓嬭浇澶辫触鍝�'
+                })
+              }
+            })
+          },
+          fail(err) {
+            count++;
+            if (count == files.length) {
+              wx.hideLoading()
+            }
+            wx.showToast({
+              title: '鍥剧墖涓嬭浇澶辫触鍝�'
+            })
+          }
+        })
+      }
+    }else{
+      wx.showToast({
+        title: '璇ヨ祫璁殏鏃犲彲鍒嗕韩鐨勫浘鐗囨垨瑙嗛',
+        icon: 'none'
+      })
+    }
+  },
+  downloadVideoFileDo(files, title) {
+    wx.showLoading({
+      title: '姝e湪涓嬭浇',
+      mask: true
+    })
+    let count = 0;
+    if (files.length) {
+      let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '0.mp4';
+      wx.downloadFile({
+        url: files[0],
+        filePath: filePath,
+        timeout: 180000,
+        success: function (res) {
+          var tempFp = res.filePath
+          wx.saveVideoToPhotosAlbum({
+            filePath: tempFp,
+            success(result) {
+              count++;
+              if (count == files.length) {
+                wx.hideLoading()
+              }
+              wx.setClipboardData({
+                data: title,
+                success: function (res) {
+                  wx.getClipboardData({
+                    success: function (res) {
+                      wx.showToast({
+                        title: '鏂囨宸插鍒舵垚鍔燂紝鍘诲垎浜惂'
+                      })
+                    }
+                  })
+                }
+              })
+            },
+            fail(err) {
+              count++;
+              if (count == files.length) {
+                wx.hideLoading()
+              }
               wx.showToast({
                 title: '瑙嗛涓嬭浇澶辫触鍝�'
               })
             }
           })
-        } 
-      }) 
-    } 
+        },
+        fail(err) {
+          count++;
+          if (count == files.length) {
+            wx.hideLoading()
+          }
+          wx.showToast({
+            title: '瑙嗛涓嬭浇澶辫触鍝�'
+          })
+        }
+      })
+    }else{
+      wx.showToast({
+        title: '璇ヨ祫璁殏鏃犲彲鍒嗕韩鐨勫浘鐗囨垨瑙嗛',
+        icon: 'none'
+      })
+    }
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
@@ -186,11 +245,13 @@
    * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
    */
   onPullDownRefresh() {
-    console.log('涓嬫媺鍒锋柊')  
-    this.setData({ page: 1 })
-    this.getList() 
+    console.log('涓嬫媺鍒锋柊')
+    this.setData({
+      page: 1
+    })
+    this.getList()
   },
- 
+
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */

--
Gitblit v1.9.3