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/note/index', text: '突眼日记', custom: true, }, { 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 } = this.data const { pagePath, custom } = list[index] app.globalData.BeginnerCardId = '' if (custom) { wx.navigateTo({ url: pagePath, }) return } wx.reLaunch({ url: pagePath, }) }, }, })