From a63f26976652d1fc99de766a324c151501573d78 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 24 七月 2024 15:22:55 +0800
Subject: [PATCH] ‘’

---
 wechat_staff/pages/detailDis/case.wxml          |    2 
 wechat_staff/utils/config.js                    |    4 
 wechat_staff/pages/detailDis/case.js            |    2 
 wechat_staff/pages/detailDis/realpic.wxml       |    2 
 wechat_staff/pages/kefu/fond.js                 |   35 +++++++-
 wechat_staff/pages/detailDis/realpic.js         |    2 
 wechat_staff/pages/kefu/fond.wxss               |    1 
 wechat_staff/pages/detailDis/product.wxml       |   12 --
 wechat_staff/pages/kefu/fond.wxml               |   16 ++--
 wechat_staff/project.private.config.json        |   11 ++
 wechat_staff/components/detailFooter/index.wxml |   16 ++-
 wechat_staff/components/disCase/index.wxml      |    4 
 wechat_staff/pages/detailDis/product.js         |   50 ++++++++++++
 wechat_staff/api/index.js                       |    8 ++
 wechat_staff/pages/kefu/fond.less               |    1 
 wechat_staff/components/detailFooter/index.js   |   27 ++++++
 wechat_staff/components/disRealpic/index.wxml   |    4 
 17 files changed, 149 insertions(+), 48 deletions(-)

diff --git a/wechat_staff/api/index.js b/wechat_staff/api/index.js
index d81c462..3d94a4f 100644
--- a/wechat_staff/api/index.js
+++ b/wechat_staff/api/index.js
@@ -256,6 +256,14 @@
     data
   })
 }
