Browse Source

地图

master
chenkainan 3 months ago
parent
commit
34c45b015e
  1. 18
      pages.json
  2. 35
      pages/map/map.vue
  3. 57
      subPackages/h5Web/h5Web.vue

18
pages.json

@ -264,6 +264,12 @@
"style" : {
"navigationBarTitleText" : "智游常熟"
}
},
{
"path": "h5Web/h5Web",
"style": {
"navigationBarTitleText": ""
}
}
]
}
@ -283,12 +289,12 @@
"selectedIconPath" : "/static/images/selectHome.png",
"text" : "首页"
},
// {
// "pagePath" : "pages/map/map",
// "iconPath" : "/static/images/map.png",
// "selectedIconPath" : "/static/images/selectMap.png",
// "text" : "地图"
// },
{
"pagePath" : "pages/map/map",
"iconPath" : "/static/images/map.png",
"selectedIconPath" : "/static/images/selectMap.png",
"text" : "地图"
},
{
"pagePath" : "pages/user/user",
"iconPath" : "/static/images/mine.png",

35
pages/map/map.vue

@ -1,11 +1,40 @@
<template>
<view class="" style="text-align: center;padding-top: 50rpx;">
开发中
<view class="content">
<web-view :src="src"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
src: ''
}
},
onShow() {
//
let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {}
console.log(userInfo)
if(userInfo.token) {
this.src = 'http://localhost:8080/?token=' + userInfo.token
// this.src = 'https://chang-map.js-dyyj.com?token=' + userInfo.token
console.log(this.src)
}else {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
methods: {
}
}
</script>
<style>
<style lang="scss" scoped>
.content {
width: 100vw;
height: 100vh;
padding-bottom: env(safe-area-inset-bottom)
}
</style>

57
subPackages/h5Web/h5Web.vue

@ -0,0 +1,57 @@
<template>
<view></view>
</template>
<script>
export default {
data() {
return {
}
},
onShow() {
//
const oTherMiniprogramIsBack = uni.getStorageSync('oTherMiniprogramIsBack')
if(oTherMiniprogramIsBack) {
uni.showModal({
title: '是否返回常熟小程序',
success: () => {
uni.removeStorageSync('oTherMiniprogramIsBack')
uni.navigateBack();
}
})
}
},
onLoad(option) {
let data = JSON.parse(option.data)
if(data && data.type == 'xcx') {
uni.navigateToMiniProgram({
shortLink: data.url,
success(res) {
uni.setStorageSync('oTherMiniprogramIsBack', 1)
}
})
}else if(data && data.type == 'map') {
uni.openLocation({
longitude: Number(data.lon), //
latitude: Number(data.lat), //
name: data.address || data.title || data.name, //
address: data.address, //
// complete: res => {
// if(res.errMsg.indexOf("openLocation:ok") != -1) {
// uni.switchTab({
// url: '/pages/map/map'
// })
// }
// }
success: res => {
uni.setStorageSync('oTherMiniprogramIsBack', 1)
}
})
}
}
}
</script>
<style>
</style>
Loading…
Cancel
Save