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.
140 lines
3.4 KiB
140 lines
3.4 KiB
import request from "@config/rerquest";
|
|
import { doAfterLogin } from "@utils/tools";
|
|
import { wxRequestPost } from "@utils/promise-wx-api";
|
|
|
|
const app = getApp();
|
|
|
|
Component({
|
|
properties: {
|
|
titleList: {
|
|
type: Array,
|
|
value: [],
|
|
},
|
|
},
|
|
data: {
|
|
iniLoaded: false,
|
|
|
|
gridId: "",
|
|
customerId: "",
|
|
page: 0,
|
|
pageSize: 10,
|
|
pageData: {},
|
|
showCom: true,
|
|
//topListHeight: 0,
|
|
funListHeight: -1,
|
|
},
|
|
|
|
lifetimes: {
|
|
async ready() {
|
|
await doAfterLogin();
|
|
// this.getProfile()
|
|
this.initPageData();
|
|
},
|
|
detached: function () {},
|
|
},
|
|
|
|
methods: {
|
|
initPage() {
|
|
console.log("父组件方法被触发了");
|
|
let that = this;
|
|
setTimeout(function () {
|
|
let query = wx.createSelectorQuery().in(that);
|
|
query
|
|
.selectAll("#functionList")
|
|
.boundingClientRect(function (res) {
|
|
if (Array.isArray(res) && res.length > 0) {
|
|
//获取标签高度
|
|
console.log("functionList高度", res[0].height);
|
|
that.setData({
|
|
funListHeight: res[0].height,
|
|
});
|
|
}
|
|
})
|
|
.exec();
|
|
}, 1000);
|
|
},
|
|
|
|
|
|
// async getProfile() {
|
|
// let customerId = app.globalData.customerId,
|
|
// gridId = app.globalData.gridId;
|
|
// const {
|
|
// data: {
|
|
// data: { code, data },
|
|
// },
|
|
// msg,
|
|
// } = await wxRequestPost(
|
|
// "resi/mine/mine/profile",
|
|
// {
|
|
// customerId,
|
|
// gridId,
|
|
// },
|
|
// {
|
|
// // isMock: true,
|
|
// isQuiet: false,
|
|
// }
|
|
// );
|
|
// console.log("我在titleli加载的");
|
|
// if (msg === "success" && code === 0) {
|
|
// const {showParty} = this.data
|
|
// data.roleList
|
|
// if()
|
|
// this.setData({
|
|
// showParty,
|
|
// });
|
|
// }
|
|
// },
|
|
|
|
async refreshData() {
|
|
console.log("刷新首页消息");
|
|
await doAfterLogin();
|
|
await this.initPageData();
|
|
this.setData({
|
|
showCom: false,
|
|
});
|
|
|
|
if (this.selectComponent("#titleList")) {
|
|
this.selectComponent("#titleList").getInfo();
|
|
}
|
|
|
|
this.setData({
|
|
showCom: true,
|
|
});
|
|
},
|
|
|
|
initPageData: async function () {
|
|
console.log("initPageData");
|
|
let that = this;
|
|
await that.getIndex();
|
|
},
|
|
|
|
getIndexData(params: object) {
|
|
return request({
|
|
method: "POST",
|
|
url: "resi/guide/stranger/getgridhome",
|
|
options: params,
|
|
ifToken: true,
|
|
});
|
|
},
|
|
async getIndex() {
|
|
let self = this;
|
|
let params = {
|
|
gridId: app.globalData.gridId,
|
|
customerId: app.globalData.customerId,
|
|
};
|
|
await this.getIndexData(params).then(function (res: { data: any }) {
|
|
// console.log('getIndexData',JSON.parse(res.data.titleList[0].configuration))
|
|
let customer = JSON.parse(res.data.titleList[0].configuration);
|
|
app.globalData.customOptions = customer;
|
|
app.globalData.pageCustomerData = res.data;
|
|
|
|
console.log(app.globalData.customOptions);
|
|
console.log("self.data.pageData", self.data.pageData);
|
|
self.setData({
|
|
pageData: res.data,
|
|
iniLoaded: true,
|
|
});
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|