日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.9 KiB

import { wxNavigateTo, wxRequestPost } from "@utils/promise-wx-api";
import { getLocation } from "@utils/location";
import { nextTick } from "@utils/tools";
const app = getApp();
Component({
data: {
iniLoaded: false,
mode: "map", //页面显示模式 地图模式map 平铺列表list
srcList: [],
list: [],
},
lifetimes: {
// 页面初始化
async attached() {
await app.doAfterLogin();
await this.getList();
this.setData({
iniLoaded: true,
});
},
},
methods: {
shiftMode(e) {
const {
currentTarget: {
dataset: { mode },
},
} = e;
this.setData({ mode });
},
handleClickMap(e) {
const {
detail: { index },
} = e;
this.toInfoPage(index);
},
handelClickItem(e) {
const {
currentTarget: {
dataset: { index },
},
} = e;
this.toInfoPage(index);
},
toInfoPage(index) {
const { srcList } = this.data;
wxNavigateTo("info/index", {
id: srcList[index].partyServiceCenterId,
});
},
toOrderPage() {
wxNavigateTo("order/index", {});
},
async getList() {
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"gov/org/icpartyservicecenter/partyservicecenterlist",
{
orgId: app.globalData.gridId,
orgType: "grid",
},
{
isMock: false,
}
);
if (msg === "success" && code === 0) {
this.setData({
srcList: data,
list: data.map((item) => {
return {
name: item.centerName,
latitude: item.latitude,
longitude: item.longitude,
};
}),
});
}
},
},
});