From c6c73b7d709322052b9cd6777b3d6657e0d43d30 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期六, 07 九月 2024 14:37:32 +0800
Subject: [PATCH] bug

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

diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js
index c41e720..670801c 100644
--- a/pages/digitalCourses/digitalCoursesDetails/index.js
+++ b/pages/digitalCourses/digitalCoursesDetails/index.js
@@ -101,6 +101,7 @@
     rzzsImg: '', //璁よ瘉璇佷功base64
     imageWidth: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勫搴�
     imageHeight: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勯珮搴�
+    website: 'https://jsek.bnuic.com',
   },
   formatDate(dateString) {
     if (!dateString) {
@@ -155,10 +156,15 @@
     this.setData({
       bookId: options.id
     })
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {} else {}
+      })
+    }
     this.digitalCoursesDetailsGet(options.id)
     this.getPlayerList()
     this.getType()
-
   },
 
   /**
@@ -311,7 +317,7 @@
       }
       this.getAboutBook(res.datas.productLinkInfo[res.datas.productLinkInfo.length - 1].LinkPath)
       this.getCertificateList()
-      res.datas.content = res.datas.content.replace('../', app.config.requestCtx + '/')
+      res.datas.content = res.datas.content && res.datas.content.replace('../', app.config.requestCtx + '/')
       this.setData({
         lecturerList: lecturer,
         digitalsData: res.datas,
@@ -619,17 +625,19 @@
         }
       })
       .then((res) => {
-        this.setData({
-          relationTextBook: res.datas[0]
-        })
-        if (this.data.relationTextBook.purchasedSaleMethodIdList.includes(this.data.relationTextBook.defaultSaleMethodId)) {
+        if (res.datas.length > 0) {
           this.setData({
-            isTextBookBuy: true
+            relationTextBook: res.datas[0]
           })
-        } else {
-          this.setData({
-            isTextBookBuy: false
-          })
+          if (this.data.relationTextBook.purchasedSaleMethodIdList.includes(this.data.relationTextBook.defaultSaleMethodId)) {
+            this.setData({
+              isTextBookBuy: true
+            })
+          } else {
+            this.setData({
+              isTextBookBuy: false
+            })
+          }
         }
       })
   },

--
Gitblit v1.9.1