| | |
| | | var app = getApp().globalData |
| | | this.setData({ |
| | | bottomLift: app.bottomLift |
| | | }) |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleShare() { |
| | |
| | | flag: !info.isEnjoy |
| | | }) |
| | | }, |
| | | handleCollec() { |
| | | handleCollec() { |
| | | const { |
| | | info |
| | | } = this.data |
| | |
| | | type: 'collec', |
| | | flag: !info.isCollection |
| | | }) |
| | | |
| | | }, |
| | | handleDown() { |
| | | const { |
| | |
| | | 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({ |
| | |
| | | sortType: 'NORMAL', |
| | | catalogCode: "" |
| | | }, |
| | | attached() { |
| | | attached() { |
| | | this.getCatelist() |
| | | var app = getApp() |
| | | console.log('globalData', app.globalData); |
| | |
| | | } |
| | | }, |
| | | 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' |
| | |
| | | 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({ |
| | |
| | | wx.showToast({title: flag ? '收藏成功' : '取消收藏'}) |
| | | this.setData({ |
| | | info |
| | | }) |
| | | }) |
| | | wx.setStorageSync('conentCountTemp', this.data.info) |
| | | }) |
| | | } |
| | | }, |
| | |
| | | }}) |
| | | wx.setNavigationBarTitle({ |
| | | title: res.data.title |
| | | }) |
| | | }) |
| | | wx.setStorageSync('conentCountTemp', this.data.info) |
| | | }) |
| | | }, |
| | | handleDesign() { |
| | |
| | | this.setData({ |
| | | info |
| | | }) |
| | | wx.setStorageSync('conentCountTemp', this.data.info) |
| | | }) |
| | | } |
| | | }, |
| | |
| | | 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 |
| | | }) |
| | |
| | | // title: productDetail.title, |
| | | // path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0' |
| | | // } |
| | | // }, |
| | | onClose() { |
| | | this.setData({ |
| | | showShare: false |
| | | }) |
| | | }, |
| | | // }, |
| | | handleDown() { |
| | | let { |
| | | info |
| | |
| | | wx.showToast({title: flag ? '收藏成功' : '取消收藏'}) |
| | | this.setData({ |
| | | info |
| | | }) |
| | | }) |
| | | wx.setStorageSync('conentCountTemp', this.data.info) |
| | | }) |
| | | } |
| | | }, |
| | |
| | | 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() { |
| | |
| | | }, |
| | | |
| | | 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 |
| | |
| | | </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> |