From 04b4bddaac0a222760113899568d20b45af701f4 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 27 九月 2024 19:04:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
wechat_staff/pages/detailDis/product.js | 83 +++++++++++++++++++++++++----------------
1 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/wechat_staff/pages/detailDis/product.js b/wechat_staff/pages/detailDis/product.js
index a946bb2..7ffee42 100644
--- a/wechat_staff/pages/detailDis/product.js
+++ b/wechat_staff/pages/detailDis/product.js
@@ -1,7 +1,8 @@
import {
shareContent,
getProductInfo,
- actionDo
+ actionDo,
+ refreshEnjoy
} from '../../api/index'
import moment from "moment";
Page({
@@ -10,10 +11,21 @@
*/
data: {
bottomLift: 0,
+ current: 0,
id: '',
info: {},
+ spaceList: [],
member: {},
- showShare: false
+ showShare: false,
+ isFold: false,
+ enjoyList: []
+ },
+ onShow(){
+ console.log('onShow')
+ refreshEnjoy(this)
+ },
+ onHide() {
+ console.log('onHide')
},
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -34,13 +46,17 @@
member
})
},
+
// 缁勪欢浜嬩欢
handleEnjoy(e) {
+ const info = this.data.info
+ if(info.id == null ){
+ return
+ }
const enjoyList = wx.getStorageSync('enjoyList') || []
const { type, flag } = e.detail
console.log('type', type);
- console.log('flag', flag);
- const info = this.data.info
+ console.log('flag', flag);
if(type == 'enjoy'){
// 鐐瑰嚮浜嗗枩娆�
const index = enjoyList.findIndex( i => i.id === info.id )
@@ -49,7 +65,7 @@
this.setData({ info })
enjoyList.push({
...info,
- joinType: 'product',
+ joinType: '0',
timestamp: new Date().getTime()
})
}else{
@@ -58,35 +74,43 @@
enjoyList.splice(index, 1)
}
wx.setStorageSync('enjoyList', enjoyList)
+ refreshEnjoy(this)
}else{
actionDo({
id: info.id,
actionType: flag ? 'collect' : 'collect_cancel'
}).then(res => {
info.isCollection = flag
- wx.showToast({title: flag ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌'})
+ wx.showToast({title: flag ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌', icon: 'none'})
this.setData({
info
})
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
}
},
- handleAction(e) {
- const actionType = e.currentTarget.dataset.code
+ priviewBanner(e) {
+ const url = e.currentTarget.dataset.url
const {
info
} = this.data
- actionDo({
- actionType,
- id: this.data.info.id
- }).then(res => {
- info.isCollection = !info.isCollection
- this.setData({
- info
- })
- wx.showToast({
- title: actionType == 'collect' ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌',
- })
+ wx.previewImage({
+ urls: info.bannerImgList,
+ current: url
+ })
+ },
+ bindchange(e) {
+ this.setData({ current: e.detail.current })
+ },
+ priviewSpace(e) {
+ return
+ const url = e.currentTarget.dataset.url
+ const {
+ info
+ } = this.data
+ wx.previewImage({
+ urls: info.spaceList.map(i => i.spaceImg),
+ current: url
})
},
onShareAppMessage() {
@@ -97,13 +121,16 @@
getProductInfo({
id
}).then(res => {
- const index = enjoyList.findIndex( i => i.id === res.data.id )
+ const index = enjoyList.findIndex( i =>(res.data && i.id === res.data.id) )
this.setData({
+ spaceList: res.data.spaceList || [],
info: {
...res.data,
isEnjoy: index > -1
}
})
+ const { info} = this.data
+ wx.setStorageSync('conentCountTemp', info)
wx.setNavigationBarTitle({
title: res.data.title
})
@@ -147,18 +174,16 @@
// this.setData({showShare: false})
// })
},
+ changeFold() {
+ this.setData({ isFold: !this.data.isFold })
+ },
// onShareAppMessage: function () {
// // let { productDetail, userInfo } = this.data
// return {
// title: productDetail.title,
// path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0'
// }
- // },
- onClose() {
- this.setData({
- showShare: false
- })
- },
+ // },
handleDown() {
let {
info
@@ -220,10 +245,4 @@
},
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage() {
-
- }
})
\ No newline at end of file
--
Gitblit v1.9.3