更新了定位功能

This commit is contained in:
weipengfei 2023-09-21 11:59:52 +08:00
parent d70f6c6f8a
commit 9bdb627cf2
3 changed files with 33 additions and 32 deletions

26
App.vue
View File

@ -91,19 +91,19 @@
initEvent(); initEvent();
// #endif // #endif
uni.getLocation({ // uni.getLocation({
// type: 'gcj02', // type: 'gcj02',
// geocode: true, // geocode: true,
// isHighAccuracy: true, // isHighAccuracy: true,
// altitude: true, // // altitude: true,
accuracy: 'best', // // accuracy: 'best',
success: (res)=> { // success: (res)=> {
console.log(res); // console.log(res);
}, // },
fail(e) { // fail(e) {
console.log(e); // console.log(e);
} // }
}); // });
let that = this; let that = this;
// #ifdef MP // #ifdef MP

View File

@ -95,8 +95,8 @@
"sdkConfigs" : { "sdkConfigs" : {
"maps" : { "maps" : {
"amap" : { "amap" : {
"appkey_ios" : "048d9f3f323eea894b49c3a7edbc8d87", "appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87" "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
} }
}, },
"payment" : { "payment" : {
@ -113,8 +113,10 @@
} }
}, },
"geolocation" : { "geolocation" : {
"system" : { "amap" : {
"__platform__" : [ "ios", "android" ] "__platform__" : [ "ios", "android" ],
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
} }
}, },
"oauth" : {}, "oauth" : {},

View File

@ -1,22 +1,21 @@
export const test = () => {
export const test = ()=>{
return '测试' return '测试'
} }
export const uniMPgetLocation = ()=>{ export const uniMPgetLocation = () => {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject) => {
uni.getLocation({ uni.getLocation({
// type: 'gcj02', type: 'gcj02',
// geocode: true, geocode: true,
// isHighAccuracy: true, isHighAccuracy: true,
// altitude: true, // altitude: true,
accuracy: 'best', // accuracy: 'best',
success: (res)=> { success: (res) => {
resolve(res) resolve(res)
}, },
fail(e) { fail(e) {
reject(e) resolve(e)
} }
}); });
}) })
} }