|
@@ -270,9 +270,25 @@ const handledUpload = async () => {
|
|
|
uni.authorize({
|
|
|
scope: "scope.userLocation",
|
|
|
success() {
|
|
|
- showUpload.value = true;
|
|
|
-
|
|
|
// 用户同意授权
|
|
|
+ uni.getLocation({
|
|
|
+ type: "wgs84",
|
|
|
+ success: function (res) {
|
|
|
+ console.log("当前位置的经度:" + res.longitude);
|
|
|
+ console.log("当前位置的纬度:" + res.latitude);
|
|
|
+ uni.setStorageSync("location", JSON.stringify(res));
|
|
|
+ setTimeout(() => {
|
|
|
+ showUpload.value = true;
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ fail(error) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请勿频繁调用!",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ showUpload.value = true;
|
|
|
},
|
|
|
fail() {
|
|
|
// 用户拒绝授权
|
|
@@ -292,11 +308,6 @@ const handledUpload = async () => {
|
|
|
console.log("当前位置的经度:" + res.longitude);
|
|
|
console.log("当前位置的纬度:" + res.latitude);
|
|
|
uni.setStorageSync("location", JSON.stringify(res));
|
|
|
- // uni.showToast({
|
|
|
- // title: "当前位置的经纬度:" + res.longitude + "," + res.latitude,
|
|
|
- // icon: "success",
|
|
|
- // mask: true,
|
|
|
- // });
|
|
|
setTimeout(() => {
|
|
|
showUpload.value = true;
|
|
|
}, 500);
|