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

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss_wx_app

姜永辉 2 лет назад
Родитель
Сommit
72d880e41f
2 измененных файлов с 32 добавлено и 1 удалено
  1. 0 1
      mixins/index.js
  2. 32 0
      pages/index/index.js

+ 0 - 1
mixins/index.js

@@ -306,7 +306,6 @@ module.exports = {
             if (item && item.button && item.button.formMode) {
               data['formMode'] = item.button.formMode
             }
-            console.log('routeUrl111111', routeUrl)
 
             //api 上的优先
             if (_this.data.route[name].formMode) {

+ 32 - 0
pages/index/index.js

@@ -373,6 +373,38 @@ Page({
     this.filterFunction();
     // 查询常用功能
     this.getComMenu();
+    const filename = 'down'
+      const fileExtName = ".pdf";
+      const randfile = filename + fileExtName;
+    //wx.env.USER_DATA_PATH 是微信提供了一个用户文件目录给开发者,开发者对这个目录有完全自由的读写权限
+    const newPath = `${wx.env.USER_DATA_PATH}/${randfile}`;
+
+    console.log('eee',newPath);
+    wx.downloadFile({
+      // 示例 url,并非真实存在
+      url: 'http://192.168.0.57:8080/wx-print?svc_code=dkic_b1&doc=sa&layout_id=6caa8bc8-6ad8-45af-8e80-881e4081d27b&data_id=10112024-0412-0000-0000-00002fd1d7b4', 
+      filePath: newPath,
+      // fileType:'pdf',
+      success: function (resd) {
+        console.log('resd',resd);
+        const filePath = resd.filePath || resd.tempFilePath 
+          wx.openDocument({
+              filePath: filePath,
+              showMenu: true,
+              // fileType:'pdf',
+              success: function (reso) {
+              }
+          })
+      },fail(err){
+         
+      }
+  })
+    // wx.navigateTo({
+    //   url: '/package-base-select/pages/web-view-select/web-view-select',
+    //   success: function (res) {
+    //     res.eventChannel.emit('url', 'http://192.168.0.57:8080/wx-print?svc_code=dkic_b1&doc=sa&layout_id=6caa8bc8-6ad8-45af-8e80-881e4081d27b&data_id=10112024-0412-0000-0000-00002fd1d7b4');
+    //   }
+    // })
   },
 
   /* 点击icon事件 */