信达小程序
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.

71 lines
1.5 KiB

3 months ago
import dayjs from 'dayjs';
const app = getApp<IAppOption>();
4 months ago
Page({
data: {
list: [] as any[],
pagination: {
page: 1,
pages: 1,
count: 1,
},
},
3 months ago
onShow() {
3 months ago
app.waitLogin({ type: 2 }).then(() => {
this.getList();
});
},
4 months ago
getList(newPage = 1) {
wx.ajax({
method: 'GET',
3 months ago
url: '?r=xd/doctor/index/get-material-list',
4 months ago
data: {
page: newPage,
3 months ago
ContentType: 3,
4 months ago
},
}).then((res) => {
3 months ago
res.list.forEach((item) => {
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
});
4 months ago
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
total: res.count,
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);
}
},
3 months ago
handleDetail(e) {
const { id } = e.currentTarget.dataset;
4 months ago
wx.navigateTo({
3 months ago
url: `/pages/informationDetail/index?id=${id}`,
4 months ago
});
},
3 months ago
onShareAppMessage(e) {
if (e.from === 'button') {
const { Title, CoverImgUrl, Id } = e.target.dataset.params;
app.mpBehavior({ PositionId: '2', OperateType: '3', OperateId: Id });
return {
title: Title,
path: `/pages/informationDetail/index?id=${Id}`,
imageUrl: CoverImgUrl,
};
}
return {};
},
4 months ago
});
export {};