+// 鑾峰彇鍐呭鍒嗕韩娴锋姤
+export const getContentShareImg = (data) => {
+  return request({
+    url: '/web/personnel/getContentShareImg',
+    method: 'POST',
+    data
+  })
+}
 // 0鍏冨畾鍒朵俊鎭�
 export const saveFreeCustomizationApply = (data) => {
   return request({
diff --git a/wechat_staff/components/detailFooter/index.js b/wechat_staff/components/detailFooter/index.js
index de45c6d..ff58f51 100644
--- a/wechat_staff/components/detailFooter/index.js
+++ b/wechat_staff/components/detailFooter/index.js
@@ -1,10 +1,11 @@
-// components/detailFooter/index.js
+import { getContentShareImg } from '../../api/index'
 Component({
   /**
    * 缁勪欢鐨勫睘鎬у垪琛�
    */
   properties: {
-
+    info: Object,
+    path: String,
   },
 
   /**
@@ -21,6 +22,28 @@
     })
   },
   methods: {
+    handleEnjoy() {
+      const { info } = this.data
+      this.triggerEvent('enjoy', {
+        type: 'enjoy', flag: !info.isEnjoy
+      })
+    },
+    handleCollec() {
+      const { info } = this.data
+      this.triggerEvent('enjoy', {
+        type: 'collec', flag: !info.isCollection
+      })
+    },
+    handleDown() {
+      const { info, path } = this.data
+      getContentShareImg({
+        articleId: info.id,
+        type: '1',
+        pageUrl: path,
+        imgurl: info.coverImage,
+
+      })
+    },
     openShare() {
       console.log('鐐瑰嚮鎵撳紑');
       this.setData({ showShare: true })
diff --git a/wechat_staff/components/detailFooter/index.wxml b/wechat_staff/components/detailFooter/index.wxml
index ed66dfa..9ee532a 100644
--- a/wechat_staff/components/detailFooter/index.wxml
+++ b/wechat_staff/components/detailFooter/index.wxml
@@ -2,15 +2,17 @@
   <view class="footer_wrap" style="padding-bottom: {{bottomLift}}px;">
     <view class="content">
       <view class="btns">
-        <view class="item">
-          <image src="../../static/icon/detail_nav_like_sel@2x.png"></image>
+        <view bindtap="handleEnjoy" class="item">
+          <image wx:if="{{ info.isEnjoy }}" src="../../static/icon/detail_nav_like_sel@2x.png"></image>
+          <image wx:else src="../../static/icon/detail_nav_like@2x.png"></image>
           <text>鍠滄</text>
         </view>
-        <view class="item">
-          <image src="../../static/icon/detail_nav_collected.png"></image>
+        <view bindtap="handleCollec" class="item">
+          <image wx:if="{{ info.isCollection }}" src="../../static/icon/detail_nav_collected.png"></image>
+          <image wx:else src="../../static/icon/detail_nav_collect.png"></image>
           <text>鏀惰棌</text>
         </view>
-        <view class="item">
+        <view bindtap="handleDown" class="item">
           <image src="../../static/icon/detail_nav_download@2x.png"></image>
           <text>涓嬭浇</text>
         </view>
@@ -19,7 +21,7 @@
     </view>
   </view>
   <!--  -->
-  <view class="shade_modal" style="padding-bottom: {{bottomLift}}px;">
+  <view wx:if="{{ showShare }}" class="shade_modal" style="padding-bottom: {{bottomLift}}px;">
     <view class="btns">
       <button open-type="share" class="item" bindtap="handleShare">
         <image src="../../static/icon/wechat.png"></image>
@@ -32,5 +34,5 @@
     </view>
     <view bindtap="onClose" class="cancel">鍙栨秷</view>
   </view>
-  <view class="shade" bindtap="onClose"></view>
+  <view wx:if="{{ showShare }}" class="shade" bindtap="onClose"></view>
 </view>
\ No newline at end of file
diff --git a/wechat_staff/components/disCase/index.wxml b/wechat_staff/components/disCase/index.wxml
index 1d0bda2..792ec77 100644
--- a/wechat_staff/components/disCase/index.wxml
+++ b/wechat_staff/components/disCase/index.wxml
@@ -44,9 +44,9 @@
           <view class="content">
             <view class="name">{{ item.title }}</view>
             <view class="info">
-              <image wx:if="{{ !item.collection }}" data-code="like" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
+              <image wx:if="{{ !item.isCollection }}" data-code="like" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
               <image wx:else data-code="like_cancel" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
-              <text class="num {{item.collection ? 'primary' : ''}}">{{ item.collectCount }}</text>
+              <text class="num {{item.isCollection ? 'primary' : ''}}">{{ item.collectCount }}</text>
               <image class="icon" src="../../static/icon/zixun_ic_liulan.png" mode="widthFix"></image>
               <text>{{ item.viewCount }}</text>
             </view>
diff --git a/wechat_staff/components/disRealpic/index.wxml b/wechat_staff/components/disRealpic/index.wxml
index 7d967f4..91172ab 100644
--- a/wechat_staff/components/disRealpic/index.wxml
+++ b/wechat_staff/components/disRealpic/index.wxml
@@ -51,9 +51,9 @@
             <view class="name">{{ item.title }}</view>
           </view>
           <view class="info">
-            <image wx:if="{{ !item.collection }}" data-code="like" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
+            <image wx:if="{{ !item.isCollection }}" data-code="like" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
             <image wx:else data-code="like_cancel" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
-            <text class="num {{item.collection ? 'primary' : ''}}">{{ item.collectCount }}</text>
+            <text class="num {{item.isCollection ? 'primary' : ''}}">{{ item.collectCount }}</text>
             <image class="icon" src="../../static/icon/zixun_ic_liulan.png" mode="widthFix"></image>
             <text>{{ item.viewCount }}</text>
           </view>
diff --git a/wechat_staff/pages/detailDis/case.js b/wechat_staff/pages/detailDis/case.js
index 09050e9..71a0531 100644
--- a/wechat_staff/pages/detailDis/case.js
+++ b/wechat_staff/pages/detailDis/case.js
@@ -56,7 +56,7 @@
       actionType,
       id: this.data.info.id
     }).then(res => {
-      info.collection = !info.collection
+      info.isCollection = !info.isCollection
       this.setData({info})
       wx.showToast({
         title: actionType == 'collect' ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌',
diff --git a/wechat_staff/pages/detailDis/case.wxml b/wechat_staff/pages/detailDis/case.wxml
index 768b6f1..f6f7c8c 100644
--- a/wechat_staff/pages/detailDis/case.wxml
+++ b/wechat_staff/pages/detailDis/case.wxml
@@ -26,7 +26,7 @@
   <view class="footer" style="padding-bottom: {{bottomLift}}px;">
     <view class="btns">
       <button class="item btn">
-        <image data-code="collect_cancel" bindtap="handleAction" wx:if="{{ info.collection }}" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
+        <image data-code="collect_cancel" bindtap="handleAction" wx:if="{{ info.isCollection }}" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
         <image wx:else data-code="collect" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
         <view class="name">鏀惰棌</view>
       </button>
diff --git a/wechat_staff/pages/detailDis/product.js b/wechat_staff/pages/detailDis/product.js
index 0d00d28..b7e5dfd 100644
--- a/wechat_staff/pages/detailDis/product.js
+++ b/wechat_staff/pages/detailDis/product.js
@@ -3,6 +3,7 @@
   getProductInfo,
   actionDo
 } from '../../api/index'
+import moment from "moment";
 Page({
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -33,6 +34,43 @@
       member
     })
   },
+  //  缁勪欢浜嬩欢
+  handleEnjoy(e) {
+    const enjoyList = wx.getStorageSync('enjoyList') || []
+    const { type, flag } = e.detail
+    console.log('type', type);
+    console.log('flag', flag);
+    const info = this.data.info
+    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: 'product',
+          timestamp: new Date().getTime()
+        })
+      }else{
+        info.isEnjoy = false
+        this.setData({ info })
+        enjoyList.splice(index, 1)
+      }
+      wx.setStorageSync('enjoyList', enjoyList)
+    }else{
+      actionDo({
+        id: info.id,
+        actionType: flag ? 'collect' : 'collect_cancel'
+      }).then(res => {
+        info.isCollection = flag
+        wx.showToast({title: flag ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌'})
+        this.setData({
+          info
+        })
+      })
+    }
+  },
   handleAction(e) {
     const actionType = e.currentTarget.dataset.code
     const {
@@ -42,7 +80,7 @@
       actionType,
       id: this.data.info.id
     }).then(res => {
-      info.collection = !info.collection
+      info.isCollection = !info.isCollection
       this.setData({
         info
       })
@@ -51,12 +89,20 @@
       })
     })
   },
+  onShareAppMessage() {
+    console.log('鐢ㄦ埛鐐瑰嚮浜嗗垎浜�');
+  },
   getDetail(id) {
+    const enjoyList = wx.getStorageSync('enjoyList') || []
     getProductInfo({
       id
     }).then(res => {
+      const index = enjoyList.findIndex( i => i.id === res.data.id )
       this.setData({
-        info: res.data
+        info: {
+          ...res.data,
+          isEnjoy: index > -1
+        }
       })
       wx.setNavigationBarTitle({
         title: res.data.title
diff --git a/wechat_staff/pages/detailDis/product.wxml b/wechat_staff/pages/detailDis/product.wxml
index 6743e03..514b179 100644
--- a/wechat_staff/pages/detailDis/product.wxml
+++ b/wechat_staff/pages/detailDis/product.wxml
@@ -1,14 +1,6 @@
 <view class="main_app">
   <buoyClient showPurpose="1" />
-  <detailFooter />
-  <view class="user" wx:if="{{ false }}">
-    <view class="avatar"></view>
-    <view class="content">
-      <view class="name">涓佹鏋�</view>
-      <view class="desc">瀵艰喘锝�5骞寸粡楠�</view>
-    </view>
-    <view class="btn">鑱旂郴TA</view>
-  </view>
+  <detailFooter bindenjoy="handleEnjoy" path="/pages/detailDis/product" info="{{info}}" />
   <!-- banner杞挱 -->
   <swiper class="banner_swiper" circular indicator-dots autoplay style="height:{{bannerHeight}}rpx" duration>
     <block wx:for="{{ info.bannerImgList }}">
@@ -38,7 +30,7 @@
     </view>
   </view>
   <!-- 瀵屾枃鏈� -->
-  <view>
+  <view wx:if="{{info.content}}">
     <mp-html content="{{info.content}}"></mp-html>
   </view>
   <view class="spaceList">
diff --git a/wechat_staff/pages/detailDis/realpic.js b/wechat_staff/pages/detailDis/realpic.js
index 9d56aa5..a6c9d1b 100644
--- a/wechat_staff/pages/detailDis/realpic.js
+++ b/wechat_staff/pages/detailDis/realpic.js
@@ -35,7 +35,7 @@
       actionType,
       id: this.data.info.id
     }).then(res => {
-      info.collection = !info.collection
+      info.isCollection = !info.isCollection
       wx.showToast({
         title: actionType == 'collect' ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌',
       })
diff --git a/wechat_staff/pages/detailDis/realpic.wxml b/wechat_staff/pages/detailDis/realpic.wxml
index 4766d86..2923d1d 100644
--- a/wechat_staff/pages/detailDis/realpic.wxml
+++ b/wechat_staff/pages/detailDis/realpic.wxml
@@ -14,7 +14,7 @@
   <view class="footer" style="padding-bottom: {{bottomLift}}px;">
     <view class="btns">
       <button class="item btn">
-        <image data-code="collect_cancel" bindtap="handleAction" wx:if="{{ info.collection }}" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
+        <image data-code="collect_cancel" bindtap="handleAction" wx:if="{{ info.isCollection }}" class="icon" src="../../static/icon/detail_nav_collected.png" mode="widthFix"></image>
         <image wx:else data-code="collect" bindtap="handleAction" class="icon" src="../../static/icon/detail_nav_collect.png" mode="widthFix"></image>
         <view class="name">鏀惰棌</view>
       </button>
diff --git a/wechat_staff/pages/kefu/fond.js b/wechat_staff/pages/kefu/fond.js
index fb178bd..7219087 100644
--- a/wechat_staff/pages/kefu/fond.js
+++ b/wechat_staff/pages/kefu/fond.js
@@ -1,11 +1,12 @@
-// pages/kefu/fond.js
+import moment from "moment";
 Page({
 
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    bottomLift: 0
+    bottomLift: 0,
+    enjoyList: []
   },
 
   /**
@@ -16,11 +17,35 @@
     this.setData({
       bottomLift: app.bottomLift
     })
+    this.initData()
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
+  initData() {
+    let temp = []
+    let enjoyList = wx.getStorageSync('enjoyList') || []
+    enjoyList = enjoyList.sort((a,b)=>{
+      return b.timestamp - a.timestamp
+    })
+    enjoyList.forEach(item  => {
+      item.joinDate = moment(item.timestamp).format('YYYY骞碝M鏈圖D鏃�')
+      item.joinTime = moment(item.timestamp).format('HH:mm')
+      item.checked = false
+      const index = temp.findIndex( i => i.joinDate === item.joinDate )
+      if(index === -1){
+        temp.push({
+          joinDate: item.joinDate,
+          list: [item]
+        })
+      }else{
+        temp[index].list.push(item)
+      }
+    });
+    this.setData({ enjoyList: temp })
+
+
+    console.log('enjoyList', temp);
+
+  },
   onReady() {
 
   },
diff --git a/wechat_staff/pages/kefu/fond.less b/wechat_staff/pages/kefu/fond.less
index 8e33916..1e3b6ba 100644
--- a/wechat_staff/pages/kefu/fond.less
+++ b/wechat_staff/pages/kefu/fond.less
@@ -50,7 +50,6 @@
       border-radius: 8rpx;
       margin-left: 26rpx;
       margin-right: 20rpx;
-      border: 1px solid;
     }
   }
 }
diff --git a/wechat_staff/pages/kefu/fond.wxml b/wechat_staff/pages/kefu/fond.wxml
index 0d4421e..7bc3998 100644
--- a/wechat_staff/pages/kefu/fond.wxml
+++ b/wechat_staff/pages/kefu/fond.wxml
@@ -1,14 +1,14 @@
 <view class="container">
-  <view class="date_item">
-    <view class="date">2024骞�07鏈�10鏃�</view>
+  <view wx:for="{{ enjoyList }}" wx:for-item="day" class="date_item">
+    <view class="date">{{ day.joinDate }}</view>
     <view class="list">
-      <view class="line">
-        <image class="icon" src="../../static/icon/ic_select_sel@2x.png" mode="widthFix"></image>
-        <image class="icon" src="../../static/icon/ic_select@2x.png" mode="widthFix"></image>
-        <image class="img" src=""></image>
+      <view class="line" wx:for="{{ day.list }}" wx:for-item="item">
+        <image wx:if="{{ item.check }}" class="icon" src="../../static/icon/ic_select_sel@2x.png" mode="widthFix"></image>
+        <image wx:else class="icon" src="../../static/icon/ic_select@2x.png" mode="widthFix"></image>
+        <image class="img" src="{{ item.coverImage }}" mode="aspectFill"></image>
         <view class="content">
-          <view class="name">绠�绾﹁交濂綔涓囩鍏洯閲岋紝宸插厜涓哄獟绠�绾﹁交濂綔涓囩鍏洯閲岋紝宸插厜涓哄獟绠�绾﹁交濂綔涓囩鍏洯閲岋紝宸插厜涓哄獟</view>
-          <view class="time">18:00</view>
+          <view class="name">{{ item.title }}</view>
+          <view class="time">{{ item.joinTime }}</view>
         </view>
       </view>
     </view>
diff --git a/wechat_staff/pages/kefu/fond.wxss b/wechat_staff/pages/kefu/fond.wxss
index e70f839..19ff615 100644
--- a/wechat_staff/pages/kefu/fond.wxss
+++ b/wechat_staff/pages/kefu/fond.wxss
@@ -50,7 +50,6 @@
   border-radius: 8rpx;
   margin-left: 26rpx;
   margin-right: 20rpx;
-  border: 1px solid;
 }
 .footer {
   position: fixed;
diff --git a/wechat_staff/project.private.config.json b/wechat_staff/project.private.config.json
index 719e31e..c1097ec 100644
--- a/wechat_staff/project.private.config.json
+++ b/wechat_staff/project.private.config.json
@@ -31,8 +31,8 @@
         },
         {
           "name": "",
-          "pathName": "pages/promotion/index",
-          "query": "",
+          "pathName": "pages/detailDis/product",
+          "query": "id=1813372914895843329",
           "launchMode": "default",
           "scene": null
         },
@@ -42,6 +42,13 @@
           "query": "",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/kefu/fond",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }
diff --git a/wechat_staff/utils/config.js b/wechat_staff/utils/config.js
index a488a8e..2d00a25 100644
--- a/wechat_staff/utils/config.js
+++ b/wechat_staff/utils/config.js
@@ -1,7 +1,7 @@
 
 
-// export const baseUrl = 'http://192.168.0.135:10027' 
-export const baseUrl = 'https://dmtest.ahapp.net/web_interface' // 鏈湴
+export const baseUrl = 'http://192.168.0.135:10027' 
+// export const baseUrl = 'https://dmtest.ahapp.net/web_interface' // 鏈湴
 // export const baseUrl = 'http://zbtest.ahapp.net/zbom_interface/jx/wechat/' //娴嬭瘯鏈嶅姟鍣�
 
 // export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/'

--
Gitblit v1.9.3