index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const app = getApp();
  2. Component({
  3. data: {
  4. selected: 0,
  5. color: "#7A7E83",
  6. selectedColor: "#3cc51f",
  7. list: [
  8. {
  9. pagePath: "/pages/index/index",
  10. text: "首页",
  11. iconPath: "/static/tabbar/index.png",
  12. selectedIconPath: "/static/tabbar/index-active.png"
  13. },
  14. {
  15. pagePath: "/pages/store/store",
  16. text: "门店",
  17. iconPath: "/static/tabbar/store.png",
  18. selectedIconPath: "/static/tabbar/store-active.png"
  19. },
  20. {
  21. pagePath: "/pages/mine/mine",
  22. text: "我的",
  23. iconPath: "/static/tabbar/me.png",
  24. selectedIconPath: "/static/tabbar/me-active.png"
  25. }
  26. ],
  27. showShare: false,
  28. showAgreementModal:false,
  29. programConfig: {}
  30. },
  31. lifetimes: {
  32. attached() {
  33. this.setData({
  34. programConfig: app.globalData.programConfig
  35. });
  36. }
  37. },
  38. methods: {
  39. switchTab(e) {
  40. const { path, index } = e.currentTarget.dataset
  41. wx.switchTab({ url: path })
  42. this.setData({ selected: index })
  43. },
  44. onCloseShare() {
  45. this.setData({ showShare: false })
  46. },
  47. openShare() {
  48. this.setData({ showShare: true })
  49. },
  50. openShowAgreementModal(){
  51. this.setData({ showAgreementModal: true })
  52. },
  53. // 分享逻辑
  54. onShareAppMessage() {
  55. return {
  56. path: '/pages/index/index',
  57. imageUrl: app.globalData.programConfig.share_img
  58. }
  59. },
  60. // onShareTimeline() {
  61. // return {
  62. // title: '分享到朋友圈标题',
  63. // query: 'id=123',
  64. // imageUrl: '/static/tabbar/tp.png'
  65. // }
  66. // },
  67. }
  68. })