Browse Source

feature: 添加分享和复制当前页面点击进入

332777428@qq.com 2 tháng trước cách đây
mục cha
commit
48994a5d8e
3 tập tin đã thay đổi với 16 bổ sung8 xóa
  1. 1 0
      app.js
  2. 2 4
      pages/pageA/index/index.js
  3. 13 4
      pages/pageD/webview/webview.js

+ 1 - 0
app.js

@@ -33,6 +33,7 @@ App({
     userData: null,
     client: null,
     oneInitBluetooth: true,
+    webSkipUrl: "",
 
     mDeviceList: [],
     // 当前设备

+ 2 - 4
pages/pageA/index/index.js

@@ -915,17 +915,15 @@ Page({
   ///点击banner事件
   onTapBanner(e) {
     var item = e.currentTarget.dataset.item;
-    console.log("gadfeqreqrqr==000==" + JSON.stringify(item));
     try {
       if (constant.strings.isEmpty(item.forwardUrl)) {
         return;
       }
-      // 内链,暂时不支持
+      // 内链
       if (item.forwardType == 0) {
         var param = "?param=" + item.forwardUrl;
-        console.log("gadfeqreqrqr==111==" + param);
+        constant.app.webSkipUrl = item.forwardUrl;
         constant.routeUtil.jumpParam(constant.routePath.webview, param);
-        //
       }
       // 外链
       else if (item.forwardType == 1) {

+ 13 - 4
pages/pageD/webview/webview.js

@@ -1,17 +1,26 @@
+const constant = require('../../../utils/constant.js');
 Page({
   data: {
-    url: ''
+    url: constant.app.webSkipUrl,
   },
 
   onLoad: function (options) {
     // 从 options 中获取传入的 url 参数
-    const url = options.param;
+    var that = this;
+    const url = that.data.url;
     if (url) {
-      this.setData({
+      that.setData({
         url: url
       });
     } else {
       console.error('URL 参数未提供');
     }
-  }
+  },
+
+  onShareAppMessage() {
+    return {
+      title: 'OhPlay',
+      path: 'pages/pageD/webview/webview'
+    }
+  },
 });