From 4bec9751f5ebd46ba1a4f16e31b84d55eac70a04 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Mon, 29 Jan 2024 10:08:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=9B=E5=88=B0=E8=8B=8F=E5=B7=9E=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=BD=AE=E6=92=AD=E5=9B=BE=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.miniapp.json | 5 +++ pages/index/index.js | 7 +++-- pages/pbService/web/index.js | 16 +++++----- project.miniapp.json | 61 ++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 app.miniapp.json create mode 100644 project.miniapp.json diff --git a/app.miniapp.json b/app.miniapp.json new file mode 100644 index 0000000..234a021 --- /dev/null +++ b/app.miniapp.json @@ -0,0 +1,5 @@ +{ + "adapteByMiniprogram": { + "userName": "gh_b55e177a4069" + } +} diff --git a/pages/index/index.js b/pages/index/index.js index e9b6c89..61a4420 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -592,10 +592,10 @@ Page({ case 3: if ((item.tdata.url.indexOf('http://') != -1 || item.tdata.url.indexOf('https://') != -1) && item.tdata.url.indexOf('m.cloud.sz-trip.com') == -1) { // 外部h5 - console.log(item.tdata) + console.log(111,item.tdata) app.globalData.weburl = item.tdata.url; wx.navigateTo({ - url: "/pages/pbService/web/index" + url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata.url) }) } else { let page = item.tdata.url.split("/"); @@ -614,8 +614,9 @@ Page({ }) } else { app.globalData.weburl = item.tdata.url; + console.log(2222,item.tdata.url,app.globalData.weburl) wx.navigateTo({ - url: "/pages/pbService/web/index" + url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata.url) }) } } diff --git a/pages/pbService/web/index.js b/pages/pbService/web/index.js index 4ee0c8b..a2bd632 100644 --- a/pages/pbService/web/index.js +++ b/pages/pbService/web/index.js @@ -16,9 +16,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - if(app.globalData.weburl.indexOf('m.cloud.sz-trip.com')!=-1){ + console.log('options',decodeURIComponent(options.weburl)) + options.weburl = decodeURIComponent(options.weburl) + if(options.weburl.indexOf('m.cloud.sz-trip.com')!=-1){ userApi.user_post("user/getMyInfo").then(res=>{ - let weburl = app.globalData.weburl + let weburl = options.weburl if(weburl.indexOf('?')!=-1){ weburl += '&token='+res.data.token; } @@ -31,10 +33,10 @@ Page({ }) }) } - else if(app.globalData.weburl.indexOf('m.jszhwlpt.com')!=-1 || app.globalData.weburl.indexOf('wechat.b2c.zj-trip.net')!=-1){ + else if(options.weburl.indexOf('m.jszhwlpt.com')!=-1 || options.weburl.indexOf('wechat.b2c.zj-trip.net')!=-1){ // 如果是去苏心游或者镇江的话 userApi.user_post("user/getJumpThirdAppCode",{}).then(res=>{ - let weburl = app.globalData.weburl + let weburl = options.weburl if(weburl.indexOf('?')!=-1){ weburl += '&original_sys_name=jdsz&auth_code='+res.data; } @@ -49,7 +51,7 @@ Page({ } else { this.setData({ - webUrl:app.globalData.weburl + webUrl:options.weburl }) } }, @@ -108,14 +110,14 @@ Page({ onShareAppMessage: function () { return { title: this.data.shareTitle, - path: this.data.shareUrl, + path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`, } }, onShareTimeline: function() { return { title: this.data.shareTitle, - path: this.data.shareUrl, + path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`, } } }) \ No newline at end of file diff --git a/project.miniapp.json b/project.miniapp.json new file mode 100644 index 0000000..cd49dc5 --- /dev/null +++ b/project.miniapp.json @@ -0,0 +1,61 @@ +{ + "miniVersion": "v2", + "name": "君到苏州", + "version": "0.0.1", + "mini-android": { + "sdkVersion": "1.0.21", + "toolkitVersion": "0.10.0", + "useExtendedSdk": { + "media": false, + "bluetooth": false, + "network": false, + "scanner": false, + "xweb": false + }, + "icons": { + "hdpi": "", + "xhdpi": "", + "xxhdpi": "", + "xxxhdpi": "" + }, + "splashscreen": { + "hdpi": "", + "xhdpi": "", + "xxhdpi": "" + }, + "enableVConsole": "open", + "privacy": { + "enable": true + } + }, + "mini-ios": { + "sdkVersion": "1.1.4", + "toolkitVersion": "0.0.9", + "useExtendedSdk": { + "WeAppOpenFuns": true, + "WeAppNetwork": false, + "WeAppBluetooth": false, + "WeAppMedia": false, + "WeAppLBS": false, + "WeAppOthers": false + }, + "enableVConsole": "open", + "icons": { + "mainIcon120": "", + "mainIcon180": "", + "spotlightIcon80": "", + "spotlightIcon120": "", + "settingsIcon58": "", + "settingsIcon87": "", + "notificationIcon40": "", + "notificationIcon60": "", + "appStore1024": "" + }, + "splashScreen": { + "customImage": "" + }, + "privacy": { + "enable": false + } + } +} \ No newline at end of file