信达小程序
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.
 
 
 

105 lines
2.6 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: 'home',
iconActive: 'home-active',
},
{
pagePath: '/patient/pages/repository/index',
text: 'MG全知道',
icon: 'story',
iconActive: 'story-active',
},
{
pagePath: '/patient/pages/live/index',
text: '周三大咖说',
icon: 'gift',
iconActive: 'gift-active',
},
{
pagePath: '/patient/pages/story/index',
text: '向往的生活',
icon: 'class',
iconActive: 'class-active',
},
{
pagePath: '/patient/pages/my/index',
text: '我的',
icon: 'my',
iconActive: 'my-active',
},
],
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,
});
}
},
},
});