From cb6bb8bda31df75afe5a5bd50fe8e3ff6a3d34e2 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 15 四月 2024 09:31:39 +0800
Subject: [PATCH] 详情页bug修改,资源购买页添加骨架屏

---
 packageDomain/pages/sampleBookList/applicationForm/index.js |   66 ++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/packageDomain/pages/sampleBookList/applicationForm/index.js b/packageDomain/pages/sampleBookList/applicationForm/index.js
index 4865e4c..baf669e 100644
--- a/packageDomain/pages/sampleBookList/applicationForm/index.js
+++ b/packageDomain/pages/sampleBookList/applicationForm/index.js
@@ -34,33 +34,49 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow() {
+    let that = this;
+    that.setData({
+      bookList: []
+    })
     if (wx.getStorageSync(app.config.userInfoKey)) {
-      this.setData({
+      that.setData({
         userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
       })
-      if (this.data.userInfo.role == 'Teacher') {
-        this.setData({
-          'teacherInfo.schoolName': JSON.parse(this.data.userInfo.data).schoolName,
-          'teacherInfo.courseName': JSON.parse(this.data.userInfo.data).courseName,
-          'contactInfo.fullName': JSON.parse(this.data.userInfo.data).fullName,
-          'contactInfo.phone': JSON.parse(this.data.userInfo.data).phone,
-          'contactInfo.detailedAddress': JSON.parse(this.data.userInfo.data).detailedAddress,
+      if (that.data.userInfo.role == 'Teacher') {
+        that.setData({
+          'teacherInfo.schoolName': JSON.parse(that.data.userInfo.data).schoolName,
+          'teacherInfo.courseName': JSON.parse(that.data.userInfo.data).courseName,
+          'contactInfo.fullName': JSON.parse(that.data.userInfo.data).fullName,
+          'contactInfo.phone': JSON.parse(that.data.userInfo.data).phone,
+          'contactInfo.detailedAddress': JSON.parse(that.data.userInfo.data).detailedAddress,
+        })
+      } else {
+        wx.showModal({
+          title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰�
+          content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹�
+          success: function (res) {
+            if (res.confirm) {
+              wx.navigateTo({
+                url: "/packageDomain/pages/teacherCertification/index",
+              });
+            }
+          }
         })
       }
       if (wx.getStorageSync("paperBookList")) {
-        this.setData({
-          paperBookList: wx.getStorageSync("paperBookList"),
-          bookList: wx.getStorageSync("paperBookList")
+        that.setData({
+          paperBookList: JSON.parse(wx.getStorageSync("paperBookList")),
+          bookList: JSON.parse(wx.getStorageSync("paperBookList"))
         })
       }
       if (wx.getStorageSync("electronicBookList")) {
-        this.setData({
-          electronicBookList: wx.getStorageSync("electronicBookList")
+        that.setData({
+          electronicBookList: JSON.parse(wx.getStorageSync("electronicBookList"))
         })
       }
-      this.getSelectBookCount();
-      this.getSelectPaperBookCount();
-      this.getPaperType();
+      that.getSelectBookCount();
+      that.getSelectPaperBookCount();
+      that.getPaperType();
     }
   },
 
@@ -146,11 +162,17 @@
     const {
       phoneError
     } = this.data;
-    const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
-    if (phoneError === isPhoneNumber) {
+    if (e.detail.value) {
+      const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
+      if (phoneError === isPhoneNumber) {
+        this.setData({
+          phoneError: !isPhoneNumber,
+          "contactInfo.phone": e.detail.value,
+        });
+      }
+    } else {
       this.setData({
-        phoneError: !isPhoneNumber,
-        "contactInfo.phone": e.detail.value,
+        phoneError: false,
       });
     }
   },
@@ -234,13 +256,13 @@
                 electronicBookList: [],
                 bookList: [],
               })
-              wx.setStorageSync("electronicBookList", []);
+              wx.removeStorageSync("electronicBookList")
             } else {
               that.setData({
                 paperBookList: [],
                 bookList: [],
               })
-              wx.setStorageSync("paperBookList", []);
+              wx.removeStorageSync("paperBookList")
             }
             wx.showModal({
               title: '鎻愮ず锛�', //鎻愮ず鐨勬爣棰�

--
Gitblit v1.9.1