3 changed files with 64 additions and 52 deletions
@ -0,0 +1,54 @@ |
|||
<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 { |
|||
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' |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
Loading…
Reference in new issue