From 1184d73a753101a577ceb67c532c2e249e5d2c15 Mon Sep 17 00:00:00 2001 From: BAKEYi <16298417+bakeyi@user.noreply.gitee.com> Date: Thu, 28 May 2026 13:13:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=84=E4=BB=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E6=8E=92=E5=BA=8F=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/jingxuan/selected-brands.vue | 2 +- pages/jingxuan/selected-skills.vue | 2 +- pages/search_common/search.vue | 28 +++++++++++++++------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/pages/jingxuan/selected-brands.vue b/pages/jingxuan/selected-brands.vue index 61d6d79..da57cfa 100644 --- a/pages/jingxuan/selected-brands.vue +++ b/pages/jingxuan/selected-brands.vue @@ -109,7 +109,7 @@ export default { selectedSecondIds: [], // 抽屉里选中的分类ID // 额外筛选参数 - orderType: 1, + orderType: 0, // 排序图标资源 iconGreyUp: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/e00ab2ac-bccf-42d8-820c-65727327e279.png', diff --git a/pages/jingxuan/selected-skills.vue b/pages/jingxuan/selected-skills.vue index 681bf30..ade02e6 100644 --- a/pages/jingxuan/selected-skills.vue +++ b/pages/jingxuan/selected-skills.vue @@ -91,7 +91,7 @@ export default { navHeight: 0, // 排序与筛选参数 - orderType: 1, // 1:时间降序, 2:时间升序, 3:浏览量降序, 4:浏览量升序 (默认1) + orderType: 0, // 1:时间降序, 2:时间升序, 3:浏览量降序, 4:浏览量升序 (默认0) linkType: '', // '':全部, 1:平台课程, 2:品牌课程 filterVisible: false, diff --git a/pages/search_common/search.vue b/pages/search_common/search.vue index 667430b..633c3d6 100644 --- a/pages/search_common/search.vue +++ b/pages/search_common/search.vue @@ -23,7 +23,7 @@ - + 发布时间 @@ -114,8 +114,8 @@ export default { limit: 10, hasMore: true, - // 排序参数 1/2发布时间 3/4浏览量 - orderType: 1, + // 排序参数:0代表无排序(全灰),1/2发布时间,3/4浏览量 + orderType: 0, // 排序图标资源 iconGreyUp: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/e00ab2ac-bccf-42d8-820c-65727327e279.png', @@ -162,6 +162,7 @@ export default { this.hasSearched = false; this.page = 1; this.hasMore = true; + this.orderType = 0; // 清除搜索时重置排序 }, // 切换排序 @@ -172,7 +173,7 @@ export default { this.orderType = this.orderType === 3 ? 4 : 3; } - // 如果已经输入了关键词并搜索过,切换排序直接重新加载当前结果 + // 切换排序直接重新加载当前结果 if (this.hasSearched) { this.page = 1; this.hasMore = true; @@ -184,6 +185,9 @@ export default { if (!this.keyword.trim()) { return uni.showToast({ title: '请输入搜索内容', icon: 'none' }); } + + // 每次发起新的关键字搜索时,重置为全灰无排序状态 + this.orderType = 0; this.hasSearched = true; this.page = 1; this.hasMore = true; @@ -197,9 +201,11 @@ export default { let apiUrl = ''; let params = { page: this.page, limit: this.limit }; - // 给支持排序的接口加上排序参数 + // 仅在有排序选择时(orderType !== 0)才传入 order_type 参数 if (['brand', 'skill', 'collection_brand', 'collection_course'].includes(this.searchType)) { - params.order_type = this.orderType; + if (this.orderType !== 0) { + params.order_type = this.orderType; + } } switch (this.searchType) { @@ -231,7 +237,6 @@ export default { if (res.code === 200 && res.data) { const list = res.data.list || []; - // 文档里总数叫 count,不是 total const totalCount = res.data.count || 0; let formattedList = list; @@ -267,7 +272,6 @@ export default { this.resultList = [...this.resultList, ...formattedList]; } - // 根据接口文档返回的 count 来判断是否还有更多 this.hasMore = this.resultList.length < totalCount; } else { @@ -300,7 +304,7 @@ export default {