index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. showPoster:false,
  30. programConfig: {}
  31. },
  32. lifetimes: {
  33. attached() {
  34. this.setData({
  35. programConfig: app.globalData.programConfig
  36. });
  37. }
  38. },
  39. methods: {
  40. switchTab(e) {
  41. const { path, index } = e.currentTarget.dataset
  42. wx.switchTab({ url: path })
  43. this.setData({ selected: index })
  44. },
  45. onCloseShare() {
  46. this.setData({ showShare: false })
  47. },
  48. openShare() {
  49. this.setData({ showShare: true })
  50. },
  51. openShowAgreementModal(){
  52. this.setData({ showAgreementModal: true })
  53. },
  54. onClosePoster(){
  55. this.setData({ showPoster: true })
  56. },
  57. openPoster() {
  58. this.setData({
  59. showShare:false,
  60. showPoster: true
  61. });
  62. },
  63. // 分享逻辑
  64. onShareAppMessage(res) {
  65. const shareType = res.target.dataset.type;
  66. if (shareType === 'poster') {
  67. // return {
  68. // title: '分享我的专属海报',
  69. // path: '/pages/index/index',
  70. // imageUrl: app.globalData.programConfig.share_img
  71. // }
  72. } else if (shareType === 'friend') {
  73. return {
  74. path: '/pages/index/index',
  75. imageUrl: app.globalData.programConfig.share_img
  76. }
  77. }
  78. }
  79. }
  80. })