From 4a9955330070cf8abd78d95aaa2067d9a06a88c3 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 07 五月 2024 10:05:59 +0800
Subject: [PATCH] 各页面bug修改

---
 pages/bibliographyList/index.js |  223 +++++++++++++++++--------------------------------------
 1 files changed, 70 insertions(+), 153 deletions(-)

diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js
index f7bba40..9043fb8 100644
--- a/pages/bibliographyList/index.js
+++ b/pages/bibliographyList/index.js
@@ -33,20 +33,18 @@
       emailError: false,
       loading: true, //寮�鍚鏋跺睆鍔犺浇
       hidden: true, //鏄惁灞曠ず鍐呭
+      height: '',
+      dialogBox: false,
+      inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding: 0 0 0 16rpx;height:70rpx',
     },
 
     /**
      * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
      */
     onLoad(options) {
-
-
-
-
       this.higherGet()
       this.vocationalGet()
       this.teacherGet()
-
       const systInfo = wx.getSystemInfoSync();
       const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
       const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
@@ -60,6 +58,15 @@
         }
       }
       this.onTabsChange(event)
+      var that = this;
+      // 鍔ㄦ�佽幏鍙栧睆骞曢珮搴�
+      wx.getSystemInfo({
+        success: (result) => {
+          that.setData({
+            height: result.windowHeight
+          });
+        },
+      })
     },
 
     /**
@@ -112,41 +119,26 @@
 
     },
     onTabsChange(event) {
-
       const value = event.detail.value
-
-      if (value === '0') {
-        console.log(value);
-        this.setData({
-          tabValue: value,
-          isMore: false
-        })
-      } else if (value === '1') {
-        console.log(value);
-        this.setData({
-          tabValue: value,
-          isMore: false
-        })
-      } else if (value === '2') {
-        console.log(value);
-        this.setData({
-          tabValue: value,
-          isMore: false
-        })
+      this.setData({
+        isMore: null,
+        tabValue: value,
+      })
+      if (value == '0') {
+        this.higherGet()
+      } else if (value == '1') {
+        this.vocationalGet()
+      } else if (value == '2') {
+        this.teacherGet()
       }
     },
-
-
     //楂樼瓑鏁欒偛
     higherGet(keyword) {
-      // console.log(keyword, 'keyword');
       let searchObj = {
         'Name*': keyword,
         '||author*': keyword,
         '||isbn*': keyword
-
       }
-
       app.MG.resource.getItem({
         path: 'jsek_biblioClassification\\jsek_bCHigherEducation',
         queryType: '*',
@@ -168,24 +160,24 @@
         },
         SysType: 'CmsItem'
       }).then(res => {
-
         res.datas.forEach(item => {
           item.determine = true
         })
-        // console.log(res, 789111);
         this.setData({
           higherList: res.datas,
           higherTotal: res.total
         })
-        // console.log(this.data.higherList, '5555');
         this.setData({
           loading: false, //寮�鍚鏋跺睆鍔犺浇
           hidden: false, //鏄惁灞曠ず鍐呭
         })
+        if (res.datas.length < 7 && res.datas.length > 0) {
+          this.setData({
+            isMore: false
+          })
+        }
       })
       wx.stopPullDownRefresh()
-
-
     },
 
     //鏁欏笀鏁欒偛
@@ -194,7 +186,6 @@
         'Name*': keyword,
         '||author*': keyword,
         '||isbn*': keyword
-
       }
       app.MG.resource.getItem({
         path: 'jsek_biblioClassification\\jsek_bCVocationalEducation',
@@ -225,7 +216,11 @@
           vocationalList: res.datas,
           vocationalTotal: res.total
         })
-
+        if (res.datas.length < 7 && this.datas.length > 0) {
+          this.setData({
+            isMore: false
+          })
+        }
       })
       wx.stopPullDownRefresh()
     },
@@ -235,7 +230,6 @@
         'Name*': keyword,
         '||author*': keyword,
         '||isbn*': keyword
-
       }
       app.MG.resource.getItem({
         path: 'jsek_biblioClassification\\jsek_bCTeacherEducation',
@@ -267,6 +261,11 @@
           teacherList: res.datas,
           teacherTotal: res.total
         })
+        if (res.datas.length < 7 && this.datas.length > 0) {
+          this.setData({
+            isMore: false
+          })
+        }
       })
       wx.stopPullDownRefresh()
     },
@@ -310,11 +309,8 @@
     //   }, 2000);
     // },
     downloadData(event) {
-
       const item = event.currentTarget.dataset.item
-      console.log(item);
       if (item.fileType == "pdf") {
-
         wx.navigateTo({
           url: "/packageBookService/pages/components/webView/index?md5=" +
             item.freeFile +
@@ -337,11 +333,7 @@
           theme: 'warning',
           direction: 'column',
         });
-        console.log(456);
       }
-
-
-
     },
     onSearchSubmit: function (e) {
       const keyword = e.detail.value;
@@ -351,14 +343,11 @@
       this.vocationalGet(keyword)
       this.teacherGet(keyword)
     },
-
-
     goBack() {
       wx.navigateBack();
     },
     onReachBottom(e) {
       if (this.data.tabValue == 0) {
-        console.log(0);
         if (this.data.higherList.length < this.data.higherTotal) {
           this.setData({
             isMore: true,
@@ -374,11 +363,8 @@
               isMore: false
             })
           }, 100)
-
         }
-
       } else if (this.data.tabValue == 2) {
-
         if (this.data.teacherList.length < this.data.teacherTotal) {
           this.setData({
             isMore: true,
@@ -394,11 +380,8 @@
               isMore: false
             })
           }, 100)
-
         }
-
       } else if (this.data.tabValue == 1) {
-
         console.log(this.data.vocationalList.length);
         console.log(this.data.vocationalTotal);
         if (this.data.vocationalList.length < this.data.vocationalTotal) {
@@ -416,13 +399,8 @@
               isMore: false
             })
           }, 100)
-
         }
-        console.log(2);
       }
-
-
-
     },
 
     onPullDownRefresh() {
@@ -438,96 +416,45 @@
     mailbox(e) {
       const key = e.currentTarget.dataset.key;
       const item = e.currentTarget.dataset.item;
-
-
-
       this.setData({
-        // [key]: true,
-        // dialogKey: key,
-        hiddenmodalput: true,
-        input: '',
-        Md5: item.datas.freeFile.FileList[0].Md5
-
-      });
-
-
-
-    },
-
-    onEmailInput(e) {
-      const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(e.detail.value);
-      this.setData({
-        emailError: !isEmailValid,
-        "input": e.detail.value,
-      });
-    },
-    //寮圭獥纭
-    onConfirm() {
-      if (!this.data.emailError && this.data.input) {
-        const {
-          dialogKey
-        } = this.data;
-        this.setData({
-          [dialogKey]: false
-        });
-
-
-        console.log(this.data.input);
-        console.log(this.data.Md5);
-        if (this.data.input) {
-          let query = {
-            eMail: this.data.input,
-            md5s: [this.data.Md5]
-          }
-          app.MG.file.sendFileWithEmail(query).then(res => {
-            console.log(res);
-          })
-        }
-      } else {
-        // 鏍¢獙涓嶉�氳繃锛岀粰鍑洪敊璇彁绀�
-        wx.showToast({
-          title: '閭鏍煎紡涓嶆纭�',
-          icon: 'none',
-        });
-      }
-
+        Md5: item.datas.freeFile.FileList[0].Md5,
+        dialogBox: true
+      })
+      // wx.scanCode({
+      //   success: res => {
+      //     console.log(res); 
+      //   }
+      // })
     },
     // 寮圭獥鍙栨秷
     closeDialog() {
-      const {
-        dialogKey
-      } = this.data;
       this.setData({
-        [dialogKey]: false
-      });
-      console.log(111);
-    },
-    //鍙栨秷寮规
-    cancelM: function (e) {
-      this.setData({
-        hiddenmodalput: false,
+        dialogBox: false
       })
     },
     //鎻愪氦
-    confirmM: function (e) {
-      console.log("濮撳悕锛�" + this.data.name + "  鐢佃瘽锛�" + this.data.phoneNum);
-      if (!this.data.emailError && this.data.name) {
-
-
-
-
-        if (this.data.name) {
-          let query = {
-            eMail: this.data.name,
-            md5s: [this.data.Md5]
-          }
-          app.MG.file.sendFileWithEmail(query).then(res => {
-            console.log(res);
-            this.setData({
-              hiddenmodalput: false,
-            })
-          })
+    confirmM(e) {
+      wx.showLoading({
+        title: '鍙戦�佷腑...',
+      })
+      const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(this.data.input);
+      if (isEmailValid && this.data.input) {
+        this.setData({
+          dialogBox: false
+        })
+        let query = {
+          eMail: this.data.input,
+          md5s: [this.data.Md5]
         }
+        app.MG.file.sendFileWithEmail(query).then(res => {
+          wx.hideLoading()
+          if (res) {
+            wx.showToast({
+              icon: 'success',
+              title: '閭欢宸插彂閫�',
+            })
+          }
+        })
       } else {
         // 鏍¢獙涓嶉�氳繃锛岀粰鍑洪敊璇彁绀�
         wx.showToast({
@@ -535,20 +462,10 @@
           icon: 'none',
         });
       }
-
     },
-
-    iName: function (e) {
+    inputChange(e) {
       this.setData({
-        name: e.detail.value
+        input: e.detail.value
       })
-      // console.log(this.data.name);
-    },
-    iPhoneNum: function (e) {
-      this.setData({
-        phoneNum: e.detail.value
-      })
-    },
-
-
+    }
   })
\ No newline at end of file

--
Gitblit v1.9.1