12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- const app = getApp()
- Component({
- data: {
- selected: 2,
- color: "#7A7E83",
- selectedColor: "#45A6B5",
- list: [{
- pagePath: "/pages/index/index",
- iconPath: "/imaes/home_nor@2x.png",
- selectedIconPath: "/imaes/home_sel@2x.png",
- text: "首页"
- }, {
- pagePath: "/pages/report/report",
- iconPath: "/imaes/baogao_nor@2x.png",
- selectedIconPath: "/imaes/baogao_sel@2x.png",
- text: "报告"
- },{
- pagePath: "/pages/my/my",
- iconPath: "/imaes/me_nor@2x.png",
- selectedIconPath: "/imaes/me_sel@2x.png",
- text: "我的"
- }]
- },
- attached() {
- },
- ready () {
- this.setData({
- selected: app.globalData.selectedInex
- })
- },
- methods: {
- switchTab(e) {
- const data = e.currentTarget.dataset
- const url = data.path
- if (data.index == 0 || data.index == 1) {
- if (!app.globalData.userInfo.login) {
- wx.showToast({
- title: '请先授权登录',
- icon: 'error'
- })
- return false
- } else {
- app.globalData.selectedInex = data.index
- wx.switchTab({url})
- }
- } else {
- app.globalData.selectedInex = data.index
- wx.switchTab({url})
- }
- }
- }
- })
|