From 5656daeb79c6d4d3f9fc78f981c7faf96582d2f1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 11 八月 2022 14:24:29 +0800
Subject: [PATCH] 登录注册模块、

---
 pages/module_consult/consultdetail/consultdetail.js |   48 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/pages/module_consult/consultdetail/consultdetail.js b/pages/module_consult/consultdetail/consultdetail.js
index f1ab91e..692712d 100644
--- a/pages/module_consult/consultdetail/consultdetail.js
+++ b/pages/module_consult/consultdetail/consultdetail.js
@@ -18,14 +18,14 @@
    */
   onLoad(options) {
     var that = this
-    // this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
-    //   that.setData({
-    //     fileId: data.fileId
-    //   })
+    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
+      that.setData({
+        fileId: data.fileId
+      })
 
-    //   that.getFile()
-    // })
-    that.getFile()
+      that.getFile()
+    })
+    // that.getFile()
   },
 
   /**
@@ -75,5 +75,39 @@
     } else {
       return undefined
     }
+  },
+
+  openFile () {
+    let content = this.data.content
+    if (content.mfFileUrl == undefined || content.mfFileUrl == null || content.mfFileUrl.length == 0) {
+      wx.showToast({
+        title: '鏂囦欢鏆傛椂鏃犳硶璁块棶',
+        duration: 1000,
+        icon: 'none',
+        mask: true,
+      })
+      return
+    }
+    console.log(content.mfFileUrl);
+    wx.showLoading({
+      title: ' 鏂囦欢涓嬭浇涓�',
+      mask: true,
+    })
+    wx.downloadFile({
+      url: content.mfFileUrl,
+      success: function (res) {
+        wx.hideLoading()
+        const filePath = res.tempFilePath
+        wx.openDocument({
+          filePath: filePath,
+          success: function (res) {
+            console.log('鎵撳紑鏂囨。鎴愬姛')
+          },
+          fail (error) {
+            console.log(error);
+          }
+        })
+      }
+    })
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3