Page({ dever: getApp().dever, product: null, data: { content: "", product_id: '' }, onLoad: function (options) { var that = this; that.setData({ id: options.id }); that.dever.request('product.api.view',{ signature: '', id: options.id }, { success: function (data, res) { that.product = data.product; var temp = that.dever.html('content', data.product.content, that); that.setData({ content: temp }) } }); }, /** * 分享 */ onShareAppMessage: function (options){ wx.showShareMenu({ withShareTicket: true, success: function(res){ //TODO }, fail: function(res){ //TODO } }) //options.from可以用来判断是从自定义button打开的转发页面,还是从右上角的打开的转发页面。 }, /** * 立即购买 */ doBuy: function(event){ var that = this; var id; if (typeof (event) == 'object') { id = event.currentTarget.dataset.id } else { id = event } this.dever.isLogin(function (res) { if (res) { that.dever.location('carts/index?id=' + id); } else { that.dever.location('login/index'); } }); } })