diff --git a/src/renderer/src/api/education/entpCourseWork.js b/src/renderer/src/api/education/entpCourseWork.js index 0ba694c..04582ba 100644 --- a/src/renderer/src/api/education/entpCourseWork.js +++ b/src/renderer/src/api/education/entpCourseWork.js @@ -108,4 +108,21 @@ export function pyOCRAPI(path) { imageBas64: path, } }) +} + + +/** + * @desc: 菁优网转发 + * @return: {*} + * @param {*} url + * @param {*} config + */ +export function getJYPath(url,config) { + config.params = config.params?config.params:{} + config.params["getjypath"] = url; + return request({ + url: "/jy/proxy", + method: config.method||"get", + params: config.params + }) } \ 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..4fda976 100644 --- a/src/renderer/src/store/modules/classTask.js +++ b/src/renderer/src/store/modules/classTask.js @@ -1,16 +1,46 @@ import { defineStore } from 'pinia' import { } from '@/api/classTask/index.js' import { listClassmain } from '@/api/classManage/index' +import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo" const useClassTaskStore = defineStore('classTask',{ state: () => ({ classListIds: [], + 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) { // 获取班级列表 return new Promise((resolve, reject) => { - listClassmain(params) + const education = params.edustage + params.edusubject; + listClassmain(education) .then((res) => { this.classListIds = res.rows&&res.rows.map((item) => item.id) resolve(res) @@ -20,9 +50,58 @@ const useClassTaskStore = defineStore('classTask',{ }) }) }, + + // 根据学科和学段获取菁优网对应得年份、题源、题型 + initJYInfo(params){ + const education = params.edustage + params.edusubject; + Promise.all([getJYYear(), getJYSO(education), getJYCT(education)]) + .then(results => { + console.log('更新第三方题源+题型succ:', results); + this.entpCourseWorkYearList = results[0]; + this.entpCourseWorkTypeList = results[2]; + this.entpCourseWorkGroupList = results[1]; + }) + .catch(error => { + console.error('更新第三方题源+题型err:', error); + }); + }, }, persist: true }) export default useClassTaskStore +const getJYYear = () => { + return new Promise((resolve, reject) => { + JYApiListOriginYear() + .then((res) => { + resolve(res) + }) + .catch((error) => { + reject(error) + }) + }) +} +const getJYSO = (params) => { + return new Promise((resolve, reject) => { + JYApiListSO(params) + .then((res) => { + resolve(res) + }) + .catch((error) => { + reject(error) + }) + }) +} + +const getJYCT = (params) => { + return new Promise((resolve, reject) => { + JYApiListCT(params) + .then((res) => { + resolve(res) + }) + .catch((error) => { + reject(error) + }) + }) +} \ No newline at end of file diff --git a/src/renderer/src/utils/examQuestion/jyeoo.js b/src/renderer/src/utils/examQuestion/jyeoo.js index 8fb0a67..2371efb 100644 --- a/src/renderer/src/utils/examQuestion/jyeoo.js +++ b/src/renderer/src/utils/examQuestion/jyeoo.js @@ -1,3 +1,5 @@ +import { getJYPath } from "@/api/education/entpcoursework"; + const JY_TOKEN = 'CA82641DA86072DEFD39E287335E035FDA6AEEC0549B58F54F4408734C8683FFAF0585CFA3B25091E588A03A65C66A80F5FF613F539D600954007A35DFFBFDC3C7BB982771C5E13F0918642CFD7596CE3718F06E5579238D92EC809AC6F4C82A9FE4B0E232A67DD3594D4DAC1C219CCBC4A7A093344446107EB11DC317526D0594249DEBBD82B740C794CF5A7065E1982B7779AF16AD25D7'; const JY_SUBJECT = [ {id: 10, subject: 'math3', name: '小学数学'}, @@ -26,8 +28,31 @@ const JY_SUBJECT = [ {id: 39, subject: 'history2', name: '高中历史'}, ]; +/** + * @desc: 获取年份 + * @return: {*} + */ +export const JYApiListOriginYear = async () => { + const arrYear = [{label: '不限', value: '-1'}]; + let i = 0; + for( ; i < 5; i++) { + const year = new Date().getFullYear(); + const s ={ + label: `${year - i}`, + value: `${year - i}`, + } + arrYear.push(s); + }; + //arrYear.push({label: '更早', value: '0'}) + return arrYear; +} -export const JYApiListCT = async (_this, name = '高中历史') => { +/** + * @desc: 根据学科+学段获取菁优网-题型 + * @return: {*} + * @param {*} name 学科+学科 + */ +export const JYApiListCT = async (name = '高中历史') => { if (name === '初中政治') { name = '初中道德与法治'; } @@ -35,7 +60,8 @@ export const JYApiListCT = async (_this, name = '高中历史') => { if(obj.length < 1) { return []; } - const res = await _this.$requestGetJYW(`/${obj[0].subject}/common`, { + getJYPath + const res = await getJYPath(`/${obj[0].subject}/common`, { headers: { authorization: `Token ${JY_TOKEN}` }, @@ -63,22 +89,13 @@ export const JYApiListCT = async (_this, name = '高中历史') => { return arrCT; } -export const JYApiListOriginYear = () => { - const arrYear = [{label: '不限', value: '-1'}]; - let i = 0; - for( ; i < 10; i++) { - const year = new Date().getFullYear(); - const s ={ - label: `${year - i}`, - value: `${year - i}`, - } - arrYear.push(s); - }; - //arrYear.push({label: '更早', value: '0'}) - return arrYear; -} -export const JYApiListSO = async (_this, name = '高中历史') => { +/** + * @desc: 根据学科+学段获取菁优网-题源 + * @return: {*} + * @param {*} name 学科+学科 + */ +export const JYApiListSO = async (name = '高中历史') => { if (name === '初中政治') { name = '初中道德与法治'; } @@ -87,7 +104,7 @@ export const JYApiListSO = async (_this, name = '高中历史') => { if(obj.length < 1) { return []; } - const res = await _this.$requestGetJYW(`/${obj[0].subject}/common`, { + const res = await getJYPath(`/${obj[0].subject}/common`, { headers: { authorization: `Token ${JY_TOKEN}` }, @@ -103,8 +120,12 @@ export const JYApiListSO = async (_this, name = '高中历史') => { } - -export const JYApiListPoint = async (_this, name = '高中历史') => { +/** + * @desc: 根据学科+学段获取菁优网-知识点 + * @return: {*} + * @param {*} name 学科+学科 + */ +export const JYApiListPoint = async (name = '高中历史') => { if (name === '初中政治') { name = '初中道德与法治'; } @@ -113,7 +134,7 @@ export const JYApiListPoint = async (_this, name = '高中历史') => { if(obj.length < 1) { return []; } - const res = await _this.$requestGetJYW(`/${obj[0].subject}/point`, { + const res = await getJYPath(`/${obj[0].subject}/point`, { headers: { authorization: `Token ${JY_TOKEN}` }, @@ -126,10 +147,12 @@ export const JYApiListPoint = async (_this, name = '高中历史') => { /** - * @desc: 获取菁优网的版本内容 + * @desc: 根据查询条件获取菁优网-教材版本 * @return: {*} + * @param {*} query {} + * @param {*} hasPoints */ -export const JYApiListVersion = async (_this, query, hasPoints=true) => { +export const JYApiListVersion = async (query, hasPoints=true) => { const listVersion = { status: 0, msg: '', @@ -148,7 +171,7 @@ export const JYApiListVersion = async (_this, query, hasPoints=true) => { listVersion.msg = `[${name}]未找到对应菁优网教材版本, 请检查学段或学科是否匹配!`; return listVersion; } - const JYBook = await _this.$requestGetJYW(`/${result[0].subject}/book2`, { + const JYBook = await getJYPath(`/${result[0].subject}/book2`, { headers: { // JYToken仅占位, 实际后续已未使用该token authorization: `Token ${JY_TOKEN}` diff --git a/src/renderer/src/views/classTask/classTaskAssign.vue b/src/renderer/src/views/classTask/classTaskAssign.vue index 590a230..ba69513 100644 --- a/src/renderer/src/views/classTask/classTaskAssign.vue +++ b/src/renderer/src/views/classTask/classTaskAssign.vue @@ -416,6 +416,7 @@ const queryPushRecords = (row) => { // 获取已推送历史 console.log(row,'查看该行推送历史') pushRecordsOpen.value = true; + pushRecordsList.value = []; pushRecordsLoading.value = true; homeworklist({ entpcourseid: entpcourseid.value, @@ -875,21 +876,6 @@ watch(() => courseObj.node, (newVal,oldVal) => { - -