index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import {
  2. storeBindingsBehavior
  3. } from 'mobx-miniprogram-bindings'
  4. import {
  5. store
  6. } from '~/store/index'
  7. Component({
  8. behaviors: [storeBindingsBehavior],
  9. storeBindings: {
  10. store,
  11. fields: {
  12. userInfo: 'userInfo',
  13. androidMask: 'androidMaskFun'
  14. },
  15. },
  16. /**
  17. * 组件的属性列表
  18. */
  19. properties: {},
  20. /**
  21. * 组件的初始数据
  22. */
  23. data: {
  24. selected: 2,
  25. color: "#999999",
  26. selectedColor: "#32CA69",
  27. mask: false,
  28. listTab: [{
  29. "pagePath": "/pages/activity/index",
  30. "text": "活动",
  31. "iconPath": "/static/activity.png",
  32. "selectedIconPath": "/static/activity2.png"
  33. }, {
  34. "pagePath": "/pages/works/index",
  35. "text": "作品",
  36. "iconPath": "/static/zp.png",
  37. "selectedIconPath": "/static/zp2.png"
  38. }, {
  39. "pagePath": "/pages/index/index",
  40. "text": "推荐",
  41. "iconPath": "/static/tj.png",
  42. "selectedIconPath": "/static/tj2.png"
  43. }, {
  44. "pagePath": "/pages/message/index",
  45. "text": "消息",
  46. "iconPath": "/static/message.png",
  47. "selectedIconPath": "/static/message2.png"
  48. }, {
  49. "pagePath": "/pages/my/index",
  50. "text": "我的",
  51. "iconPath": "/static/my.png",
  52. "selectedIconPath": "/static/my2.png"
  53. }]
  54. },
  55. /**
  56. * 组件的方法列表
  57. */
  58. methods: {
  59. switchTab(e) {
  60. if (e.currentTarget.dataset.index != this.data.selected) {
  61. this.setData({
  62. selected: ''
  63. })
  64. const data = e.currentTarget.dataset;
  65. const url = data.path;
  66. wx.switchTab({
  67. url
  68. });
  69. }
  70. },
  71. toAndroidLogin() {
  72. wx.redirectTo({
  73. url: '/pages/donutLogin/index',
  74. })
  75. }
  76. }
  77. })