const app = getApp(); Page({ data: { pagination: { page: 1, pages: 1, count: 1, }, list: [], DoctorTitleType: {}, }, onLoad() { app.waitLogin().then(() => { this.getList(); }); }, getDoctorDict() { wx.ajax({ method: "GET", url: "?r=takeda/reg/doctor-dict", data: {}, }).then((res) => { this.setData({ DoctorTitleType: res.DoctorTitleType, }); }); }, getList(newPage = 1) { wx.ajax({ method: "GET", url: "?r=takeda/doctor/audit-list", data: { page: newPage, }, }).then((res) => { res.list.forEach((item: any) => { item.SubmitTime = item.SubmitTime.split(" ")[0]; }); const list = res.page === 1 ? res.list : [...this.data.list, ...res.list]; this.setData({ list, pagination: { page: res.page, pages: res.pages, count: res.count, }, }); }); }, onReachBottom() { const { page, pages } = this.data.pagination; if (pages > page) { this.getList(page + 1); } }, handlePreview(e) { const { url } = e.currentTarget.dataset; wx.previewImage({ urls: [url], }); }, handleDetail(e) { const { index } = e.currentTarget.dataset; const { AuditId } = this.data.list[index]; wx.navigateTo({ url: `/module1/pages/auditDoctorDetail/index?id=${AuditId}`, }); }, }); export {};