From 0f9f58798cb5df9e99e60fed882b73224313915d Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期三, 08 一月 2025 16:24:38 +0800
Subject: [PATCH] shiti

---
 packageCourse/pages/studentClass/index.js |   40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/packageCourse/pages/studentClass/index.js b/packageCourse/pages/studentClass/index.js
index 7ad0e99..4ba4389 100644
--- a/packageCourse/pages/studentClass/index.js
+++ b/packageCourse/pages/studentClass/index.js
@@ -42,11 +42,14 @@
 
   // 閫氳繃code鏌ヨ鐝骇
   getClassDetail() {
-    if (this.data.refCode == '') {
+    if (!this.data.refCode) {
       wx.showToast({
         title: '璇疯緭鍏ラ個璇风爜',
         duration: 1000,
         icon: "none",
+      })
+      this.setData({
+        classDetail: null
       })
       return false
     }
@@ -56,14 +59,29 @@
     app.MG.edu
       .getCourseClass(data)
       .then(res => {
-        if (res) {
+        if (res.linkProductDto) {
           res.classTime = moment(res.beginDate).format('YYYY-MM-DD') + '--' + moment(res.endDate).format('YYYY-MM-DD')
           this.setData({
             classDetail: res
           })
+        } else {
+          this.setData({
+            classDetail: null
+          })
+          wx.showToast({
+            title: '閭�璇风爜鏃犳晥',
+            icon: "none"
+          })
         }
       })
       .catch(err => {
+        wx.showToast({
+          title: '閭�璇风爜鏃犳晥',
+          icon: "none"
+        })
+        this.setData({
+          classDetail: null
+        })
         console.log(err)
       })
   },
@@ -78,7 +96,9 @@
   // 鍏抽棴鐢宠
   cancle() {
     this.setData({
-      visible: false
+      visible: false,
+      classDetail: null,
+      refCode: ''
     })
   },
 
@@ -161,6 +181,8 @@
           classList: list,
           totalSize: totalSize,
           visible: false,
+          classDetail: null,
+          refCode: '',
           skeletonLoding: false,
           bottomLoading: false
         })
@@ -169,12 +191,12 @@
   },
 
   // 鑾峰彇鏁欐潗璇︽儏
-  async getBookDetail(shopId) {
+  async getBookDetail(shopId, path) {
     let query = {
-      path: 'jsek_digitalTextbooks',
+      path,
       queryType: '*',
       productId: String(shopId),
-      storeInfo: 'jsek_digitalTextbooks',
+      storeInfo: path,
       coverSize: {
         height: 300,
         width: 210
@@ -194,7 +216,9 @@
       classId,
       item
     } = e.currentTarget.dataset
-    const bookData = await this.getBookDetail(item.linkProductDto?.product?.id)
+    const bookRefCode = item.linkProductDto?.product?.refCode
+    const path = bookRefCode ? 'jsek_digitalTextbooks' : 'defaultGoodsStore3'
+    const bookData = await this.getBookDetail(item.linkProductDto?.product?.id, path)
     if (item.userState == 'WaitValid' || item.userState == 'Reject') {
       wx.showToast({
         title: item.userState == 'WaitValid' ? '瀹℃牳涓�' : '鏈�氳繃',
@@ -204,7 +228,7 @@
       return false
     }
     wx.navigateTo({
-      url: '/packageCourse/pages/teachClass/index?classId=' + classId + '&bookId=' + bookData.id + '&author=' + bookData.author + '&isbn=' + bookData.isbn + '&rootCmsItemId=' + bookData.rootCmsItemId,
+      url: '/packageCourse/pages/teachClass/index?classId=' + classId + '&bookId=' + bookData.id + '&author=' + bookData.author + '&isbn=' + bookData.isbn + '&rootCmsItemId=' + bookData.rootCmsItemId + '&bookRefCode=' + bookRefCode,
     })
   },
 

--
Gitblit v1.9.1