From 0e8cc18ee5d35479d30408851c21e5f4c0fb487a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 30 七月 2024 17:00:37 +0800
Subject: [PATCH] 提交
---
wechat_staff/pages/discover/discover.js | 19 +++++
wechat_staff/components/disRealpic/index.js | 22 +++++++
wechat_staff/pages/detailDis/product.js | 12 +--
wechat_staff/pages/discover/discover.wxml | 6 +-
wechat_staff/pages/detailDis/case.js | 6 +
wechat_staff/components/detailFooter/index.js | 5 +
wechat_staff/pages/detailDis/realpic.js | 8 +-
wechat_staff/components/disProduct/index.js | 24 +++++++
wechat_staff/components/disCase/index.js | 22 +++++++
9 files changed, 104 insertions(+), 20 deletions(-)
diff --git a/wechat_staff/components/detailFooter/index.js b/wechat_staff/components/detailFooter/index.js
index 4bc7482..e997649 100644
--- a/wechat_staff/components/detailFooter/index.js
+++ b/wechat_staff/components/detailFooter/index.js
@@ -26,7 +26,7 @@
var app = getApp().globalData
this.setData({
bottomLift: app.bottomLift
- })
+ })
},
methods: {
handleShare() {
@@ -52,7 +52,7 @@
flag: !info.isEnjoy
})
},
- handleCollec() {
+ handleCollec() {
const {
info
} = this.data
@@ -60,6 +60,7 @@
type: 'collec',
flag: !info.isCollection
})
+
},
handleDown() {
const {
diff --git a/wechat_staff/components/disCase/index.js b/wechat_staff/components/disCase/index.js
index 04a3324..7a2d79f 100644
--- a/wechat_staff/components/disCase/index.js
+++ b/wechat_staff/components/disCase/index.js
@@ -26,6 +26,28 @@
this.getCatelist()
},
methods: {
+ refreshCount(){
+ let temData = wx.getStorageSync('conentCountTemp')
+ if(temData && this.data.dataList){
+ var dataList =this.data.dataList;
+ dataList.forEach(item =>{
+ if(item.id+'' == temData.id+'' ){
+ item.viewCount = (item.viewCount ||0)+1;
+ if( item.isCollection != temData.isCollection){
+ if(item.isCollection){
+ item.collectCount = (item.collectCount || 0)-1
+ item.collectCount = item.collectCount >=0? item.collectCount :0;
+ } else{
+ item.collectCount = (item.collectCount || 0)+1
+ }
+ item.isCollection = temData.isCollection
+ }
+ }
+ })
+ this.setData({dataList:dataList})
+ wx.setStorageSync('conentCountTemp',null)
+ }
+ },
getCatelist(){
const { catalogCode } = this.data
getCataLogTagList({
diff --git a/wechat_staff/components/disProduct/index.js b/wechat_staff/components/disProduct/index.js
index d92ef71..3da72a6 100644
--- a/wechat_staff/components/disProduct/index.js
+++ b/wechat_staff/components/disProduct/index.js
@@ -22,7 +22,7 @@
sortType: 'NORMAL',
catalogCode: ""
},
- attached() {
+ attached() {
this.getCatelist()
var app = getApp()
console.log('globalData', app.globalData);
@@ -35,6 +35,28 @@
}
},
methods: {
+ refreshCount(){
+ let temData = wx.getStorageSync('conentCountTemp')
+ if(temData && this.data.datalist){
+ var dataList =this.data.datalist;
+ dataList.forEach(item =>{
+ if(item.id+'' == temData.id+'' ){
+ item.viewCount = (item.viewCount ||0)+1;
+ if( item.isCollection != temData.isCollection){
+ if(item.isCollection){
+ item.collectCount = (item.collectCount || 0)-1
+ item.collectCount = item.collectCount >=0? item.collectCount :0;
+ } else{
+ item.collectCount = (item.collectCount || 0)+1
+ }
+ item.isCollection = temData.isCollection
+ }
+ }
+ })
+ this.setData({datalist:dataList})
+ wx.setStorageSync('conentCountTemp',null)
+ }
+ },
getCatelist(){
getCatalogList({
catalogCode: 'product_intro'
diff --git a/wechat_staff/components/disRealpic/index.js b/wechat_staff/components/disRealpic/index.js
index aa2ca72..542bc52 100644
--- a/wechat_staff/components/disRealpic/index.js
+++ b/wechat_staff/components/disRealpic/index.js
@@ -25,6 +25,28 @@
this.getCatelist()
},
methods: {
+ refreshCount(){
+ let temData = wx.getStorageSync('conentCountTemp')
+ if(temData && this.data.dataList){
+ var dataList =this.data.dataList;
+ dataList.forEach(item =>{
+ if(item.id+'' == temData.id+'' ){
+ item.viewCount = (item.viewCount ||0)+1;
+ if( item.isCollection != temData.isCollection){
+ if(item.isCollection){
+ item.collectCount = (item.collectCount || 0)-1
+ item.collectCount = item.collectCount >=0? item.collectCount :0;
+ } else{
+ item.collectCount = (item.collectCount || 0)+1
+ }
+ item.isCollection = temData.isCollection
+ }
+ }
+ })
+ this.setData({dataList:dataList})
+ wx.setStorageSync('conentCountTemp',null)
+ }
+ },
getCatelist(){
const { catalogCode } = this.data
getCataLogTagList({
diff --git a/wechat_staff/pages/detailDis/case.js b/wechat_staff/pages/detailDis/case.js
index 5e0a0ee..9d7c6ba 100644
--- a/wechat_staff/pages/detailDis/case.js
+++ b/wechat_staff/pages/detailDis/case.js
@@ -100,7 +100,8 @@
wx.showToast({title: flag ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌'})
this.setData({
info
- })
+ })
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
}
},
@@ -127,7 +128,8 @@
}})
wx.setNavigationBarTitle({
title: res.data.title
- })
+ })
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
},
handleDesign() {
diff --git a/wechat_staff/pages/detailDis/product.js b/wechat_staff/pages/detailDis/product.js
index 1d3a8c5..4a5a7ac 100644
--- a/wechat_staff/pages/detailDis/product.js
+++ b/wechat_staff/pages/detailDis/product.js
@@ -84,6 +84,7 @@
this.setData({
info
})
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
}
},
@@ -118,13 +119,15 @@
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({
info: {
...res.data,
isEnjoy: index > -1
}
})
+ const { info} = this.data
+ wx.setStorageSync('conentCountTemp', info)
wx.setNavigationBarTitle({
title: res.data.title
})
@@ -177,12 +180,7 @@
// title: productDetail.title,
// path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0'
// }
- // },
- onClose() {
- this.setData({
- showShare: false
- })
- },
+ // },
handleDown() {
let {
info
diff --git a/wechat_staff/pages/detailDis/realpic.js b/wechat_staff/pages/detailDis/realpic.js
index 3c1ae48..8471569 100644
--- a/wechat_staff/pages/detailDis/realpic.js
+++ b/wechat_staff/pages/detailDis/realpic.js
@@ -81,7 +81,8 @@
wx.showToast({title: flag ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌'})
this.setData({
info
- })
+ })
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
}
},
@@ -96,13 +97,14 @@
getDetail(id) {
const enjoyList = wx.getStorageSync('enjoyList') || []
getRealcaseInfo({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({ info: {
...res.data, isEnjoy: index > -1
}})
wx.setNavigationBarTitle({
title: res.data.title
- })
+ })
+ wx.setStorageSync('conentCountTemp', this.data.info)
})
},
playVideo() {
diff --git a/wechat_staff/pages/discover/discover.js b/wechat_staff/pages/discover/discover.js
index 787305e..662ba28 100644
--- a/wechat_staff/pages/discover/discover.js
+++ b/wechat_staff/pages/discover/discover.js
@@ -20,15 +20,30 @@
},
onShow(){
- console.log('onShow')
+
refreshEnjoy(this)
+ this.refreshDatacount()
let discoverKey = wx.getStorageSync('discoverKey') || ''
if(discoverKey){
this.setData({ catalogCode: discoverKey })
setTimeout(() => {
wx.setStorageSync('discoverKey', '')
}, 500)
- }
+ }
+ },
+ refreshDatacount(){
+ var child =null;
+ if(this.data.catalogCode == 'product_intro'){
+ child = this.selectComponent(".disProduct")
+ }else if(this.data.catalogCode == 'whole_case'){
+ child = this.selectComponent(".disCase")
+ }else if(this.data.catalogCode == 'real_case'){
+ child = this.selectComponent(".disRealpic")
+ }
+ // 璋冪敤瀛愮粍浠朵腑瀹氫箟鐨勬柟娉�
+ if(child){
+ child.refreshCount();
+ }
},
tabsClick(e) {
const catalogCode = e.currentTarget.dataset.code
diff --git a/wechat_staff/pages/discover/discover.wxml b/wechat_staff/pages/discover/discover.wxml
index df9848e..7f87f4b 100644
--- a/wechat_staff/pages/discover/discover.wxml
+++ b/wechat_staff/pages/discover/discover.wxml
@@ -19,8 +19,8 @@
</view>
<!-- -->
<view class="main_content" style="height: 100vh">
- <disProduct menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'product_intro' }}" />
- <disCase menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'whole_case' }}" />
- <disRealpic menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'real_case' }}" />
+ <disProduct class="disProduct" menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'product_intro' }}" />
+ <disCase class="disCase" menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'whole_case' }}" />
+ <disRealpic class="disRealpic" menuButtonInfo="{{ menuButtonInfo }}" wx:if="{{ catalogCode == 'real_case' }}" />
</view>
</view>
\ No newline at end of file
--
Gitblit v1.9.3