diff --git a/app.json b/app.json index c86da7a..8bba4f0 100644 --- a/app.json +++ b/app.json @@ -229,26 +229,26 @@ "sitemapLocation": "sitemap.json", "tabBar": { "color": "#999", - "selectedColor": "#FF6756", + "selectedColor": "#F58812", "borderStyle": "white", "list": [ { "pagePath": "pages/index/index", "iconPath": "/images/home.png", - "selectedIconPath": "/images/index_seld_1.png", + "selectedIconPath": "/images/index_seld_2.png", "text": "首页", "shareTimeline": true }, { "pagePath": "pages/map/index", "iconPath": "/images/map.png", - "selectedIconPath": "/images/map_seld_1.png", + "selectedIconPath": "/images/map_seld_2.png", "text": "图游" }, { "pagePath": "pages/user/user", "iconPath": "/images/user.png", - "selectedIconPath": "/images/user_seld_1.png", + "selectedIconPath": "/images/user_seld_2.png", "text": "我的" } ] diff --git a/images/home.png b/images/home.png index 0911ce1..daff9c3 100755 Binary files a/images/home.png and b/images/home.png differ diff --git a/images/index-selds_1.png b/images/index-selds_1.png deleted file mode 100644 index fa7ca9a..0000000 Binary files a/images/index-selds_1.png and /dev/null differ diff --git a/images/index_seld_2.png b/images/index_seld_2.png new file mode 100644 index 0000000..9929818 Binary files /dev/null and b/images/index_seld_2.png differ diff --git a/images/map.png b/images/map.png index 2099fe7..205703a 100755 Binary files a/images/map.png and b/images/map.png differ diff --git a/images/map_seld_2.png b/images/map_seld_2.png new file mode 100644 index 0000000..cb83501 Binary files /dev/null and b/images/map_seld_2.png differ diff --git a/images/my-selds_1.png b/images/my-selds_1.png deleted file mode 100644 index c5103f6..0000000 Binary files a/images/my-selds_1.png and /dev/null differ diff --git a/images/tuyou-selds_1.png b/images/tuyou-selds_1.png deleted file mode 100644 index b8efcbc..0000000 Binary files a/images/tuyou-selds_1.png and /dev/null differ diff --git a/images/user.png b/images/user.png index 1f0b66e..0404c5f 100755 Binary files a/images/user.png and b/images/user.png differ diff --git a/images/user_seld_2.png b/images/user_seld_2.png new file mode 100644 index 0000000..5e6e54c Binary files /dev/null and b/images/user_seld_2.png differ diff --git a/pages/index/index.js b/pages/index/index.js index 8c339b2..315ced7 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -4,6 +4,7 @@ let app = getApp() 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: { banner: [], @@ -17,9 +18,7 @@ Page({ fourProduct: [], hotIndex: 0, indexHot: [], - area_ids: ["zhangjiagang", "changshu", "taicang", "kunshan", "wujiang", "wuzhong", "xiangcheng", "gusu", - "gongyeyuanqu", "gaoxin" - ], + month: "", months: ['JAN', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'oct', 'nov', 'dec'], date: "", @@ -34,7 +33,8 @@ Page({ prizeInfo: null, otherPlat: null, activeBannerIndex: 0, - smBannerIndex: 0, + smBannerIndex: 0, + XPathBannerIndex: 0, indexSeason: {}, // startList: [], // 启动页广告 startList: { @@ -48,98 +48,36 @@ Page({ showTime: false, xpth: {}, // 元旦新增 新品特惠和sqjNew djs: null, // 元旦新增 新品特惠倒计时 - djsTime: null, + djsTime: null, + area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"], sqjNew: [ - 'https://static.ticket.sz-trip.com/uploads/20240428/faede304469bb3e7b9bbf7001008d09a.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/77c3bd6c3f44ee0e3cc483557c1c7462.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/ad2324005ba1ed0cabe990ec62bfec76.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/a90f3ce4519a585cc5cebfe62d8d4043.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/e6fa6cdef2971c8abdb670be1f36d1ca.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/9c8186b8249bf81a2ef4fe4a4194cf2b.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/755ee01ac248aeda8812b025f483a869.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/2d29f0d14e634b0a78d4ef91b28d5999.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/71f7b558c7ca6d42728d48508d01819c.png', - 'https://static.ticket.sz-trip.com/uploads/20240428/23e07551be831036116c2fedbbf7aea5.png', + 'https://static.ticket.sz-trip.com/uploads/20241012/df831b80bc445aef8dc439ef8f9761a2.png',// 常熟 + 'https://static.ticket.sz-trip.com/uploads/20241012/9a5dc85879e87cc21f4d10286c84ac5f.png',// 太仓 + 'https://static.ticket.sz-trip.com/uploads/20241012/fceaa177de4ed13e7884ccfafb75c6ae.png',// 昆山 + 'https://static.ticket.sz-trip.com/uploads/20241012/c55a59f86b49af4ae15f1b1015887678.png',// 吴江 + 'https://static.ticket.sz-trip.com/uploads/20241012/a96c42d843dd1cc4a9ec30b189b35a6f.png',// 工业园区 + 'https://static.ticket.sz-trip.com/uploads/20241012/c1f61d9b2a13377c31561e6b50274c04.png',// 张家港 + 'https://static.ticket.sz-trip.com/uploads/20241012/b26ebd1a1ed1d5737cd22cc2da7e1b54.png',// 吴中 + 'https://static.ticket.sz-trip.com/uploads/20241012/eec299ac968f0344e124195155d88ed1.png',// 相城 + 'https://static.ticket.sz-trip.com/uploads/20241012/db5fcb0df2d8d326bd2b8d055b9284d2.png',// 姑苏 + 'https://static.ticket.sz-trip.com/uploads/20241012/279e21d3e876379140bf77d01410b07d.png',// 高新区 ], viewHeight: "0px", isMuted: true, - videoPlay: false, - hdrlNavList:[ - { - type:null, - title:'全部' - }, - { - type:'scene', - title:'景区活动' - }, - { - type:'show', - title:'演出' - }, - { - type:'exhibition', - title:'展览' - }, - { - type:'movie', - title:'电影' - }, - { - type:'other', - title:'其他' - } - ], //活动日历板块导航分类 - hdrlNavIndex:0,//活动日历默认选中第一个全部分类 - today:null, - hdrlList:[], - yszNav:['公共服务','旅游助手'], - yszIndex:0, - bdList:[ - { - bg: 'linear-gradient(172deg, #FFF3E5, #FFD9AD);', - icon:'https://static.ticket.sz-trip.com/uploads/20240923/15ee44a960511cdcf276b5d8df472626.png', //游 景点 - url:'', - path:'/pages/list/scene/index', - list: [], - - }, - { - bg: 'linear-gradient(172deg, #E7F1FF, #ADD1FF);', - icon:'https://static.ticket.sz-trip.com/uploads/20240923/cd652f4bcfcef7f55863bf8587609ca4.png', //非玩不可 景点产品 - path:'/pages/list/night/index', - url:'', - list: [], - - }, - { - bg: 'linear-gradient(172deg, #F0EBFF, #E3D9FF);', - icon:'https://static.ticket.sz-trip.com/uploads/20240923/a0b95152b87215dccbb2e5dfa1bfd145.png', //非看不可 - url:'', - path:'/pages/list/theatre/index', - list: [], - - }, - { - bg: 'linear-gradient(172deg, #FFEDF0, #FFC9D2);', - icon:'https://static.ticket.sz-trip.com/uploads/20240923/799befa78b1d474bfb26004cc2ef817d.png', //非买不可 - path:'/subPackages/techanNew/index', - url:'', - list: [], - - }, - - - ], - list1:[], //游-景点 - list2:[], //非晚-夜游 - list3:[], //非看-剧场演出 - list4:[], //非买-文创 - - nowDate: [('0' + (new Date().getMonth() + 1)).slice(-2) , ('0' + new Date().getDate()).slice(-2)] - + videoPlay: false, }, onLoad: function(options) { + console.log('options',options) + // 相城小程序跳转获取用户信息 + if(options && options.szxcCode) { + commonApi._post("uservice/user/loginByXC", { + code: options.szxcCode + }).then(res => { + if(res.data && res.data.id && res.data.token) { + https.set_logininfo(res); + } + }) + } this.getHeight() //全屏广告 wx.hideTabBar() //这里隐藏了底部导航栏 @@ -151,11 +89,9 @@ Page({ let length = res.data.length if (res.data.length > 1) { let num = Math.floor(Math.random() * length); - console.log('num', num); this.setData({ startList: res.data[num] }) - console.log(this.data.startList.head_img); } else { this.setData({ startList: res.data[0] @@ -198,21 +134,7 @@ Page({ }) if (options.from) { app.globalData.from = options.from; - } - // 获取今天的日期 - let today = new Date(); - this.setData({ - month: (this.data.months[today.getMonth()]).toUpperCase(), - date: today.getDate() - }) - let d = new Date(); - let month = d.getMonth() + 1, - day = d.getDate(); - month = month > 10 ? month : ("0" + month); - day = day > 10 ? day : ("0" + day); - this.setData({ - today: d.getFullYear() + "-" + month + "-" + day - }) + } let systemInfo = wx.getSystemInfoSync(), rect = wx.getMenuButtonBoundingClientRect(); let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height; @@ -223,12 +145,10 @@ Page({ lat: res.latitude, lon: res.longitude }) - this.getList() - this.getHdrlList() + this.getList() }, fail: (err) => { - this.getList() - this.getHdrlList() + this.getList() } }) this.setData({ @@ -247,251 +167,90 @@ Page({ }) this.getTwoProduct() this.getBanner() - this.getWeather() - }, - gobdDetail(e) { - let item = e.currentTarget.dataset.item - // wx.navigateTo({ - // url: url - // }) - util.gotoDetail(item) - }, - getList() { - let bdList = this.data.bdList - // 游--景点 - commonApi._post("scene/get_scene_by_tag",{ - tag_id:"4", - limit:6, - lon:this.data.lon, - lat:this.data.lat, - offset:0, - sort:"weight", - title:'', - area_id:'' - }).then(res=>{ - console.log('景点', res) - res.data.list.map(item => { - if (item.distance || item.distance == 0) { - if (item.distance >= 1000) { - item.distance = (item.distance / 1000).toFixed(2) + 'km'; - } else { - item.distance = (item.distance).toFixed(2) + 'm'; - } - } - }) - bdList[0].list = res.data.list - this.setData({ - list1:res.data.list, - bdList: bdList - }) - }) - // 非买不可--文创 - commonApi._post('product/get_product_by_tag',{ - product_model: 'post', - offset: 0, - limit: 6, - }).then(res=>{ - bdList[3].list = res.data.list - this.setData({ - list4:res.data.list, - bdList: bdList - }) - }) - // 非游不可--线路一日游 - commonApi._post('product/get_product_by_tag',{ - // type_id: 23, - tag_id: "10,11,12", - offset: 0, - limit: 6, - sort: 'weight' - }).then(res=>{ - bdList[1].list = res.data.list - this.setData({ - list2:res.data.list, - bdList: bdList - }) - }) - // 非看不可--剧场演出 - commonApi._post("product/get_product_by_tag",{ - tag_id:"6", - offset:0, - limit:6, - sort:'', - order:'', - lat:this.data.lat, - lon:this.data.lon, - title:'' - }).then(res=>{ - bdList[2].list = res.data.list - this.setData({ - list3:res.data.list, - bdList: bdList - }) - }) - }, - goDetail(e) { - let item = e.currentTarget.dataset.item; - let type = this.data.hdrlNavList[this.data.hdrlNavIndex].type - if (type == 'movie') { - wx.navigateTo({ - url: '/pages/list/movieticket/list/info/index?id=' + item.third_id - }) - }else { - wx.navigateTo({ - url: '/pages/info/activityInfo/index?id=' + item.id, - }) - } - }, - // 分类为电影时调这个接口 - getMovieList() { - let service = "Cinema/getHotMovieList"; - let data = { - page: 1, - pageSize: 5 - }; - commonApi._post(service, data).then(res => { - console.log(res.data); - this.setData({ - hdrlList: res.data - }) - }) - console.log(this.data.hdrlList); - }, - // 推荐榜单更多跳转 - moreBtn(e) { - let item = e.currentTarget.dataset.item - if (item.path!='') { - wx.navigateTo({ - url: item.path, - }) - } else { - // if (e.currentTarget.dataset.event) { - // this.pagePoint({ - // event: e.currentTarget.dataset.event - // }, 1) - // } - let url = item.url; - app.globalData.weburl = url; - wx.navigateTo({ - url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url), - }) - } - }, - // 活动日历下的列表 - getHdrlList() { - commonApi._post('pbservice/Actcalendar/getActList', { - page_no: 1, - date: this.data.today, - category: this.data.hdrlNavList[this.data.hdrlNavIndex].type, - keywords: '', - area_key: '', - lat: this.data.lat, - lon: this.data.lon, - page_num: 5 - }).then(res => { - res.data.rows.forEach(v=>{ - if (!v.post_url) { - v.post_url = "https://static.ticket.sz-trip.com/uploads/20240909/c9a0029cc9426d2a17f1dbbb7a179762.jpg" - } - }) - this.setData({ - hdrlList:res.data.rows - }) - }) - }, - // 切换活动日历分类 - changeHdrlNav(e) { - console.log(e.currentTarget.dataset); - this.setData({ - hdrlList:[], - hdrlNavIndex:e.currentTarget.dataset.index, - }) - if (this.data.hdrlNavIndex == 4) { - this.getMovieList() - } else { - this.getHdrlList() //切换分类重新获取活动日历列表 - } - }, - // 游苏州下的公共服务和旅游助手切换 - changeType(e) { - this.setData({ - yszIndex:e.currentTarget.dataset.index, - }) - }, - // 获取导航栏项目标题高度 + this.getWeather() + // 获取今天的日期 + let today = new Date(); + this.setData({ + month: (this.data.months[today.getMonth()]).toUpperCase(), + date: today.getDate() + }) + this.getVideoPrize() + this.getXpthList() + }, getHeight() { let that = this wx.getSystemInfo({ success(res) { - console.log(res) that.setData({ viewHeight: res.windowHeight + 'px' }) - console.log(that.data.viewHeight) } }) }, - // getXpthList: function() { - // // 元旦新增 新品特惠 - // commonApi._post("product/get_product_indulgence", { - // tag_id: 275, - // typeId: 3, - // }).then(res => { - // console.log('data', res.data); - // this.setData({ - // xpth: res.data, - // djsTime: res.data.time - // }) - // let time = setInterval(() => { - // this.setData({ - // djsTime: this.data.djsTime - 1 - // }) - // this.formatDate(this.data.djsTime) - // }, 1000) - // if (this.data.djsTime == 0) { - // clearInterval(time) - // } - // }) - // }, + getXpthList: function() { + // 元旦新增 新品特惠 + commonApi._post("product/get_product_indulgence", { + tag_id: 275, + typeId: 3, + type: 1, // 返回数组 + }).then(res => { + // res.data.adv = [res.data.adv] + this.setData({ + xpth: res.data, + djsTime: res.data.time + }) + let time = setInterval(() => { + this.setData({ + djsTime: this.data.djsTime - 1 + }) + this.formatDate(this.data.djsTime) + }, 1000) + if (this.data.djsTime == 0) { + clearInterval(time) + } + }) + }, // 元旦新品特惠 倒计时 - // formatDate: function(oTime) { - // let h = parseInt(oTime / 3600) - // let m = parseInt((oTime % 3600) / 60) - // let s = parseInt(oTime % 60) - // h = h < 10 ? "0" + h : h; - // m = m < 10 ? "0" + m : m; - // s = s < 10 ? "0" + s : s; - // this.setData({ - // djs: { - // h: h, - // m: m, - // s: s - // } - // }) - // return - // }, - // 非遗跳转 - // goFeiyi: function() { - // app.globalData.weburl = 'https://m.cloud.sz-trip.com/mlgCoupons' - // wx.navigateTo({ - // url: "/pages/pbService/web/index" - // }) - // }, - // onTabItemTap: function(e) { - // console.log(e, 99999999) - // }, - // 大轮播的监听方法 + formatDate: function(oTime) { + let h = parseInt(oTime / 3600) + let m = parseInt((oTime % 3600) / 60) + let s = parseInt(oTime % 60) + h = h < 10 ? "0" + h : h; + m = m < 10 ? "0" + m : m; + s = s < 10 ? "0" + s : s; + this.setData({ + djs: { + h: h, + m: m, + s: s + } + }) + return + }, + goFeiyi: function() { + app.globalData.weburl = 'https://m.cloud.sz-trip.com/mlgCoupons' + wx.navigateTo({ + url: "/pages/pbService/web/index" + }) + }, + onTabItemTap: function(e) { + console.log(e, 99999999) + }, changeBannerIndex: function(e) { this.setData({ activeBannerIndex: e.detail.current }) - }, - // 小轮播监听方法 + }, changeSmBannerIndex: function(e) { this.setData({ smBannerIndex: e.detail.current }) - }, + }, + changeXPathBannerIndex: function(e) { + this.setData({ + XPathBannerIndex: e.detail.current + }) + }, // 一城百馆 city: function() { wx.navigateToMiniProgram({ @@ -618,7 +377,6 @@ Page({ }, getWeather: function() { commonApi._post('pbservice/Ztfw/getWeather').then(res => { - console.log(res) this.setData({ weather: res.data }) @@ -716,7 +474,6 @@ Page({ util.gotoDetail(item) }, gotoPath: function(e) { - console.log(e) // if (e.currentTarget.dataset.event) { // if (e.currentTarget.dataset.event=='gongyeyuanqu_click') { // wx.navigateToMiniProgram({ @@ -742,13 +499,19 @@ Page({ path: 'pages/index/index' }) return; - } else if (e.currentTarget.dataset.event == 'wuzhong_click') { + // } else if (e.currentTarget.dataset.event == 'wuzhong_click') { + // wx.navigateToMiniProgram({ + // appId: 'wxdd39069b9a91dbfe', + // path: 'pages/index/index' + // }) + // return; + } else if (e.currentTarget.dataset.title == 'e读书') { wx.navigateToMiniProgram({ - appId: 'wxdd39069b9a91dbfe', + appId: 'wx26e6f4c0baba005b', path: 'pages/index/index' }) return; - } else if (e.currentTarget.dataset.event == 'kunshan_click') { + }else if (e.currentTarget.dataset.event == 'kunshan_click') { wx.navigateToMiniProgram({ appId: 'wx8888a3fd0862b4c8', path: 'pages/index/index' @@ -794,15 +557,14 @@ Page({ }, // 元旦 新品特惠部分 goBanner: function(e) { - console.log('新品特惠', e.currentTarget.dataset.url); let url = e.currentTarget.dataset.url; - app.globalData.weburl = url; + app.globalData.weburl = url; + console.log(url) wx.navigateTo({ url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(url) }) }, gotoUrl: function(e) { - console.log(e) if (e.currentTarget.dataset.event) { this.pagePoint({ event: e.currentTarget.dataset.event @@ -814,8 +576,8 @@ Page({ // url: '/pages/pbService/web/index?weburl='+encodeURIComponent('https://m.cloud.sz-trip.com/Cloudperform2022'), url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url), }) - }, - // 实时路况跳转外链 + }, + // 实时路况跳转外链 gotoUrls() { // 判断是否登录 var token = wx.getStorageSync("jstrip_token"), userId = wx.getStorageSync("jstrip_userid"); @@ -855,7 +617,6 @@ Page({ }, gotoSku: function() { commonApi.user_post("pbservice/Ztfw/sukangCode").then(res => { - console.log(res) app.globalData.weburl = res.data.url; wx.navigateTo({ url: '/pages/pbService/web/index' @@ -877,33 +638,33 @@ Page({ }) }, // 热门推荐 去掉经纬度 接口排序方式变更(韩阳) - // 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) - // }) - // }) - // }, + 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() - // } + if (this.data.list.length < 30) { + this.getList() + } }, gotoDetail: function(e) { let item = e.currentTarget.dataset.item; @@ -954,7 +715,6 @@ Page({ if ((item.tdata.url.indexOf('http://') != -1 || item.tdata.url.indexOf('https://') != -1) && item.tdata.url.indexOf('m.cloud.sz-trip.com') == -1) { // 外部h5 - console.log(111, item.tdata) app.globalData.weburl = item.tdata.url; wx.navigateTo({ url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.tdata @@ -963,7 +723,6 @@ Page({ } else { let page = item.tdata.url.split("/"); page = page[page.length - 1].split("?") - console.log(page[0]) let url = this.data.urltopage[page[0]]; if (url && url.indexOf('map') != -1) { let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', @@ -980,7 +739,6 @@ Page({ }) } else { app.globalData.weburl = item.tdata.url; - console.log(2222, item.tdata.url, app.globalData.weburl) wx.navigateTo({ url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item .tdata.url) @@ -1023,7 +781,6 @@ Page({ }, //博物馆跳转 直接跳君到苏州H5 goH5: function(e) { - console.log(e.currentTarget.dataset.path); let weburl = 'https://m.cloud.sz-trip.com/' + e.currentTarget.dataset.path; // app.globalData.weburl ='https://m.cloud.sz-trip.com/' + e.currentTarget.dataset.path; wx.navigateTo({ @@ -1031,186 +788,184 @@ Page({ url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(weburl), }) }, - // bannerClick2: function(e) { - // let item = e.currentTarget.dataset.item; - // if (item.action == 'href') { - // if (item.href.indexOf(",") != -1) { - // let info = item.href.split(","); - // wx.navigateToMiniProgram({ - // appId: info[0], - // path: info[1] - // }) - // } else if (item.href.indexOf('map/index') != -1) { - // wx.reLaunch({ - // url: item.href - // }) - // } else { - // wx.navigateTo({ - // url: item.href, - // }) - // } - // } else if (item.action == "web") { - // app.globalData.weburl = item.href; - // wx.navigateTo({ - // url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.href), - // }) - // } - // }, + bannerClick2: function(e) { + let item = e.currentTarget.dataset.item; + if (item.action == 'href') { + if (item.href.indexOf(",") != -1) { + let info = item.href.split(","); + wx.navigateToMiniProgram({ + appId: info[0], + path: info[1] + }) + } else if (item.href.indexOf('map/index') != -1) { + wx.reLaunch({ + url: item.href + }) + } else { + wx.navigateTo({ + url: item.href, + }) + } + } else if (item.action == "web") { + app.globalData.weburl = item.href; + wx.navigateTo({ + url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.href), + }) + } + }, // 监听文旅查询的scroll listenScroll(e) { this.setData({ scrollLeft: e.detail.scrollLeft }) }, - // // 获取短视频大赛是否中奖 中奖详情 - // getVideoPrize() { - // let user_id = wx.getStorageSync('jstrip_userid'); - // if (!user_id || wx.getStorageSync('indexPriceNoTip')) return; - // commonApi.user_post('actonline/video_act/getRaffle', { - // act_id: 5 - // }).then(res => { - // this.setData({ - // videoPrize: res.data - // }) - // }) - // }, - // noMoreTip() { - // wx.setStorageSync('indexPriceNoTip', true) - // this.closePrice() - // }, - // closePrice() { - // this.setData({ - // videoPrize: false, - // prizeInfo: null - // }) - // }, + // 获取短视频大赛是否中奖 中奖详情 + getVideoPrize() { + let user_id = wx.getStorageSync('jstrip_userid'); + if (!user_id || wx.getStorageSync('indexPriceNoTip')) return; + commonApi.user_post('actonline/video_act/getRaffle', { + act_id: 5 + }).then(res => { + this.setData({ + videoPrize: res.data + }) + }) + }, + noMoreTip() { + wx.setStorageSync('indexPriceNoTip', true) + this.closePrice() + }, + closePrice() { + this.setData({ + videoPrize: false, + prizeInfo: null + }) + }, // 抽奖 - // choosePrize() { - // commonApi.user_post('actonline/video_act/luckyDraw', { - // act_id: 5 - // }).then(res => { - // this.setData({ - // prizeInfo: res.data - // }) - // if (res.data.type != 'none') { - // // 抽奖成功的话 弹框 - // wx.showModal({ - // title: "提示", - // content: "中奖人员请联系君到苏州客服,领奖方式以客服通知为准", - // showCancel: false - // }) - // } - // }) - // }, - // bannerJumpNew(item) { - // let that = this - // item = item.currentTarget.dataset.item - // if (item.tdata == '') return - // that.pagePoint({ - // event: "banner_click", - // type: 'banner' - // }, 1) - // switch (item.jump_type) { - // case 0: - // break; - // case 1: - // util.gotoDetail(item.product_model) - // break; - // case 2: - // if (item.front_model && item.front_model.mini) { - // wx.navigateTo({ - // url: "/" + item.front_model.mini - // }) - // } - // break; - // case 3: - // if ((item.tdata.url.indexOf('http://') != -1 || item.tdata.url.indexOf('https://') != -1) && - // item.tdata.url.indexOf('m.cloud.sz-trip.com') == -1) { - // // 外部h5 - // console.log(item.tdata) - // app.globalData.weburl = item.tdata.url; - // wx.navigateTo({ - // url: "/pages/pbService/web/index" - // }) - // } else { - // let page = item.tdata.url.split("/"); - // page = page[page.length - 1].split("?") - // console.log(page[0]) - // let url = this.data.urltopage[page[0]]; - // if (url && url.indexOf('map') != -1) { - // let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', - // 'cinema', 'academes' - // ], - // type = page[1] ? page[1].split("=") : []; - // wx.reLaunch({ - // url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null) - // }) - // } else if (url) { - // wx.navigateTo({ - // url: url, - // }) - // } else { - // app.globalData.weburl = item.tdata.url; - // wx.navigateTo({ - // url: "/pages/pbService/web/index" - // }) - // } - // } - // break; - // case 4: - // if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) { - // // 如果是苏心游的小程序 直接把authCode带过去 - // userApi.user_post("user/getJumpThirdAppCode", {}).then(res => { - // let weburl = item.tdata.page - // if (weburl.indexOf('?') != -1) { - // weburl += '&authCode=' + res.data; - // } else { - // weburl += '?authCode=' + res.data - // } - // wx.navigateToMiniProgram({ - // appId: item.tdata.appid, - // path: weburl - // }) - // }).catch(err => { - // wx.navigateToMiniProgram({ - // appId: item.tdata.appid, - // path: item.tdata.page - // }) - // }) - // } else { - // wx.navigateToMiniProgram({ - // appId: item.tdata.appid, - // path: item.tdata.page - // }) - // } - // break; - // default: - // break; - // } - // return - // }, + choosePrize() { + commonApi.user_post('actonline/video_act/luckyDraw', { + act_id: 5 + }).then(res => { + this.setData({ + prizeInfo: res.data + }) + if (res.data.type != 'none') { + // 抽奖成功的话 弹框 + wx.showModal({ + title: "提示", + content: "中奖人员请联系君到苏州客服,领奖方式以客服通知为准", + showCancel: false + }) + } + }) + }, + bannerJumpNew(item) { + let that = this + item = item.currentTarget.dataset.item + if (item.tdata == '') return + that.pagePoint({ + event: "banner_click", + type: 'banner' + }, 1) + switch (item.jump_type) { + case 0: + break; + case 1: + util.gotoDetail(item.product_model) + break; + case 2: + if (item.front_model && item.front_model.mini) { + wx.navigateTo({ + url: "/" + item.front_model.mini + }) + } + break; + case 3: + if ((item.tdata.url.indexOf('http://') != -1 || item.tdata.url.indexOf('https://') != -1) && + item.tdata.url.indexOf('m.cloud.sz-trip.com') == -1) { + // 外部h5 + app.globalData.weburl = item.tdata.url; + wx.navigateTo({ + url: "/pages/pbService/web/index" + }) + } else { + let page = item.tdata.url.split("/"); + page = page[page.length - 1].split("?") + let url = this.data.urltopage[page[0]]; + if (url && url.indexOf('map') != -1) { + let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', + 'cinema', 'academes' + ], + type = page[1] ? page[1].split("=") : []; + wx.reLaunch({ + url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null) + }) + } else if (url) { + wx.navigateTo({ + url: url, + }) + } else { + app.globalData.weburl = item.tdata.url; + wx.navigateTo({ + url: "/pages/pbService/web/index" + }) + } + } + break; + case 4: + if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) { + // 如果是苏心游的小程序 直接把authCode带过去 + userApi.user_post("user/getJumpThirdAppCode", {}).then(res => { + let weburl = item.tdata.page + if (weburl.indexOf('?') != -1) { + weburl += '&authCode=' + res.data; + } else { + weburl += '?authCode=' + res.data + } + wx.navigateToMiniProgram({ + appId: item.tdata.appid, + path: weburl + }) + }).catch(err => { + wx.navigateToMiniProgram({ + appId: item.tdata.appid, + path: item.tdata.page + }) + }) + } else { + wx.navigateToMiniProgram({ + appId: item.tdata.appid, + path: item.tdata.page + }) + } + break; + default: + break; + } + return + }, onReady: function() { }, - // gotoOther: function(e) { - // let item = e.currentTarget.dataset.item; - // if (item.type == 'h5') { - // app.globalData.weburl = item.url - // wx.navigateTo({ - // url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url) - // }) - // } else if (item.type == 'mini') { - // wx.navigateToMiniProgram({ - // appId: item.appid, - // path: item.path - // }) - // } else if (item.type == 'page') { - // wx.navigateTo({ - // url: item.page, - // }) - // } - // }, + gotoOther: function(e) { + let item = e.currentTarget.dataset.item; + if (item.type == 'h5') { + app.globalData.weburl = item.url + wx.navigateTo({ + url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url) + }) + } else if (item.type == 'mini') { + wx.navigateToMiniProgram({ + appId: item.appid, + path: item.path + }) + } else if (item.type == 'page') { + wx.navigateTo({ + url: item.page, + }) + } + }, pagePoint: function(e, type) { util.pagePoint(e, type) }, diff --git a/pages/index/index.wxml b/pages/index/index.wxml index ed9f76b..408bb8a 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,399 +1,755 @@ - +