From 6810c281306cae6e02fbbb1478d780c823d08a33 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 25 七月 2024 11:53:39 +0800
Subject: [PATCH] ‘’

---
 wechat_jiaxuan/pages/detailDis/product.js     |    6 
 wechat_jiaxuan/pages/detailDis/product.json   |    1 
 wechat_staff/pages/download/index.less        |    2 
 wechat_jiaxuan/utils/config.js                |    4 
 wechat_jiaxuan/app.js                         |   10 
 wechat_jiaxuan/components/idCard/index.js     |   23 ++
 wechat_jiaxuan/components/idCard/index.less   |   56 ++++++
 wechat_staff/pages/detailDis/product.wxml     |    2 
 wechat_jiaxuan/pages/detailDis/product.wxml   |   12 -
 wechat_jiaxuan/pages/detailDis/product.wxss   |    4 
 wechat_staff/components/buoyClient/index.js   |    6 
 wechat_jiaxuan/pages/detailDis/product.less   |    6 
 wechat_jiaxuan/components/idCard/index.wxss   |   52 +++++
 wechat_jiaxuan/components/idCard/index.wxml   |   17 +
 wechat_staff/pages/download/index.js          |  130 +++++++++++--
 wechat_jiaxuan/components/idCard/index.json   |    4 
 wechat_staff/pages/download/index.wxml        |    2 
 wechat_staff/pages/download/index.wxss        |    2 
 wechat_staff/components/detailFooter/index.js |    7 
 wechat_staff/utils/downloadSaveFile.js        |  141 +++++++++++++++
 20 files changed, 433 insertions(+), 54 deletions(-)

