From f72f8966ba4e1715e8df82d5cf1c7e912b6da719 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期一, 01 四月 2024 10:21:07 +0800 Subject: [PATCH] 检索的bug --- packageBookService/pages/bookServices/list/index.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 95 insertions(+), 12 deletions(-) diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js index 868752e..f8279a2 100644 --- a/packageBookService/pages/bookServices/list/index.js +++ b/packageBookService/pages/bookServices/list/index.js @@ -32,6 +32,7 @@ secondList: { value: [], options: [], + disabled: false, }, majorProjectList: { value: [], @@ -49,7 +50,14 @@ size: '50rpx' }, loading: false, - noData: false + noData: false, + showDropdown: false, + isRequesting: false, + disabledStair: false, + disabledSecondList: false, + disabledProject: false, + disabledNewForms: false, + triggered: false, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 @@ -131,7 +139,13 @@ * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ onPullDownRefresh() { - console.log('涓嬫媺'); + this.setData({ + triggered: true + }) + this.setData({ + 'pageCount.page': 1 + }) + this.getBookList(this.data.path); }, /** @@ -140,11 +154,13 @@ onReachBottom(e) { const flag = this.data.bookList.length < this.data.pageCount.total if (flag) { - this.setData({ - isMore: true, - "pageCount.page": this.data.pageCount.page + 1 - }) - this.getBookList(this.data.path) + if (!this.data.isRequesting) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.getBookList(this.data.path) + } } else { this.setData({ isMore: true, @@ -167,6 +183,9 @@ }, // 鑾峰彇涓�绾у垪琛� getStairList(path) { + this.setData({ + disabledStair: false + }) const query = { path, filterList: [], @@ -196,6 +215,11 @@ 'stairList.options': options, 'stairList.value': this.data.stairCode, }); + if (!options.length) { + this.setData({ + disabledStair: true + }) + } }); }, // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被 @@ -233,6 +257,10 @@ }, // 鑾峰彇閲嶇偣椤圭洰 getProjectList(type) { + this.setData({ + disabledProject: false, + disabledNewForms: false + }) const options = []; const arr = []; let array = []; @@ -240,7 +268,7 @@ refCodes: [type], }; app.MG.store.getProductTypeField(query).then((res) => { - array = JSON.parse(res[0].config).option; + array = JSON.parse(res[0].config).option.filter(item => item.value == this.data.assortCheck.code); for (let index = 0; index < array.length; index++) { const element = array[index]; if (element.child) { @@ -258,6 +286,11 @@ label: element.name, }); } + if (!options.length) { + this.setData({ + disabledProject: true + }) + } this.setData({ 'majorProjectList.options': options, }); @@ -269,6 +302,11 @@ label: element.name, }); } + if (!options.length) { + this.setData({ + disabledNewForms: true + }) + } this.setData({ 'newTextBook.options': options, }); @@ -278,9 +316,13 @@ }, // 鑾峰彇鍥句功鍒楄〃 getBookList(path) { + if (this.data.isRequesting) { + return false; + } this.setData({ loading: true, - noData: false + noData: false, + isRequesting: true }) let sort; let pathObj = {}; @@ -339,12 +381,30 @@ bookList: res.datas, enable: false, "pageCount.total": res.total, - loading: false + loading: false, + isRequesting: false }); - console.log('鍥句功鍒楄〃', res.datas); if (!res.datas.length) { this.setData({ - noData: true + noData: true, + }) + if (!this.data.pathList.length) { + // 鏈�夋嫨浜岀骇鍒嗙被锛屼笖鏃犲浘涔� + this.setData({ + disabledSecondList: true + }) + } else { + this.setData({ + disabledSecondList: false + }) + } + } + if (this.data.triggered) { + this.setData({ + triggered: false + }) + wx.showToast({ + title: '鍒锋柊鎴愬姛', }) } }); @@ -354,6 +414,7 @@ const path = e.detail.value.length ? `${this.data.assortCheck.code}\\${e.detail.value}` : this.data.assortCheck.code; + console.log(this.data.path); this.setData({ pathList: [], stairCode: e.detail.value, @@ -363,6 +424,16 @@ }); this.getBookList(path); this.getSecondList(path); + if (e.detail.value == '') { + this.setData({ + disabledSecondList: true + }) + } else { + this.setData({ + disabledSecondList: false + }) + } + console.log(this.data.disabledSecondList); }, // 浜岀骇鍒嗙被鍒囨崲 onChangeSecond(e) { @@ -461,4 +532,16 @@ }); this.getBookList(this.data.path) }, + openDropdown() { + console.log('灞曞紑鍝�', ); + this.setData({ + showDropdown: true + }) + }, + closeDropdown() { + console.log('鍏抽棴'); + this.setData({ + showDropdown: false + }) + } }); \ No newline at end of file -- Gitblit v1.9.1