代码提交

feature/v-xuexi
wangdong 9 months ago
parent a0851c6ee2
commit 6166717459
  1. 20
      pages/index/index.vue
  2. 27
      pages/store/goodsCate.vue

@ -818,15 +818,17 @@ export default {
url: `/pages/course/special_cate` url: `/pages/course/special_cate`
}); });
} else if (item.link.indexOf('/learning/index') > -1) { } else if (item.link.indexOf('/learning/index') > -1) {
const subject_id = item.link.split('=')[1]; uni.navigateTo({
try { url: `/pages/store/goodsCate?type=learning&cate=${item.title}`
const { data } = await changeCategory({ subject_id: subject_id}); })
uni.switchTab({ // try {
url: item.link // const { data } = await changeCategory({ subject_id: subject_id});
}); // uni.switchTab({
} catch (err) { // url: item.link
console.log(err); // });
} // } catch (err) {
// console.log(err);
// }
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: item.link url: item.link

@ -7,7 +7,7 @@
{{ item.name }} {{ item.name }}
</view> </view>
</view> </view>
<view v-if="bigCate" class="cate-list-right"> <view v-if="bigCate && goodsCateList.length > 0" class="cate-list-right">
<!-- <view v-for="(item, index) in goodsCateList.filter(item => item.name === bigCate)[0].list" class="small-cate-content"> --> <!-- <view v-for="(item, index) in goodsCateList.filter(item => item.name === bigCate)[0].list" class="small-cate-content"> -->
<view class="small-cate-content"> <view class="small-cate-content">
<!-- <view class="small-cate-title">{{ bigCate }} + {{ item.title }}</view> --> <!-- <view class="small-cate-title">{{ bigCate }} + {{ item.title }}</view> -->
@ -38,8 +38,10 @@
type: '', type: '',
}; };
}, },
onLoad(options) { onLoad({type, cate}) {
this.type = options.type; this.type = type;
this.bigCate = cate || '';
console.log(type, cate);
if (this.type === 'store') { if (this.type === 'store') {
this.getGoodsCateList(); this.getGoodsCateList();
} else { } else {
@ -59,7 +61,7 @@
children: data.recommend, children: data.recommend,
}, },
].concat(data.category_list); ].concat(data.category_list);
this.bigCate = '特别推荐'; this.bigCate = this.bigCate || '特别推荐';
console.log(this.goodsCateList); console.log(this.goodsCateList);
} catch (err) { } } catch (err) { }
}, },
@ -74,7 +76,7 @@
children: data.recommend, children: data.recommend,
}, },
].concat(data.category_list); ].concat(data.category_list);
this.bigCate = '特别推荐'; this.bigCate = this.bigCate || '特别推荐';
console.log(this.goodsCateList); console.log(this.goodsCateList);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
@ -95,12 +97,15 @@
case 'learning': case 'learning':
try { try {
const { data } = await changeCategory({ subject_id: con.id}); const { data } = await changeCategory({ subject_id: con.id});
let pages = getCurrentPages(); // let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; // let prevPage = pages[pages.length - 2];
prevPage.$vm.learningData.exam.name = con.name; // prevPage.$vm.learningData.exam.name = con.name;
prevPage.$vm.learningData.exam.grade_id = con.grade_id; // prevPage.$vm.learningData.exam.grade_id = con.grade_id;
prevPage.$vm.learningData.exam.subject_id = con.id; // prevPage.$vm.learningData.exam.subject_id = con.id;
uni.navigateBack(); // uni.navigateBack();
uni.switchTab({
url: '/pages/learning/index',
});
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }

Loading…
Cancel
Save