diff --git a/wechat_jiaxuan/app.js b/wechat_jiaxuan/app.js
index 2920c51..1cc3c46 100644
--- a/wechat_jiaxuan/app.js
+++ b/wechat_jiaxuan/app.js
@@ -7,7 +7,7 @@
     bottomLift: ''
   },
   onLaunch: function (op) {
-    console.log('options', op.query.scene);
+    console.log('options', op.query.scene)
     let pathMap = [
       '/pages/detailDis/product',
       '/pages/detailDis/case',
@@ -18,7 +18,7 @@
     //鑾峰彇褰撳墠璁惧淇℃伅
     const WindowInfo = wx.getWindowInfo()
     if (WindowInfo.safeArea.top > 20) {
-      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
+      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom
     }
     // 鎺堟潈鐧诲綍
     wx.login({
@@ -35,10 +35,10 @@
               wx.setStorageSync('openid', res.data.member.openid)
               wx.setStorageSync('sessionKey', res.data.sessionKey)
               wx.setStorageSync('token', res.data.token)
-              if(op.query.scene){
-                let temp = op.query.scene.split('&')
+              if (op.query.scene) {
+                let temp = op.query.scene.split('_')
                 wx.navigateTo({
-                  url: `${pathMap[temp[1]]}?id=${temp[0]}`,
+                  url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
                 })
               }
             } else {
diff --git a/wechat_jiaxuan/components/idCard/index.js b/wechat_jiaxuan/components/idCard/index.js
new file mode 100644
index 0000000..b31b57e
--- /dev/null
+++ b/wechat_jiaxuan/components/idCard/index.js
@@ -0,0 +1,23 @@
+// components/idCard/index.js
+Component({
+  /**
+   * 缁勪欢鐨勫睘鎬у垪琛�
+   */
+  properties: {
+    users: Object
+  },
+
+  /**
+   * 缁勪欢鐨勫垵濮嬫暟鎹�
+   */
+  data: {
+
+  },
+
+  /**
+   * 缁勪欢鐨勬柟娉曞垪琛�
+   */
+  methods: {
+
+  }
+})
diff --git a/wechat_jiaxuan/components/idCard/index.json b/wechat_jiaxuan/components/idCard/index.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/wechat_jiaxuan/components/idCard/index.json
@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}
\ No newline at end of file
diff --git a/wechat_jiaxuan/components/idCard/index.less b/wechat_jiaxuan/components/idCard/index.less
new file mode 100644
index 0000000..4bf5502
--- /dev/null
+++ b/wechat_jiaxuan/components/idCard/index.less
@@ -0,0 +1,56 @@
+.user {
+  width: 750rpx;
+  padding: 0 40rpx;
+  height: 148rpx;
+  background: #FFFFFF;
+  border-radius: 8rpx;
+  padding: 0 30rpx;
+  display: flex;
+  align-items: center;
+  .content {
+    flex: 1;
+
+    .name {
+      font-size: 30rpx;
+      margin-bottom: 12rpx;
+    }
+
+    .desc {
+      font-size: 24rpx;
+      color: #999999;
+    }
+  }
+
+  .avatar {
+    width: 80rpx;
+    height: 80rpx;
+    border-radius: 50%;
+    margin-right: 24rpx;
+  }
+
+  .btns{
+    display: flex;
+    .item{
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+      justify-content: center;
+      margin-left: 70rpx;
+      .icon{
+        width: 44rpx;
+        height: 44rpx;
+      }
+    }
+  }
+  .btn {
+    width: 118rpx;
+    height: 56rpx;
+    line-height: 52rpx;
+    text-align: center;
+    background: var(--themeColor);
+    border-radius: 8rpx;
+    font-weight: 500;
+    font-size: 26rpx;
+    color: #fff;
+  }
+}
\ No newline at end of file
diff --git a/wechat_jiaxuan/components/idCard/index.wxml b/wechat_jiaxuan/components/idCard/index.wxml
new file mode 100644
index 0000000..5f52233
--- /dev/null
+++ b/wechat_jiaxuan/components/idCard/index.wxml
@@ -0,0 +1,17 @@
+<view class="user">
+    <image class="avatar" src="{{ users.imgurlFull ? users.imgurlFull : '../../static/images/default_avatar.png' }}"></image>
+    <view class="content">
+      <view class="name">{{ users.name }}</view>
+      <view class="desc">瀵艰喘锝渰{ users.jobDate || 1 }}骞寸粡楠�</view>
+    </view>
+    <view class="btns">
+      <view class="item">
+        <image class="icon" src="../../static/icon/mingpian_bg_nianxian@2x.png"></image>
+        <text>鍚嶇墖</text>
+      </view>
+      <view class="item">
+        <image class="icon" src="../../static/icon/mingpian_bg_nianxian@2x.png"></image>
+        <text>鍚嶇墖</text>
+      </view>
+    </view>
+  </view>
\ No newline at end of file
diff --git a/wechat_jiaxuan/components/idCard/index.wxss b/wechat_jiaxuan/components/idCard/index.wxss
new file mode 100644
index 0000000..f30b208
--- /dev/null
+++ b/wechat_jiaxuan/components/idCard/index.wxss
@@ -0,0 +1,52 @@
+.user {
+  width: 750rpx;
+  padding: 0 40rpx;
+  height: 148rpx;
+  background: #FFFFFF;
+  border-radius: 8rpx;
+  padding: 0 30rpx;
+  display: flex;
+  align-items: center;
+}
+.user .content {
+  flex: 1;
+}
+.user .content .name {
+  font-size: 30rpx;
+  margin-bottom: 12rpx;
+}
+.user .content .desc {
+  font-size: 24rpx;
+  color: #999999;
+}
+.user .avatar {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+  margin-right: 24rpx;
+}
+.user .btns {
+  display: flex;
+}
+.user .btns .item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  margin-left: 70rpx;
+}
+.user .btns .item .icon {
+  width: 44rpx;
+  height: 44rpx;
+}
+.user .btn {
+  width: 118rpx;
+  height: 56rpx;
+  line-height: 52rpx;
+  text-align: center;
+  background: var(--themeColor);
+  border-radius: 8rpx;
+  font-weight: 500;
+  font-size: 26rpx;
+  color: #fff;
+}
diff --git a/wechat_jiaxuan/pages/detailDis/product.js b/wechat_jiaxuan/pages/detailDis/product.js
index a9c7492..2827a2e 100644
--- a/wechat_jiaxuan/pages/detailDis/product.js
+++ b/wechat_jiaxuan/pages/detailDis/product.js
@@ -23,7 +23,7 @@
     this.setData({
       bottomLift: app.bottomLift
     })
-    this.getDetail(options.id)
+    this.getDetail(options.id, options.userId || '')
     actionDo({
       actionType: 'view',
       id: options.id
@@ -52,9 +52,9 @@
       })
     })
   },
