@@ -52,26 +52,30 @@ const subCategoryList = ref<ICategory[]>([]) // 子级分类列表
|
||||
* 获取分类下的子级分类
|
||||
*/
|
||||
const getSubCategoryList = async () => {
|
||||
let res: any = null
|
||||
switch (subject.value) {
|
||||
case '医学':
|
||||
res = await courseSubjectClassificationApi.getCourseMedicalChildLabels(categoryId.value)
|
||||
break
|
||||
case '心理学':
|
||||
res = await courseSubjectClassificationApi.getCourseSoulChildLabels(categoryId.value)
|
||||
break
|
||||
}
|
||||
if (res && res.code === 0) {
|
||||
if (res.labels && res.labels.length > 0) {
|
||||
subCategoryList.value = res.labels
|
||||
// 默认选中第一个tab
|
||||
tab_category_id.value = res.labels[0].id
|
||||
radio_category_id.value = res.labels[0].children[0] && res.labels[0].children[0].id || 0
|
||||
} else {
|
||||
subCategoryList.value = []
|
||||
tab_category_id.value = 0
|
||||
radio_category_id.value = 0
|
||||
try {
|
||||
let res: any = null
|
||||
switch (subject.value) {
|
||||
case '医学':
|
||||
res = await courseSubjectClassificationApi.getCourseMedicalChildLabels(categoryId.value)
|
||||
break
|
||||
case '心理学':
|
||||
res = await courseSubjectClassificationApi.getCourseSoulChildLabels(categoryId.value)
|
||||
break
|
||||
}
|
||||
if (res && res.code === 0) {
|
||||
if (res.labels && res.labels.length > 0) {
|
||||
subCategoryList.value = res.labels
|
||||
// 默认选中第一个tab
|
||||
tab_category_id.value = res.labels[0].id
|
||||
radio_category_id.value = res.labels[0].children[0] && res.labels[0].children[0].id || 0
|
||||
} else {
|
||||
subCategoryList.value = []
|
||||
tab_category_id.value = 0
|
||||
radio_category_id.value = 0
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取分类下的子级分类失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user