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 | 130 ++++++++++++++++++++++++++++++++++---------
1 files changed, 102 insertions(+), 28 deletions(-)
diff --git a/wechat_staff/pages/detailDis/product.js b/wechat_staff/pages/detailDis/product.js
index 0d00d28..7ffee42 100644
--- a/wechat_staff/pages/detailDis/product.js
+++ b/wechat_staff/pages/detailDis/product.js
@@ -1,18 +1,31 @@
import {
shareContent,
getProductInfo,
- actionDo
+ actionDo,
+ refreshEnjoy
} from '../../api/index'
+import moment from "moment";
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
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')
},
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -33,31 +46,91 @@
member
})
},
- handleAction(e) {
- const actionType = e.currentTarget.dataset.code
+
+ // 缁勪欢浜嬩欢
+ 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);
+ if(type == 'enjoy'){
+ // 鐐瑰嚮浜嗗枩娆�
+ const index = enjoyList.findIndex( i => i.id === info.id )
+ if(index === -1){
+ info.isEnjoy = true
+ this.setData({ info })
+ enjoyList.push({
+ ...info,
+ joinType: '0',
+ timestamp: new Date().getTime()
+ })
+ }else{
+ info.isEnjoy = false
+ this.setData({ info })
+ 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 ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌', icon: 'none'})
+ this.setData({
+ info
+ })
+ wx.setStorageSync('conentCountTemp', this.data.info)
+ })
+ }
+ },
+ priviewBanner(e) {
+ const url = e.currentTarget.dataset.url
const {
info
} = this.data
- actionDo({
- actionType,
- id: this.data.info.id
- }).then(res => {
- info.collection = !info.collection
- 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() {
+ console.log('鐢ㄦ埛鐐瑰嚮浜嗗垎浜�');
+ },
getDetail(id) {
+ const enjoyList = wx.getStorageSync('enjoyList') || []
getProductInfo({
id
}).then(res => {
+ const index = enjoyList.findIndex( i =>(res.data && i.id === res.data.id) )
this.setData({
- info: res.data
+ spaceList: res.data.spaceList || [],
+ info: {
+ ...res.data,
+ isEnjoy: index > -1
+ }
})
+ const { info} = this.data
+ wx.setStorageSync('conentCountTemp', info)
wx.setNavigationBarTitle({
title: res.data.title
})
@@ -101,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
@@ -155,6 +226,15 @@
onHide() {
},
+ goTestPage(){
+ wx.navigateTo({
+ url: '/pages/webView/index',
+ success: function(res) {
+ // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+ res.eventChannel.emit('data',{link:'http://crmtest.zhibang.com:8000/core/oauth/authorize/jump?timestamp=-465385833&agent_phone_number=18055151023&bindKey=mpAddIntention&sign=cdfe13abfe2727b40eee160085c80d11'} );
+ }
+ })
+ },
onUnload() {
},
@@ -165,10 +245,4 @@
},
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage() {
-
- }
})
\ No newline at end of file
--
Gitblit v1.9.3