-  getDetail(id) {
+  getDetail(id, userId) {
     getProductInfo({
-      id
+      id, salesId: userId || null
     }).then(res => {
       this.setData({
         info: res.data
diff --git a/wechat_jiaxuan/pages/detailDis/product.json b/wechat_jiaxuan/pages/detailDis/product.json
index afd9776..7d1fb55 100644
--- a/wechat_jiaxuan/pages/detailDis/product.json
+++ b/wechat_jiaxuan/pages/detailDis/product.json
@@ -2,6 +2,7 @@
   "usingComponents": {
     "van-popup": "@vant/weapp/popup/index",
     "authCard": "/components/authCard/authCard",
+    "idCard": "../../components/idCard/index",
     "mp-html": "mp-html"
   },
   "navigationBarTitleText": ""
diff --git a/wechat_jiaxuan/pages/detailDis/product.less b/wechat_jiaxuan/pages/detailDis/product.less
index fc3fb1c..041700f 100644
--- a/wechat_jiaxuan/pages/detailDis/product.less
+++ b/wechat_jiaxuan/pages/detailDis/product.less
@@ -7,7 +7,6 @@
   padding: 0 30rpx;
   display: flex;
   align-items: center;
-
   .content {
     flex: 1;
 
@@ -24,6 +23,7 @@
 
   .avatar {
     width: 80rpx;
+    height: 80rpx;
     border-radius: 50%;
     margin-right: 24rpx;
   }
@@ -40,7 +40,9 @@
     color: #fff;
   }
 }
-
+.container{
+  padding-bottom: 200rpx;
+}
 page {
   background-color: #f7f7f7;
 }
diff --git a/wechat_jiaxuan/pages/detailDis/product.wxml b/wechat_jiaxuan/pages/detailDis/product.wxml
index fffb970..d4294e6 100644
--- a/wechat_jiaxuan/pages/detailDis/product.wxml
+++ b/wechat_jiaxuan/pages/detailDis/product.wxml
@@ -1,12 +1,6 @@
-<view>
-  <view class="user" wx:if="{{ false }}">
-    <view class="avatar"></view>
-    <view class="content">
-      <view class="name">涓佹鏋�</view>
-      <view class="desc">瀵艰喘锝�5骞寸粡楠�</view>
-    </view>
-    <view class="btn">鑱旂郴TA</view>
-  </view>
+<view class="container">
+  <!-- 鍚嶇墖 -->
+  <idCard users="{{ info.users }}" wx:if="{{ info.users && info.users.id }}" />
   <!-- banner杞挱 -->
   <swiper class="banner_swiper" circular indicator-dots autoplay style="height:{{bannerHeight}}rpx" duration>
     <block wx:for="{{ info.bannerImgList }}">
diff --git a/wechat_jiaxuan/pages/detailDis/product.wxss b/wechat_jiaxuan/pages/detailDis/product.wxss
index e956d25..e9483c7 100644
--- a/wechat_jiaxuan/pages/detailDis/product.wxss
+++ b/wechat_jiaxuan/pages/detailDis/product.wxss
@@ -21,6 +21,7 @@
 }
 .user .avatar {
   width: 80rpx;
+  height: 80rpx;
   border-radius: 50%;
   margin-right: 24rpx;
 }
@@ -35,6 +36,9 @@
   font-size: 26rpx;
   color: #fff;
 }
+.container {
+  padding-bottom: 200rpx;
+}
 page {
   background-color: #f7f7f7;
 }
diff --git a/wechat_jiaxuan/utils/config.js b/wechat_jiaxuan/utils/config.js
index 718dce6..9e3fb71 100644
--- a/wechat_jiaxuan/utils/config.js
+++ b/wechat_jiaxuan/utils/config.js
@@ -1,8 +1,8 @@
 
 
 // export const baseUrl = 'https://jiaxuan.zbom.com/jx/wechat/' //姝e紡鏈嶅姟鍣�
-// export const baseUrl = 'http://192.168.0.135:10027' // 鏈湴
-export const baseUrl = 'https://dmtest.ahapp.net/web_interface' //娴嬭瘯鏈嶅姟鍣�
+export const baseUrl = 'http://192.168.0.135:10027' // 鏈湴
+// export const baseUrl = 'https://dmtest.ahapp.net/web_interface' //娴嬭瘯鏈嶅姟鍣�
 
 // export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/'
 
diff --git a/wechat_staff/components/buoyClient/index.js b/wechat_staff/components/buoyClient/index.js
index 72c265e..431451b 100644
--- a/wechat_staff/components/buoyClient/index.js
+++ b/wechat_staff/components/buoyClient/index.js
@@ -29,7 +29,11 @@
           console.log(res.data)
           this.setData({ url: res.data })
           wx.navigateTo({
-            url: '/pages/webView/index?link=' + res.data,
+            url: '/pages/webView/index',
+            success: function(res) {
+              // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+              res.eventChannel.emit('acceptDataFromOpenerPage', { link: res.data })
+            }
           })
         }) 
       }
