修改代码,不请求方法之间写死 qqmap_key的值

This commit is contained in:
赵毅 2025-08-25 15:58:23 +08:00
parent 53d09262c2
commit 184ed7feab
2 changed files with 38 additions and 33 deletions

View File

@ -39,23 +39,26 @@
this.address = uni.getStorageSync('city'); this.address = uni.getStorageSync('city');
return; return;
} }
uni.request({ this.qqmap_key = '55NBZ-MUQYW-EAJRL-YIWPA-ZXCR6-4NBPP';
url: apiArr.get_host_info,
method: 'post',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
dataType: 'json',
success: (result) => {
console.log(result, 'result');
let wxapp = result.data.all.wxapp;
if (wxapp) {
this.qqmap_key = wxapp.qqmap_key;
this.getUserLocation() this.getUserLocation()
}
}, // uni.request({
}) // url: apiArr.get_host_info,
// method: 'post',
// header: {
// 'Content-type': 'application/x-www-form-urlencoded'
// },
// dataType: 'json',
// success: (result) => {
// console.log(result, 'result');
// let wxapp = result.data.all.wxapp;
// if (wxapp) {
// this.qqmap_key = wxapp.qqmap_key;
// this.getUserLocation()
// }
// },
// })
}, },
getUserLocation() { getUserLocation() {

View File

@ -403,22 +403,24 @@ export default {
title: '加载中', title: '加载中',
mask: true mask: true
}); });
uni.request({ this.qqmap_key = '55NBZ-MUQYW-EAJRL-YIWPA-ZXCR6-4NBPP';
url: apiArr.get_host_info, this.getUserLocation()
method: 'POST', // uni.request({
header: { // url: apiArr.get_host_info,
'Content-type': 'application/x-www-form-urlencoded' // method: 'POST',
}, // header: {
dataType: 'json', // 'Content-type': 'application/x-www-form-urlencoded'
success: (result) => { // },
let wxapp = result.data.all.wxapp; // dataType: 'json',
if (wxapp) { // success: (result) => {
this.qqmap_key = wxapp.qqmap_key; // let wxapp = result.data.all.wxapp;
// // if (wxapp) {
this.getUserLocation(); // this.qqmap_key = wxapp.qqmap_key;
} // //
} // this.getUserLocation();
}); // }
// }
// });
}, },