Commit 9a9c25fe by 程默

跳转客服页添加参数

parent 3f802ea0
......@@ -18,7 +18,7 @@
</template>
<script>
export { getUserLocation } from "../../utils/wxIndex.js";
import { getUserLocation } from "../../utils/wxIndex.js";
export default {
data() {
return {
......@@ -27,11 +27,11 @@ export default {
},
onLoad(options) {
getUserLocation().then((res) => {
let longitude = res.longitude;
let latitude = res.latitude;
options.longitude = res.longitude;
options.latitude = res.latitude;
this.sessionFrom = options;
});
this.sessionFrom = options.opt;
},
};
</script>
......
......@@ -8,7 +8,7 @@ export function wx_decode(appId, sessionKey, encryptedData, iv) {
// 定位方法
export function getUserLocation() {
return Promise((resolve,reject)=>{
return new Promise((resolve,reject)=>{
wx.getLocation({
type: 'gcj02', // type有两中类型,gcj02 是腾讯地图所能解析的
success: res => {
......@@ -17,14 +17,3 @@ export function getUserLocation() {
})
})
}
\ No newline at end of file
// 获取定位城市名称方法
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