From 4c29b79d485d68d506e798f4fd381232ebc55a86 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期六, 14 九月 2024 11:27:33 +0800
Subject: [PATCH] bug

---
 pages/retrievalPage/index.js |  118 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 77 insertions(+), 41 deletions(-)

diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js
index 88055e3..29f5b3d 100644
--- a/pages/retrievalPage/index.js
+++ b/pages/retrievalPage/index.js
@@ -72,14 +72,14 @@
       },
     ],
     tabsId: 0, //榛樿閫夊瀷涓鸿澶�
-
+    height: '',
+    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding: 0 0 0 16rpx;height:70rpx',
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-    console.log(app.config.appId);
     const systInfo = wx.getSystemInfoSync();
     const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
     const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
@@ -96,8 +96,52 @@
       }
     }
     this.onTabsChange(e)
+    // 妫�鏌ョ櫥褰曠姸鎬�
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {
+          this.getUserInfo()
+        }
+      })
+    } else {
+      this.getUserInfo()
+    }
+    var that = this;
+    // 鍔ㄦ�佽幏鍙栧睆骞曢珮搴�
+    wx.getSystemInfo({
+      success: (result) => {
+        that.setData({
+          height: result.windowHeight
+        });
+      },
+    })
   },
-
+  // 鑾峰彇鐧诲綍鐢ㄦ埛韬唤
+  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: ''
+          })
+        }
+      }
+    });
+  },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    */
@@ -143,9 +187,8 @@
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
-  onShareAppMessage() {
-
-  },
+  onShareAppMessage() {},
+  onShareTimeline() {},
   goBack() {
     wx.navigateBack();
   },
@@ -161,7 +204,6 @@
   //鏍囩鐨勫垏鎹�
   onTabsChange(event) {
     const value = event.detail.value
-    console.log(value);
     this.setData({
       tabValue: value,
       isMore: false
@@ -420,7 +462,6 @@
       method: 'post',
       data: body
     }).then((resp) => {
-      console.log(resp, 'resp');
       //鍥句功       0
       const data1 = resp[0]
       const datas1 = handleQueryResourceListData({
@@ -432,7 +473,6 @@
         bookTotal: data1.totalCount,
         [`tabList[${0}].bookTotal`]: data1.totalCount
       })
-      console.log(this.data.tabList, 7777)
       //鏁板瓧璇剧▼    1
       const data2 = resp[1]
       const datas2 = handleQueryResourceListData({
@@ -475,7 +515,6 @@
       datas5.forEach((items) => {
         items.subtitleName = items.subtitle + items.name
       })
-      // console.log(datas5, 'sadasd');
       this.setData({
         biblioClassificationData: datas5,
         biblioClassificationTotal: data5.totalCount,
@@ -534,7 +573,6 @@
     const item = event.currentTarget.dataset.item;
     const URL = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.datas.freeFile.Value
     item.determine = false
-    console.log(URL, 'URL');
     setTimeout(() => {
       if (URL) {
         item.determine = true
@@ -559,24 +597,48 @@
       }
     });
   },
+  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,
       hidden: true,
     })
-    console.log(this.data.searchVal);
     this.retrievalPageGet()
     this.bibliographyGet()
   },
   onBook(e) {
-    console.log(e.currentTarget.dataset.item);
     const item = e.currentTarget.dataset.item
     wx.navigateTo({
       url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name
     })
   },
   onBookExhibitionDetails(e) {
-    console.log(e.currentTarget.dataset.item);
     const item = e.currentTarget.dataset.item
 
     wx.navigateTo({
@@ -592,9 +654,7 @@
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
   onReachBottom(e) {
-    console.log(this.data.tabValue);
     if (this.data.tabValue == 0) {
-      console.log(0);
       if (this.data.bookData.length < this.data.bookTotal) {
         this.setData({
           isMore: true,
@@ -632,7 +692,6 @@
         }, 100)
 
       }
-      console.log(2);
     } else if (this.data.tabValue == 2) {
 
       if (this.data.digitalTextbooksData.length < this.data.digitalTextbooksTotal && this.data.digitalTextbooksData.length > 9) {
@@ -652,7 +711,6 @@
         }, 100)
 
       }
-      console.log(2);
     } else if (this.data.tabValue == 3) {
       if (this.data.seminarData.length < this.data.seminarTotal) {
         this.setData({
@@ -670,7 +728,6 @@
           })
         }, 100)
       }
-      console.log(3);
     } else if (this.data.tabValue == 4) {
       if (this.data.bookFairData.length < this.data.bookFairTotal) {
         this.setData({
@@ -688,7 +745,6 @@
           })
         }, 100)
       }
-      console.log(4);
     } else if (this.data.tabValue == 5) {
       if (this.data.biblioClassificationData.length < this.data.biblioClassificationTotal) {
         this.setData({
@@ -711,7 +767,6 @@
 
   // 涓嬫媺鍑芥暟
   onPullDownRefresh() {
-    console.log(456);
     if (this.data.tabValue == 4) {
       this.setData({
         "pageCount.page": 1
@@ -734,13 +789,11 @@
   },
   // 閭鐐瑰嚮
   mailbox(e) {
-    console.log(e);
     const key = e.currentTarget.dataset.key;
     const item = e.currentTarget.dataset.item;
     this.setData({
       [key]: true,
       dialogKey: key,
-      input: '',
       Md5: item.datas.freeFile.FileList[0].Md5
     });
   },
@@ -761,8 +814,6 @@
       this.setData({
         [dialogKey]: false
       });
-      console.log(this.data.input);
-      console.log(this.data.Md5);
       if (this.data.input) {
         let query = {
           eMail: this.data.input,
@@ -788,11 +839,9 @@
     this.setData({
       [dialogKey]: false
     });
-    console.log(111);
   },
   onScrollToLower() {
     if (this.data.tabValue == 0) {
-      console.log(0);
       if (this.data.bookData.length < this.data.bookTotal) {
         this.setData({
           isMore: true,
@@ -830,7 +879,6 @@
         }, 100)
 
       }
-      console.log(2);
     } else if (this.data.tabValue == 2) {
 
       if (this.data.digitalTextbooksData.length < this.data.digitalTextbooksTotal && this.data.digitalTextbooksData.length > 9) {
@@ -850,7 +898,6 @@
         }, 100)
 
       }
-      console.log(2);
     } else if (this.data.tabValue == 3) {
       if (this.data.seminarData.length < this.data.seminarTotal) {
         this.setData({
@@ -868,7 +915,6 @@
           })
         }, 100)
       }
-      console.log(3);
     } else if (this.data.tabValue == 4) {
       if (this.data.bookFairData.length < this.data.bookFairTotal) {
         this.setData({
@@ -886,7 +932,6 @@
           })
         }, 100)
       }
-      console.log(4);
     } else if (this.data.tabValue == 5) {
       if (this.data.biblioClassificationData.length < this.data.biblioClassificationTotal) {
         this.setData({
@@ -906,16 +951,7 @@
       }
     }
   },
-  onTabsClick(event) {
-    console.log(`
-                      Click tab, tab - panel value is $ {
-                        event.detail.value
-                      }.
-                      `);
-  },
-  tabClick() {
-    console.log(2323);
-  },
+
   // 婊戝姩鏃惰Е鍙戠殑浜嬩欢
   slideOn(e) {
     // 鎷垮埌褰撳墠绱㈠紩骞跺姩鎬佹敼鍙�

--
Gitblit v1.9.1