// components/tabbarPage/index.js const $$ = require('../../utils/util'); const app = getApp(); Component({ /** * 组件的初始数据 */ data: { mediate: $$.url.img + 'mediate.png', mediate_active: $$.url.img + 'mediate-active.png', active: 0, loginVisible: !!app.globalData.token, moreFunctionVisible: false, moreFunctionList: [ { title: '找调解组员', subTitle: '专业的调解员为您快速解忧', icon: `${$$.url.img}mediator.png`, url: '../../pages/findAdjust/index?type=1', key: '3', }, { title: '找调解组织', subTitle: '身边的调解组织为您解忧', icon: `${$$.url.img}organization.png`, url: '../../pages/findAdjust/index?type=2', key: '2', }, // TODO:协助调解是“调解员端”功能,在当事人小程序中暂时隐藏 // { // title: '协助调解', // subTitle: '参与到外部调解并提供帮助', // icon: `${$$.url.img}assistMediate.png`, // url: '../../pages/assistMediate/index', // key: '5', // }, { title: '我的司法确认', subTitle: '查询司法确认受理进度', icon: `${$$.url.img}judicial-confirmation.png`, url: '../../pages/myJudicialConfirmation/index', key: '1', }, { title: '个人中心', subTitle: '实名认证,完善个人信息', icon: `${$$.url.img}me-center.png`, url: '../../pages/me/index', key: '4', }, ], }, pageLifetimes: { show: function () { if (app.globalData.token && !this.data.loginVisible) { this.setData({ loginVisible: true }); } if (!app.globalData.token) { this.setData({ loginVisible: false }); } }, }, /** * 组件的方法列表 */ methods: { // 退出登录 loginOut() { this.setData({ loginVisible: false }); }, // 更多功能进入 _handleGoPage(e) { let url = e.currentTarget.dataset.url; let key = e.currentTarget.dataset.key; if (['2', '3', '4'].includes(key) && $$.userTest('login')) { wx.navigateTo({ url: url, }); } if (['1', '5'].includes(key) && $$.userTest('all')) { wx.navigateTo({ url: url, }); } }, // 切换tab _handleChangeTab(event) { if (event.detail === 1) { this._handleMaskVisible(); return false; } if (event.detail === 2 && !this.data.loginVisible) { wx.navigateTo({ url: '../../pages/login/index' }); return false; } if (event.detail === 3) { if ($$.userTest('all')) { wx.navigateTo({ url: '../../pages/myMediate/index' }); } } }, // 关闭mask _handleMaskVisible() { this.setData({ moreFunctionVisible: !this.data.moreFunctionVisible }); }, }, });