From aef06b129be7a3a12ac097db8e372b0cb33c6c42 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 02 四月 2024 09:15:19 +0800
Subject: [PATCH] 我的建议,笔记bug修改

---
 packageBookService/pages/bookServices/detail/index.js |  103 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 62 insertions(+), 41 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 9294e5e..94ce20c 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -1010,45 +1010,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: '鐢宠宸叉彁浜�',
-          duration: 2000,
+    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(() => { })
-    //   }
-    // } 
+    }
   },
   // 鏁欏璧勬簮涓嬭浇鍓嶅線PC鎻愮ずDiialog
   closeTeachDownload() {
@@ -1058,10 +1062,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

--
Gitblit v1.9.1