From 61667174590d9879f16f1bdcb931db0982e64695 Mon Sep 17 00:00:00 2001 From: wangdong <1551135706@qq.com> Date: Thu, 18 Apr 2024 14:41:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 20 +++++++++++--------- pages/store/goodsCate.vue | 27 ++++++++++++++++----------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index ee29581..52ab9fa 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -818,15 +818,17 @@ export default { url: `/pages/course/special_cate` }); } else if (item.link.indexOf('/learning/index') > -1) { - const subject_id = item.link.split('=')[1]; - try { - const { data } = await changeCategory({ subject_id: subject_id}); - uni.switchTab({ - url: item.link - }); - } catch (err) { - console.log(err); - } + uni.navigateTo({ + url: `/pages/store/goodsCate?type=learning&cate=${item.title}` + }) + // try { + // const { data } = await changeCategory({ subject_id: subject_id}); + // uni.switchTab({ + // url: item.link + // }); + // } catch (err) { + // console.log(err); + // } } else { uni.navigateTo({ url: item.link diff --git a/pages/store/goodsCate.vue b/pages/store/goodsCate.vue index 1bb0261..1599a75 100644 --- a/pages/store/goodsCate.vue +++ b/pages/store/goodsCate.vue @@ -7,7 +7,7 @@ {{ item.name }} - + @@ -38,8 +38,10 @@ type: '', }; }, - onLoad(options) { - this.type = options.type; + onLoad({type, cate}) { + this.type = type; + this.bigCate = cate || ''; + console.log(type, cate); if (this.type === 'store') { this.getGoodsCateList(); } else { @@ -59,7 +61,7 @@ children: data.recommend, }, ].concat(data.category_list); - this.bigCate = '特别推荐'; + this.bigCate = this.bigCate || '特别推荐'; console.log(this.goodsCateList); } catch (err) { } }, @@ -74,7 +76,7 @@ children: data.recommend, }, ].concat(data.category_list); - this.bigCate = '特别推荐'; + this.bigCate = this.bigCate || '特别推荐'; console.log(this.goodsCateList); } catch (err) { console.log(err); @@ -95,12 +97,15 @@ case 'learning': try { const { data } = await changeCategory({ subject_id: con.id}); - let pages = getCurrentPages(); - let prevPage = pages[pages.length - 2]; - prevPage.$vm.learningData.exam.name = con.name; - prevPage.$vm.learningData.exam.grade_id = con.grade_id; - prevPage.$vm.learningData.exam.subject_id = con.id; - uni.navigateBack(); + // let pages = getCurrentPages(); + // let prevPage = pages[pages.length - 2]; + // prevPage.$vm.learningData.exam.name = con.name; + // prevPage.$vm.learningData.exam.grade_id = con.grade_id; + // prevPage.$vm.learningData.exam.subject_id = con.id; + // uni.navigateBack(); + uni.switchTab({ + url: '/pages/learning/index', + }); } catch (err) { console.log(err); }