@@ -2,11 +2,20 @@ const app = getApp();
Page({
cashdialog: null,
+ pid: '',
pg: 1,
data: {
isShowNull: false
},
onLoad: function (options) {
+ //产品详情路径附带参数,用于来源分享的参数scene=encodeURIComponent(uid, product_id)
+ if (options != null && typeof options.scene != 'undefined') {
+ let str = decodeURIComponent(options.scene);
+ let arr = str.split(',');
+ let uid = arr[0];
+ this.pid = arr[1];
+ app.saveInviteUid(uid);
+ }
if (app.isLogin){
this.getHomeData(this);
}else{
@@ -31,6 +40,9 @@ Page({
* 获取首页数据
*/
getHomeData: function(that){
+ if(that.pid != ''){
+ app.location('view/index?id=' + that.pid);
if (that.pg == 1) {
app.showLoading();
}
@@ -53,7 +53,7 @@ Page({
return {
title: '',
desc: '',
- path: '/template/view/index?scene=' + encodeURIComponent(scene)
+ path: '/template/home/index?scene=' + encodeURIComponent(scene)
};
@@ -1,21 +1,9 @@
const app = getApp();
- options: {},
pid: '',
- this.options = options;
+ this.pid = options.id;
- //产品详情路径附带参数,用于来源分享的参数scene = uid, product_id
- if (typeof options.scene == 'undefined') {//来源首页商品浏览
- this.pid = options.id;
- } else {//来源于分享
- //海报分享,路径附带的参数 encodeURIComponent(uid, product_id)
- let str = decodeURIComponent(options.scene);
- let arr = str.split(',');
- let uid = arr[0];
- this.pid = arr[1];
- app.saveInviteUid(uid);
- }
var that = this;
app.request('product.api.view', {id: this.pid}, {