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

184 lines
3.9 KiB

2 weeks ago
import dayjs from 'dayjs';
3 weeks ago
const app = getApp<IAppOption>();
Page({
2 weeks ago
data: {
popupShow: false,
1 week ago
popupType: 'popup1', // 绑定医生弹窗
2 weeks ago
// popupType: 'popup2', // 去关注弹窗
// popupType: 'popup3', // 问题反馈弹窗
1 week ago
// popupType: 'popup4', // 登录失败弹窗
2 weeks ago
popupParams: {
close: true,
} as any,
2 weeks ago
userInfo: {},
unReadMsgCount: 0,
1 week ago
current: 0,
2 weeks ago
bannerList: [],
list: [] as any[],
total: 0,
pagination: {
page: 1,
pages: 1,
count: 1,
},
},
onShow() {
app.waitLogin({ type: 2 }).then(() => {
// this.getNotice();
this.getBanner();
this.getList();
app.getUserInfo(2).then((userInfo) => {
this.setData({
userInfo,
});
1 week ago
this.getTab();
2 weeks ago
});
});
},
1 week ago
getTab() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/is-welcome',
data: {},
}).then((res) => {
if (res.IsWelcome === 1) {
this.setData({
popupShow: true,
popupType: 'popup1',
popupParams: {
close: true,
...this.data.userInfo,
},
});
}
});
},
2 weeks ago
handleWebview() {
const encodeUrl = encodeURIComponent('https://dct.meddb.cn');
wx.navigateTo({
url: `/pages/webview/index?url=${encodeUrl}`,
});
},
getNotice() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-unread-msg-count',
data: {},
}).then((res) => {
this.setData({
unReadMsgCount: res.unReadMsgCount,
});
});
},
handleNotice() {
wx.navigateTo({
url: '/pages/message/index',
});
},
1 week ago
handleSwiperChange(e) {
console.log('DEBUGPRINT[89]: index.ts:83: e=', e);
this.setData({
current: e.detail.current,
});
},
2 weeks ago
getBanner() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-banner',
data: {
count: 0,
},
}).then((res) => {
this.setData({
bannerList: res.list,
});
});
},
handleBanner(e) {
const { index } = e.currentTarget.dataset;
const { LinkUrl } = this.data.bannerList[index];
wx.navigateTo({
url: LinkUrl,
fail() {
wx.switchTab({
url: LinkUrl,
});
},
});
2 weeks ago
},
1 week ago
getList() {
2 weeks ago
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-latest-material',
1 week ago
data: {},
2 weeks ago
}).then((res) => {
res.list.forEach((item) => {
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
});
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,
},
});
});
},
handleDetail(e: any) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/informationDetail/index?id=${id}`,
});
3 weeks ago
},
1 week ago
handleMore() {
wx.switchTab({
url: '/pages/information/index',
});
},
2 weeks ago
handlePopupOk() {
const { popupType } = this.data;
},
handlePopupCancel() {
const { popupType } = this.data;
1 week ago
if (popupType === 'popup1') {
wx.ajax({
method: 'POST',
url: '?r=xd/doctor/index/cancel-welcome',
data: {},
}).then(() => {
this.setData({
popupShow: false,
popupType: '',
popupParams: {},
});
});
return;
}
2 weeks ago
this.setData({
popupShow: false,
});
},
2 weeks ago
onShareAppMessage(e) {
if (e.from === 'button') {
const { Title, CoverImgUrl, Id } = e.target.dataset.params;
app.mpBehavior({ PositionId: '1', OperateType: '3', OperateId: Id });
return {
title: Title,
path: `/pages/informationDetail/index?id=${Id}`,
imageUrl: CoverImgUrl,
};
}
return {};
},
3 weeks ago
});
export {};