diff --git a/wechat_staff/components/detailFooter/index.js b/wechat_staff/components/detailFooter/index.js
index 7fb1767..f7dc550 100644
--- a/wechat_staff/components/detailFooter/index.js
+++ b/wechat_staff/components/detailFooter/index.js
@@ -1,8 +1,6 @@
 import {
   getContentShareImg
 } from '../../api/index'
-const { HYEventBus } = require('hy-event-store')
-const eventBus = new HYEventBus()
 Component({
   /**
    * 缁勪欢鐨勫睘鎬у垪琛�
@@ -56,7 +54,7 @@
       } = this.data
       let that = this
       getContentShareImg({
-        articleId: `${info.id}&${path}&${wx.getStorageSync('member').id}`,
+        articleId: `${info.id}_${path}`,
         type: '1',
         // pageUrl: path,
         imgurl: info.coverImage,
@@ -97,6 +95,9 @@
     batchDown() {
       const downloadList = this.data.info.imageurlList || []
       wx.setStorageSync('downloadList', downloadList)
+      wx.setStorageSync('downloadConfig', {
+        path: this.data.path,id: this.data.info.id
+      })
       wx.navigateTo({
         url: '/pages/download/index',
       }, 1000)
diff --git a/wechat_staff/pages/detailDis/product.wxml b/wechat_staff/pages/detailDis/product.wxml
index 8553484..57266a5 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 binddown="handleDown" bindenjoy="handleEnjoy" path="0" info="{{info}}" />
+  <detailFooter 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/download/index.js b/wechat_staff/pages/download/index.js
index c6066ce..a18659c 100644
--- a/wechat_staff/pages/download/index.js
+++ b/wechat_staff/pages/download/index.js
@@ -1,6 +1,10 @@
-// pages/download/index.js
-const { HYEventBus } = require('hy-event-store')
-const eventBus = new HYEventBus()
+import {
+  getContentShareImg
+} from '../../api/index'
+import {
+  checkAuth,
+  downloadSaveFile
+} from '../../utils/downloadSaveFile'
 Page({
 
   /**
@@ -9,6 +13,7 @@
   data: {
     bottomLift: '',
     downloadList: [],
+    downloadConfig: {},
     checkedAll: false,
     showParam: false,
     takeQrcode: true
@@ -23,8 +28,68 @@
       bottomLift: app.bottomLift
     })
   },
+  subDownload() {
+    let that = this
+    const downloadList = this.data.downloadList
+    const downloadConfig = this.data.downloadConfig
+    checkAuth(() => {
+      wx.showLoading({
+        title: '姝e湪涓嬭浇',
+        mask: true
+      })
+      downloadList.forEach(item => {
+        if (item.checked) {
+          item.paddingStatus = 2
+        }
+      })
+      this.setData({ downloadList })
+      downloadList.forEach(item => {
+        if (item.checked) {
+          getContentShareImg({
+            articleId: `${downloadConfig.id}_${downloadConfig.path}`,
+            type: this.takeQrcode ? 1 : 0,
+            imgurl: item.url
+          }).then(res => {
+            wx.downloadFile({
+              url: res.data,
+              success: res => {
+                if (res.statusCode === 200) {
+                  wx.saveImageToPhotosAlbum({
+                    filePath: res.tempFilePath,
+                    success: res => {
+                      item.paddingStatus = 3
+                      item.checked = false
+                      that.setData({ downloadList })
+                      wx.showToast({
+                        title: '淇濆瓨鎴愬姛',
+                        icon: "none"
+                      })
+                    },
+                    fail: res => {
+                      item.paddingStatus = 4
+                      item.checked = false
+                      that.setData({ downloadList })
+                      wx.showToast({
+                        title: '淇濆瓨澶辫触',
+                        icon: "none"
+                      })
+                    }
+                  })
+        
+                }
+              }
+            })
+          })
+        }
+      })
+    })
+    this.setData({
+      showParam: false
+    })
+  },
   onShow() {
     const downloadList = wx.getStorageSync('downloadList') || []
+    const downloadConfig = wx.getStorageSync('downloadConfig') || {}
     let temp = downloadList.map(i => {
       // paddingStatus锛� 0鏈笅杞�1姝e湪涓嬭浇2绛夊緟涓嬭浇3涓嬭浇瀹屾垚
       return {
@@ -33,54 +98,69 @@
         checked: false
       }
     })
-    this.setData({ downloadList: temp })
+    this.setData({
+      downloadList: temp,
+      downloadConfig
+    })
     setTimeout(() => {
       wx.setStorageSync('downloadList', [])
-    },500)
+      wx.setStorageSync('downloadConfig', {})
+    }, 500)
   },
   openParam() {
     const downloadList = this.data.downloadList.filter(i => i.checked)
-    if(downloadList.length === 0) return wx.showToast({title: '璇峰厛閫夋嫨瑕佷笅杞界殑娴锋姤', icon: 'none'})
-    this.setData({ showParam: true })
+    if (downloadList.length === 0) return wx.showToast({
+      title: '璇峰厛閫夋嫨瑕佷笅杞界殑娴锋姤',
+      icon: 'none'
+    })
+    this.setData({
+      showParam: true
+    })
   },
   onClose() {
-    this.setData({ showParam: false })
+    this.setData({
+      showParam: false
+    })
   },
   downCheck(e) {
     const takeQrcode = e.currentTarget.dataset.flag
     console.log('takeQrcode', takeQrcode);
-    this.setData({ takeQrcode })
-  },
-  subDownload() {
-    const downloadList = this.data.downloadList
-    downloadList.forEach(item => {
-      if(item.checked){
-        
-      }
+    this.setData({
+      takeQrcode
     })
-
-    this.setData({ showParam: false })
   },
   itemCheck(e) {
     const i = e.currentTarget.dataset.i
-    const { downloadList, checkedAll } = this.data
+    const {
+      downloadList,
+      checkedAll
+    } = this.data
     let count = 0
     downloadList.forEach((item, index) => {
-      if(index === i){
+      if (index === i) {
         item.checked = !item.checked
       }
-      if(item.checked) {
-        count ++
+      if (item.checked) {
+        count++
       }
     })
-    this.setData({ checkedAll: count == downloadList.length,  downloadList})
+    this.setData({
+      checkedAll: count == downloadList.length,
+      downloadList
+    })
   },
   allCheck() {
-    const { downloadList, checkedAll } = this.data
+    const {
+      downloadList,
+      checkedAll
+    } = this.data
     downloadList.forEach(item => {
       item.checked = !checkedAll
     })
-    this.setData({ checkedAll: !checkedAll, downloadList })
+    this.setData({
+      checkedAll: !checkedAll,
+      downloadList
+    })
   },
   onHide() {
 
diff --git a/wechat_staff/pages/download/index.less b/wechat_staff/pages/download/index.less
index c12f2bc..35323f2 100644
--- a/wechat_staff/pages/download/index.less
+++ b/wechat_staff/pages/download/index.less
@@ -1,7 +1,7 @@
 .list{
   display: flex;
   flex-wrap: wrap;
-  padding: 40rpx;
+  padding: 40rpx 40rpx 200rpx;
   .item{
     width: 210rpx;
     height: 210rpx;
diff --git a/wechat_staff/pages/download/index.wxml b/wechat_staff/pages/download/index.wxml
index 8becbfe..57d1041 100644
--- a/wechat_staff/pages/download/index.wxml
+++ b/wechat_staff/pages/download/index.wxml
@@ -2,7 +2,7 @@
   <view class="list">
     <view wx:for="{{ downloadList }}" class="item">
       <image class="img" src="{{ item.url }}" mode="scaleToFill"></image>
-      <view wx:if="{{ item.paddingStatus }}" class="shade">绛夊緟涓嬭浇</view>
+      <view wx:if="{{ item.paddingStatus == 2 }}" class="shade">绛夊緟涓嬭浇</view>
       <image data-i="{{index}}" bindtap="itemCheck" wx:if="{{ item.checked }}" class="check" src="../../static/icon/ic_select_sel@2x.png"></image>
       <image wx:else data-i="{{index}}" bindtap="itemCheck" class="check" src="../../static/icon/ic_select.png"></image>
     </view>
diff --git a/wechat_staff/pages/download/index.wxss b/wechat_staff/pages/download/index.wxss
index 5a33faf..27176fa 100644
--- a/wechat_staff/pages/download/index.wxss
+++ b/wechat_staff/pages/download/index.wxss
@@ -1,7 +1,7 @@
 .list {
   display: flex;
   flex-wrap: wrap;
-  padding: 40rpx;
+  padding: 40rpx 40rpx 200rpx;
 }
 .list .item {
   width: 210rpx;
diff --git a/wechat_staff/utils/downloadSaveFile.js b/wechat_staff/utils/downloadSaveFile.js
new file mode 100644
index 0000000..6c11afe
--- /dev/null
+++ b/wechat_staff/utils/downloadSaveFile.js
@@ -0,0 +1,141 @@
+// 灏佽涓�涓柟娉� 鍦╱tils涓� 鍚嶄负 downloadSaveFile.js
+// 浣跨敤鏃� 寮曞叆锛堟寜鐓ц嚜宸辩殑璺姴鍐欙級  import { downloadFiles} from '../../utils/downloadSaveFile'
+
+
+function downloadFiles(type, urls) {
+  checkAuth(() => {
+    wx.showLoading({
+      title: '姝e湪涓嬭浇',
+      mask: true
+    })
+    for (let i = 0; i < urls.length; i++) {
+      downloadSaveFile(
+        urls[i],
+      );
+    }
+  })
+}
+
+//涓嬭浇鏂囦欢
+function downloadSaveFile(url, successc) {
+  let isimg = 'bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,wmf, jpeg'.includes(url.split('.').slice(-1))
+  if (isimg) {
+  // 濡傛灉鏄浘鐗囩被鍨�
+    wx.downloadFile({
+      url: url,
+      success: res => {
+        if (res.statusCode === 200) {
+          wx.saveImageToPhotosAlbum({
+            filePath: res.tempFilePath,
+            success: res => {
+              wx.showToast({
+                title: '淇濆瓨鎴愬姛',
+                icon: "none"
+              })
+            },
+            fail: res => {
+              wx.showToast({
+                title: '淇濆瓨澶辫触',
+                icon: "none"
+              })
+            }
+          })
+
+        }
+      }
+    })
+
+  } else {
+  // 濡傛灉鏄棰戠被鍨�
+    wx.downloadFile({
+      url: url,
+      success: res => {
+        if (res.statusCode === 200) {
+          wx.saveVideoToPhotosAlbum({
+            filePath: res.tempFilePath,
+            success: res => {
+              // successc && successc();
+              wx.showToast({
+                title: '淇濆瓨鎴愬姛',
+                icon: "none"
+              })
+            },
+            fail: res => {
+                wx.showToast({
+                title: '淇濆瓨澶辫触',
+                icon: "none"
+              })
+            }
+          })
+        }
+      }
+    })
+  }
+}
+
+//妫�鏌ユ潈闄�
+function checkAuth(gotc) {
+  //鏌ヨ鏉冮檺
+  wx.showLoading({
+    title: '妫�鏌ユ巿鏉冩儏鍐�',
+    mask: true
+  })
+  wx.getSetting({
+    success(res) {
+      wx.hideLoading();
+      if (!res.authSetting['scope.writePhotosAlbum']) {
+        //璇锋眰鎺堟潈
+        wx.authorize({
+          scope: 'scope.writePhotosAlbum',
+          success() {
+            //鑾峰緱鎺堟潈锛屽紑濮嬩笅杞�
+            gotc && gotc();
+          },
+          fail() {
+            wx.showModal({
+              title: '',
+              content: '淇濆瓨鍒扮郴缁熺浉鍐岄渶瑕佹巿鏉�',
+              confirmText: '鎺堟潈',
+              success(res) {
+                if (res.confirm) {
+                  wx.openSetting({
+                    success(res) {
+                      if (res.authSetting['scope.writePhotosAlbum'] === true) {
+                        gotc && gotc();
+                      }
+                    }
+                  })
+                }
+              },
+              fail() {
+                wx.showToast({
+                  title: '鎵撳紑璁剧疆椤靛け璐�',
+                  icon: 'none',
+                })
+              }
+            })
+          }
+        })
+      } else {
+        //宸叉湁鎺堟潈
+        gotc && gotc();
+      }
+    },
+    fail() {
+      wx.hideLoading();
+      wx.showToast({
+        title: '鑾峰彇鎺堟潈澶辫触',
+        icon: 'none',
+      })
+    }
+  })
+}
+
+module.exports = {
+  downloadFiles,
+  checkAuth,
+  downloadSaveFile
+};
+
+
+

--
Gitblit v1.9.3