Browse Source

修改首页UI

修改首页UI
master
xuetaotao 4 years ago
parent
commit
27c0bb7eb1
  1. 2
      app.js
  2. 480
      pages/index/index.js
  3. 24
      pages/index/index.wxml

2
app.js

@ -22,7 +22,7 @@ App({
unique_key: "wechatxcx" unique_key: "wechatxcx"
}).then(res => { }).then(res => {
let data = JSON.parse(res.data); let data = JSON.parse(res.data);
data.isTest = data.isTest22?true:false; data.isTest = data.isTest23?true:false;
this.globalData.configJson = data this.globalData.configJson = data
}) })

480
pages/index/index.js

@ -6,66 +6,67 @@ import userApi from "../../utils/https/user"
import util from "../../utils/util" import util from "../../utils/util"
Page({ Page({
data: { data: {
banner:[], banner: [],
xiaobanner:[], xiaobanner: [],
height:0, height: 0,
padHeight:0, padHeight: 0,
right:0, right: 0,
weather:null, weather: null,
saleProduct:null, saleProduct: null,
roadProduct:null, roadProduct: null,
fourProduct:[], fourProduct: [],
hotIndex:0, hotIndex: 0,
indexHot:[], indexHot: [],
area_ids:["zhangjiagang","changshu","taicang","kunshan","wujiang","wuzhong","xiangcheng","gusu","gongyeyuanqu","gaoxin"], area_ids: ["zhangjiagang", "changshu", "taicang", "kunshan", "wujiang", "wuzhong", "xiangcheng", "gusu", "gongyeyuanqu", "gaoxin"],
month:"", month: "",
months:['JAN','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','oct','nov','dec'], months: ['JAN', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'oct', 'nov', 'dec'],
date:"", date: "",
list:[], list: [],
listMore:true, listMore: true,
isTest:false, isTest: false,
lat:"", lat: "",
lon:"", lon: "",
urltopage:{}, urltopage: {},
scrollLeft:0, scrollLeft: 0,
videoPrize:false, videoPrize: false,
prizeInfo:null, prizeInfo: null,
otherPlat:null, otherPlat: null,
activeBannerIndex:0, activeBannerIndex: 0,
smBannerIndex:0 smBannerIndex: 0,
indexSeason: {}
}, },
onLoad: function (options) { onLoad: function (options) {
if(options.from){ if (options.from) {
app.globalData.from = options.from; app.globalData.from = options.from;
} }
let systemInfo = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect(); let systemInfo = wx.getSystemInfoSync(), rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height; let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
wx.getLocation({ wx.getLocation({
type: 'gcj02', type: 'gcj02',
success:(res)=>{ success: (res) => {
this.setData({ this.setData({
lat:res.latitude, lat: res.latitude,
lon:res.longitude lon: res.longitude
}) })
this.getList() this.getList()
}, },
fail:(err)=>{ fail: (err) => {
this.getList() this.getList()
} }
}) })
this.setData({ this.setData({
height:height, height: height,
padHeight:systemInfo.statusBarHeight, padHeight: systemInfo.statusBarHeight,
right:(systemInfo.screenWidth - rect.right) + rect.width right: (systemInfo.screenWidth - rect.right) + rect.width
}) })
commonApi._post("pbservice/Other/getClientConfig",{ commonApi._post("pbservice/Other/getClientConfig", {
unique_key:"urltopage" unique_key: "urltopage"
}).then(res=>{ }).then(res => {
let data = JSON.parse(res.data) let data = JSON.parse(res.data)
this.setData({ this.setData({
urltopage:data urltopage: data
}) })
}) })
this.getTwoProduct() this.getTwoProduct()
@ -74,46 +75,46 @@ Page({
// 获取今天的日期 // 获取今天的日期
let today = new Date(); let today = new Date();
this.setData({ this.setData({
month:(this.data.months[today.getMonth()]).toUpperCase(), month: (this.data.months[today.getMonth()]).toUpperCase(),
date:today.getDate() date: today.getDate()
}) })
this.getVideoPrize() this.getVideoPrize()
}, },
onTabItemTap:function(e){ onTabItemTap: function (e) {
console.log(e,99999999) console.log(e, 99999999)
}, },
changeBannerIndex:function(e){ changeBannerIndex: function (e) {
this.setData({ this.setData({
activeBannerIndex:e.detail.current activeBannerIndex: e.detail.current
}) })
}, },
changeSmBannerIndex:function(e){ changeSmBannerIndex: function (e) {
this.setData({ this.setData({
smBannerIndex:e.detail.current smBannerIndex: e.detail.current
}) })
}, },
// 一城百馆 // 一城百馆
city:function(){ city: function () {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx114d514f39cb1fed', appId: 'wx114d514f39cb1fed',
path:"pages/entry/index" path: "pages/entry/index"
}) })
commonApi._post("browse/burying_point",{ commonApi._post("browse/burying_point", {
drive:"mini", drive: "mini",
title:"一城百馆", title: "一城百馆",
uuid:app.globalData.uuid uuid: app.globalData.uuid
}).then(res=>{ }).then(res => {
}) })
}, },
changeHotIndex:function(e){ changeHotIndex: function (e) {
this.setData({ this.setData({
hotIndex:e.currentTarget.dataset.index, hotIndex: e.currentTarget.dataset.index,
fourProduct:[] fourProduct: []
}) })
this.getFourProduct() this.getFourProduct()
}, },
getBanner:function(){ getBanner: function () {
// commonApi._post("adv/getAdvByKey",{ // commonApi._post("adv/getAdvByKey",{
// key:"xcxBanner" // key:"xcxBanner"
// }).then(res=>{ // }).then(res=>{
@ -130,171 +131,171 @@ Page({
// }) // })
// }) // })
// return; // return;
commonApi._post("adv/getAdv",{ commonApi._post("adv/getAdv", {
position:0, position: 0,
type_id:3 type_id: 3
}).then(res=>{ }).then(res => {
this.setData({ this.setData({
banner:res.data || [] banner: res.data || []
}) })
}) })
commonApi._post("adv/getAdv",{ commonApi._post("adv/getAdv", {
position:1, position: 1,
type_id:3 type_id: 3
}).then(res=>{ }).then(res => {
this.setData({ this.setData({
xiaobanner:res.data || [] xiaobanner: res.data || []
}) })
}) })
}, },
getWeather:function(){ getWeather: function () {
commonApi._post('pbservice/Ztfw/getWeather').then(res=>{ commonApi._post('pbservice/Ztfw/getWeather').then(res => {
console.log(res) console.log(res)
this.setData({ this.setData({
weather:res.data weather: res.data
}) })
}) })
}, },
saleDetail:function(){ saleDetail: function () {
}, },
getTwoProduct:function(){ getTwoProduct: function () {
// 获取首页限时特惠 // 获取首页限时特惠
commonApi._post('act/fast_sale_now',{ commonApi._post('act/fast_sale_now', {
offset:0, offset: 0,
limit:1 limit: 1
}).then(res=>{ }).then(res => {
if(res.data[0] && res.data[0].fast_sales_sku[0]){ if (res.data[0] && res.data[0].fast_sales_sku[0]) {
if(res.data[0].fast_sales_sku.length > 0){ if (res.data[0].fast_sales_sku.length > 0) {
let price = res.data[0].fast_sales_sku[0].price let price = res.data[0].fast_sales_sku[0].price
let data = res.data[0].fast_sales_sku[0] let data = res.data[0].fast_sales_sku[0]
for (let item of res.data[0].fast_sales_sku){ for (let item of res.data[0].fast_sales_sku) {
if (price > item.price) price = item.price if (price > item.price) price = item.price
} }
data.price = price data.price = price
this.setData({ this.setData({
saleProduct:data saleProduct: data
}) })
}else{ } else {
this.setData({ this.setData({
saleProduct:res.data[0].fast_sales_sku[0] saleProduct: res.data[0].fast_sales_sku[0]
}) })
} }
} }
}) })
commonApi._post("product/get_product_by_tag",{ commonApi._post("product/get_product_by_tag", {
tag_id:17, tag_id: 17,
offset:0, offset: 0,
limit:1, limit: 1,
sort: 'price', sort: 'price',
order: 'asc' order: 'asc'
}).then(res=>{ }).then(res => {
if(res.data.list.length > 0){ if (res.data.list.length > 0) {
let price = res.data.list[0].price let price = res.data.list[0].price
for(let item of res.data.list ){ for (let item of res.data.list) {
if(item.price > price){ if (item.price > price) {
price = item.price price = item.price
} }
} }
let data = res.data.list[0] let data = res.data.list[0]
data.price = price data.price = price
this.setData({ this.setData({
roadProduct:data roadProduct: data
}) })
}else{ } else {
this.setData({ this.setData({
roadProduct:[111] roadProduct: [111]
}) })
} }
}) })
}, },
getFourProduct:function(){ getFourProduct: function () {
let item = this.data.indexHot[this.data.hotIndex],service="product/get_product_by_tag",data={ let item = this.data.indexHot[this.data.hotIndex], service = "product/get_product_by_tag", data = {
tag_id:item.id, tag_id: item.id,
offset:0, offset: 0,
limit:4, limit: 4,
sort:'weight', sort: 'weight',
order:'desc' order: 'desc'
}; };
if(item.type=='scene'){ if (item.type == 'scene') {
service="scene/get_scene_by_tag"; service = "scene/get_scene_by_tag";
} }
else if(item.type=='movie'){ else if (item.type == 'movie') {
service="Cinema/getHotMovieList"; service = "Cinema/getHotMovieList";
data = { data = {
page:1, page: 1,
pageSize:4 pageSize: 4
}; };
} }
commonApi._post(service,data).then(res=>{ commonApi._post(service, data).then(res => {
this.setData({ this.setData({
fourProduct:res.data.list || res.data fourProduct: res.data.list || res.data
}) })
}) })
}, },
tagGotoDetail:function(e){ tagGotoDetail: function (e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
if(this.data.indexHot[this.data.hotIndex].type=='movie'){ if (this.data.indexHot[this.data.hotIndex].type == 'movie') {
wx.navigateTo({ wx.navigateTo({
url: '/pages/list/movieticket/list/info/index?id='+item.third_id+'&title='+item.title, url: '/pages/list/movieticket/list/info/index?id=' + item.third_id + '&title=' + item.title,
}) })
} }
else { else {
util.gotoDetail(item) util.gotoDetail(item)
} }
}, },
productGotoDetail:function(e){ productGotoDetail: function (e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
util.gotoDetail(item) util.gotoDetail(item)
}, },
gotoPath:function(e){ gotoPath: function (e) {
if(e.currentTarget.dataset.event){ if (e.currentTarget.dataset.event) {
this.pagePoint({event:e.currentTarget.dataset.event},1) this.pagePoint({ event: e.currentTarget.dataset.event }, 1)
} }
if(e.currentTarget.dataset.title=='书香借阅'){ if (e.currentTarget.dataset.title == '书香借阅') {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx165d4f1727f6bdb0', appId: 'wx165d4f1727f6bdb0',
path:'pages/home/home' path: 'pages/home/home'
}) })
return; return;
} }
wx.navigateTo({ wx.navigateTo({
url: e.currentTarget.dataset.path, url: e.currentTarget.dataset.path,
}) })
if(e.currentTarget.dataset.title){ if (e.currentTarget.dataset.title) {
commonApi._post("browse/burying_point",{ commonApi._post("browse/burying_point", {
uuid:app.globalData.uuid, uuid: app.globalData.uuid,
drive:"mini", drive: "mini",
title:e.currentTarget.dataset.title title: e.currentTarget.dataset.title
}).then(res=>{ }).then(res => {
}) })
} }
}, },
gotoUrl:function(e){ gotoUrl: function (e) {
if(e.currentTarget.dataset.event){ if (e.currentTarget.dataset.event) {
this.pagePoint({event:e.currentTarget.dataset.event},1) this.pagePoint({ event: e.currentTarget.dataset.event }, 1)
} }
let url = e.currentTarget.dataset.url; let url = e.currentTarget.dataset.url;
app.globalData.weburl = url; app.globalData.weburl = url;
wx.navigateTo({ wx.navigateTo({
url:"/pages/pbService/web/index" url: "/pages/pbService/web/index"
}) })
}, },
gotoMini:function(e){ gotoMini: function (e) {
let appid = e.currentTarget.dataset.appid,path = e.currentTarget.dataset.path let appid = e.currentTarget.dataset.appid, path = e.currentTarget.dataset.path
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: appid, appId: appid,
path:path path: path
}) })
}, },
garbage:function(){ garbage: function () {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx13be821f3b1afed3', appId: 'wx13be821f3b1afed3',
path:'pages/home/home' path: 'pages/home/home'
}) })
}, },
gotoSku:function(){ gotoSku: function () {
commonApi.user_post("pbservice/Ztfw/sukangCode").then(res=>{ commonApi.user_post("pbservice/Ztfw/sukangCode").then(res => {
console.log(res) console.log(res)
app.globalData.weburl = res.data.url; app.globalData.weburl = res.data.url;
wx.navigateTo({ wx.navigateTo({
@ -303,115 +304,115 @@ Page({
return; return;
}) })
}, },
audioGuide:function(){ audioGuide: function () {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx74f380bc721a0379', appId: 'wx74f380bc721a0379',
path:'/pages/listen/listen?title=君到苏州' path: '/pages/listen/listen?title=君到苏州'
}) })
commonApi._post("browse/burying_point",{ commonApi._post("browse/burying_point", {
drive:"mini", drive: "mini",
title:"语音导览", title: "语音导览",
uuid:app.globalData.uuid uuid: app.globalData.uuid
}).then(res=>{ }).then(res => {
}) })
}, },
// 热门推荐 去掉经纬度 接口排序方式变更(韩阳) // 热门推荐 去掉经纬度 接口排序方式变更(韩阳)
getList:function(){ getList: function () {
if(!this.data.listMore) return; if (!this.data.listMore) return;
commonApi._post("search/recommend",{ commonApi._post("search/recommend", {
offset:this.data.list.length, offset: this.data.list.length,
limit:16 limit: 16
}).then(res=>{ }).then(res => {
res.data.map(item=>{ res.data.map(item => {
if(item.ext.display_tags){ if (item.ext.display_tags) {
item.ext.display_tags = item.ext.display_tags.split(",").splice(0,2) item.ext.display_tags = item.ext.display_tags.split(",").splice(0, 2)
} }
else { else {
item.ext.display_tags = [] item.ext.display_tags = []
} }
}) })
if(res.data.length<15) { if (res.data.length < 15) {
this.setData({ this.setData({
listMore:false listMore: false
}) })
} }
this.setData({ this.setData({
list:this.data.list.concat(res.data) list: this.data.list.concat(res.data)
}) })
}) })
}, },
onReachBottom:function(){ onReachBottom: function () {
// this.getList() // this.getList()
}, },
gotoDetail:function(e){ gotoDetail: function (e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
util.pagePoint({ util.pagePoint({
event:'recommend_click', event: 'recommend_click',
param: { param: {
id:item.id, id: item.id,
type:item.type type: item.type
} }
},1) }, 1)
if(item.type=='travels'){ if (item.type == 'travels') {
// 游记做特殊处理 其他都按照原来的来 // 游记做特殊处理 其他都按照原来的来
wx.navigateTo({ wx.navigateTo({
url: '/pages/info/strategyInfo/index?id='+item.s_id, url: '/pages/info/strategyInfo/index?id=' + item.s_id,
}) })
} }
else { else {
util.gotoDetail(item.ext); util.gotoDetail(item.ext);
} }
}, },
meituan:function(){ meituan: function () {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wxde8ac0a21135c07d', appId: 'wxde8ac0a21135c07d',
path:"hotel/pages/h5/index?q=https%3A%2F%2Ffenxiao.meituan.com%2Fopdtor%2Fh5%2Fhotel%2Fsearch%3FpartnerId%3D16829" path: "hotel/pages/h5/index?q=https%3A%2F%2Ffenxiao.meituan.com%2Fopdtor%2Fh5%2Fhotel%2Fsearch%3FpartnerId%3D16829"
}) })
}, },
// 轮播图点击 // 轮播图点击
bannerClick:function(e){ bannerClick: function (e) {
if(this.data.isTest) return; if (this.data.isTest) return;
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
console.log(item) console.log(item)
this.pagePoint({ this.pagePoint({
event:"banner_click", event: "banner_click",
type:'banner' type: 'banner'
},1) }, 1)
switch(item.jump_type){ switch (item.jump_type) {
case 0: case 0:
break; break;
case 1: case 1:
util.gotoDetail(item.product_model) util.gotoDetail(item.product_model)
break; break;
case 2: case 2:
if(item.front_model && item.front_model.mini){ if (item.front_model && item.front_model.mini) {
wx.navigateTo({ wx.navigateTo({
url: "/"+item.front_model.mini url: "/" + item.front_model.mini
}) })
} }
break; break;
case 3: case 3:
if((item.tdata.indexOf('http://')!=-1 || item.tdata.indexOf('https://')!=-1) && item.tdata.indexOf('m.cloud.sz-trip.com')==-1){ if ((item.tdata.indexOf('http://') != -1 || item.tdata.indexOf('https://') != -1) && item.tdata.indexOf('m.cloud.sz-trip.com') == -1) {
// 外部h5 // 外部h5
console.log(item.tdata) console.log(item.tdata)
app.globalData.weburl = item.tdata; app.globalData.weburl = item.tdata;
wx.navigateTo({ wx.navigateTo({
url:"/pages/pbService/web/index" url: "/pages/pbService/web/index"
}) })
} }
else { else {
let page = item.tdata.split("/"); let page = item.tdata.split("/");
page = page[page.length-1].split("?") page = page[page.length - 1].split("?")
console.log(page[0]) console.log(page[0])
let url = this.data.urltopage[page[0]]; let url = this.data.urltopage[page[0]];
if(url && url.indexOf('map')!=-1){ if (url && url.indexOf('map') != -1) {
let types = ['','scenic','venue','post','restaurant','relic','tenscenic','cinema','academes'],type = page[1]?page[1].split("="):[]; let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', 'cinema', 'academes'], type = page[1] ? page[1].split("=") : [];
wx.reLaunch({ wx.reLaunch({
url: url+"?type="+(type[1]?types.findIndex(t=>t==type[1]):null) url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null)
}) })
} }
else if(url){ else if (url) {
wx.navigateTo({ wx.navigateTo({
url: url, url: url,
}) })
@ -419,37 +420,37 @@ Page({
else { else {
app.globalData.weburl = item.tdata; app.globalData.weburl = item.tdata;
wx.navigateTo({ wx.navigateTo({
url:"/pages/pbService/web/index" url: "/pages/pbService/web/index"
}) })
} }
} }
break; break;
case 4: case 4:
if(item.tdata.appid=='wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')){ if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) {
// 如果是苏心游的小程序 直接把authCode带过去 // 如果是苏心游的小程序 直接把authCode带过去
userApi.user_post("user/getJumpThirdAppCode",{}).then(res=>{ userApi.user_post("user/getJumpThirdAppCode", {}).then(res => {
let weburl = item.tdata.page let weburl = item.tdata.page
if(weburl.indexOf('?')!=-1){ if (weburl.indexOf('?') != -1) {
weburl += '&authCode='+res.data; weburl += '&authCode=' + res.data;
} }
else { else {
weburl += '?authCode='+res.data weburl += '?authCode=' + res.data
} }
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: item.tdata.appid, appId: item.tdata.appid,
path:weburl path: weburl
}) })
}).catch(err=>{ }).catch(err => {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: item.tdata.appid, appId: item.tdata.appid,
path:item.tdata.page path: item.tdata.page
}) })
}) })
} }
else { else {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: item.tdata.appid, appId: item.tdata.appid,
path:item.tdata.page path: item.tdata.page
}) })
} }
break; break;
@ -457,19 +458,19 @@ Page({
break; break;
} }
return; return;
}, },
bannerClick2:function(e){ bannerClick2: function (e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
if(item.action=='href'){ if (item.action == 'href') {
if(item.href.indexOf(",")!=-1){ if (item.href.indexOf(",") != -1) {
let info = item.href.split(","); let info = item.href.split(",");
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: info[0], appId: info[0],
path:info[1] path: info[1]
}) })
} }
else if(item.href.indexOf('map/index')!=-1){ else if (item.href.indexOf('map/index') != -1) {
wx.reLaunch({ wx.reLaunch({
url: item.href url: item.href
}) })
@ -480,7 +481,7 @@ Page({
}) })
} }
} }
else if(item.action=="web"){ else if (item.action == "web") {
app.globalData.weburl = item.href; app.globalData.weburl = item.href;
wx.navigateTo({ wx.navigateTo({
url: "/pages/pbService/web/index", url: "/pages/pbService/web/index",
@ -488,92 +489,93 @@ Page({
} }
}, },
// 监听文旅查询的scroll // 监听文旅查询的scroll
listenScroll(e){ listenScroll(e) {
this.setData({ this.setData({
scrollLeft:e.detail.scrollLeft scrollLeft: e.detail.scrollLeft
}) })
}, },
// 获取短视频大赛是否中奖 中奖详情 // 获取短视频大赛是否中奖 中奖详情
getVideoPrize(){ getVideoPrize() {
let user_id = wx.getStorageSync('jstrip_userid'); let user_id = wx.getStorageSync('jstrip_userid');
if(!user_id || wx.getStorageSync('indexPriceNoTip')) return; if (!user_id || wx.getStorageSync('indexPriceNoTip')) return;
commonApi.user_post('actonline/video_act/getRaffle',{ commonApi.user_post('actonline/video_act/getRaffle', {
act_id:5 act_id: 5
}).then(res=>{ }).then(res => {
this.setData({ this.setData({
videoPrize:res.data videoPrize: res.data
}) })
}) })
}, },
noMoreTip(){ noMoreTip() {
wx.setStorageSync('indexPriceNoTip', true) wx.setStorageSync('indexPriceNoTip', true)
this.closePrice() this.closePrice()
}, },
closePrice(){ closePrice() {
this.setData({ this.setData({
videoPrize:false, videoPrize: false,
prizeInfo:null prizeInfo: null
}) })
}, },
// 抽奖 // 抽奖
choosePrize(){ choosePrize() {
commonApi.user_post('actonline/video_act/luckyDraw',{ commonApi.user_post('actonline/video_act/luckyDraw', {
act_id:5 act_id: 5
}).then(res=>{ }).then(res => {
this.setData({ this.setData({
prizeInfo:res.data prizeInfo: res.data
}) })
if(res.data.type!='none'){ if (res.data.type != 'none') {
// 抽奖成功的话 弹框 // 抽奖成功的话 弹框
wx.showModal({ wx.showModal({
title:"提示", title: "提示",
content:"中奖人员请联系君到苏州客服,领奖方式以客服通知为准", content: "中奖人员请联系君到苏州客服,领奖方式以客服通知为准",
showCancel:false showCancel: false
}) })
} }
}) })
}, },
onReady:function(){ onReady: function () {
if(app.globalData.configJson){ if (app.globalData.configJson) {
this.setData({ this.setData({
indexHot:app.globalData.configJson.indexHot, indexHot: app.globalData.configJson.indexHot,
isTest:app.globalData.configJson.isTest, isTest: app.globalData.configJson.isTest,
otherPlat:app.globalData.configJson.otherPlats otherPlat: app.globalData.configJson.otherPlats,
indexSeason: app.globalData.configJson.indexSeason
}) })
console.log(app.globalData.configJson) console.log(app.globalData.configJson)
this.getFourProduct() this.getFourProduct()
} }
else { else {
setTimeout(()=>{ setTimeout(() => {
this.onReady() this.onReady()
},300) }, 300)
} }
}, },
gotoOther:function(e){ gotoOther: function (e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
if(item.type=='h5'){ if (item.type == 'h5') {
app.globalData.weburl = item.url app.globalData.weburl = item.url
wx.navigateTo({ wx.navigateTo({
url:"/pages/pbService/web/index" url: "/pages/pbService/web/index"
}) })
} }
else if(item.type=='mini'){ else if (item.type == 'mini') {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: item.appid, appId: item.appid,
path:item.path path: item.path
}) })
} }
else if(item.type=='page'){ else if (item.type == 'page') {
wx.navigateTo({ wx.navigateTo({
url: item.page, url: item.page,
}) })
} }
}, },
pagePoint: function(e,type){ pagePoint: function (e, type) {
util.pagePoint(e,type) util.pagePoint(e, type)
}, },
onShow: function() { onShow: function () {
this.pagePoint({event:'home_view'},1) this.pagePoint({ event: 'home_view' }, 1)
}, },
/** /**

24
pages/index/index.wxml

@ -1,8 +1,9 @@
<!--index.wxml--> <!--index.wxml-->
<title title="君到苏州(文化旅游总入口)"></title> <title title="君到苏州(文化旅游总入口)"></title>
<!-- <view class="old-btn">关怀模式</view> --> <!-- <view class="old-btn">关怀模式</view> -->
<image class="top-bg-img" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/spring22/flowerbg.png" mode="widthFix"></image> <!-- <image class="top-bg-img" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/spring22/flowerbg.png" mode="widthFix"></image> -->
<image class="top-bg-img" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/spring22/flower.gif" mode="widthFix"></image> <!-- <image class="top-bg-img" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/spring22/flower.gif" mode="widthFix"></image> -->
<image class="top-bg-img" src="{{indexSeason.topBac}}" mode="widthFix"></image>
<view wx:if="{{weather}}" class="top-box"> <view wx:if="{{weather}}" class="top-box">
<image src="{{weather.icon2}}" style="margin-left:0" mode="aspectFill"></image> <image src="{{weather.icon2}}" style="margin-left:0" mode="aspectFill"></image>
<view class="weather-num">{{weather.max_temp}}°</view> <view class="weather-num">{{weather.max_temp}}°</view>
@ -136,8 +137,7 @@
</view> </view>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0"> <view class="sale-road-boxes" style="margin-top:0">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title1.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.lyzs}}"></image>
</image>
</view> </view>
<view class="pic-list" style="margin-top:20rpx"> <view class="pic-list" style="margin-top:20rpx">
<image bindtap="gotoPath" data-event="food_click" data-title="街巷美食" data-path="/pages/list/{{isTest?'road':'food'}}/index" <image bindtap="gotoPath" data-event="food_click" data-title="街巷美食" data-path="/pages/list/{{isTest?'road':'food'}}/index"
@ -149,8 +149,7 @@
<image bindtap="city" data-event="city_click" src="https://static.ticket.sz-trip.com/xcxImages/index/pic4.png" mode="aspectFill"></image> <image bindtap="city" data-event="city_click" src="https://static.ticket.sz-trip.com/xcxImages/index/pic4.png" mode="aspectFill"></image>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0;align-items:center"> <view class="sale-road-boxes" style="margin-top:0;align-items:center">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title2.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.ggfw}}"></image>
</image>
<navigator url="/pages/pbService/index" catchtap="pagePoint" data-event="public_view" class="title-more">更多<text class="iconfont icon-you"></text> </navigator> <navigator url="/pages/pbService/index" catchtap="pagePoint" data-event="public_view" class="title-more">更多<text class="iconfont icon-you"></text> </navigator>
</view> </view>
<view style="overflow-x:auto"> <view style="overflow-x:auto">
@ -174,8 +173,7 @@
</view> </view>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0"> <view class="sale-road-boxes" style="margin-top:0">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title3.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.wlcx}}"></image>
</image>
</view> </view>
<scroll-view scroll-x style="height:360rpx" bindscroll="listenScroll" class="slide-box"> <scroll-view scroll-x style="height:360rpx" bindscroll="listenScroll" class="slide-box">
<view class="pbservice" style="margin-bottom:30rpx"> <view class="pbservice" style="margin-bottom:30rpx">
@ -239,8 +237,7 @@
<view class="scroll-line-bg" style="width:{{4 / 5 * 100}}%;margin-left:{{scrollLeft}}px"></view> <view class="scroll-line-bg" style="width:{{4 / 5 * 100}}%;margin-left:{{scrollLeft}}px"></view>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0"> <view class="sale-road-boxes" style="margin-top:0">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title4.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.sqj}}"></image>
</image>
</view> </view>
<view class="six-box"> <view class="six-box">
<image bindtap="gotoPath" data-event="{{area_ids[index]}}_click" data-title="苏城六纪" data-path="/pages/list/six/index?area={{area_ids[index]}}" <image bindtap="gotoPath" data-event="{{area_ids[index]}}_click" data-title="苏城六纪" data-path="/pages/list/six/index?area={{area_ids[index]}}"
@ -248,8 +245,7 @@
</image> </image>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0" wx:if="{{otherPlat}}"> <view class="sale-road-boxes" style="margin-top:0" wx:if="{{otherPlat}}">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title5.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.csjwlpt}}"></image>
</image>
</view> </view>
<view class="other-plats" wx:if="{{otherPlat}}"> <view class="other-plats" wx:if="{{otherPlat}}">
<view class="other-plat" wx:for="{{otherPlat}}" bindtap="gotoOther" data-item="{{item}}"> <view class="other-plat" wx:for="{{otherPlat}}" bindtap="gotoOther" data-item="{{item}}">
@ -258,10 +254,8 @@
</view> </view>
</view> </view>
<view class="sale-road-boxes" style="margin-top:0"> <view class="sale-road-boxes" style="margin-top:0">
<image mode="widthFix" style="width:403rpx" src="https://static.ticket.sz-trip.com/xcxImages/spring22/title6.png"> <image mode="heightFix" style="height:86rpx" src="{{indexSeason.rmtj}}"></image>
</image>
</view> </view>
<view class="hot-list" wx:if="{{isTest==false}}"> <view class="hot-list" wx:if="{{isTest==false}}">
<view class="hot-list-item" wx:for="{{2}}" wx:for-index="number"> <view class="hot-list-item" wx:for="{{2}}" wx:for-index="number">
<view wx:for="{{list}}" wx:if="{{index%2==number}}" bindtap="gotoDetail" data-item="{{item}}"> <view wx:for="{{list}}" wx:if="{{index%2==number}}" bindtap="gotoDetail" data-item="{{item}}">

Loading…
Cancel
Save