diff --git a/src/renderer/src/store/modules/classTask.js b/src/renderer/src/store/modules/classTask.js index 18b06b0..4fda976 100644 --- a/src/renderer/src/store/modules/classTask.js +++ b/src/renderer/src/store/modules/classTask.js @@ -6,9 +6,34 @@ import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuesti const useClassTaskStore = defineStore('classTask',{ state: () => ({ classListIds: [], - jyCT: [], - jySO: [], - jyYear: [], + entpCourseWorkTypeList: [ + {value: 0, label: "不限"}, + {value: 1, label: "单选题"}, + {value: 2, label: "填空题"}, + {value: 3, label: "多选题"}, + {value: 4, label: "判断题"}, + {value: 5, label: "主观题"}, + {value: 6, label: "复合题"}, + ], // 习题查询条件 - 题型 + entpCourseWorkGroupList: [{ + Key: -1, + Value: '不限', + }, { + Key: 1, + Value: '真题', + }, { + Key: 0, + Value: '非真题', + } + ], // 习题查询条件 - 题源 + entpCourseWorkYearList: [ + {label: '不限', value: '-1'}, + {label: '2024', value: '2024'}, + {label: '2023', value: '2023'}, + {label: '2022', value: '2022'}, + {label: '2021', value: '2021'}, + {label: '2020', value: '2020'}, + ], // 习题查询条件 - 年份 }), actions: { listClassmain(params) { @@ -32,15 +57,12 @@ const useClassTaskStore = defineStore('classTask',{ Promise.all([getJYYear(), getJYSO(education), getJYCT(education)]) .then(results => { console.log('更新第三方题源+题型succ:', results); - this.jyYear = results[0]; - this.jyCT = results[2]; - this.jySO = results[1]; + this.entpCourseWorkYearList = results[0]; + this.entpCourseWorkTypeList = results[2]; + this.entpCourseWorkGroupList = results[1]; }) .catch(error => { console.error('更新第三方题源+题型err:', error); - this.jyYear = []; - this.jySO = []; - this.jyCT = []; }); }, }, diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 94263d1..0496bee 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -294,8 +294,8 @@ import FileUpload from "@/components/FileUpload/index.vue"; import whiteboard from '@/components/whiteboard/whiteboard.vue' import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue' import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue' -import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo" - + +import useClassTaskStore from '@/store/modules/classTask' import {throttle,debounce } from '@/utils/comm' import { useToolState } from '@/store/modules/tool' import useUserStore from '@/store/modules/user' @@ -303,6 +303,11 @@ const userStore = useUserStore().user const { proxy } = getCurrentInstance() const router = useRouter() const toolStore = useToolState() +const { + entpCourseWorkTypeList, + entpCourseWorkGroupList, + entpCourseWorkYearList +} = useClassTaskStore(); const props = defineProps({ bookobj: { @@ -326,39 +331,11 @@ const props = defineProps({ const prevReadMsgDialogRef = ref(null);// 预览框ref const classWorkFormRef = ref(null); -const entpCourseWorkTypeList = ref([ - {value: 0, label: "不限"}, - {value: 1, label: "单选题"}, - {value: 2, label: "填空题"}, - {value: 3, label: "多选题"}, - {value: 4, label: "判断题"}, - {value: 5, label: "主观题"}, - {value: 6, label: "复合题"}, -]); // 习题查询条件 - 题型 - -const entpCourseWorkGroupList = ref([{ - Key: -1, - Value: '不限', -}, { - Key: 1, - Value: '真题', -}, { - Key: 0, - Value: '非真题', -}]); // 习题查询条件 - 题源 const entpCourseWorkPointList = ref([ {label: '不限', value: []}, ]); // 习题查询条件 - 知识点 const knowledgePointProps = ref({value: 'thirdId', label: 'title'}); -const entpCourseWorkYearList =ref([ - {label: '不限', value: '-1'}, - {label: '2024', value: '2024'}, - {label: '2023', value: '2023'}, - {label: '2022', value: '2022'}, - {label: '2021', value: '2021'}, - {label: '2020', value: '2020'}, -]); // 习题查询条件 - 年份 const paginationParams = reactive({ @@ -1006,18 +983,6 @@ const initPageParams = () => { onMounted(async() => { - // 获取当前学科下的试题题型 - const name = userStore.edustage + userStore.edusubject; - const jyCT = await JYApiListCT(name); - if (jyCT.length == 0) { - ElMessage.error('获取题型失败!'); - return; - } - entpCourseWorkTypeList.value = jyCT; - // 获取当前学科下的试题年份 - entpCourseWorkYearList.value = JYApiListOriginYear(); - entpCourseWorkGroupList.value = await JYApiListSO(name); - }) // const refreshData = () => { diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue index c0bb2d6..90f71da 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue @@ -139,7 +139,11 @@ const router = useRouter() const emit = defineEmits(['addQuiz']) const { proxy } = getCurrentInstance() const userStore = useUserStore().user -const classTaskStore = useClassTaskStore(); +const { + entpCourseWorkTypeList, + entpCourseWorkGroupList, + entpCourseWorkYearList +} = useClassTaskStore(); const props = defineProps({ bookobj: { @@ -148,37 +152,7 @@ const props = defineProps({ }, }) - -const entpCourseWorkTypeList = ref([ - {value: 0, label: "不限"}, - {value: 1, label: "单选题"}, - {value: 2, label: "填空题"}, - {value: 3, label: "多选题"}, - {value: 4, label: "判断题"}, - {value: 5, label: "主观题"}, - {value: 6, label: "复合题"}, -]); // 习题查询条件 - 题型 - -const entpCourseWorkGroupList = ref([{ - Key: -1, - Value: '不限', -}, { - Key: 1, - Value: '真题', -}, { - Key: 0, - Value: '非真题', -}]); // 习题查询条件 - 题源 - const knowledgePointProps = ref({value: 'thirdId', label: 'title'}); -const entpCourseWorkYearList =ref([ - {label: '不限', value: '-1'}, - {label: '2024', value: '2024'}, - {label: '2023', value: '2023'}, - {label: '2022', value: '2022'}, - {label: '2021', value: '2021'}, - {label: '2020', value: '2020'}, -]); // 习题查询条件 - 年份 // 习题查询参数条件 @@ -224,16 +198,6 @@ const dlgImportSingle = reactive({ }) onMounted(() => { - if (classTaskStore.jyCT.length>0) { - entpCourseWorkTypeList.value = classTaskStore.jyCT; - } - if (classTaskStore.jySO.length>0) { - entpCourseWorkGroupList.value = classTaskStore.jySO; - } - if (classTaskStore.jyYear.length>0) { - entpCourseWorkYearList.value = classTaskStore.jyYear; - } - debounceQueryData(); // 查询习题列表 }) /** 前往习题上传页面 */ diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue index ad1d325..92f804e 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue @@ -417,7 +417,11 @@ import useUserStore from '@/store/modules/user' import useClassTaskStore from '@/store/modules/classTask' const userStore = useUserStore().user -const classTaskStore = useClassTaskStore(); +const { + entpCourseWorkTypeList, + entpCourseWorkGroupList, + entpCourseWorkYearList +} = useClassTaskStore(); const { proxy } = getCurrentInstance() // 定义要发送的emit事件 @@ -619,15 +623,15 @@ onMounted(() => { }; // 更新第三方题型、题源 - if (classTaskStore.jyCT.length>0) { + if (entpCourseWorkTypeList.length>0) { const flagDict = ['单选题', '多选题', '判断题', '填空题']; - fromOptions.type = classTaskStore.jyCT.filter(item => flagDict.includes(item.label)); + fromOptions.type = entpCourseWorkTypeList.filter(item => flagDict.includes(item.label)); } - if (classTaskStore.jySO.length>0) { - fromOptions.flag = classTaskStore.jySO; + if (entpCourseWorkGroupList.length>0) { + fromOptions.flag = entpCourseWorkGroupList; } - // if (classTaskStore.jyYear.length>0) { - // yearList.value = classTaskStore.jyYear; + // if (entpCourseWorkYearList.length>0) { + // yearList.value = entpCourseWorkYearList; // } }) diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue index 2921ae7..b24c080 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue @@ -125,7 +125,11 @@ import useClassTaskStore from '@/store/modules/classTask' const emit = defineEmits(['addQuiz']) const { proxy } = getCurrentInstance() const userStore = useUserStore().user -const classTaskStore = useClassTaskStore(); +const { + entpCourseWorkTypeList, + entpCourseWorkGroupList, + entpCourseWorkYearList +} = useClassTaskStore(); const props = defineProps({ bookobj: { @@ -134,41 +138,11 @@ const props = defineProps({ }, }) - -const entpCourseWorkTypeList = ref([ - {value: 0, label: "不限"}, - {value: 1, label: "单选题"}, - {value: 2, label: "填空题"}, - {value: 3, label: "多选题"}, - {value: 4, label: "判断题"}, - {value: 5, label: "主观题"}, - {value: 6, label: "复合题"}, -]); // 习题查询条件 - 题型 - -const entpCourseWorkGroupList = ref([{ - Key: -1, - Value: '不限', -}, { - Key: 1, - Value: '真题', -}, { - Key: 0, - Value: '非真题', -}]); // 习题查询条件 - 题源 - const entpCourseWorkPointList = ref([ {label: '不限', value: []}, ]); // 习题查询条件 - 知识点 const knowledgePointProps = ref({value: 'thirdId', label: 'title'}); //const knowledgePointProps = ref({value: 'thirdId', label: 'knowTitle'}); -const entpCourseWorkYearList =ref([ - {label: '不限', value: '-1'}, - {label: '2024', value: '2024'}, - {label: '2023', value: '2023'}, - {label: '2022', value: '2022'}, - {label: '2021', value: '2021'}, - {label: '2020', value: '2020'}, -]); // 习题查询条件 - 年份 // 习题查询参数条件 @@ -209,16 +183,6 @@ const workResource = reactive({ }); // 作业资源 onMounted(() => { - if (classTaskStore.jyCT.length>0) { - entpCourseWorkTypeList.value = classTaskStore.jyCT; - } - if (classTaskStore.jySO.length>0) { - entpCourseWorkGroupList.value = classTaskStore.jySO; - } - if (classTaskStore.jyYear.length>0) { - entpCourseWorkYearList.value = classTaskStore.jyYear; - } - debounceQueryData(); // 查询习题列表 })