|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
|
|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
const licia = require('miniprogram-licia')
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
today: dayjs().format('YYYY年MM月DD日 dddd'),
|
|
|
|
|
|
|
|
|
|
qolShow: false,
|
|
|
|
|
hormoneShow: false,
|
|
|
|
|
medicalInsuranceShow: false,
|
|
|
|
|
hospitalMapShow: false,
|
|
|
|
|
configList: [],
|
|
|
|
|
infoList: [] as any,
|
|
|
|
|
zdUserInfo: {} as any,
|
|
|
|
|
anyWhere: false,
|
|
|
|
|
regGuide: true,
|
|
|
|
|
isLogin: 1,
|
|
|
|
|
|
|
|
|
|
qolDetail: {} as any,
|
|
|
|
|
hormoneDetail: { recordId: '' },
|
|
|
|
|
|
|
|
|
|
adlList: [],
|
|
|
|
|
adlNum: '',
|
|
|
|
|
adlNewRecord: {} as any,
|
|
|
|
|
|
|
|
|
|
liveList: [],
|
|
|
|
|
liveStatus: app.globalData.liveStatus,
|
|
|
|
|
|
|
|
|
|
liveDownList: [],
|
|
|
|
|
|
|
|
|
|
// toastShow: true,
|
|
|
|
|
// toastType: "doubleStandards",
|
|
|
|
|
// toastType: "healthCare",
|
|
|
|
|
// toastType: "aldAlert",
|
|
|
|
|
// toastType:"dedicatedDoctor",
|
|
|
|
|
// toastType: 'public-toast',
|
|
|
|
|
// toastType: 'drug-guide',
|
|
|
|
|
// toastType: 'medical-guide',
|
|
|
|
|
// toastType: 'question-toast',
|
|
|
|
|
// toastType: 'guideEnterInfo',
|
|
|
|
|
// toastType: 'guideEnterInfoJump',
|
|
|
|
|
|
|
|
|
|
toastShow: false,
|
|
|
|
|
toastType: '',
|
|
|
|
|
toastParams: {} as any,
|
|
|
|
|
|
|
|
|
|
sliderTop: 0,
|
|
|
|
|
|
|
|
|
|
unreadCount: 0,
|
|
|
|
|
|
|
|
|
|
options: {} as any,
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
const systemInfo = wx.getSystemInfoSync()
|
|
|
|
|
|
|
|
|
|
if (options.visitors === '1') {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '未完成注册,登录失败',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.zdGetTheme().then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
theme: res,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (options.jump == '1') {
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: true,
|
|
|
|
|
toastType: 'guideEnterInfoJump',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
sliderTop: systemInfo.screenHeight - 160,
|
|
|
|
|
options,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
app.waitLogin({ type: [0, 1] }).then(() => {
|
|
|
|
|
app.mpBehavior({ PageName: 'PG_PatientHome' })
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
anyWhere: app.globalData.anyWhere,
|
|
|
|
|
isLogin: app.globalData.isLogin,
|
|
|
|
|
})
|
|
|
|
|
if (this.data.options.es === '201501') {
|
|
|
|
|
app.globalData.IsAliQiWei = 1
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
options: {},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
app.getZdUserInfo(this, true, (zdUserInfo) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
zdUserInfo,
|
|
|
|
|
})
|
|
|
|
|
if (zdUserInfo.ExclusiveDoctorId) {
|
|
|
|
|
app.mpBehavior({ PageName: 'PG_PatientHomeDoctorCard' })
|
|
|
|
|
}
|
|
|
|
|
this.getPopup()
|
|
|
|
|
this.getConfig(zdUserInfo)
|
|
|
|
|
this.getSystemConfig()
|
|
|
|
|
if (zdUserInfo.ExclusiveDoctorId > 0) {
|
|
|
|
|
this.getUnreadCount()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async getPopup() {
|
|
|
|
|
if (this.data.toastShow)
|
|
|
|
|
return
|
|
|
|
|
const data1 = await wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/popup/info',
|
|
|
|
|
data: {
|
|
|
|
|
Type: 6,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if (data1.showAlert) {
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: data1.showAlert,
|
|
|
|
|
toastType: 'dedicatedDoctor',
|
|
|
|
|
toastParams: {},
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data2 = await wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/popup/get-popup',
|
|
|
|
|
data: {
|
|
|
|
|
type: 1,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if (data2.showAlert) {
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: data2.showAlert,
|
|
|
|
|
toastType: 'drug-guide',
|
|
|
|
|
toastParams: {},
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data3 = await wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/popup/get-popup',
|
|
|
|
|
data: {
|
|
|
|
|
type: 3,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if (data3.showAlert) {
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: data3.showAlert,
|
|
|
|
|
toastType: 'medical-guide',
|
|
|
|
|
toastParams: {},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data4 = await wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/popup/get-need-popup',
|
|
|
|
|
data: {
|
|
|
|
|
type: 1,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if (data4.showAlert) {
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: data4.showAlert,
|
|
|
|
|
toastType: 'guideEnterInfo',
|
|
|
|
|
toastParams: {},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getUnreadCount() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/message-interact/get-unread-count',
|
|
|
|
|
data: {},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
unreadCount: res,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getSystemConfig() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/common/get-config',
|
|
|
|
|
data: {},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
systemConfig: res,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getConfig(zdUserInfo: any) {
|
|
|
|
|
// 处理用户类型
|
|
|
|
|
const UserType = zdUserInfo.UserType <= 2 ? 1 : Math.min(zdUserInfo.UserType, 3)
|
|
|
|
|
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `?r=zd/mini-conf/get-config`,
|
|
|
|
|
data: { userType: UserType },
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
// 过滤子列表
|
|
|
|
|
const processedRes = res.map((item: any) => {
|
|
|
|
|
if (['spread1', 'spread2', 'serviceConf'].includes(item.code)) {
|
|
|
|
|
item.subList = item.subList?.filter((subItem: any) => subItem.showStatus == 1) || []
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 初始化显示状态
|
|
|
|
|
const statusMap = {
|
|
|
|
|
qolShow: false,
|
|
|
|
|
hormoneShow: false,
|
|
|
|
|
medicalInsuranceShow: false,
|
|
|
|
|
hospitalMapShow: false,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理配置项
|
|
|
|
|
processedRes.forEach((item: any) => {
|
|
|
|
|
const { code, showStatus, configId, showNum } = item
|
|
|
|
|
|
|
|
|
|
// 设置显示状态
|
|
|
|
|
if (code === 'medicalInsurance' && showStatus == 1) {
|
|
|
|
|
statusMap.medicalInsuranceShow = true
|
|
|
|
|
}
|
|
|
|
|
if (code === 'hospitalMap' && showStatus == 1) {
|
|
|
|
|
statusMap.hospitalMapShow = true
|
|
|
|
|
}
|
|
|
|
|
if (code === 'adl' && showStatus == 1) {
|
|
|
|
|
statusMap.qolShow = true
|
|
|
|
|
}
|
|
|
|
|
if (code === 'hormone' && showStatus == 1) {
|
|
|
|
|
statusMap.hormoneShow = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 调用对应方法
|
|
|
|
|
switch (code) {
|
|
|
|
|
case 'article':
|
|
|
|
|
this.getInfoList(configId)
|
|
|
|
|
break
|
|
|
|
|
case 'adl':
|
|
|
|
|
this.getQol()
|
|
|
|
|
break
|
|
|
|
|
case 'hormone':
|
|
|
|
|
this.getHormone()
|
|
|
|
|
break
|
|
|
|
|
case 'activity2':
|
|
|
|
|
this.getActivity(configId, showNum, 'liveList')
|
|
|
|
|
break
|
|
|
|
|
case 'activity1':
|
|
|
|
|
this.getActivity(configId, showNum, 'liveDownList')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
configList: processedRes,
|
|
|
|
|
...statusMap,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
setPopupInfo() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/update-click-status',
|
|
|
|
|
data: {
|
|
|
|
|
Type: 1,
|
|
|
|
|
Id: this.data.toastParams.Id,
|
|
|
|
|
},
|
|
|
|
|
}).then((_res) => {})
|
|
|
|
|
},
|
|
|
|
|
getInfoList(configId: string) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/pic-text/index-list',
|
|
|
|
|
data: {
|
|
|
|
|
count: 0,
|
|
|
|
|
ConfigId: configId,
|
|
|
|
|
},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
infoList: licia.chunk(res.list, 3),
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getQol() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=xd/qol/index',
|
|
|
|
|
data: {},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
qolDetail: {
|
|
|
|
|
...res.newRecord,
|
|
|
|
|
isTodayRecord: res.isTodayRecord,
|
|
|
|
|
CreateDate: dayjs(res.newRecord.CreateTime).format('MM-DD'),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getHormone() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=xd/hormone-dosage/get-last-record',
|
|
|
|
|
data: {},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
hormoneDetail: {
|
|
|
|
|
...res,
|
|
|
|
|
createTime: dayjs(res.createTime).format('MM-DD'),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getActivity(ConfigId: string, count: number, key: string) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=zd/activity/index-list',
|
|
|
|
|
data: { ConfigId, count },
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
[key]: res.list.map((item) => {
|
|
|
|
|
item.EndTimeValue = dayjs(item.EndTime).valueOf()
|
|
|
|
|
item.BeginTimeValue = dayjs(item.BeginTime).valueOf()
|
|
|
|
|
item.SignUpDeadlineValue = dayjs(item.SignUpDeadline).valueOf()
|
|
|
|
|
item.BeginDate = dayjs(item.BeginTime).format('YYYY-MM-DD')
|
|
|
|
|
item.EndDate = dayjs(item.EndTime).format('YYYY-MM-DD')
|
|
|
|
|
item.isDay = item.BeginDate == item.EndDate
|
|
|
|
|
item.BeginHm = dayjs(item.BeginTime).format('HH:mm')
|
|
|
|
|
item.EndHm = dayjs(item.EndTime).format('HH:mm')
|
|
|
|
|
item.BeginTime = dayjs(item.BeginTime).format('YYYY-MM-DD HH:mm')
|
|
|
|
|
item.EndTime = dayjs(item.EndTime).format('YYYY-MM-DD HH:mm')
|
|
|
|
|
return item
|
|
|
|
|
}),
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
routerTo(e) {
|
|
|
|
|
let { url, active, code } = e.currentTarget.dataset
|
|
|
|
|
if (!url)
|
|
|
|
|
return
|
|
|
|
|
if (code === 'doctor') {
|
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientHomeDoctorCard' })
|
|
|
|
|
}
|
|
|
|
|
if (code === 'activity2' && url.includes('/patient/pages/live/index')) {
|
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientHomeLiveCard' })
|
|
|
|
|
}
|
|
|
|
|
if (code === 'activity2' && url.includes('/patient/pages/liveDetail/index')) {
|
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientHomeLiveCard' })
|
|
|
|
|
}
|
|
|
|
|
if (code === 'article' && url.includes('/patient/pages/repositoryDetail/index')) {
|
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientHomeContentCard' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (url.includes('loginState')) {
|
|
|
|
|
url = url + encodeURIComponent(app.globalData.loginState)
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url,
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url,
|
|
|
|
|
fail() {
|
|
|
|
|
app.globalData.active = active
|
|
|
|
|
wx.switchTab({
|
|
|
|
|
url,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleAddQol() {
|
|
|
|
|
const { qolDetail } = this.data
|
|
|
|
|
const url = qolDetail.Id ? `/patient/pages/qolAdd/index?id=${qolDetail.Id}` : `/patient/pages/qol/index`
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url,
|
|
|
|
|
success() {
|
|
|
|
|
if (qolDetail.isTodayRecord) {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: '每日仅录入1次,您可修改选项',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleReg() {
|
|
|
|
|
app.zdPermissionVerification(3, 0, '')
|
|
|
|
|
},
|
|
|
|
|
handleToastOk() {
|
|
|
|
|
const { toastType } = this.data
|
|
|
|
|
if (toastType === 'ndrlAldAlert') {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/adl/index?nrdl=1',
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel()
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'doubleStandards') {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/adl/index',
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel()
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'dedicatedDoctor') {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/close-popup',
|
|
|
|
|
data: {
|
|
|
|
|
Type: 6,
|
|
|
|
|
},
|
|
|
|
|
}).then((_res) => {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/interactivePatient/index',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel(null, false)
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'drug-guide') {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/add-record',
|
|
|
|
|
data: { type: 1 },
|
|
|
|
|
}).then(() => {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/personalInformation/index?bottom=1&submit=1',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel(null, false)
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'medical-guide') {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/add-record',
|
|
|
|
|
data: { type: 3 },
|
|
|
|
|
}).then(() => {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/medical/index',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel(null, false)
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'guideEnterInfo') {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/close-need-popup',
|
|
|
|
|
data: { type: 1 },
|
|
|
|
|
}).then(() => {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/personalInformation/index',
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel(null, false)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'guideEnterInfoJump') {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/patient/pages/personalInformation/index',
|
|
|
|
|
})
|
|
|
|
|
this.handleToastCancel(null, false)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleToastCancel(_e = null, sure = true) {
|
|
|
|
|
const { toastType } = this.data
|
|
|
|
|
if (toastType === 'doubleStandards' && sure) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/close-popup',
|
|
|
|
|
data: {
|
|
|
|
|
Type: 5,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'dedicatedDoctor' && sure) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/close-popup',
|
|
|
|
|
data: {
|
|
|
|
|
Type: 6,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'drug-guide' && sure) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/add-record',
|
|
|
|
|
data: { type: 1 },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'medical-guide' && sure) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/add-record',
|
|
|
|
|
data: { type: 3 },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else if (toastType === 'guideEnterInfo' && sure) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/popup/close-need-popup',
|
|
|
|
|
data: { type: 1 },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: false,
|
|
|
|
|
toastType: '',
|
|
|
|
|
toastParams: '',
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleRegClose() {
|
|
|
|
|
this.setData({
|
|
|
|
|
regGuide: false,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleToggleSave(e) {
|
|
|
|
|
const { index, sindex } = e.currentTarget.dataset
|
|
|
|
|
const list = this.data.infoList
|
|
|
|
|
const { Id, IsCollect } = list[index][sindex]
|
|
|
|
|
app.zdPermissionVerification(3, 3, `patient/pages/repository/index`).then(() => {
|
|
|
|
|
if (IsCollect == 1) {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/pic-text/cancel-collection',
|
|
|
|
|
data: {
|
|
|
|
|
ContentId: Id,
|
|
|
|
|
},
|
|
|
|
|
loading: true,
|
|
|
|
|
}).then(() => {
|
|
|
|
|
list[index][sindex].IsCollect = 0
|
|
|
|
|
list[index][sindex].CollectionPeopleNum = list[index][sindex].CollectionPeopleNum - 1
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '取消收藏',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
infoList: list,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/pic-text/collection',
|
|
|
|
|
data: {
|
|
|
|
|
ContentId: Id,
|
|
|
|
|
},
|
|
|
|
|
loading: true,
|
|
|
|
|
}).then(() => {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '收藏成功',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
})
|
|
|
|
|
list[index][sindex].IsCollect = 1
|
|
|
|
|
list[index][sindex].CollectionPeopleNum = Number(list[index][sindex].CollectionPeopleNum) + 1
|
|
|
|
|
this.setData({
|
|
|
|
|
timeToastType: '10',
|
|
|
|
|
saveLock: true,
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
infoList: list,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleQuestionToast(e) {
|
|
|
|
|
const { type } = e.currentTarget.dataset
|
|
|
|
|
this.setData({
|
|
|
|
|
toastShow: true,
|
|
|
|
|
toastType: 'question-toast',
|
|
|
|
|
toastParams: {
|
|
|
|
|
content: { 1: '???', 2: '???' }[type],
|
|
|
|
|
close: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|