拓恒河湖长制全民护河平台WEB端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

56 行
1.3KB

  1. const app = getApp();
  2. import {getUserInfo} from '../utils/getUserInfo.js'
  3. Component({
  4. data: {
  5. selected: 0,
  6. color: "#939393",
  7. selectedColor: "#477DF3",
  8. list: [
  9. {
  10. pagePath: "/pages/home/index",
  11. iconPath: '../assets/tabBar/protect.png',
  12. selectedIconPath:'../assets/tabBar/protect_h.png',
  13. text: "全民护河",
  14. auth: false,
  15. isSpecial: false
  16. },
  17. {
  18. pagePath: "/pages/mine/index",
  19. iconPath: '../assets/tabBar/mine.png',
  20. selectedIconPath:'../assets/tabBar/mine_h.png',
  21. text: "我的",
  22. auth: true,
  23. isSpecial: false
  24. }
  25. ],
  26. isIphoneX: app.globalData.isIphoneX
  27. },
  28. methods: {
  29. switchTab(e) {
  30. const dataset = e.currentTarget.dataset
  31. const path = dataset.path
  32. const index = dataset.index
  33. const auth = dataset.auth
  34. const openId = wx.getStorageSync('openId')
  35. if(auth) {
  36. if(openId) {
  37. wx.switchTab({
  38. url: path
  39. })
  40. } else {
  41. getUserInfo().then(res=> {
  42. wx.switchTab({
  43. url: path
  44. })
  45. })
  46. }
  47. } else {
  48. //正常的tabbar切换界面
  49. wx.switchTab({
  50. url: path
  51. })
  52. }
  53. }
  54. }
  55. })