2024-09-19 07:20:14 +08:00
|
|
|
"use strict";
|
|
|
|
var __async = (__this, __arguments, generator) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
var fulfilled = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.next(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var rejected = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.throw(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const common_vendor = require("../common/vendor.js");
|
|
|
|
const service_mapService = require("../service/mapService.js");
|
2024-10-01 09:15:35 +08:00
|
|
|
const utils_commUtils = require("../utils/commUtils.js");
|
2024-09-19 07:20:14 +08:00
|
|
|
const utils_platform = require("../utils/platform.js");
|
|
|
|
const _sfc_main = {
|
|
|
|
__name: "AddressCell",
|
|
|
|
setup(__props) {
|
|
|
|
const addressDetail = common_vendor.ref({});
|
2024-10-01 09:15:35 +08:00
|
|
|
const loading = common_vendor.ref(true);
|
2024-09-19 07:20:14 +08:00
|
|
|
const getLocationDetail = () => __async(this, null, function* () {
|
|
|
|
try {
|
|
|
|
const loction = yield service_mapService.getLocation();
|
|
|
|
const res = yield service_mapService.getMapDetailAddress(loction.longitude, loction.latitude);
|
|
|
|
addressDetail.value = res;
|
2024-10-01 09:15:35 +08:00
|
|
|
if (!addressDetail.value.addressComponent)
|
|
|
|
loading.value = false;
|
2024-09-19 07:20:14 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2024-10-01 09:15:35 +08:00
|
|
|
loading.value = false;
|
2024-09-19 07:20:14 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
common_vendor.onLoad(() => __async(this, null, function* () {
|
|
|
|
yield getLocationDetail();
|
|
|
|
}));
|
|
|
|
return (_ctx, _cache) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
return common_vendor.e({
|
|
|
|
a: common_vendor.unref(utils_commUtils.imgUrl)("@/static/addresscell/location.png"),
|
|
|
|
b: common_vendor.unref(loading)
|
|
|
|
}, common_vendor.unref(loading) ? {
|
|
|
|
c: common_vendor.t(!common_vendor.unref(addressDetail).addressComponent ? "正在加载..." : `${common_vendor.unref(addressDetail).addressComponent.city} ${common_vendor.unref(addressDetail).addressComponent.district}`)
|
|
|
|
} : {}, {
|
|
|
|
d: common_vendor.n(common_vendor.unref(utils_platform.isH5) ? "top-_a_2_a__a_" : "top-_a_6_a__a_")
|
|
|
|
});
|
2024-09-19 07:20:14 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wx.createComponent(_sfc_main);
|