You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

1029 lines
25 KiB

//index.js
//获取应用实例
let app = getApp()
import imageSource from "./imgSource"
import commonApi from "../../utils/https/common"
import userApi from "../../utils/https/user"
import util from "../../utils/util"
import https from "../../utils/https.js"
Page({
data: {
bannerInterver: 1000*60,
banner: [],
xiaobanner: [],
height: 0,
padHeight: 0,
right: 0,
weather: null,
saleProduct: null,
roadProduct: null,
fourProduct: [],
hotIndex: 0,
indexHot: [],
month: "",
months: ['JAN', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'oct', 'nov', 'dec'],
date: "",
list: [],
listMore: true,
isTest: false,
lat: "",
lon: "",
urltopage: {},
scrollLeft: 0,
videoPrize: false,
prizeInfo: null,
otherPlat: null,
activeBannerIndex: 0,
smBannerIndex: 0,
XPathBannerIndex: 0,
indexSeason: {},
// startList: [], // 启动页广告
startList: {
head_img: ''
}, // 启动页广告
alertSwipeList: [], //弹窗广告
showAdv: false, //弹窗开关
showFullAdv: true, //全屏广告开关
opacity: 1,
time: 3, //全屏广告剩余时间
showTime: false,
xpth: {}, // 元旦新增 新品特惠和sqjNew
djs: null, // 元旦新增 新品特惠倒计时
djsTime: null,
area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"],
sqjNew: [
'https://static.ticket.sz-trip.com/uploads/20241012/df831b80bc445aef8dc439ef8f9761a2.png',// 常熟
'https://static.ticket.sz-trip.com/uploads/20241012/9a5dc85879e87cc21f4d10286c84ac5f.png',// 太仓
'https://static.ticket.sz-trip.com/uploads/20241012/fceaa177de4ed13e7884ccfafb75c6ae.png',// 昆山
'https://static.ticket.sz-trip.com/uploads/20241012/c55a59f86b49af4ae15f1b1015887678.png',// 吴江
'https://static.ticket.sz-trip.com/uploads/20241012/a96c42d843dd1cc4a9ec30b189b35a6f.png',// 工业园区
'https://static.ticket.sz-trip.com/uploads/20241012/c1f61d9b2a13377c31561e6b50274c04.png',// 张家港
'https://static.ticket.sz-trip.com/uploads/20241012/b26ebd1a1ed1d5737cd22cc2da7e1b54.png',// 吴中
'https://static.ticket.sz-trip.com/uploads/20241012/eec299ac968f0344e124195155d88ed1.png',// 相城
'https://static.ticket.sz-trip.com/uploads/20241012/db5fcb0df2d8d326bd2b8d055b9284d2.png',// 姑苏
'https://static.ticket.sz-trip.com/uploads/20241012/279e21d3e876379140bf77d01410b07d.png',// 高新区
],
viewHeight: "0px",
isMuted: true,
videoPlay: false,
// 页面图片
imageSourceList:imageSource,
},
onLoad: function(options) {
console.log('onload')
wx.getLocation({type: 'gcj02'})
console.log('options',options)
// 相城小程序跳转获取用户信息
if(options && options.szxcCode) {
commonApi._post("uservice/user/loginByXC", {
code: options.szxcCode
}).then(res => {
if(res.data && res.data.id && res.data.token) {
https.set_logininfo(res);
}
})
}
this.getHeight()
//全屏广告
wx.hideTabBar() //这里隐藏了底部导航栏
commonApi._post("adv/getAdv", {
position: 2,
type_id: 3
}).then(res => {
if (res.data.length > 0) {
let length = res.data.length
if (res.data.length > 1) {
let num = Math.floor(Math.random() * length);
this.setData({
startList: res.data[num]
})
} else {
this.setData({
startList: res.data[0]
})
}
// 图片
if (this.data.startList.media_type) {
this.setData({
showTime: true
})
var timer = setInterval(() => {
this.setData({
time: this.data.time - 1
})
if (this.data.time === 0) {
var opacityTimer = setInterval(() => {
this.setData({
opacity: this.data.opacity - 0.3
})
}, 100)
}
if (this.data.time == -1) {
clearInterval(timer)
clearInterval(opacityTimer)
wx.showTabBar() //倒计时结束清除定时器显示导航栏
this.setData({
showFullAdv: false
})
}
}, 1000)
} else {
// 视频
}
} else {
this.setData({
showFullAdv: false
})
}
})
if (options.from) {
app.globalData.from = options.from;
}
let systemInfo = wx.getSystemInfoSync(),
rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
wx.getLocation({
type: 'gcj02',
success: (res) => {
this.setData({
lat: res.latitude,
lon: res.longitude
})
this.getList()
},
fail: (err) => {
this.getList()
}
})
this.setData({
height: height,
padHeight: systemInfo.statusBarHeight,
right: (systemInfo.screenWidth - rect.right) + rect.width
})
commonApi._post("pbservice/Other/getClientConfig", {
unique_key: "urltopage"
}).then(res => {
let data = JSON.parse(res.data)
this.setData({
urltopage: data
})
})
this.getTwoProduct()
this.getBanner()
this.getWeather()
// 获取今天的日期
let today = new Date();
this.setData({
month: (this.data.months[today.getMonth()]).toUpperCase(),
date: today.getDate()
})
// 调用接口如果token过期会导致一进入就要登陆
// this.getVideoPrize()
this.getXpthList()
},
getHeight() {
let that = this
wx.getSystemInfo({
success(res) {
that.setData({
viewHeight: res.windowHeight + 'px'
})
}
})
},
getXpthList: function() {
// 元旦新增 新品特惠
commonApi._post("product/get_product_indulgence", {
tag_id: 275,
typeId: 3,
type: 1, // 返回数组
}).then(res => {
// res.data.adv = [res.data.adv]
this.setData({
xpth: res.data,
djsTime: res.data.time
})
let time = setInterval(() => {
this.setData({
djsTime: this.data.djsTime - 1
})
this.formatDate(this.data.djsTime)
}, 1000)
if (this.data.djsTime == 0) {
clearInterval(time)
}
})
},
// 元旦新品特惠 倒计时
formatDate: function(oTime) {
let h = parseInt(oTime / 3600)
let m = parseInt((oTime % 3600) / 60)
let s = parseInt(oTime % 60)
h = h < 10 ? "0" + h : h;
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
this.setData({
djs: {
h: h,
m: m,
s: s
}
})
return
},
goFeiyi: function() {
app.globalData.weburl = 'https://m.cloud.sz-trip.com/mlgCoupons'
wx.navigateTo({
url: "/pages/pbService/web/index"
})
},
onTabItemTap: function(e) {
console.log(e, 99999999)
},
changeBannerIndex: function(e) {
this.setData({
activeBannerIndex: e.detail.current,
bannerInterver: 5000
})
},
changeSmBannerIndex: function(e) {
this.setData({
smBannerIndex: e.detail.current
})
},
changeXPathBannerIndex: function(e) {
this.setData({
XPathBannerIndex: e.detail.current
})
},
xlzs: function (e) {
wx.navigateToMiniProgram({
appId: 'wx757dd1ee184e75e9',
page: "pages/tabBar/index/index"
})
},
// 一城百馆
city: function() {
wx.navigateToMiniProgram({
appId: 'wx114d514f39cb1fed',
path: "pages/entry/index"
})
commonApi._post("browse/burying_point", {
drive: "mini",
title: "一城百馆",
uuid: app.globalData.uuid
}).then(res => {
})
},
changeHotIndex: function(e) {
this.setData({
hotIndex: e.currentTarget.dataset.index,
fourProduct: []
})
this.getFourProduct()
},
getBanner: function() {
// commonApi._post("adv/getAdvByKey",{
// key:"xcxBanner"
// }).then(res=>{
// console.log(res)
// this.setData({
// banner:res.data.content || []
// })
// })
// commonApi._post("adv/getAdvByKey",{
// key:"xiaobanner"
// }).then(res=>{
// this.setData({
// xiaobanner:res.data.content || []
// })
// })
// return;
commonApi._post("adv/getAdv", {
position: 0,
type_id: 3
}).then(res => {
this.setData({
banner: res.data || []
})
})
commonApi._post("adv/getAdv", {
position: 1,
type_id: 3
}).then(res => {
this.setData({
xiaobanner: res.data || []
})
})
//弹窗广告
commonApi._post("adv/getAdv", {
position: 3,
type_id: 3
}).then(res => {
if (res.data.length > 0) {
this.setData({
alertSwipeList: res.data || [],
showAdv: true
})
} else if (!this.data.showFullAdv) {
wx.showTabBar({
animation: true,
})
}
})
},
//获取季节配置
getIndexSeason() {
this.setData({
indexHot: app.globalData.configJson.indexHot,
isTest: app.globalData.configJson.isTest,
otherPlat: app.globalData.configJson.otherPlats,
// 正式数据
indexSeason: app.globalData.configJson.indexSeason,
// 开发数据
// indexSeason: imageSource.testImgs.indexSeason
})
this.getFourProduct()
console.log(this.data)
},
//关闭弹窗广告
closeAdv: function() {
this.setData({
showAdv: false
})
wx.showTabBar({
animation: true,
})
},
//关闭全屏广告
closeFullAdv: function() {
this.setData({
showFullAdv: false
})
if (!this.data.alertSwipeList.length > 0) {
wx.showTabBar({
animation: true,
})
}
},
// 是否静音
closeMuted: function() {
this.setData({
isMuted: this.data.isMuted = !this.data.isMuted
})
},
// 播放视频
videoPlay: function() {
let videoplay = wx.createVideoContext('myVideo', this)
videoplay.play();
this.setData({
videoPlay: false
})
},
// 暂停视频
videoPause: function() {
let videoplay = wx.createVideoContext('myVideo', this)
videoplay.pause();
this.setData({
videoPlay: true
})
},
getWeather: function() {
commonApi._post('pbservice/Ztfw/getWeather').then(res => {
this.setData({
weather: res.data
})
})
},
saleDetail: function() {},
getTwoProduct: function() {
// 获取首页限时特惠
commonApi._post('act/fast_sale_now', {
offset: 0,
limit: 1
}).then(res => {
if (res.data[0] && res.data[0].fast_sales_sku[0]) {
if (res.data[0].fast_sales_sku.length > 0) {
let price = res.data[0].fast_sales_sku[0].price
let data = res.data[0].fast_sales_sku[0]
for (let item of res.data[0].fast_sales_sku) {
if (price > item.price) price = item.price
}
data.price = price
this.setData({
saleProduct: data
})
} else {
this.setData({
saleProduct: res.data[0].fast_sales_sku[0]
})
}
}
})
commonApi._post("product/get_product_by_tag", {
tag_id: 17,
offset: 0,
limit: 1,
sort: 'price',
order: 'asc'
}).then(res => {
if (res.data.list.length > 0) {
let price = res.data.list[0].price
for (let item of res.data.list) {
if (item.price > price) {
price = item.price
}
}
let data = res.data.list[0]
data.price = price
this.setData({
roadProduct: data
})
} else {
this.setData({
roadProduct: [111]
})
}
})
},
getFourProduct: function() {
let item = this.data.indexHot[this.data.hotIndex],
service = "product/get_product_by_tag",
data = {
tag_id: item.id,
offset: 0,
limit: 4,
sort: 'weight',
order: 'desc'
};
if (item.type == 'scene') {
service = "scene/get_scene_by_tag";
} else if (item.type == 'movie') {
service = "Cinema/getHotMovieList";
data = {
page: 1,
pageSize: 4
};
}
commonApi._post(service, data).then(res => {
this.setData({
fourProduct: res.data.list || res.data
})
})
},
tagGotoDetail: function(e) {
let item = e.currentTarget.dataset.item;
if (this.data.indexHot[this.data.hotIndex].type == 'movie') {
wx.navigateTo({
url: '/pages/list/movieticket/list/info/index?id=' + item.third_id + '&title=' +
item.title,
})
} else {
util.gotoDetail(item)
}
},
productGotoDetail: function(e) {
let item = e.currentTarget.dataset.item;
util.gotoDetail(item)
},
gotoPath: function(e) {
// if (e.currentTarget.dataset.event) {
// if (e.currentTarget.dataset.event=='gongyeyuanqu_click') {
// wx.navigateToMiniProgram({
// appId: 'wxd323e63a10aa6865',
// path: 'pages/home/index'
// })
// return
// }else{
// this.pagePoint({
// event: e.currentTarget.dataset.event
// }, 1)
// }
// }
if (e.currentTarget.dataset.title == '书香借阅') {
wx.navigateToMiniProgram({
appId: 'wx165d4f1727f6bdb0',
path: 'pages/home/home'
})
return;
} else if (e.currentTarget.dataset.title == '12348') {
wx.navigateToMiniProgram({
appId: 'wxcdfd45c001466ba3',
path: 'pages/index/index'
})
return;
// } else if (e.currentTarget.dataset.event == 'wuzhong_click') {
// wx.navigateToMiniProgram({
// appId: 'wxdd39069b9a91dbfe',
// path: 'pages/index/index'
// })
// return;
} else if (e.currentTarget.dataset.title == 'e读书') {
wx.navigateToMiniProgram({
appId: 'wx26e6f4c0baba005b',
path: 'pages/index/index'
})
return;
}else if (e.currentTarget.dataset.event == 'kunshan_click') {
wx.navigateToMiniProgram({
appId: 'wx8888a3fd0862b4c8',
path: 'pages/index/index'
})
return;
} else if (e.currentTarget.dataset.event == 'taicang_click') {
wx.navigateToMiniProgram({
appId: 'wx8853b0d93cbca75e',
path: 'pages/home/home'
})
return;
} else if (e.currentTarget.dataset.event == 'changshu_click') {
wx.navigateToMiniProgram({
appId: 'wx4df5fd9a6a5ea123',
path: 'pages/index'
})
return;
} else if (e.currentTarget.dataset.event == 'gongyeyuanqu_click') {
wx.navigateToMiniProgram({
appId: 'wxd323e63a10aa6865',
path: 'pages/home/index'
})
return;
} else if (e.currentTarget.dataset.event == 'wujiang_click') {
wx.navigateToMiniProgram({
appId: 'wx8eadea4ee2d42d4b',
path: 'pages/index/index'
})
return;
}
wx.navigateTo({
url: e.currentTarget.dataset.path,
})
if (e.currentTarget.dataset.title) {
commonApi._post("browse/burying_point", {
uuid: app.globalData.uuid,
drive: "mini",
title: e.currentTarget.dataset.title
}).then(res => {
})
}
},
// 元旦 新品特惠部分
goBanner: function(e) {
let url = e.currentTarget.dataset.url;
app.globalData.weburl = url;
console.log(url)
wx.navigateTo({
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(url)
})
},
gotoUrl: function(e) {
if (e.currentTarget.dataset.event) {
this.pagePoint({
event: e.currentTarget.dataset.event
}, 1)
}
let url = e.currentTarget.dataset.url;
app.globalData.weburl = url;
wx.navigateTo({
// url: '/pages/pbService/web/index?weburl='+encodeURIComponent('https://m.cloud.sz-trip.com/Cloudperform2022'),
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
},
// 实时路况跳转外链
gotoUrls() {
// 判断是否登录
var token = wx.getStorageSync("jstrip_token"), userId = wx.getStorageSync("jstrip_userid");
if(!token || !userId) {
let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html'
app.globalData.weburl = url;
wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
}else {
commonApi.user_post("uservice/user/userEncry").then(res => {
if(res.code == 1) {
let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html?userEncry=' + res.data
app.globalData.weburl = url;
wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
}
})
}
},
gotoMini: function(e) {
let appid = e.currentTarget.dataset.appid,
path = e.currentTarget.dataset.path
wx.navigateToMiniProgram({
appId: appid,
path: path
})
},
garbage: function() {
wx.navigateToMiniProgram({
appId: 'wx13be821f3b1afed3',
path: 'pages/home/home'
})
},
gotoSku: function() {
commonApi.user_post("pbservice/Ztfw/sukangCode").then(res => {
app.globalData.weburl = res.data.url;
wx.navigateTo({
url: '/pages/pbService/web/index'
})
return;
})
},
audioGuide: function() {
wx.navigateToMiniProgram({
appId: 'wx74f380bc721a0379',
path: '/pages/listen/listen?title=君到苏州'
})
commonApi._post("browse/burying_point", {
drive: "mini",
title: "语音导览",
uuid: app.globalData.uuid
}).then(res => {
})
},
// 热门推荐 去掉经纬度 接口排序方式变更(韩阳)
getList: function() {
if (!this.data.listMore) return;
commonApi._post("search/recommend", {
offset: this.data.list.length,
limit: 16
}).then(res => {
res.data.map(item => {
if (item.ext.display_tags) {
item.ext.display_tags = item.ext.display_tags.split(",").splice(0, 2)
} else {
item.ext.display_tags = []
}
})
if (res.data.length < 15) {
this.setData({
listMore: false
})
}
this.setData({
list: this.data.list.concat(res.data)
})
})
},
onReachBottom: function() {
if (this.data.list.length < 30) {
this.getList()
}
},
gotoDetail: function(e) {
let item = e.currentTarget.dataset.item;
util.pagePoint({
event: 'recommend_click',
param: {
id: item.id,
type: item.type
}
}, 1)
if (item.type == 'travels') {
// 游记做特殊处理 其他都按照原来的来
wx.navigateTo({
url: '/pages/info/strategyInfo/index?id=' + item.s_id,
})
} else {
util.gotoDetail(item.ext);
}
},
meituan: function() {
wx.navigateToMiniProgram({
appId: 'wxde8ac0a21135c07d',
path: "hotel/pages/h5/index?q=https%3A%2F%2Ffenxiao.meituan.com%2Fopdtor%2Fh5%2Fhotel%2Fsearch%3FpartnerId%3D16829"
})
},
// 轮播图点击
bannerClick: function(e) {
if (this.data.isTest) return;
let item = e.currentTarget.dataset.item;
this.pagePoint({
event: "banner_click",
type: 'banner'
}, 1)
switch (item.jump_type) {
case 0:
break;
case 1:
util.gotoDetail(item.product_model)
break;
case 2:
if (item.front_model && item.front_model.mini) {
wx.navigateTo({
url: "/" + item.front_model.mini
})
}
break;
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
app.globalData.weburl = item.tdata.url;
wx.navigateTo({
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata
.url)
})
} else {
let page = item.tdata.url.split("/");
page = page[page.length - 1].split("?")
let url = this.data.urltopage[page[0]];
if (url && url.indexOf('map') != -1) {
let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic',
'cinema', 'academes'
],
type = page[1] ? page[1].split("=") : [];
wx.reLaunch({
url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) :
null)
})
} else if (url) {
wx.navigateTo({
url: url,
})
} else {
app.globalData.weburl = item.tdata.url;
wx.navigateTo({
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item
.tdata.url)
})
}
}
break;
case 4:
if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) {
// 如果是苏心游的小程序 直接把authCode带过去
userApi.user_post("user/getJumpThirdAppCode", {}).then(res => {
let weburl = item.tdata.page
if (weburl.indexOf('?') != -1) {
weburl += '&authCode=' + res.data;
} else {
weburl += '?authCode=' + res.data
}
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: weburl
})
}).catch(err => {
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: item.tdata.page
})
})
} else {
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: item.tdata.page
})
}
break;
default:
break;
}
return;
},
//博物馆跳转 直接跳君到苏州H5
goH5: function(e) {
let weburl = 'https://m.cloud.sz-trip.com/' + e.currentTarget.dataset.path;
// app.globalData.weburl ='https://m.cloud.sz-trip.com/' + e.currentTarget.dataset.path;
wx.navigateTo({
// url: "/pages/pbService/web/index"
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(weburl),
})
},
bannerClick2: function(e) {
let item = e.currentTarget.dataset.item;
if (item.action == 'href') {
if (item.href.indexOf(",") != -1) {
let info = item.href.split(",");
wx.navigateToMiniProgram({
appId: info[0],
path: info[1]
})
} else if (item.href.indexOf('map/index') != -1) {
wx.reLaunch({
url: item.href
})
} else {
wx.navigateTo({
url: item.href,
})
}
} else if (item.action == "web") {
app.globalData.weburl = item.href;
wx.navigateTo({
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.href),
})
}
},
// 监听文旅查询的scroll
listenScroll(e) {
this.setData({
scrollLeft: e.detail.scrollLeft
})
},
// 获取短视频大赛是否中奖 中奖详情
getVideoPrize() {
let user_id = wx.getStorageSync('jstrip_userid');
if (!user_id || wx.getStorageSync('indexPriceNoTip')) return;
commonApi.user_post('actonline/video_act/getRaffle', {
act_id: 5
}).then(res => {
this.setData({
videoPrize: res.data
})
})
},
noMoreTip() {
wx.setStorageSync('indexPriceNoTip', true)
this.closePrice()
},
closePrice() {
this.setData({
videoPrize: false,
prizeInfo: null
})
},
// 抽奖
choosePrize() {
commonApi.user_post('actonline/video_act/luckyDraw', {
act_id: 5
}).then(res => {
this.setData({
prizeInfo: res.data
})
if (res.data.type != 'none') {
// 抽奖成功的话 弹框
wx.showModal({
title: "提示",
content: "中奖人员请联系君到苏州客服,领奖方式以客服通知为准",
showCancel: false
})
}
})
},
bannerJumpNew(item) {
let that = this
item = item.currentTarget.dataset.item
if (item.tdata == '') return
that.pagePoint({
event: "banner_click",
type: 'banner'
}, 1)
switch (item.jump_type) {
case 0:
break;
case 1:
util.gotoDetail(item.product_model)
break;
case 2:
if (item.front_model && item.front_model.mini) {
wx.navigateTo({
url: "/" + item.front_model.mini
})
}
break;
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
app.globalData.weburl = item.tdata.url;
wx.navigateTo({
url: "/pages/pbService/web/index"
})
} else {
let page = item.tdata.url.split("/");
page = page[page.length - 1].split("?")
let url = this.data.urltopage[page[0]];
if (url && url.indexOf('map') != -1) {
let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic',
'cinema', 'academes'
],
type = page[1] ? page[1].split("=") : [];
wx.reLaunch({
url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null)
})
} else if (url) {
wx.navigateTo({
url: url,
})
} else {
app.globalData.weburl = item.tdata.url;
wx.navigateTo({
url: "/pages/pbService/web/index"
})
}
}
break;
case 4:
if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) {
// 如果是苏心游的小程序 直接把authCode带过去
userApi.user_post("user/getJumpThirdAppCode", {}).then(res => {
let weburl = item.tdata.page
if (weburl.indexOf('?') != -1) {
weburl += '&authCode=' + res.data;
} else {
weburl += '?authCode=' + res.data
}
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: weburl
})
}).catch(err => {
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: item.tdata.page
})
})
} else {
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: item.tdata.page
})
}
break;
default:
break;
}
return
},
onReady: function() {
},
gotoOther: function(e) {
let item = e.currentTarget.dataset.item;
if (item.type == 'h5') {
app.globalData.weburl = item.url
wx.navigateTo({
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url)
})
} else if (item.type == 'mini') {
wx.navigateToMiniProgram({
appId: item.appid,
path: item.path
})
} else if (item.type == 'page') {
wx.navigateTo({
url: item.page,
})
}
},
pagePoint: function(e, type) {
util.pagePoint(e, type)
},
onShow: function() {
if (app.globalData.loadIndexSeason) {
this.getIndexSeason()
} else {
let t = setInterval(() => {
if (app.globalData.loadIndexSeason) {
this.getIndexSeason()
clearInterval(t)
t = null
}
}, 500)
}
this.pagePoint({
event: 'home_view'
}, 1)
// this.data.time!=5?wx.showTabBar():1
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
onShareTimeline: function() {
return {
title: '君到苏州(文化旅游总入口)',
query: '',
imageUrl: 'https://static.ticket.sz-trip.com/xcxImages/zwt/logo.png'
}
}
})