|
|
|
|
//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"
|
|
|
|
|
import {
|
|
|
|
|
unix
|
|
|
|
|
} from "dayjs"
|
|
|
|
|
|
|
|
|
|
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配置项
|
|
|
|
|
func_data: {},
|
|
|
|
|
|
|
|
|
|
// bannerInterver: 5*1000, // 动态更改banner时间
|
|
|
|
|
banner: [],
|
|
|
|
|
xiaobanner: [],
|
|
|
|
|
ztbanner: [], //苏城环游记banner
|
|
|
|
|
activeBannerIndex: 0,
|
|
|
|
|
smBannerIndex: 0,
|
|
|
|
|
ztBannerIndex: 0,
|
|
|
|
|
bannerDataListFake: [{
|
|
|
|
|
title: "美食",
|
|
|
|
|
img: "https://static.ticket.sz-trip.com/uploads/20260131/7d8082943bfbaca55676a371c9378bc5.png",
|
|
|
|
|
path: "/subPackages/foodListNew/index",
|
|
|
|
|
}, ],
|
|
|
|
|
|
|
|
|
|
// banner上的金刚区
|
|
|
|
|
bannerDataList: [],
|
|
|
|
|
// 金刚区
|
|
|
|
|
mainTypeList: [],
|
|
|
|
|
mainTypeLeft: 0,
|
|
|
|
|
mainNavIndex: 0,
|
|
|
|
|
|
|
|
|
|
xpth: {}, // 新品特惠
|
|
|
|
|
XPathBannerIndex: 0,
|
|
|
|
|
xpthIndex: 0,
|
|
|
|
|
list: [], // 热门推荐
|
|
|
|
|
|
|
|
|
|
// 公共服务
|
|
|
|
|
publicSerivce: [],
|
|
|
|
|
|
|
|
|
|
// 旅游助手
|
|
|
|
|
travelData: [],
|
|
|
|
|
|
|
|
|
|
// 数字文旅
|
|
|
|
|
travelCulture: [],
|
|
|
|
|
scrollLeft: 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 十全十美
|
|
|
|
|
// area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"],
|
|
|
|
|
SQSM: [],
|
|
|
|
|
|
|
|
|
|
// 长三角文旅平台
|
|
|
|
|
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/20250604/5112dd50e7c175bf58416ba9d4e4b846.png",
|
|
|
|
|
"type": "h5",
|
|
|
|
|
"url": "https://tour.wlczy.com/h5/"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "畅游宿迁",
|
|
|
|
|
"icon": "https://static.ticket.sz-trip.com/uploads/20250604/962f331b2319b9759363c3787ca8d088.png",
|
|
|
|
|
"type": "mini",
|
|
|
|
|
"path": "/pages/index/index",
|
|
|
|
|
"appid": "wxcb00a59c4fba136e"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
// 回购榜
|
|
|
|
|
repurchaseList: [],
|
|
|
|
|
canGetrepurchase: true,
|
|
|
|
|
|
|
|
|
|
urltopage: {},
|
|
|
|
|
|
|
|
|
|
cityIndex: 0,
|
|
|
|
|
scrollItem: "scrollItem-0",
|
|
|
|
|
|
|
|
|
|
aiStr: "",
|
|
|
|
|
|
|
|
|
|
// ---------------2025-5-26改版没用到的------------------
|
|
|
|
|
fourProduct: [],
|
|
|
|
|
hotIndex: 0,
|
|
|
|
|
indexHot: [],
|
|
|
|
|
weather: null,
|
|
|
|
|
showMore: false,
|
|
|
|
|
|
|
|
|
|
// 页面图片
|
|
|
|
|
// imageSourceList:imageSource,
|
|
|
|
|
|
|
|
|
|
recommendType: [{
|
|
|
|
|
id: 306,
|
|
|
|
|
name: '必逛景点榜',
|
|
|
|
|
img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png',
|
|
|
|
|
path: '/pages/list/scene/index',
|
|
|
|
|
list: []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 307,
|
|
|
|
|
name: '寻鲜美食榜',
|
|
|
|
|
img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png',
|
|
|
|
|
path: '/subPackages/foodListNew/index',
|
|
|
|
|
list: []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 308,
|
|
|
|
|
name: '优选住宿榜',
|
|
|
|
|
img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png',
|
|
|
|
|
path: '/pages/pbService/web/index?weburl=' + encodeURIComponent(
|
|
|
|
|
'https://m.cloud.sz-trip.com/selectedHotels'),
|
|
|
|
|
list: []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 309,
|
|
|
|
|
name: '必看演出榜',
|
|
|
|
|
img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png',
|
|
|
|
|
path: '/pages/list/theatre/index',
|
|
|
|
|
list: []
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
activeIndex: 0,
|
|
|
|
|
cardStyles: [],
|
|
|
|
|
cardTouchStartX: 0, // 卡片堆叠专用
|
|
|
|
|
|
|
|
|
|
// ========== 十二时辰相关 ==========
|
|
|
|
|
twelveActiveIndex: 0,
|
|
|
|
|
navScrollLeft: 0,
|
|
|
|
|
isProgramScroll: false,
|
|
|
|
|
scrollTouchStartX: 0, // 滚动专用
|
|
|
|
|
scrollTouchStartTime: 0, // 滚动专用
|
|
|
|
|
windowWidth: 375,
|
|
|
|
|
rpxRatio: 0.5,
|
|
|
|
|
twelvePeriodList: [{
|
|
|
|
|
name: '清晨',
|
|
|
|
|
desc: '一碗头汤面',
|
|
|
|
|
imgNormal: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/1.png',
|
|
|
|
|
imgSelected: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/1s.png',
|
|
|
|
|
id: '333',
|
|
|
|
|
list: [],
|
|
|
|
|
num: 6,
|
|
|
|
|
type: 'food'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '上午',
|
|
|
|
|
desc: '游园入梦来',
|
|
|
|
|
imgNormal: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/2.png',
|
|
|
|
|
imgSelected: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/2s.png',
|
|
|
|
|
id: '334',
|
|
|
|
|
list: [],
|
|
|
|
|
num: 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '中午',
|
|
|
|
|
desc: '游乐拾清欢',
|
|
|
|
|
imgNormal: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/3.png',
|
|
|
|
|
imgSelected: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/3s.png',
|
|
|
|
|
id: '335',
|
|
|
|
|
list: [],
|
|
|
|
|
num: 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '午后',
|
|
|
|
|
desc: '华灯映水巷',
|
|
|
|
|
imgNormal: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/4.png',
|
|
|
|
|
imgSelected: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/4s.png',
|
|
|
|
|
id: '336',
|
|
|
|
|
list: [],
|
|
|
|
|
num: 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '傍晚',
|
|
|
|
|
desc: '江南踏月歌',
|
|
|
|
|
imgNormal: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/5.png',
|
|
|
|
|
imgSelected: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/5s.png',
|
|
|
|
|
id: '337',
|
|
|
|
|
list: [],
|
|
|
|
|
num: 6
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
rpxRatio: 0.5,
|
|
|
|
|
},
|
|
|
|
|
onLoad: function(options) {
|
|
|
|
|
// 初始化时计算一次样式
|
|
|
|
|
this.updateCardStyles();
|
|
|
|
|
this.initTimeIndex();
|
|
|
|
|
// 相城小程序跳转获取用户信息
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onReady: function() {
|
|
|
|
|
this.getHeight()
|
|
|
|
|
this.getWeather() // 天气
|
|
|
|
|
this.getIndexSeason()
|
|
|
|
|
this.getBanner()
|
|
|
|
|
|
|
|
|
|
this.setAiStr()
|
|
|
|
|
|
|
|
|
|
this.getXpthList() // 限时特惠
|
|
|
|
|
|
|
|
|
|
this.getList() // 回购榜
|
|
|
|
|
|
|
|
|
|
this.getRepurchaseList()
|
|
|
|
|
|
|
|
|
|
// this.getFourProduct() // 活动日历
|
|
|
|
|
|
|
|
|
|
wx.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
lat: res.latitude,
|
|
|
|
|
lon: res.longitude
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
fail: (err) => {}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.getUrlToPage()
|
|
|
|
|
this.getShowMore()
|
|
|
|
|
|
|
|
|
|
const typeList = this.data.recommendType;
|
|
|
|
|
|
|
|
|
|
// 遍历数组进行请求
|
|
|
|
|
typeList.forEach((item, index) => {
|
|
|
|
|
// 1. 根据索引判断接口地址 (前两个用 scene 接口,后面用 product 接口)
|
|
|
|
|
let apiUrl = '';
|
|
|
|
|
if (index < 2) {
|
|
|
|
|
apiUrl = 'scene/get_scene_by_tag_subject';
|
|
|
|
|
} else {
|
|
|
|
|
apiUrl = 'product/get_product_by_tag_subject';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 发起请求
|
|
|
|
|
commonApi._post(apiUrl, {
|
|
|
|
|
offset: 0,
|
|
|
|
|
limit: 3,
|
|
|
|
|
tag_id: item.id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
const key = `recommendType[${index}].list`;
|
|
|
|
|
res.data.list.forEach(item => {
|
|
|
|
|
// 手动增加一个 tagsArray 字段
|
|
|
|
|
if (item.display_tags) {
|
|
|
|
|
item.tagsArray = item.display_tags.split(',').slice(0, 2);
|
|
|
|
|
} else {
|
|
|
|
|
item.tagsArray = [];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.setData({
|
|
|
|
|
[key]: res.data.list // 假设返回的数据里直接有 list 字段
|
|
|
|
|
});
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.error(`请求第 ${index + 1} 个榜单失败`, err);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 十二时辰初始化
|
|
|
|
|
this.getTwelveList();
|
|
|
|
|
|
|
|
|
|
// 获取屏幕宽度
|
|
|
|
|
const systemInfo = wx.getSystemInfoSync();
|
|
|
|
|
console.log('屏幕信息:', systemInfo);
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
windowWidth: systemInfo.windowWidth,
|
|
|
|
|
rpxRatio: systemInfo.windowWidth / 750
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 延迟执行滚动
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log('准备初始化滚动,当前索引:', this.data.twelveActiveIndex);
|
|
|
|
|
this.scrollToCenter(this.data.twelveActiveIndex);
|
|
|
|
|
}, 800); // 增加到800ms确保DOM完全渲染
|
|
|
|
|
},
|
|
|
|
|
stopTouchMove: function() {
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 根据当前时间初始化选中的时间段
|
|
|
|
|
*/
|
|
|
|
|
initTimeIndex() {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const totalMinutes = now.getHours() * 60 + now.getMinutes();
|
|
|
|
|
let idx = 0;
|
|
|
|
|
|
|
|
|
|
if (totalMinutes >= 240 && totalMinutes < 540) {
|
|
|
|
|
idx = 0; // 清晨
|
|
|
|
|
} else if (totalMinutes >= 540 && totalMinutes < 690) {
|
|
|
|
|
idx = 1; // 上午
|
|
|
|
|
} else if (totalMinutes >= 690 && totalMinutes < 840) {
|
|
|
|
|
idx = 2; // 中午
|
|
|
|
|
} else if (totalMinutes >= 840 && totalMinutes < 1080) {
|
|
|
|
|
idx = 3; // 午后
|
|
|
|
|
} else {
|
|
|
|
|
idx = 4; // 傍晚
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('🕐 初始化时间段:', idx, '当前时间:', now.getHours() + ':' + now.getMinutes());
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
twelveActiveIndex: idx
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取各时间段的数据列表
|
|
|
|
|
*/
|
|
|
|
|
getTwelveList() {
|
|
|
|
|
const list = this.data.twelvePeriodList;
|
|
|
|
|
|
|
|
|
|
list.forEach((subItem, index) => {
|
|
|
|
|
let apiUrl = '';
|
|
|
|
|
let params = {
|
|
|
|
|
offset: 0,
|
|
|
|
|
limit: 20,
|
|
|
|
|
tag_id: subItem.id
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (subItem.id == '333') {
|
|
|
|
|
apiUrl = 'scene/get_scene_by_tag_subject';
|
|
|
|
|
params.food = 1;
|
|
|
|
|
} else {
|
|
|
|
|
apiUrl = 'product/get_product_by_tag_subject';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commonApi._post(apiUrl, params).then(res => {
|
|
|
|
|
if (res.data && res.data.list) {
|
|
|
|
|
const key = `twelvePeriodList[${index}].list`;
|
|
|
|
|
this.setData({
|
|
|
|
|
[key]: res.data.list
|
|
|
|
|
});
|
|
|
|
|
console.log(`✅ 获取时间段 ${index} 数据成功,数量:`, res.data.list.length);
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.error(`❌ 获取时间段 ${index} 数据失败:`, err);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 触摸开始 - 十二时辰滚动专用
|
|
|
|
|
*/
|
|
|
|
|
handleScrollTouchStart(e) {
|
|
|
|
|
console.log('👆 滚动触摸开始');
|
|
|
|
|
this.setData({
|
|
|
|
|
scrollTouchStartX: e.touches[0].pageX,
|
|
|
|
|
scrollTouchStartTime: Date.now()
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 触摸移动 - 十二时辰滚动专用
|
|
|
|
|
*/
|
|
|
|
|
handleScrollTouchMove(e) {
|
|
|
|
|
// 如果是程序控制的滚动,允许通过
|
|
|
|
|
if (this.data.isProgramScroll) {
|
|
|
|
|
console.log('✅ 程序滚动,允许通过');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const moveX = Math.abs(e.touches[0].pageX - this.data.scrollTouchStartX);
|
|
|
|
|
const moveTime = Date.now() - this.data.scrollTouchStartTime;
|
|
|
|
|
|
|
|
|
|
console.log('📏 移动距离:', moveX, 'px, 移动时间:', moveTime, 'ms');
|
|
|
|
|
|
|
|
|
|
// 判断是否为滑动行为
|
|
|
|
|
if (moveX > 15 && moveTime < 300) {
|
|
|
|
|
console.log('🚫 阻止用户快速滑动');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 滚动监听
|
|
|
|
|
*/
|
|
|
|
|
onNavScroll(e) {
|
|
|
|
|
// 如果是程序控制的滚动,不处理
|
|
|
|
|
if (this.data.isProgramScroll) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('📜 用户手动滚动:', e.detail.scrollLeft);
|
|
|
|
|
|
|
|
|
|
if (this.scrollTimer) clearTimeout(this.scrollTimer);
|
|
|
|
|
this.scrollTimer = setTimeout(() => {
|
|
|
|
|
console.log('⏸ 滚动结束');
|
|
|
|
|
}, 150);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点击顶部时间段
|
|
|
|
|
*/
|
|
|
|
|
handleTwelveTabClick(e) {
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
console.log('🖱 点击时间段,索引:', index, '当前索引:', this.data.twelveActiveIndex);
|
|
|
|
|
|
|
|
|
|
if (this.data.twelveActiveIndex === index) {
|
|
|
|
|
console.log('⚠️ 点击的是当前项,不执行滚动');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
twelveActiveIndex: index
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.scrollToCenter(index);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 滚动到指定索引的中心位置
|
|
|
|
|
*/
|
|
|
|
|
scrollToCenter(index) {
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
console.log('🎯 开始滚动到索引:', index);
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
|
|
|
|
|
// 标记为程序滚动
|
|
|
|
|
this.setData({ isProgramScroll: true });
|
|
|
|
|
console.log('🔒 已设置 isProgramScroll = true');
|
|
|
|
|
|
|
|
|
|
const query = wx.createSelectorQuery();
|
|
|
|
|
query.select('.nav-scroll-wrapper').boundingClientRect();
|
|
|
|
|
query.select('#nav-item-' + index).boundingClientRect();
|
|
|
|
|
|
|
|
|
|
query.exec((res) => {
|
|
|
|
|
console.log('🔍 query结果:', res);
|
|
|
|
|
|
|
|
|
|
if (!res[0]) {
|
|
|
|
|
console.log('❌ scroll-view 未找到!');
|
|
|
|
|
this.setData({ isProgramScroll: false });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!res[1]) {
|
|
|
|
|
console.log('❌ 目标item (#nav-item-' + index + ') 未找到!');
|
|
|
|
|
this.setData({ isProgramScroll: false });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const scrollView = res[0];
|
|
|
|
|
const targetItem = res[1];
|
|
|
|
|
|
|
|
|
|
console.log('📊 scrollView信息:', {
|
|
|
|
|
left: scrollView.left,
|
|
|
|
|
width: scrollView.width
|
|
|
|
|
});
|
|
|
|
|
console.log('📊 targetItem信息:', {
|
|
|
|
|
left: targetItem.left,
|
|
|
|
|
width: targetItem.width
|
|
|
|
|
});
|
|
|
|
|
console.log('📊 当前navScrollLeft:', this.data.navScrollLeft);
|
|
|
|
|
|
|
|
|
|
// 计算目标位置
|
|
|
|
|
const scrollLeft = targetItem.left - scrollView.left - (scrollView.width / 2) + (targetItem.width / 2) + this.data.navScrollLeft;
|
|
|
|
|
|
|
|
|
|
console.log('💡 计算公式:');
|
|
|
|
|
console.log(` ${targetItem.left} - ${scrollView.left} - (${scrollView.width}/2) + (${targetItem.width}/2) + ${this.data.navScrollLeft}`);
|
|
|
|
|
console.log('🎯 计算的scrollLeft:', scrollLeft);
|
|
|
|
|
console.log('🎯 实际设置的scrollLeft:', Math.max(0, scrollLeft));
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
navScrollLeft: Math.max(0, scrollLeft)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log('✅ 已更新 navScrollLeft, 等待滚动动画...');
|
|
|
|
|
|
|
|
|
|
// 等待滚动动画完成后解除锁定
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setData({ isProgramScroll: false });
|
|
|
|
|
console.log('🔓 滚动完成,已解除锁定');
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
}, 400);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 底部内容滑动联动
|
|
|
|
|
*/
|
|
|
|
|
onTwelveSwipeChange(e) {
|
|
|
|
|
console.log('📱 底部swiper切换:', e.detail);
|
|
|
|
|
|
|
|
|
|
if (e.detail.source === 'touch' || e.detail.source === 'autoplay') {
|
|
|
|
|
const index = e.detail.current;
|
|
|
|
|
console.log('➡️ 切换到索引:', index);
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
twelveActiveIndex: index
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.scrollToCenter(index);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点击"查看更多"按钮
|
|
|
|
|
*/
|
|
|
|
|
handleShowMore(e) {
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
const key = `twelvePeriodList[${index}].num`;
|
|
|
|
|
console.log('📋 显示更多,索引:', index);
|
|
|
|
|
this.setData({
|
|
|
|
|
[key]: 100
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 1. 点击 Tab 切换
|
|
|
|
|
handleTabClick(e) {
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
this.setData({
|
|
|
|
|
activeIndex: index
|
|
|
|
|
});
|
|
|
|
|
this.updateCardStyles(); // 更新样式
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 2. 点击卡片切换
|
|
|
|
|
handleCardClick(e) {
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
if (index !== this.data.activeIndex) {
|
|
|
|
|
this.setData({
|
|
|
|
|
activeIndex: index
|
|
|
|
|
});
|
|
|
|
|
this.updateCardStyles(); // 更新样式
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 3. ★核心逻辑:在 JS 中计算所有卡片的样式
|
|
|
|
|
updateCardStyles() {
|
|
|
|
|
const {
|
|
|
|
|
activeIndex,
|
|
|
|
|
recommendType
|
|
|
|
|
} = this.data;
|
|
|
|
|
const len = recommendType.length;
|
|
|
|
|
|
|
|
|
|
// 偏移量配置 (单位 rpx)
|
|
|
|
|
const xStep = 24;
|
|
|
|
|
const yStep = 14;
|
|
|
|
|
|
|
|
|
|
// 遍历生成每个卡片的样式字符串
|
|
|
|
|
const newStyles = recommendType.map((item, index) => {
|
|
|
|
|
// 计算距离
|
|
|
|
|
let diff = (index - activeIndex + len) % len;
|
|
|
|
|
|
|
|
|
|
let zIndex = 0;
|
|
|
|
|
let xOffset = 0;
|
|
|
|
|
let yOffset = 0;
|
|
|
|
|
let opacity = 1;
|
|
|
|
|
let bgColor = '#fcf1e2';
|
|
|
|
|
let bgImage = 'none';
|
|
|
|
|
|
|
|
|
|
if (diff === 0) {
|
|
|
|
|
// --- 第1层 (最上面) ---
|
|
|
|
|
zIndex = 10;
|
|
|
|
|
xOffset = 0;
|
|
|
|
|
yOffset = 0;
|
|
|
|
|
bgImage =
|
|
|
|
|
'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png)';
|
|
|
|
|
} else if (diff === 1) {
|
|
|
|
|
// --- 第2层 ---
|
|
|
|
|
zIndex = 9;
|
|
|
|
|
xOffset = xStep * 1;
|
|
|
|
|
yOffset = yStep * 1;
|
|
|
|
|
bgImage =
|
|
|
|
|
'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)';
|
|
|
|
|
} else if (diff === 2) {
|
|
|
|
|
// --- 第3层 ---
|
|
|
|
|
zIndex = 8;
|
|
|
|
|
xOffset = xStep * 2;
|
|
|
|
|
yOffset = yStep * 2;
|
|
|
|
|
bgImage =
|
|
|
|
|
'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)';
|
|
|
|
|
} else if (diff === 3) {
|
|
|
|
|
// --- 第4层 ---
|
|
|
|
|
zIndex = 7;
|
|
|
|
|
xOffset = xStep * 3;
|
|
|
|
|
yOffset = yStep * 3;
|
|
|
|
|
bgImage =
|
|
|
|
|
'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)';
|
|
|
|
|
} else {
|
|
|
|
|
// --- 储备层 (隐藏在第4层后面) ---
|
|
|
|
|
zIndex = 1;
|
|
|
|
|
xOffset = xStep * 3;
|
|
|
|
|
yOffset = yStep * 3;
|
|
|
|
|
bgImage =
|
|
|
|
|
'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造样式字符串
|
|
|
|
|
return `
|
|
|
|
|
z-index: ${zIndex};
|
|
|
|
|
transform: translate(${xOffset}rpx, ${yOffset}rpx);
|
|
|
|
|
opacity: ${opacity};
|
|
|
|
|
background-image: ${bgImage};
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
`;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 更新到视图
|
|
|
|
|
this.setData({
|
|
|
|
|
cardStyles: newStyles
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 卡片堆叠 - 触摸开始
|
|
|
|
|
handleTouchStart(e) {
|
|
|
|
|
this.setData({
|
|
|
|
|
cardTouchStartX: e.touches[0].clientX // 使用 cardTouchStartX
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 卡片堆叠 - 触摸结束
|
|
|
|
|
handleTouchEnd(e) {
|
|
|
|
|
const touchEndX = e.changedTouches[0].clientX;
|
|
|
|
|
const diff = this.data.cardTouchStartX - touchEndX; // 使用 cardTouchStartX
|
|
|
|
|
const len = this.data.recommendType.length;
|
|
|
|
|
let current = this.data.activeIndex;
|
|
|
|
|
|
|
|
|
|
if (diff > 50) {
|
|
|
|
|
current = (current + 1) % len;
|
|
|
|
|
} else if (diff < -50) {
|
|
|
|
|
current = (current - 1 + len) % len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current !== this.data.activeIndex) {
|
|
|
|
|
this.setData({
|
|
|
|
|
activeIndex: current
|
|
|
|
|
});
|
|
|
|
|
this.updateCardStyles();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setAiStr: function() {
|
|
|
|
|
let str = "你好啊,我是卿卿,我来带你游苏州~";
|
|
|
|
|
let i = 0;
|
|
|
|
|
let timer = setInterval(() => {
|
|
|
|
|
i++
|
|
|
|
|
this.setData({
|
|
|
|
|
aiStr: str.slice(0, i)
|
|
|
|
|
})
|
|
|
|
|
if (i > str.length) {
|
|
|
|
|
clearInterval(timer)
|
|
|
|
|
}
|
|
|
|
|
}, 125)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
showImg(img) {
|
|
|
|
|
if (!img) {
|
|
|
|
|
return img
|
|
|
|
|
}
|
|
|
|
|
if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) {
|
|
|
|
|
return img;
|
|
|
|
|
} else {
|
|
|
|
|
// return "https://test.api.cloud.sz-trip.com"+img
|
|
|
|
|
return "https://static.ticket.sz-trip.com" + img;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
gotoPath(e) {
|
|
|
|
|
console.log(e.currentTarget)
|
|
|
|
|
if (e.currentTarget.dataset.item.path) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: e.currentTarget.dataset.item.path,
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
gotoPaths(e) {
|
|
|
|
|
if (e.currentTarget.dataset.path) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: e.currentTarget.dataset.path,
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 获取系统信息
|
|
|
|
|
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() {
|
|
|
|
|
if (app.globalData.configJson && app.globalData.configJson.indexSeason) {
|
|
|
|
|
console.log('app', app.globalData.configJson)
|
|
|
|
|
this.setData({
|
|
|
|
|
indexHot: app.globalData.configJson.indexHot,
|
|
|
|
|
isTest: app.globalData.configJson.isTest,
|
|
|
|
|
indexSeason: app.globalData.configJson.indexSeason,
|
|
|
|
|
bannerDataList: (app.globalData.configJson.nav_menu || []),
|
|
|
|
|
mainTypeList: (app.globalData.configJson.menu_button || []),
|
|
|
|
|
publicSerivce: (app.globalData.configJson.service_data || []),
|
|
|
|
|
travelData: (app.globalData.configJson.travel_data || []),
|
|
|
|
|
travelCulture: (app.globalData.configJson.number_data || []),
|
|
|
|
|
SQSM: (app.globalData.configJson.city_data || []),
|
|
|
|
|
otherPlat: app.globalData.configJson.platform_data,
|
|
|
|
|
func_data: (app.globalData.configJson.func_data || {})
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// 小程序是3 测试H5 15
|
|
|
|
|
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
|
|
|
|
|
app.globalData.configJson.nav_menu = (res.data.nav_menu || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'nav_menu',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
app.globalData.configJson.menu_button = (res.data.menu_button || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'menu_button',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 公共服务 publicSerivce
|
|
|
|
|
app.globalData.configJson.service_data = (res.data.service_data || []).map((v,
|
|
|
|
|
index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'service_data',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 旅游助手 travelData
|
|
|
|
|
app.globalData.configJson.travel_data = (res.data.travel_data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'travel_data',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 数字文旅 travelCulture
|
|
|
|
|
app.globalData.configJson.number_data = (res.data.number_data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'number_data',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 十全十美 SQSM
|
|
|
|
|
app.globalData.configJson.city_data = (res.data.city_data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'city_data',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 其他平台otherPlat
|
|
|
|
|
app.globalData.configJson.platform_data = (res.data.platform_data || []).map((v,
|
|
|
|
|
index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'platform_data',
|
|
|
|
|
key_number: index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let func_data = {}
|
|
|
|
|
for (let item of (res.data.func_data || [])) {
|
|
|
|
|
func_data[item.jump_type] = true
|
|
|
|
|
}
|
|
|
|
|
app.globalData.configJson.func_data = func_data
|
|
|
|
|
console.log('webData', app.globalData.configJson)
|
|
|
|
|
this.setData({
|
|
|
|
|
indexHot: app.globalData.configJson.indexHot,
|
|
|
|
|
isTest: app.globalData.configJson.isTest,
|
|
|
|
|
otherPlat: app.globalData.configJson.platform_data,
|
|
|
|
|
indexSeason: app.globalData.configJson.indexSeason,
|
|
|
|
|
bannerDataList: (app.globalData.configJson.nav_menu || []),
|
|
|
|
|
mainTypeList: (app.globalData.configJson.menu_button || []),
|
|
|
|
|
publicSerivce: (app.globalData.configJson.service_data || []),
|
|
|
|
|
travelData: (app.globalData.configJson.travel_data || []),
|
|
|
|
|
travelCulture: (app.globalData.configJson.number_data || []),
|
|
|
|
|
SQSM: (app.globalData.configJson.city_data || []),
|
|
|
|
|
func_data: (app.globalData.configJson.func_data || {})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getShowMore() {
|
|
|
|
|
commonApi._post("multimedia/detail", {
|
|
|
|
|
id: 2462
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res && res.data) {
|
|
|
|
|
this.setData({
|
|
|
|
|
showMore: res.data.company_name == 1 ? true : false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// --------------------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
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 顶部banner
|
|
|
|
|
commonApi._post("adv/getAdv", {
|
|
|
|
|
position: 0,
|
|
|
|
|
type_id: 3
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let resData = (res.data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'bigBanner',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
banner: resData
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 专题banner
|
|
|
|
|
commonApi._post("adv/getAdv", {
|
|
|
|
|
position: 6,
|
|
|
|
|
type_id: 3
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let resData = (res.data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'specialBanner',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
ztbanner: resData
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 小banner
|
|
|
|
|
commonApi._post("adv/getAdv", {
|
|
|
|
|
position: 1,
|
|
|
|
|
type_id: 3
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let resData = (res.data || []).map((v, index) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
pagePoint: {
|
|
|
|
|
classification: 'smallBanner',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
xiaobanner: resData
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
//弹窗广告
|
|
|
|
|
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;
|
|
|
|
|
let source = e.currentTarget.dataset.source;
|
|
|
|
|
if (source) {
|
|
|
|
|
util.setGlobalPagePoint(source);
|
|
|
|
|
}
|
|
|
|
|
console.log(item)
|
|
|
|
|
if (item.pagePoint) {
|
|
|
|
|
this.newPagePoint(item.pagePoint)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
newPagePoint(param) {
|
|
|
|
|
commonApi._post("browse/newBuryingPoint", {
|
|
|
|
|
uuid: app.globalData.uuid,
|
|
|
|
|
drive: "mini",
|
|
|
|
|
...param,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//------------------------金刚区点击-------------------------------------
|
|
|
|
|
// 自定义数据的跳转
|
|
|
|
|
mainIconClick: function(e) {
|
|
|
|
|
let item = e.currentTarget.dataset.item
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 后台配置数据跳转
|
|
|
|
|
mainNavClick: function(e) {
|
|
|
|
|
let item = e.currentTarget.dataset.item
|
|
|
|
|
console.log(item)
|
|
|
|
|
if(item.menu_name == 'AI避高峰') this.gotoUrls()
|
|
|
|
|
if (item.pagePoint) {
|
|
|
|
|
this.newPagePoint(item.pagePoint)
|
|
|
|
|
}
|
|
|
|
|
util.setGlobalPagePoint(item.menu_name || "首页")
|
|
|
|
|
|
|
|
|
|
if (item.jump_type == "page") {
|
|
|
|
|
if (item.page.mini) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: "/" + item.page.mini,
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (item.page.tdata) {
|
|
|
|
|
//sph 视频号
|
|
|
|
|
if (item.page.tdata.appid && item.page.tdata.appid.indexOf("sph") >= 0) {
|
|
|
|
|
// if (item.page.tdata.page) {
|
|
|
|
|
// wx.openChannelsActivity({
|
|
|
|
|
// finderUserName: item.page.tdata.appid, // 视频号的原始ID
|
|
|
|
|
// feedId: item.page.tdata.page, // 视频号的视频ID
|
|
|
|
|
// success(res) {
|
|
|
|
|
// console.log('拉起视频号成功', res);
|
|
|
|
|
// },
|
|
|
|
|
// fail(res) {
|
|
|
|
|
// console.log('拉起视频号失败', res);
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// wx.openChannelsUserProfile({
|
|
|
|
|
// finderUserName: item.page.tdata.appid, // 视频号的原始ID
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
wx.openChannelsUserProfile({
|
|
|
|
|
finderUserName: item.page.tdata.appid, // 视频号的原始ID
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.page.tdata.ghid == "gh_b55e177a4069" || item.page.tdata.appid ==
|
|
|
|
|
'wx4bb7b6050831f585') {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: "/" + item.page.tdata.page,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
wx.navigateToMiniProgram({
|
|
|
|
|
appId: item.page.tdata.appid,
|
|
|
|
|
path: item.page.tdata.page
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (item.jump_type == "link") {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url),
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (item.jump_type == "text") {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: item.text,
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000,
|
|
|
|
|
})
|
|
|
|
|
}, 200);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 其他平台配置数据的跳转
|
|
|
|
|
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 => {
|
|
|
|
|
console.log("resData", res.data.adv);
|
|
|
|
|
(res.data.adv || []).forEach(v => {
|
|
|
|
|
v.pagePoint = {
|
|
|
|
|
classification: 'flashSales',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
(res.data.list || []).forEach(v => {
|
|
|
|
|
v.pagePoint = {
|
|
|
|
|
classification: 'flashSales',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
xpth: res.data
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 更换新品特惠 当即热门
|
|
|
|
|
changeXpthIndex: function(e) {
|
|
|
|
|
let value = e.currentTarget.dataset.value
|
|
|
|
|
this.setData({
|
|
|
|
|
xpthIndex: value
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
productGotoDetail: function(e) {
|
|
|
|
|
let item = e.currentTarget.dataset.item;
|
|
|
|
|
let source = e.currentTarget.dataset.source;
|
|
|
|
|
if (source) {
|
|
|
|
|
util.setGlobalPagePoint(source);
|
|
|
|
|
}
|
|
|
|
|
if (item.pagePoint) {
|
|
|
|
|
this.newPagePoint(item.pagePoint)
|
|
|
|
|
}
|
|
|
|
|
util.gotoDetail(item)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 热门推荐
|
|
|
|
|
getList: function() {
|
|
|
|
|
commonApi._post("product/get_product_by_tag_subject", {
|
|
|
|
|
tag_id: 85,
|
|
|
|
|
offset: 0,
|
|
|
|
|
limit: 5,
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let resData = res.data.list || []
|
|
|
|
|
resData.forEach(v => {
|
|
|
|
|
v.pagePoint = {
|
|
|
|
|
classification: 'hot',
|
|
|
|
|
key_number: v.id
|
|
|
|
|
};
|
|
|
|
|
v.display_tags_arr = v.display_tags ? v.display_tags.split(",") : []
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
list: resData
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 回购
|
|
|
|
|
getRepurchaseList: function() {
|
|
|
|
|
commonApi._post("repurchase/repurchase/getRepurchaseList", {}).then(res => {
|
|
|
|
|
(res.data || []).forEach(v => {
|
|
|
|
|
v.headimg = this.showImg(v.headimg)
|
|
|
|
|
v.pagePoint = {
|
|
|
|
|
classification: 'repurchase',
|
|
|
|
|
key_number: v.product_id
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
repurchaseList: res.data || []
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onReachBottom: function() {
|
|
|
|
|
// if (this.data.list.length < 30) {
|
|
|
|
|
// this.getList()
|
|
|
|
|
// }
|
|
|
|
|
// if (this.data.canGetrepurchase) {
|
|
|
|
|
// this.data.canGetrepurchase = false
|
|
|
|
|
// this.getRepurchaseList()
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
gotoDetail: function(e) {
|
|
|
|
|
let item = e.currentTarget.dataset.item;
|
|
|
|
|
let source = e.currentTarget.dataset.source;
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
|
|
console.log(index)
|
|
|
|
|
if (index == 1) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/subPackages/foodNew/index?id=' + item.id
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (source) {
|
|
|
|
|
util.setGlobalPagePoint(source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commonApi._post("repurchase/repurchase/recordClick", {
|
|
|
|
|
product_id: item.product_id
|
|
|
|
|
})
|
|
|
|
|
// item.id = item.type=='post'?item.product_id:item.scene_id
|
|
|
|
|
if (item.pagePoint) {
|
|
|
|
|
this.newPagePoint(item.pagePoint)
|
|
|
|
|
}
|
|
|
|
|
// util.gotoDetail(item);
|
|
|
|
|
util.gotoDetail(item);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
changeSimpleVal(e) {
|
|
|
|
|
let keyname = e.currentTarget.dataset.keyname;
|
|
|
|
|
let val = e.currentTarget.dataset.val;
|
|
|
|
|
let param = {}
|
|
|
|
|
param[keyname] = val
|
|
|
|
|
if (keyname == "cityIndex") {
|
|
|
|
|
let scrollIndex = val - 2
|
|
|
|
|
if (scrollIndex < 0) {
|
|
|
|
|
scrollIndex = 0
|
|
|
|
|
}
|
|
|
|
|
param.scrollItem = "scrollItem-" + scrollIndex
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData(param)
|
|
|
|
|
console.log(this.data)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShow: function() {
|
|
|
|
|
this.pagePoint({
|
|
|
|
|
event: 'home_view'
|
|
|
|
|
}, 1)
|
|
|
|
|
// 修复 首页广告点击后返回首页 tabbar不显示
|
|
|
|
|
if (this.data.showTime && !this.data.showFullAdv) {
|
|
|
|
|
wx.showTabBar()
|
|
|
|
|
}
|
|
|
|
|
util.clearGlobalPagePoint()
|
|
|
|
|
|
|
|
|
|
if (app.globalData.innerAudioContext) {
|
|
|
|
|
app.globalData.innerAudioContext.stop()
|
|
|
|
|
}
|
|
|
|
|
app.globalData.isCartBuy = false
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
goAIUrl() {
|
|
|
|
|
wx.switchTab({
|
|
|
|
|
url: '/pages/pbService/aiHelpYou/index',
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
goYjgl() {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/list/strategy/index'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
*/
|
|
|
|
|
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),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|