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.
114 lines
2.7 KiB
114 lines
2.7 KiB
|
1 week ago
|
import { getCurrentPageUrl } from '@/utils/util'
|
||
|
|
const app = getApp()
|
||
|
|
|
||
|
|
Component({
|
||
|
|
properties: {},
|
||
|
|
data: {
|
||
|
|
imageUrl: app.globalData.imageUrl,
|
||
|
|
isChild: 0,
|
||
|
|
active: 0,
|
||
|
|
list: [
|
||
|
|
{
|
||
|
|
pagePath: '/pages/index/index',
|
||
|
|
text: '首页',
|
||
|
|
icon: 'home',
|
||
|
|
iconActive: 'home-active',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: '/pages/repository/index',
|
||
|
|
text: 'MG全知道',
|
||
|
|
icon: 'story',
|
||
|
|
iconActive: 'story-active',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: '/pages/live/index',
|
||
|
|
text: '周三大咖说',
|
||
|
|
icon: 'gift',
|
||
|
|
iconActive: 'gift-active',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: '/pages/story/index',
|
||
|
|
text: '向往的生活',
|
||
|
|
icon: 'class',
|
||
|
|
iconActive: 'class-active',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: '/pages/my/index',
|
||
|
|
text: '我的',
|
||
|
|
icon: 'my',
|
||
|
|
iconActive: 'my-active',
|
||
|
|
},
|
||
|
|
],
|
||
|
|
userInfo: {},
|
||
|
|
showRed: false,
|
||
|
|
anyWhere: false,
|
||
|
|
|
||
|
|
config: {} as any,
|
||
|
|
},
|
||
|
|
observers: {},
|
||
|
|
lifetimes: {
|
||
|
|
ready() {
|
||
|
|
app.getTheme().then((res) => {
|
||
|
|
this.setData({
|
||
|
|
theme: res,
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|
||
|
|
const pagePath = getCurrentPageUrl()
|
||
|
|
const active = this.data.list.findIndex((item) => item.pagePath === pagePath)
|
||
|
|
this.setData({
|
||
|
|
active,
|
||
|
|
anyWhere: app.globalData.anyWhere,
|
||
|
|
})
|
||
|
|
this.setData({
|
||
|
|
showRed: app.globalData.showRed,
|
||
|
|
})
|
||
|
|
getApp().registerListener(() => {
|
||
|
|
this.setData({
|
||
|
|
anyWhere: app.globalData.anyWhere,
|
||
|
|
})
|
||
|
|
wx.ajax({
|
||
|
|
method: 'GET',
|
||
|
|
url: '?r=igg4/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 = ''
|
||
|
|
this.setData({
|
||
|
|
anyWhere: app.globalData.anyWhere,
|
||
|
|
})
|
||
|
|
if (pagePath == '/pages/my/index') {
|
||
|
|
app.permissionVerification(2, 0, `/pages/index/index`).then(() => {
|
||
|
|
wx.switchTab({
|
||
|
|
url: pagePath,
|
||
|
|
})
|
||
|
|
})
|
||
|
|
} else if (pagePath == '/pages/repository/index' && config.picTextEbookStatus == 1) {
|
||
|
|
app.permissionVerification(2, 0, `/pages/repository/index`).then(() => {
|
||
|
|
const webviewUrl = encodeURIComponent(
|
||
|
|
`${app.globalData.url}/zdcare/#/cover?loginState=${app.globalData.loginState}`,
|
||
|
|
)
|
||
|
|
wx.navigateTo({
|
||
|
|
url: `/pages/webview/index?url=${webviewUrl}`,
|
||
|
|
})
|
||
|
|
})
|
||
|
|
} else {
|
||
|
|
wx.switchTab({
|
||
|
|
url: pagePath,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})
|