From aff8d054df4a638f399dc8f15d98c19b9c9aa785 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 29 四月 2025 10:11:25 +0800 Subject: [PATCH] 扫码视频播放 --- pages/bookExhibitionList/index.js | 529 +++++++++++++++++++++++++--------------------------------- 1 files changed, 228 insertions(+), 301 deletions(-) diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js index e3b7d50..865682f 100644 --- a/pages/bookExhibitionList/index.js +++ b/pages/bookExhibitionList/index.js @@ -1,57 +1,52 @@ // pages/bookExhibitionList/index.js -import Toast from 'tdesign-miniprogram/toast/index'; - -const app = getApp() +import Toast from "tdesign-miniprogram/toast/index"; +import watch from "./watch/watch"; +const app = getApp(); Page({ - /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + name: "娴嬭瘯watch", + newPrice: "", loading: true, hidden: true, - totalSize: '', + totalSize: "", start: 0, isMore: null, keynoteDisabled: true, - value: '', - keyword: '', + value: "", + keyword: "", nameSort: null, total: null, page: { start: 0, - size: 16 + size: 16, }, - keynoteValue: null, + keynoteValue: [], filteredItems: [], newValue: null, bookExhibitionList: [], sorter: { - value: 'default', + value: "default", }, product: { - value: '*', + value: "*", options: [{ - value: '*', - label: '鎬诲垎绫�', + value: "*", + label: "鎬诲垎绫�", }, { - value: 'jsek_bFHigherEducation', - //閲嶇偣椤圭洰 - price: 'jsek_higherEducation', - label: '楂樼瓑鏁欒偛', + value: "jsek_bFHigherEducation", + label: "楂樼瓑鏁欒偛", }, { - value: 'jsek_bFVocationalEducation', - //閲嶇偣椤圭洰 - price: 'jsek_vocationalEducation', - label: '鑱屼笟鏁欒偛', + value: "jsek_bFVocationalEducation", + label: "鑱屼笟鏁欒偛", }, { - value: 'jsek_bFTeacherEducation', - //閲嶇偣椤圭洰 - price: 'jsek_teacherEducation', - label: '鏁欏笀鏁欒偛', + value: "jsek_bFTeacherEducation", + label: "鏁欏笀鏁欒偛", }, ], }, @@ -59,368 +54,306 @@ value: [], options: [], }, - navBarHeight: '', - barHeight: '', - windowHeight: '', + navBarHeight: "", + barHeight: "", + windowHeight: "", sorter: { - value: 'timeAsc', + value: "timeAsc", options: [{ - value: 'nameAsc', - label: '鍚嶇О姝e簭', + value: "nameAsc", + label: "鍚嶇О姝e簭", }, { - value: 'nameDesc', - label: '鍚嶇О鍊掑簭', + value: "nameDesc", + label: "鍚嶇О鍊掑簭", }, { - value: 'timeAsc', - label: '鍑虹増鏃堕棿姝e簭', + value: "timeAsc", + label: "鍑虹増鏃堕棿姝e簭", }, { - value: 'timeDesc', - label: '鍑虹増鏃堕棿鍊掑簭', + value: "timeDesc", + label: "鍑虹増鏃堕棿鍊掑簭", }, ], }, + newValue: "", + disbaleProject: true, + disabledSort: false }, - - /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - - console.log(this.data.keynoteDisabled, 'keynoteDisabled'); - // console.log(this.data.filteredItems, 88888); + // this.setData({ + // 'product.value': '*', + // }); const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 - const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + const navBarHeight = + (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� this.setData({ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, - }) - - // 鍗曞垪閫夋嫨鍣ㄩ�夐」 - const singleSelectOptions = this.data.filteredItems.map(item => ({ - label: item.name, - value: item.value, - disabled: false, - })) - - if (this.data.filteredItems = []) { - console.log(11111); - // singleSelectOptions.push({ - // label: '鏆傛棤鏁版嵁', - // value: 'disabled', - // disabled: true, - // }); - } else { - console.log(7889); - } - - - - - - console.log(this.data.bookExhibitionList.length, 'this.data.bookExhibitionList.length'); - // 鏇存柊鏁版嵁 - this.setData({ - 'multipleSelect.options': singleSelectOptions, }); - - - // }, - /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 */ - onReady() { - - }, + onReady() {}, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - this.bookExhibitionGet() - this.keyProjectsGet() - + this.bookExhibitionGet(); + this.keyProjectsGet(this.data.newPrice); }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ - onHide() { - - }, + onHide() {}, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ - onUnload() { - - }, + onUnload() {}, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ - onPullDownRefresh() { - - }, - // onPullDownRefresh() { - // this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫�� - // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 - // }, - + onPullDownRefresh() {}, onScrollToLower() { - console.log(789); - console.log(this.data.bookExhibitionList.length); - console.log(this.data.totalSize); if (this.data.bookExhibitionList.length < this.data.totalSize) { this.setData({ isMore: true, - start: this.data.start + 1 - }) - this.bookExhibitionGet() + start: this.data.start + 1, + }); + this.bookExhibitionGet(); } else { this.setData({ isMore: true, - }) + }); setTimeout(() => { this.setData({ - isMore: false - }) - console.log('300'); - }, 300) + isMore: false, + }); + }, 300); } }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom() { - // console.log(this.data.page.size); - // console.log(this.data.total); if (this.data.page.size >= this.data.total) { - console.log('宸插姞杞藉畬鎵�鏈夋暟鎹�'); Toast({ context: this, - selector: '#t-toast', - message: '娌℃湁鏇村浜�', - direction: 'column', + selector: "#t-toast", + message: "娌℃湁鏇村浜�", + direction: "column", duration: 1000, preventScrollThrough: true, - icon: 'poweroff', + icon: "poweroff", }); } else { // const currentPage = this.data.page.start + 1; // 鑾峰彇褰撳墠椤垫暟骞跺姞1 const newSize = this.data.page.size + 10; // 鍘熸潵鐨勫熀纭�涓婂姞10 this.setData({ // 'page.start': currentPage, - 'page.size': newSize + "page.size": newSize, }); // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 - - - } }, - - /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ - onShareAppMessage() { + onShareAppMessage() {}, + onShareTimeline() {}, - }, // 鍥剧墖鏁版嵁鐨勬帴鍙� bookExhibitionGet(newValue) { - wx.showLoading({ - title: '鍔犺浇涓�...', + this.setData({ + disabledSort: false }) let searchObj = { - 'Name*': this.data.keyword, - '||subtitle*': this.data.keyword - } - // console.log(this.data.keynoteValue); - let sort = {}; - - const sortOptions = { - '*': { - CreateDate: 'Asc' - }, - 'nameAsc': { - Name: 'Asc' - }, - 'nameDesc': { - Name: 'Desc' - }, - 'timeAsc': { - CreateDate: 'Asc' - }, - 'timeDesc': { - CreateDate: 'Desc' - } + "Name*": this.data.keyword, + "||subtitle*": this.data.keyword, }; + let sort = {}; + const sortOptions = { + "*": { + CreateDate: "Asc", + }, + nameAsc: { + Name: "Asc", + }, + nameDesc: { + Name: "Desc", + }, + timeAsc: { + CreateDate: "Asc", + }, + timeDesc: { + CreateDate: "Desc", + }, + }; sort = sortOptions[this.data.product.value] || {}; - - console.log(sort); - - app.MG.store.getProductList({ - storeInfo: 'jsek_bookFair', - path: newValue, - queryType: '*', - fields: { - jsek_link: [], - subtitle: [], - 'bookClassification*': this.data.keynoteValue || [], - ...searchObj - }, - paging: { - start: '0', - size: this.data.start * 10 - }, - sort: sort, - // coverSize: { - // width: 100 - // }, - }).then(res => { - res.datas.forEach((item) => { - if (item.subtitle == undefined) { - item.subtitle = '' + app.MG.store + .getProductList({ + storeInfo: "jsek_bookFair", + path: this.data.newValue, + queryType: "*", + fields: { + jsek_link: [], + subtitle: [], + "bookClassification*": this.data.keynoteValue || [], + ...searchObj, + }, + paging: { + start: "0", + size: this.data.start * 10, + }, + sort: sort, + // coverSize: { + // width: 100 + // }, + }) + .then((res) => { + res.datas.forEach((item) => { + if (item.subtitle == undefined) { + item.subtitle = ""; + } + item.subtitleName = item.subtitle + item.name; + }); + this.data.total = res.total; + if (res.datas.length == 0) { + this.setData({ + disabledSort: true + }) + if (!this.data.keynoteValue.length) { + this.setData({ + disbaleProject: true + }); + } } - item.subtitleName = item.subtitle + item.name - }) - console.log(res, 'item'); - this.data.total = res.total - - // list.push(res.datas) - console.log(res.datas.length); - - - if (res.datas.length == 0) { + const list = [...res.datas]; this.setData({ - keynoteDisabled: true - }) - } - - const list = [...res.datas] - console.log(res); - this.setData({ - bookExhibitionList: list, - totalSize: res.total - }) - // 鍒ゆ柇鏁版嵁闀垮害 - console.log(list.length, 'list.length'); - - - //鍙栨秷 - wx.hideLoading() - // console.log(this.data.bookExhibitionList, '鏁版嵁'); - - this.setData({ - loading: false, - hidden: false, - }) - }) - + bookExhibitionList: list, + totalSize: res.total, + }); + this.setData({ + loading: false, + hidden: false, + }); + }); }, - //閲嶇偣椤圭洰鎺ュ彛 + //鑾峰鎯呭喌鎺ュ彛 keyProjectsGet(newPrice) { - + this.setData({ + filteredItems: [], // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� + }); + //楠ㄦ灦灞� this.setData({ loading: true, hidden: true, - }) - // console.log(newPrice, 'newPrice'); + }); + // 鍙傛暟 let parms = { - refCodes: ['bookClassification'] - } - app.MG.store.getProductTypeField(parms).then(res => { - const checkData = JSON.parse(res[0].config) - checkData.option.forEach(item => { + refCodes: ["bookClassification"], + }; + //璇锋眰鏁版嵁 + app.MG.store.getProductTypeField(parms).then((res) => { + // 鏍煎紡鍖栨暟鎹� + const checkData = JSON.parse(res[0].config); + // 寰幆鐒跺悗鍒ゆ柇鐩稿尮閰嶇殑鏁版嵁璧嬪�肩粰filteredItems + checkData.option.forEach((item) => { if (newPrice == item.value) { this.setData({ - filteredItems: item.child || [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� + filteredItems: item.child || [], // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� }); - // console.log(this.data.filteredItems); } - }) - - this.onLoad(); - + }); + let singleSelectOptions = []; + // 鍗曞垪閫夋嫨鍣ㄩ�夐」 + // 鍗曞垪閫夋嫨鍣ㄩ�夐」 + this.data.filteredItems.forEach((item) => { + singleSelectOptions.push({ + label: item.name, + value: item.value, + }); + }); + if (singleSelectOptions.length === 0) { + singleSelectOptions.push({ + label: "鏆傛棤鏁版嵁", + }); + this.setData({ + disbaleProject: true + }) + } + // 鏇存柊鏁版嵁 + this.setData({ + "multipleSelect.options": singleSelectOptions, + }); + // 鍙栨秷楠ㄦ灦灞� this.setData({ loading: false, hidden: false, - }) - }) + }); + }); + // if (newPrice) { + // this.setData({ + // keynoteDisabled: false + // }) + // } + // if (!newPrice) { + // this.setData({ + // keynoteDisabled: true + // }) + // } }, - - - // 鎬诲垎绫� // 鎬诲垎绫� onChange(e) { - // e.stopImmediatePropagation(); - - - - - - - - - - - this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫�� const newValue = e.detail.value; - const selectedOption = this.data.product.options.find(option => option.value === newValue); - const newPrice = selectedOption ? selectedOption.price : null; - const bookExhibitionListsubsidiary = [] this.setData({ - bookExhibitionListsubsidiary: this.data.bookExhibitionList - }) - console.log(bookExhibitionListsubsidiary, 'bookExhibitionListsubsidiary'); - console.log(newValue, 'newValue'); - console.log(newPrice, 'newPrice'); - - if (newPrice) { - this.setData({ - keynoteDisabled: false - }) - } - if (!newPrice) { - this.setData({ - keynoteDisabled: true - }) - } - console.log(newValue); - this.setData({ - 'product.value': newValue, - 'product.price': newPrice, // 灏嗛�変腑鐨� price 鍊间繚瀛樺湪鏁版嵁涓� + "product.value": newValue, + newValue: newValue, + disbaleProject: false, + loading: true }); - this.bookExhibitionGet(newValue); + let newPrice = ""; + if (newValue == "jsek_bFHigherEducation") { + newPrice = "jsek_higherEducation"; + } else if (newValue == "jsek_bFVocationalEducation") { + newPrice = "jsek_vocationalEducation"; + } else if (newValue == "jsek_bFTeacherEducation") { + newPrice = "jsek_teacherEducation"; + } else { + // 閫夋嫨鎬诲垎绫� + this.setData({ + disbaleProject: true + }) + newPrice = ""; + } this.keyProjectsGet(newPrice); - // 璋冪敤鏇存柊椤甸潰鏁版嵁鐨勫嚱鏁帮紝浼犲叆鏂扮殑 value 鍜� price 鍊� - + this.bookExhibitionGet(newValue); if (this.data.keynoteValue) { //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈� - this.data.keynoteValue = [] - this.bookExhibitionGet(newValue) - this.onLoad() + this.data.keynoteValue = []; + this.bookExhibitionGet(newValue); } - // e.stopImmediatePropagation() - }, - // 閲嶇偣椤圭洰 + // 鑾峰鎯呭喌 handleMultipleSelect(e) { this.setData({ - 'multipleSelect.value': e.detail.value, + "multipleSelect.value": e.detail.value, }); }, handleConfirm(event) { @@ -428,70 +361,64 @@ value } = event.detail; // 纭鎿嶄綔鐨勫鐞嗛�昏緫 - - console.log('纭鎿嶄綔锛岄�変腑鐨勫�间负锛�', value); - this.data.keynoteValue = value - this.bookExhibitionGet() + // this.data.keynoteValue = value + this.setData({ + keynoteValue: value, + loading: true + }); + this.bookExhibitionGet(); }, - handleReset(e) { - // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫 - this.data.keynoteValue = [] - this.bookExhibitionGet() + this.data.keynoteValue = []; + this.bookExhibitionGet(); }, onSwapRight() { if (!this.data.nameSort) { this.setData({ - nameSort: 'Desc', + nameSort: "Desc", }); - } else if (this.data.nameSort == 'Desc') { + } else if (this.data.nameSort == "Desc") { this.setData({ - nameSort: 'Asc', + nameSort: "Asc", }); - } else if (this.data.nameSort == 'Asc') { + } else if (this.data.nameSort == "Asc") { this.setData({ - nameSort: '', + nameSort: "", }); } - this.bookExhibitionGet() - + this.bookExhibitionGet(); }, onSwapLeft() { - this.data.nameSort = 'Desc' - // console.log('sssssss'); - this.bookExhibitionGet() + this.data.nameSort = "Desc"; + this.bookExhibitionGet(); }, onBookExhibitionDetails: function (event) { - console.log(456); const item = event.currentTarget.dataset.item; - console.log(item); wx.navigateTo({ - url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name + '&subtitleName=' + item.subtitleName // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟 + url: "/pages/bookExhibitionDetails/index?id=" + item.id, // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟 }); }, // 鎼滅储妗� onSearchSubmit(e) { this.setData({ - keyword: e.detail.value - }) - console.log(this.data.keyword, 'keyword'); - this.bookExhibitionGet() + keyword: e.detail.value, + }); + + this.bookExhibitionGet(); }, goBack() { wx.navigateBack(); }, onSort(e) { this.setData({ - 'product.value': e.detail.value, + "product.value": e.detail.value, }); - console.log(e.detail.value, 'e.detail.value'); - this.bookExhibitionGet() + + this.bookExhibitionGet(); }, - onOpend() { - console.log(7555); - } -}) \ No newline at end of file + onOpend() {}, +}); \ No newline at end of file -- Gitblit v1.9.1