diff --git a/src/renderer/src/hooks/useClassTaskWorkQuest.js b/src/renderer/src/hooks/useClassTaskWorkQuest.js new file mode 100644 index 0000000..7837ec2 --- /dev/null +++ b/src/renderer/src/hooks/useClassTaskWorkQuest.js @@ -0,0 +1,86 @@ +import { onMounted, ref, nextTick, watch, reactive, getCurrentInstance, computed } from 'vue'; +import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo"; +import useUserStore from '@/store/modules/user'; +const userStore = useUserStore().user; +import useClassTaskStore from '@/store/modules/classTask.js' + + +export default () => { + const { proxy } = getCurrentInstance(); + const { } = useClassTaskStore(); + + const workTypeList = ref([]); // 习题查询条件 - 题型 + const workGroupList = ref([]); // 习题查询条件 - 题源 + const workYearList = ref([]); // 习题查询条件 - 年份(label: '2024', value: '2024') + const workKeyWord = ref(''); // 习题查询条件 - 关键字 + + + const name = userStore.edustage + userStore.edusubject; // 获取当前学科下的题型 + + // 获取题型列表 + const getWorkTypeList =async() =>{ + const jyCT = await JYApiListCT(proxy, name); + if (jyCT.length == 0) { + // ElMessage.error('获取题型失败!'); + // return; + workTypeList.value = [ + {value: 0, label: "不限"}, + {value: 1, label: "单选题"}, + {value: 2, label: "填空题"}, + {value: 3, label: "多选题"}, + {value: 4, label: "判断题"}, + {value: 5, label: "主观题"}, + {value: 6, label: "复合题"}, + ]; // 习题查询条件 - 题型 + return; + } + workTypeList.value = jyCT; + }; + + // 获取题源列表 + const getWorkGroupList =async() =>{ + const jySO = await JYApiListSO(proxy, name); + if (jySO.length == 0) { + workGroupList.value = [{ + Key: -1, + Value: '不限', + }, { + Key: 1, + Value: '真题', + }, { + Key: 0, + Value: '非真题', + }]; + return; + } + workGroupList.value = jySO; + }; + + //获取年份 + const getWorkYearList =()=> { + const now = new Date(); + const year = now.getFullYear(); //年份 + workYearList.value = []; + const arrYear = [{label: '不限', value: '-1'}]; // 默认添加不限选项 + for(let i = 0; i < 10; i++) { + arrYear.push({label: `${year - i}`, value: `${year - i}`}) + } + workYearList.value = arrYear; + }; + + + const inits= () => { + getWorkTypeList(); + getWorkGroupList(); + getWorkYearList(); + }; + + + return { + workTypeList, + workGroupList, + workYearList, + workKeyWord, + inits, + } +} \ No newline at end of file diff --git a/src/renderer/src/store/modules/classTask.js b/src/renderer/src/store/modules/classTask.js index f0008cf..6ee57aa 100644 --- a/src/renderer/src/store/modules/classTask.js +++ b/src/renderer/src/store/modules/classTask.js @@ -5,6 +5,8 @@ import { listClassmain } from '@/api/classManage/index' const useClassTaskStore = defineStore('classTask',{ state: () => ({ classListIds: [], + jyCT: [],// 青优网题型列表 + }), actions: { listClassmain(params) { diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue index 27be20e..ff664ff 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue @@ -5,7 +5,7 @@ - + @@ -13,14 +13,14 @@ - + - + @@ -125,12 +125,22 @@ import { delEntpcoursework, updateEntpcoursework } from "@/api/education/entpCou import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue' import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue"; import { useHandleData } from "@/hooks/useHandleData"; -import { processList } from '@/hooks/useProcessList' +import { processList } from '@/hooks/useProcessList'; +import useClassTaskWorkQuest from '@/hooks/useClassTaskWorkQuest'; + import { debounce } from '@/utils/comm' import useUserStore from '@/store/modules/user' const router = useRouter() +const { + workTypeList, + workGroupList, + workYearList, + workKeyWord, + inits, +} = useClassTaskWorkQuest(); + // 定义要发送的emit事件 const emit = defineEmits(['addQuiz']) const { proxy } = getCurrentInstance() @@ -218,9 +228,10 @@ const dlgImportSingle = reactive({ }) onMounted(() => { + inits(); debounceQueryData(); // 查询习题列表 }) - +/** 前往习题上传页面 */ const goToQuestUpload = () => { router.push({ path: '/model/questionUpload', query: { courseObj: JSON.stringify(props.bookobj) } }); }