From 7eea32a9a7a034e951468bea279688e8db5c1c98 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 09 九月 2024 14:31:51 +0800
Subject: [PATCH] bug

---
 pages/retrievalPage/index.js |   71 +++++++++++++++++++++++++++++++++--
 1 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js
index 3b5f105..231881f 100644
--- a/pages/retrievalPage/index.js
+++ b/pages/retrievalPage/index.js
@@ -96,8 +96,43 @@
       }
     }
     this.onTabsChange(e)
+    // 妫�鏌ョ櫥褰曠姸鎬�
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {
+          this.getUserInfo()
+        }
+      })
+    } else {
+      this.getUserInfo()
+    }
   },
-
+  // 鑾峰彇鐧诲綍鐢ㄦ埛韬唤
+  getUserInfo() {
+    app.MG.identity.getCurrentAppUser().then(res => {
+      // 鐢ㄦ埛淇℃伅浼樺厛绾э細鏁欏笀璁よ瘉 > 寰俊 > 瀛︾敓锛堟敞鍐屾椂榛樿锛�
+      if (res) {
+        //鑾峰彇鐢ㄦ埛绫诲瀷
+        let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher')
+        let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo')
+        let eMailData = res.secretList.find(i => i.type == 'EMail')
+        if (eMailData) {
+          this.setData({
+            input: eMailData.credential
+          })
+        } else if (teacherRole && teacherInfos) {
+          this.setData({
+            input: JSON.parse(teacherInfos.data).email
+          })
+        } else {
+          this.setData({
+            input: ''
+          })
+        }
+      }
+    });
+  },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    */
@@ -193,7 +228,8 @@
         'Name*': this.data.searchVal.trim(),
         '||author*': this.data.searchVal.trim(),
         '||isbn*': this.data.searchVal.trim(),
-        '||seriesName*': this.data.searchVal.trim()
+        '||seriesName*': this.data.searchVal.trim(),
+        '||projectLeader*': this.data.searchVal.trim()
       }
 
     }
@@ -235,7 +271,8 @@
         'Name*': this.data.searchVal.trim(),
         '||author*': this.data.searchVal.trim(),
         '||isbn*': this.data.searchVal.trim(),
-        '||seriesName*': this.data.searchVal.trim()
+        '||seriesName*': this.data.searchVal.trim(),
+        '||projectLeader*': this.data.searchVal.trim()
       }
     }
     //璇剧▼
@@ -557,6 +594,33 @@
       }
     });
   },
+  openBookFair(event) {
+    const item = event.currentTarget.dataset.item
+    if (item.fileType == "pdf") {
+      wx.navigateTo({
+        url: "/packageBookService/pages/components/webView/index?md5=" +
+          item.freeFile +
+          "&fileName=" +
+          item.name +
+          "&fileType=" +
+          item.fileType + "&bookBuy=true"
+          // "&freePage=" +
+          // this.data.fileInfo.freePage +
+
+          +
+          "&bookId=" +
+          item.id,
+      });
+    } else {
+      Toast({
+        context: this,
+        selector: '#t-toast',
+        message: '姝や功涓嶈兘鏌ョ湅',
+        theme: 'warning',
+        direction: 'column',
+      });
+    }
+  },
   onSearchSubmit() {
     this.setData({
       loading: true,
@@ -738,7 +802,6 @@
     this.setData({
       [key]: true,
       dialogKey: key,
-      input: '',
       Md5: item.datas.freeFile.FileList[0].Md5
     });
   },

--
Gitblit v1.9.1