Page({ dever: getApp().dever, product_id: '', data: { content: '' }, onLoad: function (options) { var that = this; that.dever.showLoading(); if(typeof options.scene == 'undefined'){ that.product_id = options.id; }else{ var scene = decodeURIComponent(options.scene); scene = scene.split(','); //var uid = scene[0]; that.product_id = scene[1]; } that.dever.request('product.api.view',{ signature: that.dever.getSignature(), id: that.product_id }, { success: function (data, res) { var temp = that.dever.html('content', data.product.content, that); that.setData({ content: temp }) that.dever.hideLoading(); } }); }, /** * 跳转海报分享页面,分享海报 */ toShare: function(){ var that = this; that.dever.isLogin(function (res) { if (res) { this.dever.location('poster/index'); } else { that.dever.location('login/index'); } }); }, /** * 立即购买 */ doBuy: function(e){ var that = this; this.dever.isLogin(function (res) { if (res) { that.dever.request('product.api.addCarts', { json: 1, signature: that.dever.getSignature(), product_id: that.product_id, num: 1 }, { success: function (data, res) { that.dever.location('carts/index?id=' + that.product_id); } }); } else { that.dever.location('login/index'); } }); } })