You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.8 KiB

11 months ago
// pages/pbService/web/index.js
let app = getApp()
import commonApi from "../../../utils/https/common"
import userApi from "../../../utils/https/user"
import https from "../../../utils/https.js"
Page({
/**
* 页面的初始数据
*/
data: {
webUrl:"",
shareTitle: "",
shareUrl: "",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
11 months ago
let weburl = 'https://m.cloud.sz-trip.com/aiPlay'
11 months ago
let token = wx.getStorageSync('jstrip_token')
if (token) {
weburl += '?token='+token
}
let _this = this
try {
let lonAndLat = (wx.getStorageSync('lonAndLat'))
if (lonAndLat && JSON.parse(lonAndLat)) {
lonAndLat = JSON.parse(lonAndLat)
if (Object.keys(webParam).length>0 || token) {
weburl+=`&lon=${lonAndLat.lon}&lat=${lonAndLat.lat}`
} else {
weburl+=`?lon=${lonAndLat.lon}&lat=${lonAndLat.lat}`
}
this.setUrl(weburl)
return
} else {
wx.getLocation({
type: 'gcj02',
success: (res) => {
let lonAndLat = JSON.stringify({lat: res.latitude,lon: res.longitude})
wx.setStorageSync('lonAndLat', lonAndLat)
if (Object.keys(webParam).length>0 || token) {
weburl+=`&lon=${lonAndLat.lon}&lat=${lonAndLat.lat}`
} else {
weburl+=`?lon=${lonAndLat.lon}&lat=${lonAndLat.lat}`
}
_this.setUrl(weburl)
},
fail: (err) => {
_this.setUrl(weburl)
}
})
}
} catch(e) {
this.setUrl(weburl)
}
},
handleMessage(data) {
console.log('打印22222',data);
},
setUrl (url) {
this.setData({
webUrl:url
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: this.data.shareTitle,
path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`,
}
},
onShareTimeline: function() {
return {
title: this.data.shareTitle,
path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`,
}
}
})