|
|
@@ -158,7 +158,8 @@ const classOutlineData = ref([])
|
|
|
|
|
|
const fetchCtTypes = async () => {
|
|
|
try {
|
|
|
- const response = await ClassList()
|
|
|
+ const response = await ClassList()
|
|
|
+
|
|
|
if (response.code === 0) {
|
|
|
classData.value = response.data
|
|
|
// 获取到数据,将第一个选项的值作为默认选中值
|
|
|
@@ -171,6 +172,25 @@ const fetchCtTypes = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 添加 watch 监听 selectedGrade 的变化
|
|
|
+watch(selectedGrade, newValue => {
|
|
|
+ // 根据 id 切换高年级或低年级
|
|
|
+ const selectedItem = classData.value.find(item => item.ctType === newValue)
|
|
|
+ if (selectedItem) {
|
|
|
+ if (selectedItem.id === 1) {
|
|
|
+ selectedGrade.value = '小学低年级'
|
|
|
+ } else if (selectedItem.id === 3) {
|
|
|
+ selectedGrade.value = '小学高年级'
|
|
|
+ }
|
|
|
+ // 调用获取教学大纲函数并传入年级id
|
|
|
+ ClassOutline(selectedItem.id).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ classOutlineData.value = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
// 添加获取课程标题
|
|
|
const getCourseTitle = index => {
|
|
|
if (
|