Commit 9a9c25fe by 程默

跳转客服页添加参数

parent 3f802ea0
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</template> </template>
<script> <script>
export { getUserLocation } from "../../utils/wxIndex.js"; import { getUserLocation } from "../../utils/wxIndex.js";
export default { export default {
data() { data() {
return { return {
...@@ -27,11 +27,11 @@ export default { ...@@ -27,11 +27,11 @@ export default {
}, },
onLoad(options) { onLoad(options) {
getUserLocation().then((res) => { getUserLocation().then((res) => {
let longitude = res.longitude; options.longitude = res.longitude;
let latitude = res.latitude; options.latitude = res.latitude;
this.sessionFrom = options;
}); });
this.sessionFrom = options.opt;
}, },
}; };
</script> </script>
......
...@@ -8,7 +8,7 @@ export function wx_decode(appId, sessionKey, encryptedData, iv) { ...@@ -8,7 +8,7 @@ export function wx_decode(appId, sessionKey, encryptedData, iv) {
// 定位方法 // 定位方法
export function getUserLocation() { export function getUserLocation() {
return Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
wx.getLocation({ wx.getLocation({
type: 'gcj02', // type有两中类型,gcj02 是腾讯地图所能解析的 type: 'gcj02', // type有两中类型,gcj02 是腾讯地图所能解析的
success: res => { success: res => {
...@@ -16,15 +16,4 @@ export function getUserLocation() { ...@@ -16,15 +16,4 @@ export function getUserLocation() {
} }
}) })
}) })
}
// 获取定位城市名称方法
function getCity() {
var _this = this
wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=key填写的位置&location=` + _this.data.locationObj.latitude + ',' + _this.data.locationObj.longitude,
success: res => {
console.log(res) // 此处返回的就是需要查询的城市名称
}
})
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment