From 89d33476c7ab9bf7a4fbad399685652eabd478de Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期六, 07 九月 2024 11:17:15 +0800
Subject: [PATCH] token

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

diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js
index c41e720..d443f2c 100644
--- a/pages/digitalCourses/digitalCoursesDetails/index.js
+++ b/pages/digitalCourses/digitalCoursesDetails/index.js
@@ -1,5 +1,6 @@
 // pages/digitalCourses/digitalCoursesDetails/index.js
 const app = getApp()
+import moment from 'moment'
 import SparkMD5 from 'spark-md5'
 import FormData from '../../../utils/formdata/index.js';
 import Wxml2Canvas from 'wxml2canvas';
@@ -101,6 +102,7 @@
     rzzsImg: '', //璁よ瘉璇佷功base64
     imageWidth: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勫搴�
     imageHeight: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勯珮搴�
+    website: 'https://jsek.bnuic.com',
   },
   formatDate(dateString) {
     if (!dateString) {
@@ -155,6 +157,12 @@
     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 +319,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 +627,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