Commit 287167c1 by 赵雅纹

Merge branch 'feature-zyw-sc' into 'dev_7.1.0'

Feature zyw sc

See merge request !108
parents 0428f2f7 f0261fd1
......@@ -12,7 +12,7 @@
</view>
</view>
<template name="water-list">
<navigator hover-class="none" url="/pages/productDetail/productDetail?productId={{productId}}">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}">
<view class="item">
<image class="item-img" src="{{indexUrl}}" mode="widthFix"></image>
<view class="item-title-box">
......
<!--component/productListStyleTwo/productListStyleTwo.wxml-->
<block wx:for="{{imageData}}" wx:key="{{index}}">
<navigator hover-class="none" url="/pages/productDetail/productDetail?productId={{menuSec.productId}}">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{menuSec.productId}}">
<view class="hot-item border_box" >
<view class="hot-img-box">
<image class="hot-img" src="{{item.indexUrl}}" mode="widthFix" lazy-load="false" binderror="" bindload="" />
......
......@@ -22,17 +22,24 @@ wxService.page({
openPlusStatus: false,
memberLevel: false,
showCardModal: false,
currentShareContent: null
currentShareContent: null,
pageForm : true,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options && options.productId) {
if (options && options.id) {
this.setData({
productId: options.productId
})
productId: options.id,
pageForm: options.fromZc != 1
});
//不是从种草过来的, 需要清除本地临时的触点信息
if (!options.fromZc){
wx.removeStorageSync('TEMP_TENTACLE_INFO');
wx.removeStorageSync('TIME_EXPIRATION');
}
}
},
......
......@@ -127,8 +127,9 @@
bindsubmit="addCart"
report-submit
name='nav'
wx:if="{{pageForm}}"
>
<button class="cart-button get-formId--btn" formType="submit">加入购物车</button>
<button class="cart-button get-formId--btn" formType="submit" >加入购物车</button>
</form>
<form
class='get-formId get-formId--form'
......
......@@ -201,7 +201,9 @@ page{
.product-footer .footer-buttons {
flex: 1;
display: flex;
height: 100rpx; }
height: 100rpx;
justify-content: flex-end;
}
.product-footer .footer-buttons button {
flex: 1;
......
......@@ -39,6 +39,29 @@ wxService.page({
this.data.currentShareContent = null;
},
//跳转商品详情
onTapToGoodsInfo(e){
console.log(e)
let item = e.currentTarget.dataset.item;
let productId = e.currentTarget.dataset.productid;
//组装一个临时触点信息对象到本地
let tempObj = {
memberId: item.userId ? item.userId : '-99',
obj : {
id: item.tentacleObjectId,
tentacleType: item.tentacleType,
tentacleId: item.tentacleId,
contentType: item.contentType,
contentId: item.contentId
}
};
//存储
var timestamp = Date.parse(new Date())
var expiration = timestamp + 1800000
wx.setStorageSync('TEMP_TENTACLE_INFO', tempObj);
wx.setStorageSync('TIME_EXPIRATION', expiration);
wxService.router(`/pages/productDetail/productDetail?id=${productId}&fromZc=1`);
},
// 分享
onTapShare() {
......
......@@ -17,8 +17,8 @@
<view class="buy-product-wrap">
<view class="buy-product-content">
<block wx:for="{{proList}}" wx:key="{{index}}">
<navigator hover-class="none" url="/pages/productDetail/productDetail?productId={{item.productId}}">
<view class="buy-list">
<!-- <navigator hover-class="none" url="/pages/productDetail/productDetail?productId={{item.productId}}"> -->
<view class="buy-list" bindtap="onTapToGoodsInfo" data-item="{{contentInfo}}" data-productid="{{item.productId}}">
<view class="prod-img">
<image src="{{item.indexUrl}}" />
</view>
......@@ -32,7 +32,7 @@
</view>
</view>
</view>
</navigator>
<!-- </navigator> -->
</block>
</view>
</view>
......
......@@ -177,10 +177,14 @@ class Http {
getTentacle(){
let time = Date.parse(new Date())
let TIME_EXPIRATION = wx.getStorageSync('TIME_EXPIRATION')
let TENTACLE_CONTENT = JSON.stringify(wx.getStorageSync('TENTACLE_CONTENT'))
if (TENTACLE_CONTENT && TIME_EXPIRATION > time){
let storage = wx.getStorageSync('TENTACLE_CONTENT') , tentacle = null;
if (storage){
tentacle = storage.obj;
}
if (tentacle && TIME_EXPIRATION > time){
wx.setStorageSync('TIME_EXPIRATION', time)
return TENTACLE_CONTENT
return JSON.stringify(tentacle);
}else{
wx.removeStorageSync('TENTACLE_CONTENT')
wx.removeStorageSync('TIME_EXPIRATION')
......
......@@ -266,17 +266,52 @@ class WXService extends Http {
contentId: data.contentId
}
let storageObj = {
memberId : '',
obj: TENTACLE_CONTENT
}
if (data.status == 1) {
var timestamp = Date.parse(new Date())
var expiration = timestamp + 1800000
wx.setStorageSync('TENTACLE_CONTENT', TENTACLE_CONTENT)
wx.setStorageSync('TENTACLE_CONTENT', storageObj)
wx.setStorageSync('TIME_EXPIRATION', expiration)
}
}).finally(() => {
})
}
//更新本地触点对象信息
updateLocalTentacleInfo(){
//先获取本地触点对象信息
let tentacleInfo = wx.getStorageSync('TENTACLE_CONTENT');
//获取从种草详情商品购买时存储的临时触点对象信息
let tempTentacleInfo = wx.getStorageSync('TEMP_TENTACLE_INFO');
//格式
/**
* tempTentacleInfo = {
* memberId : '',
* obj : {}
}
*
*/
//判断tentacleInfo是否为空
if (!tentacleInfo){
wx.setStorageSync('TENTACLE_CONTENT', tempTentacleInfo);
return ;
}
//tentacleInfo 不为空
//判断先获取本地触点对象信息 中memberid 是否为空
let memberId = tentacleInfo.memberId;
// 若memberId 为空 表示从分享过来的链接 此时不能更新wx.getStorageSync('TENTACLE_CONTENT') 信息
if (!memberId){
return ;
}
//不为空 则表示 之前从种草详情中的商品直接购买过 直接更新本地TENTACLE_CONTENT
wx.setStorageSync('TENTACLE_CONTENT', tempTentacleInfo);
}
getManageDate() {
return manageDate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment