From 7adfe5210fad2b4ab1b1be41e2d58eb3dd9b2b1a Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 02 四月 2024 09:38:22 +0800
Subject: [PATCH] 代码合并

---
 packageBookService/pages/bookServices/detail/index.js |  121 ++++++++++++++++++++++-----------------
 1 files changed, 68 insertions(+), 53 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 6d7e767..07ab18a 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -418,9 +418,13 @@
           selectedIds: res.datas[0].defaultSaleMethod.id,
           bookBuy: res.datas[0].purchasedSaleMethodIdList.indexOf(res.datas[0].defaultSaleMethodId) > -1
         });
+        console.log(res);
+        console.log(res.datas[0].defaultSaleMethod.endDate, 'res.datas[0].defaultSaleMethod.endDate');
+        console.log(res.datas[0].defaultSaleMethod.beginDate, 'res.datas[0].defaultSaleMethod.beginDate');
         console.log(this.data.bookItemDetail, 'bookItemData.value');
         let times = new Date(res.datas[0].defaultSaleMethod.endDate).getTime()
         let startTime = new Date(res.datas[0].defaultSaleMethod.beginDate).getTime()
+
         if (times < new Date().getTime() || new Date().getTime() < startTime) {
           this.setData({
             expire: true
@@ -523,7 +527,6 @@
         }
       })
     } else {
-      debugger
       if (this.data.bookDetail.isFavourite) {
         app.MG.store
           .delProductLink({
@@ -822,15 +825,7 @@
   // 鍥句功娣诲姞璐墿杞�
   async addBookShopcCar() {
     if (!this.data.expire) {
-      const token = wx.getStorageSync('jsek-token')
-      if (!token) {
-        return wx.getUserProfile({
-          desc: '鐢ㄦ埛鐧诲綍',
-          success: (res) => {
-            console.log(res);
-          }
-        })
-      }
+
 
       const shoppingCartGetId = []
 
@@ -1011,46 +1006,49 @@
     wx.showLoading({
       title: '鍔犺浇涓�',
     })
-    // let role = userStore.userInfo ? userStore.userInfo.role : null
-    // if (role) {
-    //   if (role == 'Teacher') {
-    // 鐢宠鏁欏璧勬簮
-    let query = {
-      topicIdOrRefCode: 'productDownLoad',
-      type: 'applyForDownload',
-      state: 'WaitAudit',
-      cmsTypeRefCode: '',
-      newDataListRequest: [],
-      name: this.data.bookDetail.name, // name涓虹敵璇风殑涔︽湰鍚嶇О
-      content: JSON.stringify([{
-        name: this.data.bookDetail.name,
-        id: this.data.bookDetail.id,
-        // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
-        icon: this.data.bookDetail.icon
-      }])
-    }
-    app.MG.ugc.newTopicMessage(query).then(async (res) => {
-      if (res) {
-        wx.showToast({
-          title: '鐢宠宸叉彁浜わ紝璇峰緟瀹℃牳閫氳繃鍚庝笅杞�',
+    let role = wx.getStorageSync(app.config.userInfoKey).role
+    if (role) {
+      debugger
+      if (role == 'Teacher') {
+        // 鐢宠鏁欏璧勬簮
+        let query = {
+          topicIdOrRefCode: 'productDownLoad',
+          type: 'applyForDownload',
+          state: 'WaitAudit',
+          cmsTypeRefCode: '',
+          newDataListRequest: [],
+          name: this.data.bookDetail.name, // name涓虹敵璇风殑涔︽湰鍚嶇О
+          content: JSON.stringify([{
+            name: this.data.bookDetail.name,
+            id: this.data.bookDetail.id,
+            // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
+            icon: this.data.bookDetail.icon
+          }])
+        }
+        app.MG.ugc.newTopicMessage(query).then(async (res) => {
+          if (res) {
+            wx.showToast({
+              title: '鐢宠宸叉彁浜�',
+              duration: 2000,
+            })
+          }
+          await this.getApplyInfo(this.data.bookDetail.id)
+        })
+      } else {
+        wx.showModal({
+          title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�',
+          content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�',
+          complete: (res) => {
+            if (res.cancel) {}
+            if (res.confirm) {
+              wx.navigateTo({
+                url: '/packageDomain/pages/teacherCertification/index',
+              })
+            }
+          }
         })
       }
-      await this.getApplyInfo(this.data.bookDetail.id)
-    })
-    //   } else {
-    //     ElMessageBox.confirm('璇峰厛杩涜鏁欏笀璁よ瘉锛�', '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', {
-    //       confirmButtonText: '鍘昏璇�',
-    //       cancelButtonText: '鍙栨秷',
-    //       type: 'warning'
-    //     })
-    //       .then(() => {
-    //         isShow.value = true
-    //       })
-    //       .catch(() => { })
-    //   }
-    // } else {
-    //   // logIn()
-    // }
+    }
   },
   // 鏁欏璧勬簮涓嬭浇鍓嶅線PC鎻愮ずDiialog
   closeTeachDownload() {
@@ -1060,10 +1058,27 @@
   },
   // 涓嬭浇鍔熻兘
   downloadTeach(e) {
-    this.setData({
-      isShowTeachDownload: true
-    })
-    console.log('zhuan', this.data.isShowTeachDownload);
+    let role = JSON.parse(wx.getStorageSync(app.config.userInfoKey)).role
+    if (role && role == 'Teacher') {
+      this.setData({
+        isShowTeachDownload: true
+      })
+    } else {
+      wx.showModal({
+        title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�',
+        content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�',
+        complete: (res) => {
+          if (res.cancel) {
+
+          }
+          if (res.confirm) {
+            wx.navigateTo({
+              url: '/packageDomain/pages/teacherCertification/index',
+            })
+          }
+        }
+      })
+    }
     //   const data = e.detail.value
     //   // const data
     //   // let role = userStore.userInfo ? userStore.userInfo.role : null
@@ -1518,7 +1533,7 @@
       return false;
     }
     wx.navigateTo({
-      url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage + '&bookBuy=' + this.data.bookBuy
+      url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage + '&bookBuy=' + this.data.bookBuy + '&bookId=' + this.data.bookDetail.id
     })
 
   },

--
Gitblit v1.9.1