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.
|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
popupShow: false,
|
|
|
|
popupType: 'argument',
|
|
|
|
popupParams: {
|
|
|
|
position: 'bottom',
|
|
|
|
},
|
|
|
|
|
|
|
|
userInfo: {},
|
|
|
|
bannerList: [],
|
|
|
|
knowledgeList: [] as any,
|
|
|
|
|
|
|
|
pageTop: '',
|
|
|
|
background: 'transparent',
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
app.waitLogin().then(() => {
|
|
|
|
this.setData({})
|
|
|
|
app.getUserInfo().then((userInfo) => {
|
|
|
|
this.setData({
|
|
|
|
userInfo,
|
|
|
|
popupShow: !userInfo.guestPrivacyAgree,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.getBanner()
|
|
|
|
this.getKnowledgeList()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getBanner() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=wtx/common/banner-config',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
bannerList: res,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getKnowledgeList() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=wtx/knowledge/index-list',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
knowledgeList: res.list,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onBannerItemTap(e: any) {
|
|
|
|
const { path } = e.currentTarget.dataset
|
|
|
|
wx.navigateTo({
|
|
|
|
url: path,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleKnowledge() {
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/knowledge/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleKnowledgeDetail(e: any) {
|
|
|
|
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}`,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
routerTo(e) {
|
|
|
|
const { url } = e.currentTarget.dataset
|
|
|
|
wx.navigateTo({
|
|
|
|
url,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handlePopupOk() {
|
|
|
|
const { popupType } = this.data
|
|
|
|
if (popupType === 'argument') {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'POST',
|
|
|
|
url: '?r=wtx/user/agree-guest-privacy',
|
|
|
|
data: {
|
|
|
|
// TODO: 待补充
|
|
|
|
WorkerId: '',
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.setData({
|
|
|
|
popupShow: false,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handlePopupCancel() {
|
|
|
|
if (this.data.popupType === 'argument') {
|
|
|
|
wx.exitMiniProgram()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export {}
|