Browse Source

提交

master
chenkainan 2 years ago
parent
commit
d62f51cade
  1. 52
      pages/index/index.js
  2. 2
      pages/index/index.wxml
  3. 3
      project.private.config.json

52
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: [],
@ -64,6 +65,17 @@ Page({
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() //这里隐藏了底部导航栏
@ -75,11 +87,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]
@ -169,11 +179,9 @@ Page({
let that = this
wx.getSystemInfo({
success(res) {
console.log(res)
that.setData({
viewHeight: res.windowHeight + 'px'
})
console.log(that.data.viewHeight)
}
})
},
@ -183,7 +191,6 @@ Page({
tag_id: 275,
typeId: 3,
}).then(res => {
console.log('data', res.data);
this.setData({
xpth: res.data,
djsTime: res.data.time
@ -361,7 +368,6 @@ Page({
},
getWeather: function() {
commonApi._post('pbservice/Ztfw/getWeather').then(res => {
console.log(res)
this.setData({
weather: res.data
})
@ -459,7 +465,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({
@ -543,7 +548,6 @@ Page({
},
// 元旦 新品特惠部分
goBanner: function(e) {
console.log('新品特惠', e.currentTarget.dataset.url);
let url = e.currentTarget.dataset.url;
app.globalData.weburl = url;
wx.navigateTo({
@ -551,7 +555,6 @@ Page({
})
},
gotoUrl: function(e) {
console.log(e)
if (e.currentTarget.dataset.event) {
this.pagePoint({
event: e.currentTarget.dataset.event
@ -564,6 +567,30 @@ Page({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
},
// 实时路况跳转外链
gotoUrls() {
// 判断是否登录
var token = wx.getStorageSync("jstrip_token"), userId = wx.getStorageSync("jstrip_userid");
if(!token || !userId) {
let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html'
app.globalData.weburl = url;
wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
}else {
commonApi.user_post("uservice/user/userEncry").then(res => {
if(res.code == 1) {
let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html?userEncry=' + res.data
app.globalData.weburl = url;
wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url),
})
}
})
}
},
gotoMini: function(e) {
let appid = e.currentTarget.dataset.appid,
path = e.currentTarget.dataset.path
@ -580,7 +607,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'
@ -679,7 +705,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
@ -688,7 +713,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',
@ -705,7 +729,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)
@ -748,7 +771,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({
@ -852,7 +874,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(item.tdata)
app.globalData.weburl = item.tdata.url;
wx.navigateTo({
url: "/pages/pbService/web/index"
@ -860,7 +881,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',

2
pages/index/index.wxml

@ -174,7 +174,7 @@
<view style="display: flex;">
<view bindtap="gotoUrl" data-event="comfort_click" data-title="景区舒适度" data-url="https://m.cloud.sz-trip.com/ScenicComfort" class="jqssd"></view>
<!-- <view bindtap="gotoUrl" data-event="xlqc" data-url="https://wlsjzx.wglj.suzhou.com.cn:8096/kt_h5/index.html#/home" class="sslk"></view> -->
<view bindtap="gotoUrl" data-event="xlqc" data-url="https://jiaotonghao2.amap.com/?channel=amap&unitId=257&src=app_share#/" class="sslk"></view>
<view bindtap="gotoUrls" data-event="xlqc" class="sslk"></view>
</view>
<!-- 元旦修改 限时特惠--新版-->
<view class="sale-road-boxes xpth" style="margin-bottom: 18.67rpx;margin-top: 0;padding-top: 0;" wx:if="{{!isTest}}">

3
project.private.config.json

@ -1,6 +1,7 @@
{
"setting": {
"compileHotReLoad": true
"compileHotReLoad": true,
"urlCheck": false
},
"condition": {
"miniprogram": {

Loading…
Cancel
Save