Browse Source

君到苏州首页轮播图分享

master
chenkainan 2 years ago
parent
commit
4bec9751f5
  1. 5
      app.miniapp.json
  2. 7
      pages/index/index.js
  3. 16
      pages/pbService/web/index.js
  4. 61
      project.miniapp.json

5
app.miniapp.json

@ -0,0 +1,5 @@
{
"adapteByMiniprogram": {
"userName": "gh_b55e177a4069"
}
}

7
pages/index/index.js

@ -592,10 +592,10 @@ Page({
case 3: 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) { if ((item.tdata.url.indexOf('http://') != -1 || item.tdata.url.indexOf('https://') != -1) && item.tdata.url.indexOf('m.cloud.sz-trip.com') == -1) {
// 外部h5 // 外部h5
console.log(item.tdata) console.log(111,item.tdata)
app.globalData.weburl = item.tdata.url; app.globalData.weburl = item.tdata.url;
wx.navigateTo({ wx.navigateTo({
url: "/pages/pbService/web/index" url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata.url)
}) })
} else { } else {
let page = item.tdata.url.split("/"); let page = item.tdata.url.split("/");
@ -614,8 +614,9 @@ Page({
}) })
} else { } else {
app.globalData.weburl = item.tdata.url; app.globalData.weburl = item.tdata.url;
console.log(2222,item.tdata.url,app.globalData.weburl)
wx.navigateTo({ wx.navigateTo({
url: "/pages/pbService/web/index" url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata.url)
}) })
} }
} }

16
pages/pbService/web/index.js

@ -16,9 +16,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { 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=>{ userApi.user_post("user/getMyInfo").then(res=>{
let weburl = app.globalData.weburl let weburl = options.weburl
if(weburl.indexOf('?')!=-1){ if(weburl.indexOf('?')!=-1){
weburl += '&token='+res.data.token; 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=>{ userApi.user_post("user/getJumpThirdAppCode",{}).then(res=>{
let weburl = app.globalData.weburl let weburl = options.weburl
if(weburl.indexOf('?')!=-1){ if(weburl.indexOf('?')!=-1){
weburl += '&original_sys_name=jdsz&auth_code='+res.data; weburl += '&original_sys_name=jdsz&auth_code='+res.data;
} }
@ -49,7 +51,7 @@ Page({
} }
else { else {
this.setData({ this.setData({
webUrl:app.globalData.weburl webUrl:options.weburl
}) })
} }
}, },
@ -108,14 +110,14 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
return { return {
title: this.data.shareTitle, title: this.data.shareTitle,
path: this.data.shareUrl, path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`,
} }
}, },
onShareTimeline: function() { onShareTimeline: function() {
return { return {
title: this.data.shareTitle, title: this.data.shareTitle,
path: this.data.shareUrl, path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`,
} }
} }
}) })

61
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
}
}
}
Loading…
Cancel
Save