let app = getApp(); const util = require("../../utils/util"); Component({ properties: { imgPath: { type: String, observer: function (newVal, oldVal) { console.log(newVal); this.setData({ imgPath: newVal }); } }, data: { type: Object, observer: function (newVal, oldVal) { console.log(newVal); this.setData({ activeData: newVal }) } }, history: { type: Number, observer: function (newVal, oldVal) { this.setData({ history: newVal }) } } }, data: { activeData: {}, history: 0 }, methods: { goDetails(e) { wx.reportAnalytics('index_acitve', { aid: e.currentTarget.dataset.aid, title: e.currentTarget.dataset.title, }); wx.navigateTo({ url: '/pages/product/activity/index?aid=' + e.currentTarget.dataset.aid }) }, binderror(e) { var activeData = this.data.activeData, index = e.currentTarget.dataset.index; activeData[index].logo = '/images/noimg.png'; this.setData({ activeData }); }, goenlist(e) { wx.reportAnalytics('index_pay', { aid: e.currentTarget.dataset.aid, title: e.currentTarget.dataset.title, }); if (app.globalData.userInfo) { wx.navigateTo({ url: '/pages/product/activity/buy?aid=' + e.currentTarget.dataset.aid }) } else { // 静默登录 util.silentLogin().then(res => { wx.navigateTo({ url: '/pages/product/activity/buy?aid=' + e.currentTarget.dataset.aid }) }) } }, } });