From c3086cda662e2b908cf96b6b3ff599713eb924d6 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期一, 02 九月 2024 16:59:16 +0800
Subject: [PATCH] gongneng

---
 pages/digitalTextbooks/index.js |   73 ++++++++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/pages/digitalTextbooks/index.js b/pages/digitalTextbooks/index.js
index d0101e6..374ff4d 100644
--- a/pages/digitalTextbooks/index.js
+++ b/pages/digitalTextbooks/index.js
@@ -22,7 +22,32 @@
     selectedIndex: 0,
     digitalTextbooksData: [],
     path: "jsek_dTHigherEducation",
-    loading: true
+    loading: true,
+    sorter: {
+      value: "*",
+      options: [{
+          value: "*",
+          label: "榛樿鎺掑簭",
+        },
+        {
+          value: "nameAsc",
+          label: "鐐瑰嚮閲忔搴�",
+        },
+        {
+          value: "nameDesc",
+          label: "鐐瑰嚮閲忓�掑簭",
+        },
+        {
+          value: "timeAsc",
+          label: "鍒涘缓鏃堕棿姝e簭",
+        },
+        {
+          value: "timeDesc",
+          label: "鍒涘缓鏃堕棿鍊掑簭",
+        },
+      ],
+    },
+    sortActive: ''
 
   },
 
@@ -165,13 +190,20 @@
     this.bookExhibitionGet()
 
   },
+  onSort(e) {
+    this.setData({
+      "sortActive": e.detail.value,
+    });
+    console.log(e)
+    this.bookExhibitionGet()
+  },
   // 鑾峰彇鍥剧墖鏂囧瓧鍒楄〃
   bookExhibitionGet(keyword) {
     // console.log(path.value, '456')
 
     // loading.value = true
     let searchObj = {}
-    // let sort = {}
+    let sort = {}
     // 鎼滅储妗�
     if (keyword) {
       searchObj = {
@@ -180,22 +212,23 @@
       }
     }
 
-    // if (timeSort.value) {
-    //     sort = {
-    //         CreateDate: timeSort.value || 'Desc'
-    //     }
-    // } else {
-    //     sort = {
-    //         ViewCount: nameSort.value || 'Desc'
-
-    //     }
-    //     // 缁勫悎鐨勫啓娉� 瑕佹煡璇㈢殑瀛楁:鍗囧簭鍜岄檷搴�
-
-    //     // Name: "Desc"
-    //     //涓�鑸殑鎺掑簭浼犳硶
-    //     // type: "Asc",
-    //     // field: "CreateDate",
-    // }
+    if (this.data.sortActive == 'nameAsc') {
+      sort = {
+        ViewCount: 'Asc'
+      }
+    } else if (this.data.sortActive == 'nameDesc') {
+      sort = {
+        ViewCount: 'Desc'
+      }
+    } else if (this.data.sortActive == 'timeAsc') {
+      sort = {
+        CreateDate: 'Asc'
+      }
+    } else if (this.data.sortActive == 'timeDesc') {
+      sort = {
+        CreateDate: 'Desc'
+      }
+    }
     app.MG.store
       .getProductList({
         storeInfo: 'jsek_digitalTextbooks',
@@ -205,7 +238,7 @@
           start: 0,
           size: 99
         },
-        // sort: sort,
+        sort: sort,
         fields: {
           content: [],
           subtitle: [],
@@ -219,8 +252,6 @@
           digitalTextbooksData: res.datas,
           loading: false
         })
-
-
         console.log(this.data.digitalTextbooksData);
       })
   },

--
Gitblit v1.9.1