jiangping
2024-07-30 0e8cc18ee5d35479d30408851c21e5f4c0fb487a
提交
已修改9个文件
124 ■■■■ 文件已修改
wechat_staff/components/detailFooter/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/disCase/index.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/disProduct/index.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/disRealpic/index.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/case.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/product.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/realpic.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/discover/discover.js 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/discover/discover.wxml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
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({
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'
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({
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() {
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
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() {
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
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>