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.
99 lines
2.5 KiB
99 lines
2.5 KiB
import { getCurrentPageUrl } from '@/utils/util' |
|
const app = getApp() |
|
|
|
Component({ |
|
properties: {}, |
|
data: { |
|
imageUrl: app.globalData.imageUrl, |
|
isChild: 0, |
|
active: 0, |
|
list: [ |
|
{ |
|
pagePath: '/patient/pages/index/index', |
|
text: '首页', |
|
icon: 'tab1', |
|
iconActive: 'tab-active1', |
|
}, |
|
{ |
|
pagePath: '/patient/pages/repository/index', |
|
text: '了解TED', |
|
icon: 'tab2', |
|
iconActive: 'tab-active2', |
|
}, |
|
{ |
|
pagePath: '/patient/pages/live/index', |
|
text: '大咖说', |
|
icon: 'tab5', |
|
iconActive: 'tab-active5', |
|
}, |
|
{ |
|
pagePath: '/patient/pages/my/index', |
|
text: '我的', |
|
icon: 'tab3', |
|
iconActive: 'tab-active3', |
|
}, |
|
], |
|
userInfo: {}, |
|
showRed: false, |
|
|
|
config: {} as any, |
|
}, |
|
observers: {}, |
|
lifetimes: { |
|
ready() { |
|
app.zdGetTheme().then((res) => { |
|
this.setData({ |
|
theme: res, |
|
}) |
|
}) |
|
|
|
const pagePath = getCurrentPageUrl() |
|
const active = this.data.list.findIndex((item) => item.pagePath === pagePath) |
|
this.setData({ |
|
active, |
|
}) |
|
this.setData({ |
|
showRed: app.globalData.showRed, |
|
}) |
|
// getApp().registerListener(() => { |
|
// wx.ajax({ |
|
// method: 'GET', |
|
// url: '?r=zd/common/get-config', |
|
// }).then((res) => { |
|
// this.setData({ |
|
// config: res, |
|
// }); |
|
// }); |
|
// }); |
|
}, |
|
}, |
|
methods: { |
|
onChange() {}, |
|
handleNav(e) { |
|
const { index } = e.currentTarget.dataset |
|
const { list, config } = this.data |
|
const pagePath = list[index].pagePath |
|
app.globalData.BeginnerCardId = '' |
|
if (pagePath == '/patient/pages/my/index') { |
|
app.zdPermissionVerification(2, 0, `/patient/pages/index/index`).then(() => { |
|
wx.reLaunch({ |
|
url: pagePath, |
|
}) |
|
}) |
|
} else if (pagePath == '/patient/pages/repository/index' && config.picTextEbookStatus == 1) { |
|
app.zdPermissionVerification(2, 0, `/pages/repository/index`).then(() => { |
|
const webviewUrl = encodeURIComponent( |
|
`${app.globalData.url}/zdcare/#/cover?loginState=${app.globalData.loginState}`, |
|
) |
|
wx.navigateTo({ |
|
url: `/patient/pages/webview/index?url=${webviewUrl}`, |
|
}) |
|
}) |
|
} else { |
|
wx.reLaunch({ |
|
url: pagePath, |
|
}) |
|
} |
|
}, |
|
}, |
|
})
|
|
|