From aa2c08b3be23a01d44205b2c19d21a2bf53f944f Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 01 四月 2024 16:15:38 +0800
Subject: [PATCH] 图书服务列表、详情页bug修改

---
 packageDomain/pages/sampleBookList/index.js |  577 +++++++++++++++++++++++++--------------------------------
 1 files changed, 254 insertions(+), 323 deletions(-)

diff --git a/packageDomain/pages/sampleBookList/index.js b/packageDomain/pages/sampleBookList/index.js
index 30be704..9d63ba3 100644
--- a/packageDomain/pages/sampleBookList/index.js
+++ b/packageDomain/pages/sampleBookList/index.js
@@ -1,3 +1,6 @@
+import {
+  loginInfo
+} from '../../../assets/js/login';
 const app = getApp();
 Page({
 
@@ -63,6 +66,7 @@
     electronicBookList: [], //鏍蜂功鍗曠數瀛愪功
     paperBookCount: 0, //绾歌川涔﹀墿浣欐鏁�
     ebookCount: 0, //鐢靛瓙涔﹀墿浣欐鏁�
+    num: 0,
   },
 
   /**
@@ -112,34 +116,40 @@
           Path: options.secondCode,
           Type: '*',
           StoreRefCode: app.config.goodsStore,
-        }
-        ],
+        }],
       })
     }
     this.getIconTypeList();
-    this.getBookList(false);
     // 鑾峰彇閲嶇偣椤圭洰
     this.getProjectList('bookClassification');
     //鏂板舰鎬佹暀鏉�
     this.getProjectList('newFormsTextbooks');
-    if (wx.getStorageSync(app.config.tokenKey)) {
-      this.getAlreadyPBookList()
-      this.getAlreadyEBookList()
-    }
-    if (wx.getStorageSync(app.config.userInfoKey)) {
+
+    // 妫�鏌ョ櫥褰曠姸鎬�
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {
+          this.setData({
+            userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
+          })
+          this.getAlreadyPBookList()
+          this.getAlreadyEBookList()
+          // 鑾峰彇鐢宠娆℃暟
+          this.getSelectPaperBookCount()
+          this.getSelectBookCount()
+
+        }
+      })
+    } else {
       this.setData({
         userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
       })
-    }
-    if (wx.getStorageSync("paperBookList")) {
-      this.setData({
-        paperBookList: wx.getStorageSync("paperBookList")
-      })
-    }
-    if (wx.getStorageSync("electronicBookList")) {
-      this.setData({
-        electronicBookList: wx.getStorageSync("electronicBookList")
-      })
+      this.getAlreadyPBookList()
+      this.getAlreadyEBookList()
+      // 鑾峰彇鐢宠娆℃暟
+      this.getSelectPaperBookCount()
+      this.getSelectBookCount()
     }
   },
 
@@ -154,31 +164,72 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow() {
-
+    if (wx.getStorageSync("paperBookList")) {
+      this.setData({
+        paperBookList: wx.getStorageSync("paperBookList"),
+      })
+    }
+    if (wx.getStorageSync("electronicBookList")) {
+      this.setData({
+        electronicBookList: wx.getStorageSync("electronicBookList"),
+      })
+    }
+    this.setData({
+      num: this.data.paperBookList.length + this.data.electronicBookList.length
+    })
+    this.getBookList(false);
   },
   goBack() {
     wx.navigateBack();
+  },
+
+  // 鑾峰彇绾歌川涔﹀墿浣欐鏁�
+  getSelectPaperBookCount(item) {
+    app.MG.app
+      .getTicketResult({
+        ticketRefCodeOrGuid: 'paperSampleBookapplyNum',
+        roleId: this.data.userInfo.roleId
+      })
+      .then((res) => {
+        this.setData({
+          paperBookCount: res.totalCount - res.usedCount
+        })
+      })
+  },
+  // 鑾峰彇鐢靛瓙涔﹀墿浣欐鏁�
+  getSelectBookCount(item) {
+    app.MG.app
+      .getTicketResult({
+        ticketRefCodeOrGuid: 'electronicSampleBookapplyNum',
+        roleId: this.data.userInfo.roleId
+      })
+      .then((res) => {
+        this.setData({
+          ebookCount: res.totalCount - res.usedCount
+        })
+      })
   },
   //鑾峰彇楂樼骇鍒嗙被
   getIconTypeList() {
     let query = {
       path: '*',
-      filterList: [
-        {
-          value: 'Normal',
-          field: 'state'
-        }
-      ],
+      filterList: [{
+        value: 'Normal',
+        field: 'state'
+      }],
       queryType: '\\',
       searchList: [],
       size: '5',
       start: '0',
       storeRefCode: app.config.goodsStore,
-      sort: { type: 'Asc', field: 'LinkOrder' }
+      sort: {
+        type: 'Asc',
+        field: 'LinkOrder'
+      }
     }
     app.MG.store.getStoreChannelList(query).then((res) => {
       let list = [];
-      if (res.datas.length > 0) (
+      if (res.datas.length > 0)(
         res.datas.forEach((item) => {
           item.value = item.refCode;
           item.label = item.name;
@@ -207,7 +258,10 @@
       size: '30',
       start: '0',
       storeRefCode: app.config.goodsStore,
-      sort: { type: 'Asc', field: 'LinkOrder' },
+      sort: {
+        type: 'Asc',
+        field: 'LinkOrder'
+      },
     };
     app.MG.store.getStoreChannelList(query).then(async (res) => {
       let options = [];
@@ -224,6 +278,7 @@
         'stairList.options': options,
         'stairList.value': this.data.stairCode,
       });
+      console.log(this.data.stairList.options)
     });
   },
   // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被
@@ -237,7 +292,10 @@
       size: '30',
       start: '0',
       storeRefCode: app.config.goodsStore,
-      sort: { type: 'Asc', field: 'LinkOrder' },
+      sort: {
+        type: 'Asc',
+        field: 'LinkOrder'
+      },
     };
     app.MG.store.getStoreChannelList(query).then((res) => {
       if (res.datas.length > 0) {
@@ -299,7 +357,6 @@
         this.setData({
           'newTextBook.options': options,
         });
-        console.log('閲嶇偣椤圭洰', this.data.newTextBook);
       }
     });
   },
@@ -341,16 +398,11 @@
     }
     const query = {
       ...pathObj,
-      filterList: [
-        {
-          value: 'Normal',
-          field: 'state',
-        },
-      ],
+      filterList: [{
+        value: 'Normal',
+        field: 'state',
+      }, ],
       sort,
-      coverSize: {
-        height: 145,
-      },
       paging: {
         start: that.data.page * that.data.limit - that.data.limit,
         size: that.data.limit
@@ -389,6 +441,7 @@
                 })
               })
             }
+
             if (that.data.alreadyElectronicBookList.length > 0) {
               that.data.alreadyElectronicBookList.forEach((eBook) => {
                 eBook.content.forEach((eBookItem) => {
@@ -441,9 +494,7 @@
   //楂樼骇鍒嗙被閫夋嫨
   onChangeIcon(e) {
     this.setData({
-      assortCheck: {
-        code: e.detail.value,
-      },
+      'assortCheck.code': e.detail.value,
       stairCode: '',
       secondCode: '',
       path: `${e.detail.value}`,
@@ -455,9 +506,9 @@
   },
   // 涓�绾у垎绫诲垏鎹�
   onChangeStair(e) {
-    const path = e.detail.value.length
-      ? `${this.data.assortCheck.code}\\${e.detail.value}`
-      : this.data.assortCheck.code;
+    const path = e.detail.value.length ?
+      `${this.data.assortCheck.code}\\${e.detail.value}` :
+      this.data.assortCheck.code;
     this.setData({
       pathList: [],
       stairCode: e.detail.value,
@@ -546,7 +597,6 @@
   },
   // 鎼滅储鍥句功
   searchBook(e) {
-    console.log(e.detail.value);
     this.setData({
       searchValue: e.detail.value,
     });
@@ -554,7 +604,9 @@
   },
   // 璺宠浆鍥句功璇︽儏
   goDetail(e) {
-    const { book } = e.currentTarget.dataset;
+    const {
+      book
+    } = e.currentTarget.dataset;
     wx.navigateTo({
       url: `/packageBookService/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`,
     });
@@ -572,13 +624,15 @@
       }
     }
     app.MG.ugc.getTopicMessageList(data).then((res) => {
+      let list = [];
       res.datas.map((item) => {
         if (item.content) {
           item.content = JSON.parse(item.content)
         }
+        list.push(item)
       })
       this.setData({
-        alreadyPaperBookList: res.datas,
+        alreadyPaperBookList: list,
       });
     })
   },
@@ -596,27 +650,32 @@
     }
     app.MG.ugc.getTopicMessageList(data).then((res) => {
       let list = []
-      res.datas.map((item) => {
-        if (item.feedBack) {
-          item.feedBack = JSON.parse(item.feedBack)
-          if (item.feedBack.endDate) {
-            let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime()
-            let currentDate = new Date().getTime()
-            if (times < currentDate) {
-              item.isExpiry = true
+      if (res.datas.length > 0) {
+        res.datas.map((item) => {
+          if (item.feedBack) {
+            item.feedBack = JSON.parse(item.feedBack)
+            if (item.feedBack.endDate) {
+              let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime()
+              let currentDate = new Date().getTime()
+              if (times < currentDate) {
+                item.isExpiry = true
+              }
             }
           }
+          if (item.content) {
+            item.content = JSON.parse(item.content)
+          }
+          if (item.state != 'Reject') {
+            list.push(item)
+          }
+        })
+        this.setData({
+          alreadyElectronicBookList: list,
+        });
+        if (wx.getStorageSync(app.config.tokenKey)) {
+          this.getBookList(false);
         }
-        if (item.content) {
-          item.content = JSON.parse(item.content)
-        }
-        if (item.state != 'Reject') {
-          list.push(item)
-        }
-      })
-      this.setData({
-        alreadyElectronicBookList: list,
-      });
+      }
     })
   },
 
@@ -671,186 +730,140 @@
   //绾歌川鏍蜂功
   onChangePaper(e) {
     const item = e.currentTarget.dataset.book;
+    const index = this.data.bookList.findIndex(citem => citem.id == item.id)
     let role = this.data.userInfo != null ? this.data.userInfo.role : null
-    if (role) {
-      if (item.paperDisabled) {
-        wx.showToast({
-          title: "璇ユ牱涔﹀凡鐢宠",
-          icon: 'none',
-          duration: 1000,
+    if (role && role == 'Teacher') {
+      // 鏄暀甯�
+      if (e.detail.checked) {
+        // 鐐瑰嚮閫変腑
+        if (this.data.paperBookCount == 0) {
+          wx.showToast({
+            title: "鎮ㄧ殑绾歌川鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒",
+            icon: "none",
+            duration: 1000,
+          })
+          return false;
+        }
+        if (this.data.paperBookList.length >= 2) {
+          wx.showToast({
+            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
+            icon: "none",
+            duration: 1000,
+          })
+          return false;
+        }
+        this.addBookFun(item, "pBook")
+        this.setData({
+          ["bookList[" + index + "].paperChecked"]: e.detail.checked
         })
-        return
-      }
-
-      if (item.paperChecked) {
-        if (this.data.paperBookList.length > 0) {
-          this.data.paperBookList.forEach((obj, index) => {
+      } else {
+        // 鍙栨秷閫変腑
+        let pList = this.data.paperBookList;
+        if (pList.length > 0) {
+          pList.forEach((obj, index) => {
             if (obj.id == item.id) {
-              this.data.paperBookList.splice(index, 1);
+              pList.splice(index, 1);
             }
           })
         }
-        item.paperChecked = false;
-        if (this.data.bookList.length > 0) {
-          this.data.bookList.forEach(i => {
-            if (i.id == item.id) {
-              i.paperChecked = false;
-            }
-          })
-        }
+        this.setData({
+          paperBookList: pList,
+          num: this.data.num - 1,
+          ["bookList[" + index + "].paperChecked"]: e.detail.checked
+        })
+        wx.setStorageSync("paperBookList", JSON.stringify(pList));
         wx.showToast({
           title: "宸蹭粠鏍蜂功鐢宠鍗曠Щ闄�",
           icon: 'none',
           duration: 1000,
-        })
-        wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
-        return
-      }
-      if (role == 'Teacher') {
-        this.getSelectPaperBookCount(item)
-      } else {
-        item.paperChecked = false
-        wx.showModal({
-          title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰�
-          content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹�
-          success: function (res) {
-            if (res.confirm) {
-              wx.navigateTo({
-                url: "/packageDomain/pages/teacherCertification/index",
-              });
-            } else if (res.cancel) {
-              item.paperChecked = false
-            }
-          }
         })
       }
     } else {
-      item.paperChecked = false
-    }
-  },
-  getSelectPaperBookCount(item) {
-    app.MG.app
-      .getTicketResult({
-        ticketRefCodeOrGuid: 'paperSampleBookapplyNum',
-        roleId: this.data.userInfo.roleId
-      })
-      .then((res) => {
-        this.setData({
-          paperBookCount: res.totalCount - res.usedCount
-        })
-        if (!item.paperDisabled) {
-          this.getAlreadyBookList(item, 'pBook')
+      wx.showModal({
+        title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰�
+        content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹�
+        success: function (res) {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: "/packageDomain/pages/teacherCertification/index",
+            });
+          }
         }
       })
+    }
   },
+
   //閫夋嫨鐢靛瓙鏍蜂功
   onChangeElectron(e) {
     const item = e.currentTarget.dataset.book;
-    let role = this.data.userInfo != null ? this.data.userInfo.role : null;
-    if (role) {
-      if (item.electronDisabled) {
-        wx.showToast({
-          title: "璇ユ牱涔﹀凡鐢宠",
-          icon: 'none',
-          duration: 1000,
+    const index = this.data.bookList.findIndex(citem => citem.id == item.id)
+    let role = this.data.userInfo != null ? this.data.userInfo.role : null
+    if (role && role == 'Teacher') {
+      // 鏄暀甯�
+      if (e.detail.checked) {
+        // 鐐瑰嚮閫変腑
+        if (this.data.ebookCount == 0) {
+          wx.showToast({
+            title: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒",
+            icon: "none",
+            duration: 1000,
+          })
+          return false;
+        }
+        if (this.data.electronicBookList.length >= 2) {
+          wx.showToast({
+            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
+            icon: "none",
+            duration: 1000,
+          })
+          return false;
+        }
+        this.addBookFun(item, "eBook")
+        this.setData({
+          ["bookList[" + index + "].electronChecked"]: e.detail.checked
         })
-        return
-      }
-      if (item.electronChecked) {
-        if (this.data.electronicBookList) {
-          this.data.electronicBookList.forEach((obj, index) => {
+      } else {
+        // 鍙栨秷閫変腑
+        let eList = this.data.electronicBookList;
+        if (eList.length > 0) {
+          eList.forEach((obj, index) => {
             if (obj.id == item.id) {
-              this.data.electronicBookList.splice(index, 1);
+              eList.splice(index, 1);
             }
           })
         }
-        if (this.data.bookList.length > 0) {
-          this.data.bookList.forEach(i => {
-            if (i.id == item.id) {
-              i.electronChecked = false;
-            }
-          })
-        }
-        item.electronChecked = false;
+        this.setData({
+          electronicBookList: eList,
+          num: this.data.num - 1,
+          ["bookList[" + index + "].electronChecked"]: e.detail.checked
+        })
+        wx.setStorageSync("electronicBookList", JSON.stringify(eList));
         wx.showToast({
           title: "宸蹭粠鏍蜂功鐢宠鍗曠Щ闄�",
           icon: 'none',
           duration: 1000,
         })
-        wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
-        return
       }
-      if (role == 'Teacher') {
-        //鏈夋棤瀛愬晢鍝侊紝瀛愬晢鍝佹湁鏃犵數瀛愪功鏂囦欢
-        const obj = {
-          path: '*',
-          queryType: 'SubProduct',
-          sort: {
-            type: 'Desc',
-            field: 'CreateDate'
-          },
-          paging: {
-            start: 0,
-            size: 6
-          },
-          mainProductId: item.id,
-          fields: {
-            bookshelf_pdf: [],
-            bookshelf_protectedEpub: [],
+    } else {
+      wx.showModal({
+        title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰�
+        content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹�
+        success: function (res) {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: "/packageDomain/pages/teacherCertification/index",
+            });
           }
         }
-        app.MG.store.getProductList(obj).then((res) => {
-          if (res.datas.length > 0) {
-            if (res.datas[0].bookshelf_pdf || res.datas[0].bookshelf_protectedEpub) {
-              this.getSelectBookCount(item)
-            } else {
-              wx.showToast({
-                title: "鏆傛棤鐢靛瓙涔︽枃浠�,璇疯仈绯荤鐞嗗憳!",
-                icon: 'none',
-                duration: 1000,
-              })
-            }
-          } else {
-            this.getSelectBookCount(item)
-          }
-        })
-      } else {
-        item.electronChecked = false
-        wx.showModal({
-          title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰�
-          content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹�
-          success: function (res) {
-            if (res.confirm) {
-              wx.navigateTo({
-                url: "/packageDomain/pages/teacherCertification/index",
-              });
-            } else if (res.cancel) {
-              item.electronChecked = false
-            }
-          }
-        })
-      }
+      })
     }
   },
-  getSelectBookCount(item) {
-    app.MG.app
-      .getTicketResult({
-        ticketRefCodeOrGuid: 'electronicSampleBookapplyNum',
-        roleId: this.data.userInfo.roleId
-      })
-      .then((res) => {
-        this.setData({
-          ebookCount: res.totalCount - res.usedCount
-        })
-        if (!item.electronDisabled) {
-          this.getAlreadyBookList(item, 'eBook')
-        }
-      })
-  },
 
-  getAlreadyBookList(item, type) {
+  //  娣诲姞鏍蜂功
+  addBookFun(item, type) {
     let itemAttr = null
-    let isHas = false
+    const eList = this.data.electronicBookList;
+    const pList = this.data.paperBookList;
     itemAttr = {
       id: item.id,
       title: item.name || '-',
@@ -863,122 +876,27 @@
       isbn: item.isbn || '-',
       publicationDate: item.publicationDate
     }
-
     if (type == 'eBook') {
-      if (this.data.ebookCount > 0) {
-        const eBookData = this.data.electronicBookList
-        if (eBookData.length == 2) {
-          item.electronChecked = false
-          wx.showToast({
-            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
-            icon: 'none',
-            duration: 1000,
-          })
-          return false
-        }
-        if (eBookData.length > 0) {
-          for (let i = 0; i < eBookData.length; i++) {
-            if (eBookData[i].id == item.id) {
-              isHas = true
-            }
-          }
-          if (!isHas) {
-            wx.showToast({
-              title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~",
-              icon: "none",
-              duration: 1000,
-            })
-            this.setData({
-              electronicBookList: [...this.data.electronicBookList, ...[item]]
-            })
-            wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
-          } else {
-            item.electronChecked = false
-            wx.showToast({
-              title: "璇ヤ功宸插湪娓呭崟鍒楄〃涓�",
-              icon: "none",
-              duration: 1000,
-            })
-          }
-        } else {
-          wx.showToast({
-            title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~",
-            icon: "none",
-            duration: 1000,
-          })
-          this.setData({
-            electronicBookList: [...this.data.electronicBookList, ...[item]]
-          })
-          wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
-        }
-      } else {
-        item.electronChecked = false
-        wx.showToast({
-          title: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒",
-          icon: "none",
-          duration: 1000,
-        })
-      }
+      eList.push(itemAttr)
+      this.setData({
+        electronicBookList: eList,
+      })
+      wx.setStorageSync("electronicBookList", eList);
     } else {
-      if (this.data.paperBookCount > 0) {
-        const pBookData = this.data.paperBookList
-        if (pBookData.length == 2) {
-          item.paperChecked = false
-          wx.showToast({
-            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
-            icon: 'none',
-            duration: 1000,
-          })
-          return false
-        }
-        if (pBookData.length > 0) {
-          for (let i = 0; i < pBookData.length; i++) {
-            if (pBookData[i].id == item.id) {
-              isHas = true
-            }
-          }
-          if (!isHas) {
-            item.paperChecked = true
-            wx.showToast({
-              title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~",
-              icon: 'none',
-              duration: 1000,
-            })
-            this.setData({
-              paperBookList: [...this.data.paperBookList, ...[item]]
-            })
-            wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
-            console.log(this.data.paperBookList, "3")
-          } else {
-            item.paperChecked = false
-            wx.showToast({
-              title: "璇ヤ功宸插湪娓呭崟鍒楄〃涓�",
-              icon: 'none',
-              duration: 1000,
-            })
-          }
-        } else {
-          item.paperChecked = true;
-          wx.showToast({
-            title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~",
-            icon: 'none',
-            duration: 1000,
-          })
-          this.setData({
-            paperBookList: [item]
-          })
-          wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
-          console.log(this.data.paperBookList, "4")
-        }
-      } else {
-        item.paperChecked = false
-        wx.showToast({
-          title: "鎮ㄧ殑绾歌川鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒",
-          icon: 'none',
-          duration: 1000,
-        })
-      }
+      pList.push(itemAttr)
+      this.setData({
+        paperBookList: pList,
+      })
+      wx.setStorageSync("paperBookList", pList);
     }
+    this.setData({
+      num: this.data.num + 1
+    })
+    wx.showToast({
+      title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~",
+      icon: "none",
+      duration: 1000,
+    })
   },
   //鍘绘牱涔︾敵璇峰崟
   goApply() {
@@ -986,6 +904,19 @@
       url: "/packageDomain/pages/sampleBookList/applicationForm/index",
     });
   },
+
+  // 鐩戝惉婊氬姩璺濈
+  onPageScroll(e) {
+    if (e && e.scrollTop >= 1000) {
+      this.setData({
+        isBackTop: true
+      })
+    } else {
+      this.setData({
+        isBackTop: false
+      })
+    }
+  },
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */

--
Gitblit v1.9.1