|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
const app = getApp<IAppOption>();
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
popupShow: false,
|
|
|
|
popupType: 'popup1', // 绑定医生弹窗
|
|
|
|
// popupType: 'popup2', // 去关注弹窗
|
|
|
|
// popupType: 'popup3', // 问题反馈弹窗
|
|
|
|
// popupType: 'popup4', // 登录失败弹窗
|
|
|
|
popupParams: {
|
|
|
|
close: true,
|
|
|
|
} as any,
|
|
|
|
|
|
|
|
userInfo: {},
|
|
|
|
current: 0,
|
|
|
|
|
|
|
|
notice: [],
|
|
|
|
|
|
|
|
bannerList: [],
|
|
|
|
|
|
|
|
briefingList: [],
|
|
|
|
sopList: [],
|
|
|
|
|
|
|
|
list: [] as any[],
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
app.waitLogin({ type: 2 }).then(() => {
|
|
|
|
this.getNotice();
|
|
|
|
this.getBanner();
|
|
|
|
this.getBriefingList();
|
|
|
|
this.getSopList();
|
|
|
|
this.getList();
|
|
|
|
app.getUserInfo(2).then((userInfo) => {
|
|
|
|
this.setData({
|
|
|
|
userInfo,
|
|
|
|
});
|
|
|
|
this.getTab();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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-latest-mini-msg',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
notice: res.list.map((item) => {
|
|
|
|
item.year = dayjs(item.PublishDate).format('YYYY');
|
|
|
|
item.month = dayjs(item.PublishDate).format('MM');
|
|
|
|
item.day = dayjs(item.PublishDate).format('DD');
|
|
|
|
return item;
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleNotice() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/message/index',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleNoticeDetail(e) {
|
|
|
|
const { index } = e.currentTarget.dataset;
|
|
|
|
const { Id, Url } = this.data.notice[index];
|
|
|
|
app.mpBehavior({ PositionId: '4', OperateType: '1', OperateId: Id });
|
|
|
|
if (Url) {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: Url,
|
|
|
|
fail() {
|
|
|
|
wx.reLaunch({
|
|
|
|
url: Url,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleSwiperChange(e) {
|
|
|
|
const current = e.detail.current;
|
|
|
|
const { Id } = this.data.notice[current];
|
|
|
|
app.mpBehavior({ PositionId: '4', OperateType: '4', OperateId: Id });
|
|
|
|
this.setData({
|
|
|
|
current: e.detail.current,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getBriefingList() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=xd/doctor/index/get-material-list',
|
|
|
|
data: {
|
|
|
|
count: 10,
|
|
|
|
ContentType: 1,
|
|
|
|
},
|
|
|
|
}).then((res) => {
|
|
|
|
res.list.forEach((item) => {
|
|
|
|
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
|
|
|
|
});
|
|
|
|
this.setData({
|
|
|
|
briefingList: res.list,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getSopList() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=xd/doctor/index/get-material-list',
|
|
|
|
data: {
|
|
|
|
count: 10,
|
|
|
|
ContentType: 2,
|
|
|
|
},
|
|
|
|
}).then((res) => {
|
|
|
|
res.list.forEach((item) => {
|
|
|
|
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
|
|
|
|
});
|
|
|
|
this.setData({
|
|
|
|
sopList: res.list,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getList() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=xd/doctor/index/get-latest-material',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
res.list.forEach((item) => {
|
|
|
|
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
|
|
|
|
});
|
|
|
|
this.setData({
|
|
|
|
list: res.list,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleDetail(e: any) {
|
|
|
|
const { id } = e.currentTarget.dataset;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/pages/informationDetail/index?id=${id}`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleMore() {
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/information/index',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handlePopupOk() {
|
|
|
|
const { popupType } = this.data;
|
|
|
|
},
|
|
|
|
handlePopupCancel() {
|
|
|
|
const { popupType } = this.data;
|
|
|
|
if (popupType === 'popup1') {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'POST',
|
|
|
|
url: '?r=xd/doctor/index/cancel-welcome',
|
|
|
|
data: {},
|
|
|
|
}).then(() => {
|
|
|
|
this.setData({
|
|
|
|
popupShow: false,
|
|
|
|
popupType: '',
|
|
|
|
popupParams: {},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
popupShow: false,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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 {};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export {};
|