From a924e3906a3b77f04ac4fedcff9e76ebe0c997a2 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 24 七月 2024 19:19:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 wechat_staff/pages/kefu/fond.js |  136 +++++++++++++++++++++++++++++++-------------
 1 files changed, 95 insertions(+), 41 deletions(-)

diff --git a/wechat_staff/pages/kefu/fond.js b/wechat_staff/pages/kefu/fond.js
index fb178bd..cb63da1 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,54 +17,107 @@
     this.setData({
       bottomLift: app.bottomLift
     })
+    this.initData()
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady() {
+  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);
 
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow() {
-
+  itemCheck(e){
+    const { enjoyList } = this.data
+    const { index, inde } = e.currentTarget.dataset
+    enjoyList[index].list[inde].check = !enjoyList[index].list[inde].check
+    this.setData({ enjoyList })
   },
+  handleDown() {
+    const {
+      info,
+      path
+    } = this.data
+    let that = this
+    getContentShareImg({
+      articleId: path + '&' + info.id,
+      type: '1',
+      // pageUrl: path,
+      imgurl: info.coverImage,
+    }).then(res => {
+      this.setData({
+        isShowPoster: true,
+        showShare: false,
+        posterUrl: res.data
+      })
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
-   */
-  onHide() {
-
+    })
   },
+  saveCard() {
+    let that = this
+    const posterUrl = this.data.posterUrl
+    wx.downloadFile({
+      url: posterUrl,
+      success: function (res) {
+        console.log('涓嬭浇鎴愬姛', res);
+        wx.saveImageToPhotosAlbum({
+          filePath: res.tempFilePath,
+          success(result) {
+            console.log(result)
+            that.setData({
+              isShowPoster: false
+            })
+            wx.showToast({
+              title: '淇濆瓨鎴愬姛',
+              icon: 'success',
+              duration: 2000
+            })
+          }
+        })
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
-   */
-  onUnload() {
-
+      }
+    })
   },
-
-  /**
-   * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
-   */
-  onPullDownRefresh() {
-
+  batchDown() {
+    setTimeout(() => {
+      eventBus.emit('batchDown', [1,2,3])
+    }, 800)
+    wx.navigateTo({
+      url: '/pages/download/index',
+    })
   },
-
-  /**
-   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
-   */
-  onReachBottom() {
-
+  closeCard() {
+    this.setData({ isShowPoster: false })
   },
-
-  /**
-   * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
-   */
-  onShareAppMessage() {
-
-  }
+  openShare() {
+    console.log('鐐瑰嚮鎵撳紑');
+    this.setData({
+      showShare: true
+    })
+  },
+  onClose() {
+    console.log('鐐瑰嚮鍏抽棴');
+    this.setData({
+      showShare: false
+    })
+  },
 })
\ No newline at end of file

--
Gitblit v1.9.3