Explorar el Código

首页隐私和用户协议跳转更新

liuyao hace 1 año
padre
commit
f491ca1dc7
Se han modificado 1 ficheros con 46 adiciones y 14 borrados
  1. 46 14
      pages/login/login.js

+ 46 - 14
pages/login/login.js

@@ -82,17 +82,33 @@ Page({
     if (url) {
       // 看下是否包括http,http就跳转到product页面
       if (url.indexOf('http') >= 0) {
-        toUrl = '/pages/product/product'
+        // toUrl = '/pages/product/product'
+        wx.downloadFile({
+          url: url,
+          success(e){
+            wx.openDocument({
+              filePath: e.tempFilePath,
+              showMenu: true,
+              fileType: 'pdf',
+              success(e) {
+                console.log('success', e);
+              },
+              fail(e){
+                console.log('fail', e);
+              }
+            })
+          }
+        })
       } else {
         // 说明是跳本产品
         toUrl = url;
+        wx.navigateTo({
+          url: toUrl,
+          success: function (res) {
+            res.eventChannel.emit('url', url);
+          }
+        })
       }
-      wx.navigateTo({
-        url: toUrl,
-        success: function (res) {
-          res.eventChannel.emit('url', url);
-        }
-      })
     }
   },
   /**
@@ -107,17 +123,33 @@ Page({
   if (url) {
     // 看下是否包括http,http就跳转到product页面
     if (url.indexOf('http') >= 0) {
-      toUrl = '/pages/product/product'
+      // toUrl = '/pages/product/product'
+      wx.downloadFile({
+        url: url,
+        success(e){
+          wx.openDocument({
+            filePath: e.tempFilePath,
+            showMenu: true,
+            fileType: 'pdf',
+            success(e) {
+              console.success('openFile', e);
+            },
+            fail(e){
+              console.fail('openFile', e);
+            }
+          })
+        }
+      })
     } else {
       // 说明是跳本产品
       toUrl = url;
+      wx.navigateTo({
+        url: toUrl,
+        success: function (res) {
+          res.eventChannel.emit('url', url);
+        }
+      })
     }
-    wx.navigateTo({
-      url: toUrl,
-      success: function (res) {
-        res.eventChannel.emit('url', url);
-      }
-    })
   }
 },
   /**