diff --git a/src/components/Course/courseForm.vue b/src/components/Course/courseForm.vue index 24e910e8..32713ab4 100644 --- a/src/components/Course/courseForm.vue +++ b/src/components/Course/courseForm.vue @@ -919,14 +919,18 @@ export default { this.courseInfo.coverImg = ''; }, //获取字典信息 - getDictIds() { - console.log("--- 获取字典信息 1 = ",this.dicts) - const { result, status } = apiCourse.getDictIds(637,1); - console.log("--- 获取字典信息 2 result= ",result) - if (status === 200) { - console.log("--- 获取字典信息 3 = ",this.dicts) - this.dicts = result.dicts; - console.log("--- 获取字典信息 4 = ",this.dicts) + async getDictIds() { + console.log("--- 获取字典信息 1 = ", this.dicts); + try { + const response = await apiCourse.getDictIds(637, 1); // 确保返回 Promise + console.log("--- 获取字典信息 2 result= ", response); + + if (response.status === 200) { + this.dicts = response.result.dicts; // 正确提取 dicts + console.log("--- 获取字典信息 3 = ", this.dicts); + } + } catch (error) { + console.error("获取字典信息失败:", error); } }, //获取课程信息