武田基因病B开发环境
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.

147 lines
3.2 KiB

2 months ago
const app = getApp<IAppOption>()
2 months ago
Page({
data: {
popupShow: false,
popupType: 'argument',
popupParams: {
position: 'bottom',
},
2 months ago
userInfo: {},
bannerList: [],
2 months ago
knowledgeList: [] as any,
questionList: [] as any,
2 months ago
2 months ago
pageTop: '',
background: 'transparent',
},
onLoad() {
2 months ago
app.waitLogin().then(() => {
2 months ago
this.setData({})
2 months ago
app.getUserInfo().then((userInfo) => {
this.setData({
userInfo,
2 months ago
popupShow: !userInfo.guestPrivacyAgree,
2 months ago
})
2 months ago
if (!userInfo.guestPrivacyAgree) {
app.mpBehavior({ PageName: 'PG_PATIENTLOGIN' })
}
2 months ago
})
this.getBanner()
2 months ago
this.getKnowledgeList()
this.getQuestionList()
2 months ago
})
},
getBanner() {
wx.ajax({
method: 'GET',
url: '?r=wtx/common/banner-config',
data: {},
}).then((res) => {
this.setData({
bannerList: res,
})
})
},
2 months ago
getKnowledgeList() {
wx.ajax({
method: 'GET',
url: '?r=wtx/knowledge/index-list',
data: {},
}).then((res) => {
this.setData({
knowledgeList: res.list,
})
})
},
getQuestionList() {
wx.ajax({
method: 'GET',
url: '?r=wtx/common-question/index-list',
data: {},
}).then((res) => {
this.setData({
questionList: res.list,
})
})
},
2 months ago
onBannerItemTap(e: any) {
app.mpBehavior({ PageName: 'BTN_HOMEBANNER' })
2 months ago
const { path } = e.currentTarget.dataset
wx.navigateTo({
url: path,
2 months ago
})
},
2 months ago
handleKnowledge() {
app.mpBehavior({ PageName: 'BTN_HOMEEDUCATIONALL' })
2 months ago
wx.switchTab({
url: '/pages/knowledge/index',
})
},
handleKnowledgeDetail(e: any) {
app.mpBehavior({ PageName: 'BTN_HOMEEDUCATIONCARD' })
2 months ago
const { index } = e.currentTarget.dataset
const params = this.data.knowledgeList[index]
if (params.Type == 1) {
wx.navigateTo({
url: `/pages/knowledgeDetail/index?id=${params.Id}`,
})
return
}
wx.navigateTo({
url: `/pages/knowledgeDetailVideo/index?id=${params.Id}`,
})
},
2 months ago
handleAskItem(e) {
app.mpBehavior({ PageName: 'BTN_HOMEFAQENTRY' })
const { id } = e.currentTarget.dataset
wx.navigateTo({
url: `/pages/ask/index?id=${id}`,
})
wx.ajax({
method: 'POST',
url: '?r=wtx/common-question/click',
data: { Id: id },
})
},
2 months ago
routerTo(e) {
const { url } = e.currentTarget.dataset
2 months ago
const PageName = {
'/pages/applyFrom/index': 'BTN_HOMEPREAPPLYCARD',
2 months ago
'/pages/ask/index': 'BTN_HOMEFAQENTRY',
}[url]
if (PageName) {
app.mpBehavior({ PageName })
}
2 months ago
wx.navigateTo({
url,
})
},
2 months ago
handlePopupOk() {
const { popupType } = this.data
if (popupType === 'argument') {
2 months ago
app.mpBehavior({ PageName: 'BTN_PATIENTLOG' })
2 months ago
wx.ajax({
method: 'POST',
url: '?r=wtx/user/agree-guest-privacy',
data: {
2 months ago
WorkerId: app.globalData.scene?.workerId || '',
2 months ago
},
}).then(() => {
this.setData({
popupShow: false,
})
})
}
},
handlePopupCancel() {
if (this.data.popupType === 'argument') {
wx.exitMiniProgram()
}
},
2 months ago
})
export {}