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.
983 lines
28 KiB
983 lines
28 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: {
|
|
isTest: false,
|
|
|
|
startList: {head_img: ''}, // 启动页广告
|
|
fullAdvTimer: null, // 全屏timer
|
|
showFullAdv: true, //全屏广告开关
|
|
opacity: 1, // 全屏广告透明度
|
|
time: 3, //全屏广告剩余时间
|
|
showTime: false, // 全屏广告时间展示
|
|
alertSwipeList: [], //弹窗广告
|
|
showAdv: false, //弹窗开关
|
|
isMuted: true,
|
|
videoPlay: false,
|
|
|
|
systemStyle: {
|
|
height: 0,
|
|
padHeight: 0,
|
|
right: 0,
|
|
},
|
|
lat: "",
|
|
lon: "",
|
|
|
|
indexSeason: {}, // 后台UI配置项
|
|
|
|
// bannerInterver: 5*1000, // 动态更改banner时间
|
|
banner: [],
|
|
xiaobanner: [],
|
|
activeBannerIndex: 0,
|
|
smBannerIndex: 0,
|
|
|
|
// banner上的金刚区
|
|
bannerDataList: [
|
|
{
|
|
title: "景点门票",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/5934b8b77b058ce1de5943adbaf51739.png",
|
|
path: "/pages/list/scene/index",
|
|
},
|
|
{
|
|
title: "活动日历",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/d75d7a3924d832912a2633ee29b30b9b.png",
|
|
path: "/pages/list/activitynew/index",
|
|
},
|
|
{
|
|
title: "匠意臻品",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/69722050b638954e0b755a4d6c771d48.png",
|
|
path: "/subPackages/techanNew/index",
|
|
},
|
|
{
|
|
title: "领券中心",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/4384a93f77d8faba5f504195c77e57c1.png",
|
|
path: "/pages/list/scene/index",
|
|
},
|
|
],
|
|
// 金刚区
|
|
mainTypeList: [
|
|
{
|
|
title: "非遗专卖",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
path: "/subPackages/feiyiNew/index",
|
|
},
|
|
{
|
|
title: "场馆预约",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
path: "/pages/list/museum/index",
|
|
},
|
|
{
|
|
title: "一日游",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
weburl:"https://m.cloud.sz-trip.com/OneDayTravelNew",
|
|
},
|
|
{
|
|
title: "户外游",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
weburl:"https://m.cloud.sz-trip.com/LearningTravel",
|
|
},
|
|
{
|
|
title: "电影购票",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
weburl:"https://m.cloud.sz-trip.com/movies",
|
|
},
|
|
{
|
|
type: 'hotel', // 特殊标识方便查找 更新weburl
|
|
title: "酒店住宿",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
weburl: '',
|
|
path: '/pages/list/hotel/index'
|
|
},
|
|
{
|
|
title: "水上游",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
path: '/pages/list/night/index'
|
|
},
|
|
{
|
|
title: "剧场演出",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png",
|
|
path: '/pages/list/theatre/index'
|
|
},
|
|
],
|
|
mainTypeLeft: 0,
|
|
|
|
xpth: {}, // 新品特惠
|
|
XPathBannerIndex: 0,
|
|
// 公共服务
|
|
publicSerivce: [
|
|
{
|
|
title: "高峰预警",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/c7e28d88bde040c386183d69ae9bb228.png",
|
|
weburl: "https://wlsjzx.zdhxwl.cn/kt_h5/index.html#/morecopy",
|
|
eventName: "comfort_click",
|
|
},
|
|
{
|
|
title: "实时路况",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a678fdc2127648cd7881e36791b2062a.png",
|
|
weburl: "https://jiaotonghao2.amap.com/?channel=amap&unitId=257&src=app_share#/",
|
|
eventName: "sslk",
|
|
},
|
|
{
|
|
title: "行李直送",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/66c8614112630ed168a27150f15a3234.png",
|
|
appId: 'wx757dd1ee184e75e9',
|
|
pagePath: "pages/tabBar/index/index"
|
|
},
|
|
{
|
|
title: "行李寄存",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/3b9886609236df983e6512055662693c.png",
|
|
weburl: "https://weixin.2500sz.net/zt/2023/07/luggage_storage/",
|
|
eventName: "xljc",
|
|
},
|
|
{
|
|
title: "找厕所",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/e8e75d8cd8761d4de4336a35e29e5c6d.png",
|
|
path: "/pages/pbService/bike/index?type=1",
|
|
},
|
|
{
|
|
title: "停车场",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/ef3d9cfb4817552288d666d8e5617707.png",
|
|
weburl: "https://m.cloud.sz-trip.com/ParkingArea",
|
|
},
|
|
|
|
],
|
|
|
|
// 旅游助手
|
|
travelData: [
|
|
{
|
|
title: "最美打卡点",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/800a30b94f77c1f7f1bc17f33c0daacd.png",
|
|
path: "/subPackageCheckPoint/pages/index/index",
|
|
},
|
|
{
|
|
title: "街巷美食",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/a4918bd24ff162991ca8db28759ade51.png",
|
|
path: "/pages/list/food/index",
|
|
},
|
|
{
|
|
title: "语音导览",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/f72a9f174aa66e520cbfe7429dca6635.png",
|
|
appId: "wx74f380bc721a0379",
|
|
pagePath: "/pages/listen/listen?title=君到苏州"
|
|
},
|
|
{
|
|
title: "游记攻略",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250526/e1762ba22ba5d4cc5882de321bc10110.png",
|
|
path: "/pages/list/strategy/index",
|
|
},
|
|
],
|
|
|
|
// 数字文旅
|
|
travelCulture: [
|
|
{
|
|
title: "数字非遗",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/bc747aa7767770dc26e663480ac9150d.png',
|
|
weburl: "https://m.cloud.sz-trip.com/IntangibleCultural2",
|
|
},
|
|
{
|
|
title: "数字博物馆",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/86c986c2991e968ee143cf5777bb9f08.png',
|
|
weburl: "https://m.cloud.sz-trip.com/BwsInfo",
|
|
},
|
|
{
|
|
title: "数字名人馆",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/d570a1bb6961b9ddf26b17cc64b733dd.png',
|
|
weburl: "https://www.szsmrg.com/home",
|
|
},
|
|
{
|
|
title: "云上观展",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/8f96c29f6199b811a757e4e5c5901daa.png',
|
|
weburl: "https://m.cloud.sz-trip.com/CloudPerform2022",
|
|
},
|
|
{
|
|
title: "云上文博会",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250312.png',
|
|
weburl: "https://m.cloud.sz-trip.com/CloudExpo",
|
|
},
|
|
{
|
|
title: "精彩回顾",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250312/58d0fd32ea7521b0b1ea12bf5b593fe2.png',
|
|
path: "/pages/pbService/activity/index",
|
|
},
|
|
{
|
|
title: "文化场馆查询",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250312/58d0fd32ea7521b0b1ea12bf5b593fe2.png',
|
|
weburl: "https://m.cloud.sz-trip.com/Museum",
|
|
},
|
|
{
|
|
title: "苏影通",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/e60996bf57f35f2dab63c81bc48b609a.png',
|
|
weburl: "https://m.cloud.sz-trip.com/movies",
|
|
},
|
|
{
|
|
title: "书仓",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/41d87b6d8d78ac497a6654ad293f9329.png',
|
|
appId: 'wx165d4f1727f6bdb0',
|
|
pagePath: 'pages/home/home'
|
|
},
|
|
{
|
|
title: "e读书",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/87e9c9e3453492fa1ee65b705565efbb.png',
|
|
appId: 'wx26e6f4c0baba005b',
|
|
pagePath: 'pages/index/index'
|
|
},
|
|
{
|
|
title: "数字公共文化",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250526/c60ed1f766645fa67a749dffa0d347a2.png',
|
|
weburl: "https://m.cloud.sz-trip.com/PublicCulture2022",
|
|
},
|
|
{
|
|
title: "云游苏州",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250312/58d0fd32ea7521b0b1ea12bf5b593fe2.png',
|
|
weburl: 'https://speed.web.yunyouyizhan.com/downloadApp/index.html#/',
|
|
},
|
|
{
|
|
title: "美图鉴赏",
|
|
img: 'https://static.ticket.sz-trip.com/uploads/20250312/58d0fd32ea7521b0b1ea12bf5b593fe2.png',
|
|
path: "/pages/pbService/appreciate/index",
|
|
|
|
},
|
|
|
|
],
|
|
scrollLeft: 0,
|
|
|
|
|
|
// 十全十美
|
|
// area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"],
|
|
SQSM: [
|
|
{
|
|
title: "常熟",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/3e4b8f20f9468cb4fd3f0c92d604db09.png",
|
|
appId: 'wx4df5fd9a6a5ea123',
|
|
pagePath: 'pages/index'
|
|
},
|
|
{
|
|
title: "太仓",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/24fc48715691714988d5e0cf78e5a657.png",
|
|
appId: 'wx8853b0d93cbca75e',
|
|
pagePath: 'pages/home/home'
|
|
},
|
|
{
|
|
title: "昆山",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/55b86da028a00326994ac8ebf10447b5.png",
|
|
appId: 'wx8888a3fd0862b4c8',
|
|
pagePath: 'pages/index/index'
|
|
},
|
|
{
|
|
title: "吴江",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/aa60aec108158b47e0210b8b33c72fe5.png",
|
|
appId: 'wx8eadea4ee2d42d4b',
|
|
pagePath: 'pages/index/index'
|
|
},
|
|
{
|
|
title: "工业园区",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/4fdd5f3e9f63421d4394f2c3b3a0c7a4.png",
|
|
appId: 'wxd323e63a10aa6865',
|
|
pagePath: 'pages/home/index'
|
|
},
|
|
{
|
|
title: "张家港",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/bb32450e448ec520c90241556a68c092.png",
|
|
path: "/pages/list/six/index?area=zhangjiagang"
|
|
},
|
|
{
|
|
title: "吴中",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/cea52b2c0f3c18762d7feea2ba987e63.png",
|
|
path: "/pages/list/six/index?area=wuzhong"
|
|
},
|
|
{
|
|
title: "相城",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/ef29b1cbdd9b33919891732750f72f2a.png",
|
|
path: "/pages/list/six/index?area=xiangcheng"
|
|
},
|
|
{
|
|
title: "姑苏",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/8de375c2fc322cb44d7e0cdb84c97cfe.png",
|
|
path: "/pages/list/six/index?area=gusu"
|
|
},
|
|
{
|
|
title: "高新",
|
|
img: "https://static.ticket.sz-trip.com/uploads/20250312/96a0c3631a0b3a9d5836943663a2f5c5.png",
|
|
path: "/pages/list/six/index?area=gaoxin"
|
|
},
|
|
|
|
|
|
],
|
|
|
|
// 长三角文旅平台
|
|
otherPlat: [
|
|
{
|
|
"name":"玉见昆山",
|
|
"icon":"https://static.ticket.sz-trip.com/uploads/20250526/c85dbe1b0f8f58014c05a30b3e6f86b5.png",
|
|
"type":"mini",
|
|
"path":"",
|
|
"appid":"wx8888a3fd0862b4c8"
|
|
},
|
|
{
|
|
"name":"智游常熟",
|
|
"icon":"https://static.ticket.sz-trip.com/uploads/20250526/98d57e31995b6dc3188f8717201640f1.png",
|
|
"type":"mini",
|
|
"path":"",
|
|
"appid":"wxdaf3d5edd07dc7af"
|
|
},
|
|
{
|
|
"name":"常享游",
|
|
"icon":"https://static.ticket.sz-trip.com/uploads/20250526/abfe0d4d2b02fcfd9bd791b9468bb4f4.png",
|
|
"type":"h5",
|
|
"url":"https://tour.wlczy.com/h5/"
|
|
},
|
|
{
|
|
"name":"畅游宿迁",
|
|
"icon":"https://static.ticket.sz-trip.com/uploads/20250526/bcfa9789f2d2d52d2da8f11b6a99b002.png",
|
|
"type":"mini",
|
|
"path":"/pages/index/index",
|
|
"appid":"wxcb00a59c4fba136e"
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
saleProduct: null,
|
|
roadProduct: null,
|
|
|
|
month: "",
|
|
months: ['JAN', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'oct', 'nov', 'dec'],
|
|
date: "",
|
|
list: [],
|
|
listMore: true,
|
|
|
|
urltopage: {},
|
|
|
|
// ---------------2025-5-26改版没用到的------------------
|
|
fourProduct: [],
|
|
hotIndex: 0,
|
|
indexHot: [],
|
|
weather: null,
|
|
|
|
// 页面图片
|
|
// imageSourceList:imageSource,
|
|
|
|
|
|
},
|
|
onLoad: function(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);
|
|
}
|
|
})
|
|
}
|
|
if (options.from) {
|
|
app.globalData.from = options.from;
|
|
}
|
|
return
|
|
console.log('options',options)
|
|
|
|
|
|
|
|
// 获取今天的日期
|
|
let today = new Date();
|
|
this.setData({
|
|
month: (this.data.months[today.getMonth()]).toUpperCase(),
|
|
date: today.getDate()
|
|
})
|
|
|
|
},
|
|
|
|
onReady: function() {
|
|
this.getHeight()
|
|
this.getIndexSeason()
|
|
this.getBanner()
|
|
|
|
this.getXpthList() // 限时特惠
|
|
this.getTwoProduct()
|
|
|
|
this.getList() // 回购榜
|
|
// this.getWeather() // 2025-5-26首页改版不需要天气了
|
|
// this.getFourProduct() // 活动日历
|
|
|
|
wx.getLocation({
|
|
type: 'gcj02',
|
|
success: (res) => {
|
|
this.setData({
|
|
lat: res.latitude,
|
|
lon: res.longitude
|
|
})
|
|
// this.getList() // 2025不需要经纬度了
|
|
},
|
|
fail: (err) => {
|
|
// this.getList()
|
|
}
|
|
})
|
|
|
|
this.getUrlToPage()
|
|
|
|
|
|
},
|
|
// 获取系统信息
|
|
getHeight() {
|
|
let systemInfo = wx.getSystemInfoSync(),
|
|
rect = wx.getMenuButtonBoundingClientRect();
|
|
let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
|
|
let systemStyle = {
|
|
height: height, // 导航栏
|
|
padHeight: systemInfo.statusBarHeight, // 状态栏
|
|
right: (systemInfo.screenWidth - rect.right) + rect.width // 右侧胶囊
|
|
}
|
|
this.setData({
|
|
systemStyle: systemStyle,
|
|
})
|
|
},
|
|
//获取季节配置
|
|
getIndexSeason() {
|
|
let mainTypeList = this.data.mainTypeList
|
|
let hotelData = mainTypeList.find(v=>v.type == "hotel")
|
|
|
|
if (app.globalData.configJson&&app.globalData.configJson.indexSeason) {
|
|
console.log('app', app.globalData.configJson)
|
|
hotelData.weburl = app.globalData.configJson.hotelUrl
|
|
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,
|
|
mainTypeList: mainTypeList
|
|
})
|
|
} else {
|
|
commonApi._post("adv/get_home_ui", {type_id: 3}).then(res => {
|
|
let obj = {}
|
|
res.data.content.forEach(item => {
|
|
obj[item.id] = item.image
|
|
});
|
|
app.globalData.configJson.indexSeason = obj
|
|
app.globalData.loadIndexSeason = true
|
|
hotelData.weburl = app.globalData.configJson.hotelUrl
|
|
console.log('webData', app.globalData.configJson)
|
|
this.setData({
|
|
indexHot: app.globalData.configJson.indexHot,
|
|
isTest: app.globalData.configJson.isTest,
|
|
// otherPlat: app.globalData.configJson.otherPlats,
|
|
indexSeason: app.globalData.configJson.indexSeason,
|
|
mainTypeList: mainTypeList
|
|
})
|
|
})
|
|
}
|
|
console.log(this.data)
|
|
},
|
|
// url跳转(不知道什么东西)
|
|
getUrlToPage () {
|
|
commonApi._post("pbservice/Other/getClientConfig", {
|
|
unique_key: "urltopage"
|
|
}).then(res => {
|
|
let data = JSON.parse(res.data)
|
|
this.setData({
|
|
urltopage: data
|
|
})
|
|
})
|
|
},
|
|
|
|
// --------------------banner 相关---------------------------
|
|
// 获取banner 和开屏广告
|
|
getBanner: function() {
|
|
let _this = this
|
|
//全屏广告
|
|
commonApi._post("adv/getAdv", {position: 2,type_id: 3}).then(res => {
|
|
if (res.data.length > 0) {
|
|
let length = res.data.length
|
|
let num = Math.floor(Math.random() * length);
|
|
this.setData({startList: res.data[num]})
|
|
// 图片
|
|
if (this.data.startList.media_type) {
|
|
wx.hideTabBar() //这里隐藏了底部导航栏
|
|
this.setData({showTime: true})
|
|
this.data.fullAdvTimer = setInterval(() => {
|
|
_this.data.time-=0.5
|
|
if (Number.isInteger(_this.data.time)) {
|
|
_this.setData({time: _this.data.time})
|
|
}
|
|
if (_this.data.time <= 0) {
|
|
_this.setData({opacity: _this.data.opacity - 0.3})
|
|
}
|
|
if (_this.data.time <= -1) {
|
|
clearInterval(_this.data.fullAdvTimer)
|
|
wx.showTabBar() //倒计时结束清除定时器显示导航栏
|
|
_this.setData({showFullAdv: false})
|
|
}
|
|
}, 500)
|
|
} else {
|
|
// 视频
|
|
}
|
|
} else {
|
|
this.setData({showFullAdv: false})
|
|
}
|
|
})
|
|
|
|
|
|
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
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 统一的banner change 需要时可以放开
|
|
changeBannerIndex: function(e) {
|
|
return
|
|
let keyname = e.currentTarget.dataset.keyname
|
|
this.setData({
|
|
[keyname]: e.detail.current,
|
|
})
|
|
},
|
|
// 轮播图点击
|
|
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;
|
|
|
|
},
|
|
|
|
//------------------------金刚区点击-------------------------------------
|
|
// 自定义数据的跳转
|
|
mainIconClick: function(e) {
|
|
let item = e.currentTarget.dataset.item
|
|
// 埋点
|
|
if (item.eventName) {
|
|
this.pagePoint({event: item.eventName,}, 1)
|
|
}else if (item.title) {
|
|
commonApi._post("browse/burying_point", {
|
|
uuid: app.globalData.uuid,
|
|
drive: "mini",
|
|
title: item.title
|
|
})
|
|
}
|
|
|
|
if (item.appId) {
|
|
wx.navigateToMiniProgram({
|
|
appId: item.appId,
|
|
path: item.pagePath,
|
|
})
|
|
return
|
|
}
|
|
if (item.path) {
|
|
wx.navigateTo({
|
|
url: item.path
|
|
})
|
|
return
|
|
}
|
|
if (item.weburl) {
|
|
wx.navigateTo({
|
|
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.weburl)
|
|
})
|
|
return
|
|
}
|
|
|
|
},
|
|
// 后台配置数据的跳转
|
|
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,
|
|
})
|
|
}
|
|
},
|
|
|
|
// 滚动监听
|
|
listenScroll(e) {
|
|
let keyname = e.currentTarget.dataset.keyname
|
|
this.setData({
|
|
[keyname]: e.detail.scrollLeft,
|
|
})
|
|
},
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// 新品特惠
|
|
getXpthList: function() {
|
|
commonApi._post("product/get_product_indulgence", {
|
|
tag_id: 275,
|
|
typeId: 3,
|
|
type: 1, // 返回数组
|
|
}).then(res => {
|
|
this.setData({xpth: res.data,})
|
|
})
|
|
},
|
|
|
|
|
|
|
|
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]
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
|
|
productGotoDetail: function(e) {
|
|
let item = e.currentTarget.dataset.item;
|
|
util.gotoDetail(item)
|
|
},
|
|
|
|
// 热门推荐 去掉经纬度 接口排序方式变更(韩阳)
|
|
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);
|
|
}
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
pagePoint: function(e, type) {
|
|
util.pagePoint(e, type)
|
|
},
|
|
|
|
// --------------------------广告----------------------------
|
|
//关闭弹窗广告
|
|
closeAdv: function() {
|
|
this.setData({
|
|
showAdv: false
|
|
})
|
|
wx.showTabBar({
|
|
animation: true,
|
|
})
|
|
},
|
|
//关闭全屏广告
|
|
closeFullAdv: function() {
|
|
this.setData({showFullAdv: false})
|
|
clearInterval(this.data.fullAdvTimer)
|
|
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
|
|
})
|
|
},
|
|
|
|
onShow: function() {
|
|
this.pagePoint({event: 'home_view'}, 1)
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
onShareTimeline: function() {
|
|
return {
|
|
title: '君到苏州(文化旅游总入口)',
|
|
query: '',
|
|
imageUrl: 'https://static.ticket.sz-trip.com/xcxImages/zwt/logo.png'
|
|
}
|
|
},
|
|
|
|
|
|
|
|
// --------------------以前的东西 暂时用不到仅做保留------------------------
|
|
// 一城百馆 以前的活动
|
|
city: function() {
|
|
wx.navigateToMiniProgram({
|
|
appId: 'wx114d514f39cb1fed',
|
|
path: "pages/entry/index"
|
|
})
|
|
commonApi._post("browse/burying_point", {
|
|
drive: "mini",
|
|
title: "一城百馆",
|
|
uuid: app.globalData.uuid
|
|
}).then(res => {
|
|
|
|
})
|
|
},
|
|
meituan: function() {
|
|
wx.navigateToMiniProgram({
|
|
appId: 'wxde8ac0a21135c07d',
|
|
path: "hotel/pages/h5/index?q=https%3A%2F%2Ffenxiao.meituan.com%2Fopdtor%2Fh5%2Fhotel%2Fsearch%3FpartnerId%3D16829"
|
|
})
|
|
},
|
|
// 活动日历
|
|
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
|
|
})
|
|
})
|
|
},
|
|
changeHotIndex: function(e) {
|
|
this.setData({
|
|
hotIndex: e.currentTarget.dataset.index,
|
|
fourProduct: []
|
|
})
|
|
this.getFourProduct()
|
|
},
|
|
getWeather: function() {
|
|
commonApi._post('pbservice/Ztfw/getWeather').then(res => {
|
|
this.setData({
|
|
weather: res.data
|
|
})
|
|
})
|
|
},
|
|
// Ai避高峰
|
|
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),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
})
|