no message
This commit is contained in:
168
unpackage/dist/dev/mp-alipay/pages/index/index.js
vendored
Normal file
168
unpackage/dist/dev/mp-alipay/pages/index/index.js
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const api_api = require("../../api/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
|
||||
const _easycom_orderList2 = common_vendor.resolveComponent("orderList");
|
||||
const _easycom_tabbar2 = common_vendor.resolveComponent("tabbar");
|
||||
(_easycom_uni_transition2 + _easycom_orderList2 + _easycom_tabbar2)();
|
||||
}
|
||||
const _easycom_uni_transition = () => "../../uni_modules/uni-transition/components/uni-transition/uni-transition.js";
|
||||
const _easycom_orderList = () => "../../components/orderList/orderList.js";
|
||||
const _easycom_tabbar = () => "../../components/tabbar/tabbar.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_transition + _easycom_orderList + _easycom_tabbar)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "index",
|
||||
setup(__props) {
|
||||
let longitude = common_vendor.ref(113.675688);
|
||||
let latitude = common_vendor.ref(34.75527700365562);
|
||||
let mapContext = common_vendor.ref(null);
|
||||
let mapBox = common_vendor.ref(false);
|
||||
let mapLocationRef = common_vendor.ref();
|
||||
let infoDz = common_vendor.ref([]);
|
||||
let markList = common_vendor.ref([]);
|
||||
common_vendor.onLoad(async () => {
|
||||
common_vendor.index.hideTabBar();
|
||||
mapContext.value = common_vendor.index.createMapContext("map");
|
||||
const { longitude: lon, latitude: lat } = await common_vendor.index.getLocation({
|
||||
type: "gcj02"
|
||||
// 根据实际需要选择坐标系
|
||||
});
|
||||
latitude.value = lat;
|
||||
longitude.value = lon;
|
||||
getInfo();
|
||||
setTimeout(() => {
|
||||
mapLocation();
|
||||
}, 300);
|
||||
});
|
||||
let getInfo = async () => {
|
||||
let _res = await api_api.aroundAreaMap({
|
||||
orderByType: 1,
|
||||
lat: latitude.value,
|
||||
lon: longitude.value
|
||||
});
|
||||
let list = _res.map((item, index) => {
|
||||
return {
|
||||
id: item.id,
|
||||
longitude: item.location.lng,
|
||||
latitude: item.location.lat,
|
||||
iconPath: "/static/icon/marker-pointer.png",
|
||||
width: 20,
|
||||
height: 23,
|
||||
content: "2",
|
||||
gunUseCount: item.gunUseCount,
|
||||
gunCount: item.gunCount,
|
||||
customCallout: {
|
||||
display: "ALWAYS",
|
||||
// 显示方式
|
||||
anchorX: 60,
|
||||
// 锚点X轴
|
||||
anchorY: 12
|
||||
// 锚点Y轴
|
||||
}
|
||||
};
|
||||
});
|
||||
list.unshift({
|
||||
longitude: longitude.value,
|
||||
latitude: latitude.value,
|
||||
iconPath: "/static/icon/my-location-default.png",
|
||||
width: 45,
|
||||
height: 45,
|
||||
id: -1
|
||||
});
|
||||
markList.value = list;
|
||||
};
|
||||
const mapLocation = () => {
|
||||
const log = longitude.value;
|
||||
const lat = latitude.value;
|
||||
mapContext.value.moveToLocation({
|
||||
longitude: log,
|
||||
latitude: lat
|
||||
});
|
||||
};
|
||||
const regionchange = (e) => {
|
||||
if (e.type == "end") {
|
||||
console.log(e);
|
||||
console.log(e.detail.scale);
|
||||
mapBox.value = false;
|
||||
mapLocationRefStep(false);
|
||||
}
|
||||
};
|
||||
const markerClick = async (e) => {
|
||||
var _a;
|
||||
if (e.markerId == -1) {
|
||||
return;
|
||||
}
|
||||
common_vendor.index.showLoading();
|
||||
let _res = await api_api.infoAroundApi({
|
||||
id: e.markerId
|
||||
});
|
||||
let data = (_a = _res == null ? void 0 : _res.priceList) == null ? void 0 : _a.find((val) => val.isCurrent == 1);
|
||||
infoDz.value = _res;
|
||||
infoDz.value.priceAmount = data.totalAmount;
|
||||
common_vendor.index.hideLoading();
|
||||
mapBox.value = true;
|
||||
mapLocationRefStep(true);
|
||||
};
|
||||
const mapLocationRefStep = (type) => {
|
||||
if (type) {
|
||||
mapLocationRef.value.step(
|
||||
{
|
||||
translateY: "-200rpx"
|
||||
},
|
||||
{
|
||||
timingFunction: "ease-in",
|
||||
duration: 100
|
||||
}
|
||||
);
|
||||
} else {
|
||||
mapLocationRef.value.step(
|
||||
{
|
||||
translateY: "0rpx"
|
||||
},
|
||||
{
|
||||
timingFunction: "ease",
|
||||
duration: 500
|
||||
}
|
||||
);
|
||||
}
|
||||
mapLocationRef.value.run();
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.unref(longitude),
|
||||
b: common_vendor.o(markerClick),
|
||||
c: common_vendor.o(markerClick),
|
||||
d: common_vendor.o(regionchange),
|
||||
e: common_vendor.unref(markList),
|
||||
f: common_vendor.unref(latitude),
|
||||
g: common_assets._imports_0$1,
|
||||
h: common_vendor.o(mapLocation),
|
||||
i: () => ({
|
||||
r: mapLocationRef,
|
||||
k: "mapLocationRef"
|
||||
}),
|
||||
j: common_vendor.p({
|
||||
show: true
|
||||
}),
|
||||
k: common_vendor.p({
|
||||
toNav: true,
|
||||
Image: true,
|
||||
info: common_vendor.unref(infoDz),
|
||||
list: common_vendor.unref(infoDz).pictures
|
||||
}),
|
||||
l: common_vendor.p({
|
||||
modeClass: "fade",
|
||||
show: common_vendor.unref(mapBox)
|
||||
}),
|
||||
m: common_vendor.p({
|
||||
path: "/pages/index/index"
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
my.createPage(_sfc_main);
|
||||
Reference in New Issue
Block a user