From f4a2f400fdc999946e75a4322fe1ceb6e528c169 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 27 八月 2024 19:59:46 +0800
Subject: [PATCH] xuexi

---
 pages/digitalCourses/digitalCoursesDetails/index.js |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js
index 69d1f5a..4ede1be 100644
--- a/pages/digitalCourses/digitalCoursesDetails/index.js
+++ b/pages/digitalCourses/digitalCoursesDetails/index.js
@@ -81,7 +81,8 @@
     isTest: false,
     userInfo: {
       fullName: '' //鍚嶇О
-    }
+    },
+    publishingUnit: ''
   },
   formatDate(dateString) {
     if (!dateString) {
@@ -244,7 +245,7 @@
         //epub璇曡鐧惧垎姣�
       }
     }
-    app.MG.store.getProductDetail(query).then(res => {
+    app.MG.store.getProductDetail(query).then(async res => {
       console.log(res);
       if (res.datas.purchasedSaleMethodIdList.includes(res.datas.defaultSaleMethodId)) {
         this.setData({
@@ -266,12 +267,15 @@
           expire: res.false
         })
       }
-      res.datas.publicationDate = this.formatDate(res.datas.publicationDate)
+      res.datas.publicationDate = moment(res.datas.publicationDate).format('YYYY骞碝M鏈圖D鏃�')
       res.datas.price = res.datas.price.toFixed(2)
 
       wx.setNavigationBarTitle({
         title: res.datas.name,
       })
+      if (res.datas.publishingUnit) {
+        await this.getBookPublishUnit(res.datas.publishingUnit)
+      }
       let lecturer = []
       if (res.datas.datas.speaker && res.datas.datas.speaker.length > 0) {
         res.datas.datas.speaker.forEach(item => {
@@ -297,6 +301,29 @@
       })
     })
   },
+
+  //鑾峰彇鍥句功鍑虹増鍗曚綅
+  async getBookPublishUnit(listStr) {
+    let query = {
+      refCodes: ['publishingUnit']
+    }
+    await app.MG.store.getProductTypeField(query).then((res) => {
+      const list = JSON.parse(listStr)
+      let dataList = []
+      list.forEach((unit) => {
+        JSON.parse(res[0].config).option.forEach((item) => {
+          if (item.value == unit) {
+            dataList.push(item.name)
+          }
+        })
+      })
+      if (dataList.length == list.length) {
+        this.setData({
+          publishingUnit: dataList.join('  '),
+        })
+      }
+    })
+  },
   onTabsChange(event) {
     const value = event.detail.value
     this.setData({

--
Gitblit v1.9.1