from_share 加入购物车要跳转到 cart

wechat_user_type
Ge Hao 7 years ago
parent 86e3b8a624
commit 45ebc09c93
  1. 1
      app.js
  2. 11
      pages/show_product/show_product.js

@ -90,6 +90,7 @@ App({
data: {code: that.globalData.code},
success: function(res) {
if (!res.data.token) {
wx.hideToast()
wx.showModal({
title: '未登录',
content: '请前往 “我的” 页面绑定手机号',

@ -9,7 +9,8 @@ Page({
windowWidth: 375,
windowHeight: 667,
pixelRatio: 2,
accountType: ''
accountType: '',
from_share: false
},
onShareAppMessage: function () {
@ -41,6 +42,7 @@ Page({
productUtil.getProduct(id, function(result){
var data = app.store.sync(result.data)
that.setData({
from_share: true,
id: data.id,
product: data,
title: data.name
@ -59,6 +61,7 @@ Page({
})[0]
this.setData({
from_share: false,
id: id,
product: product,
title: product.name
@ -117,5 +120,11 @@ Page({
key: 'cartItems',
data: cartItems
})
if (this.data.from_share) {
wx.switchTab({
url: '../cart/cart'
})
}
}
})

Loading…
Cancel
Save