zouyf_dev #195

Merged
zouyf merged 4 commits from zouyf_dev into main 2024-12-30 16:42:16 +08:00
6 changed files with 150 additions and 79 deletions

View File

@ -2,6 +2,8 @@ import { defineStore } from 'pinia'
import { } from '@/api/classTask/index.js' import { } from '@/api/classTask/index.js'
import { listClassmain } from '@/api/classManage/index' import { listClassmain } from '@/api/classManage/index'
import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo" import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo"
import { listEvaluation } from '@/api/subject'
import { getBindlist, listKnowlegepointFormat } from '@/api/education/knowledgePoint'
const useClassTaskStore = defineStore('classTask',{ const useClassTaskStore = defineStore('classTask',{
state: () => ({ state: () => ({
@ -38,6 +40,7 @@ const useClassTaskStore = defineStore('classTask',{
{label: '2021', value: '2021'}, {label: '2021', value: '2021'},
{label: '2020', value: '2020'}, {label: '2020', value: '2020'},
], // 习题查询条件 - 年份 ], // 习题查询条件 - 年份
entpCourseWorkPointList: [], // 习题查询条件 - 知识点
}), }),
actions: { actions: {
listClassmain(params) { listClassmain(params) {
@ -69,6 +72,36 @@ const useClassTaskStore = defineStore('classTask',{
console.error('更新第三方题源+题型err:', error); console.error('更新第三方题源+题型err:', error);
}); });
}, },
// 根据学科和学段获取知识点
initJYPoint(params) {
/**
* 格式化知识点: 分两种情况
* 1. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点)
* 2. 其他: 获取当前章节下的所有知识点
*/
this.entpCourseWorkPointList = [];
let id = params.levelSecondId!='' ? params.levelSecondId : params.levelFirstId;
if( params.edusubject == '语文' || params.edusubject == '英语'){
id = params.textbookId;
listEvaluation({ edusubject: params.edusubject, edustage: params.edustage, itemkey: "subject", pageSize: 10 }).then((res => {
id = res.rows[0]?.id;
if (id) {
listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,}).then(res => {
this.entpCourseWorkPointList = formatKnowledgePoint(res.rows);
console.log('1.entpCourseWorkPointList->', this.entpCourseWorkPointList);
});
}
}))
}else{
getBindlist({ eid: id }).then(res => {
if (res.data && res.data.length > 0) {
this.entpCourseWorkPointList = res.data;
console.log('2.entpCourseWorkPointList->', this.entpCourseWorkPointList);
}
})
}
},
}, },
persist: true persist: true
}) })
@ -108,4 +141,21 @@ const getJYCT = (params) => {
reject(error) reject(error)
}) })
}) })
} }
/**
* @desc: 遍历原知识点数据, 将title字段转为knowTitle以供knowledgePointProps进行tree的格式转换显示
* @return: {*}
* @param {*} list
*/
const formatKnowledgePoint = (list) => {
list.forEach(item => {
if (item.title && item.title != '') {
item.knowTitle = item.title;
}
if (item.children && Array.isArray(item.children)) {
formatKnowledgePoint(item.children);
}
});
return list;
};

View File

@ -17,6 +17,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4" :offset="2">
<el-button v-if="!props.isHtml2canvas" type="primary" @click="goToQuestUpload()">添加习题</el-button>
</el-col>
</el-row>
<!-- 习题筛选2 -->
<el-row style="width: 100%; height: 50px;">
<el-col :span="7"> <el-col :span="7">
<el-form-item label="年份" label-width="70"> <el-form-item label="年份" label-width="70">
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择"> <el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择">
@ -24,9 +31,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<!-- 习题筛选2 -->
<el-row style="width: 100%; height: 50px;">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="关键词" label-width="70"> <el-form-item label="关键词" label-width="70">
<el-input <el-input
@ -39,9 +43,6 @@
<el-col :span="5"> <el-col :span="5">
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> </el-button> <el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> </el-button>
</el-col> </el-col>
<el-col :span="5">
<el-button v-if="!props.isHtml2canvas" type="primary" @click="goToQuestUpload()">添加习题</el-button>
</el-col>
</el-row> </el-row>
<!-- 习题表格 --> <!-- 习题表格 -->
<div class="page-table" > <div class="page-table" >

View File

@ -50,7 +50,7 @@
<el-form-item label="知识点" prop="knowledgePointIdArr"> <el-form-item label="知识点" prop="knowledgePointIdArr">
<el-cascader <el-cascader
v-model="questForm.knowledgePointIdArr" v-model="questForm.knowledgePointIdArr"
:options="curKnowledgePointList" :options="entpCourseWorkPointList"
:props="knowledgePointProps" :props="knowledgePointProps"
popper-class="my-popper" popper-class="my-popper"
@change="onchange" @change="onchange"
@ -432,7 +432,8 @@ const userStore = useUserStore().user
const { const {
entpCourseWorkTypeList, entpCourseWorkTypeList,
entpCourseWorkGroupList, entpCourseWorkGroupList,
entpCourseWorkYearList entpCourseWorkYearList,
entpCourseWorkPointList
} = useClassTaskStore(); } = useClassTaskStore();
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -489,9 +490,9 @@ const fromOptions = reactive({
], ],
}); });
// (UpdateForm) // (UpdateForm)
const initKonwPointFlagByUpdateForm = ref(true); //const initKonwPointFlagByUpdateForm = ref(true);
// [] // []
const curKnowledgePointList = ref([]); //const curKnowledgePointList = ref([]);
// //
const questForm = reactive({ const questForm = reactive({
id: 0, id: 0,
@ -1018,41 +1019,41 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{
// [] // []
if (initKonwPointFlagByUpdateForm.value) { // if (initKonwPointFlagByUpdateForm.value) {
// // //
initKonwPointFlagByUpdateForm.value = false; // initKonwPointFlagByUpdateForm.value = false;
lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId; // lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
console.log('lessionid', lessionid.value); // console.log('lessionid', lessionid.value);
// // //
if( props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语' ){ // if( props.bookobj.node.edusubject == '' || props.bookobj.node.edusubject == '' ){
const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 }); // const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 });
const id = res.rows[0]?.id; // const id = res.rows[0]?.id;
if (id) { // if (id) {
const res = await listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,}); // const res = await listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,});
curKnowledgePointList.value = updateKnowledgePoint(res.rows); // curKnowledgePointList.value = formatKnowledgePoint(res.rows);
//console.log('updateKnowledgePoint->', res.rows); // console.log('updateKnowledgePoint->', curKnowledgePointList.value);
} // }
} else { // } else {
const res = await getBindlist({ eid: lessionid.value }) // const res = await getBindlist({ eid: lessionid.value })
if (!res.data || res.data.length < 1) { // if (!res.data || res.data.length < 1) {
ElMessage.warning('当前章节下未绑定知识点,暂不更新该试题知识点!'); // ElMessage.warning('');
curKnowledgePointList.value = []; // curKnowledgePointList.value = [];
} // }
else { // else {
curKnowledgePointList.value = res.data; // curKnowledgePointList.value = res.data;
} // }
} // }
} // }
//item.evalnodeid = '3772b,374112,374233'; //item.evalnodeid = '3772b,374112,374233';
let knowledgePointIdArr = []; let knowledgePointIdArr = [];
const pointArr = item.evalnodeid.split(','); const pointArr = item.evalnodeid.split(',');
if (curKnowledgePointList.value.length > 0 && pointArr.length > 0) { if (entpCourseWorkPointList.length > 0 && pointArr.length > 0) {
pointArr.forEach(element => { pointArr.forEach(element => {
element = element.trim(); element = element.trim();
let point = []; let point = [];
if (getCurKnowledgePointToForm(point, element, curKnowledgePointList.value)) { if (getCurKnowledgePointToForm(point, element, entpCourseWorkPointList)) {
point = point.reverse(); point = point.reverse();
knowledgePointIdArr.push(point); knowledgePointIdArr.push(point);
} }
@ -1747,33 +1748,33 @@ watch([
// props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId // props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId
lessionid.value = props.bookobj.levelSecondId!='' ? props.bookobj.levelSecondId : props.bookobj.levelFirstId; lessionid.value = props.bookobj.levelSecondId!='' ? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
/** // /**
* 格式化知识点: 分两种情 // * :
* 1. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点) // * 1. /: (, )
* 2. 其他: 获取当前章节下的所有知识 // * 2. :
*/ // */
let id = lessionid.value; // let id = lessionid.value;
if( props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语'){ // if( props.bookobj.node.edusubject == '' || props.bookobj.node.edusubject == ''){
id = props.bookobj.node.rootid; // id = props.bookobj.node.rootid;
const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 }); // const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 });
id = res.rows[0]?.id; // id = res.rows[0]?.id;
if (id) { // if (id) {
listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,}).then(res => { // listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,}).then(res => {
//console.log('listKnowlegepointFormat->', res.rows); // //console.log('listKnowlegepointFormat->', res.rows);
curKnowledgePointList.value = formatKnowledgePoint(res.rows); // curKnowledgePointList.value = formatKnowledgePoint(res.rows);
}); // });
} // }
}else{ // }else{
getBindlist({ eid: id }).then(res => { // getBindlist({ eid: id }).then(res => {
if (!res.data || res.data.length < 1) { // if (!res.data || res.data.length < 1) {
ElMessage.warning('当前章节下未绑定知识点,暂不更新该试题知识点!'); // ElMessage.warning('');
curKnowledgePointList.value = []; // curKnowledgePointList.value = [];
} // }
else { // else {
curKnowledgePointList.value = res.data; // curKnowledgePointList.value = res.data;
} // }
}) // })
} // }
}) })

View File

@ -18,9 +18,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="知识点" label-width="70"> <!-- <el-form-item label="知识点" label-width="70">
<el-cascader <el-cascader
disabled :disabled="entpCourseWorkPointList.length==0"
v-model="entpCourseWorkQueryParams.point" v-model="entpCourseWorkQueryParams.point"
clearable clearable
style="width: 100%" style="width: 100%"
@ -31,7 +31,7 @@
collapse-tags collapse-tags
collapse-tags-tooltip collapse-tags-tooltip
/> />
</el-form-item> </el-form-item> -->
</el-col> </el-col>
</el-row> </el-row>
<!-- 习题筛选2 --> <!-- 习题筛选2 -->
@ -132,7 +132,8 @@ const userStore = useUserStore().user
const { const {
entpCourseWorkTypeList, entpCourseWorkTypeList,
entpCourseWorkGroupList, entpCourseWorkGroupList,
entpCourseWorkYearList entpCourseWorkYearList,
entpCourseWorkPointList
} = useClassTaskStore(); } = useClassTaskStore();
const props = defineProps({ const props = defineProps({
@ -146,12 +147,11 @@ const props = defineProps({
}, },
}) })
const entpCourseWorkPointList = ref([ // const entpCourseWorkPointList = ref([
{label: '不限', value: []}, // {label: '', value: []},
]); // - // ]); // -
const knowledgePointProps = ref({value: 'thirdId', label: 'title'}); const knowledgePointProps = reactive({value: 'thirdId', label: 'knowTitle'});
//const knowledgePointProps = ref({value: 'thirdId', label: 'knowTitle'}); //const knowledgePointProps = ref({value: 'thirdId', label: 'title'});
// //
const entpCourseWorkQueryParams = reactive({ const entpCourseWorkQueryParams = reactive({
@ -193,7 +193,7 @@ const workResource = reactive({
onMounted(() => { onMounted(() => {
console.log('entpCourseWorkTypeList', entpCourseWorkTypeList); console.log('entpCourseWorkTypeList', entpCourseWorkTypeList);
// () // ()
getEntpCourseWorkPointList(); //getEntpCourseWorkPointList();
debounceQueryData(); // debounceQueryData(); //
}) })
@ -258,7 +258,7 @@ const t = function(name, time) {
// //
yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'', yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'',
// //
thirdId: entpCourseWorkQueryParams.point&&entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'', thirdId: entpCourseWorkQueryParams.point&&entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[entpCourseWorkQueryParams.point.length-1]:'',
// //
keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'', keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'',
@ -351,6 +351,7 @@ const handleQueryFromEntpCourseWork= async (queryType) => {
} }
/** /**
* 注意: 该方法已不再使用, 具体知识点初始化方法查看 useClassTaskStore - 241230
* 3知识点 * 3知识点
*/ */
const getEntpCourseWorkPointList = async () => { const getEntpCourseWorkPointList = async () => {

View File

@ -451,6 +451,14 @@ const changeBook = async(data) => {
}).then((res) => { }).then((res) => {
currentFileList.value = [...res.rows] currentFileList.value = [...res.rows]
}) })
//
const pointParams = {
...uploadData.value,
edustage: data.node.edustage,
edusubject: data.node.edusubject,
}
await classTaskStore.initJYPoint(pointParams);
} }
const onchange = (item) => { const onchange = (item) => {
let path = item.path let path = item.path

View File

@ -209,10 +209,12 @@ import * as commUtils from "@/utils/comm";
import msgUtils from "@/plugins/modal"; import msgUtils from "@/plugins/modal";
import * as Api_server from "@/api/apiService"; import * as Api_server from "@/api/apiService";
import * as API_entpcoursefile from "@/api/education/entpcoursefile"; import * as API_entpcoursefile from "@/api/education/entpcoursefile";
import useClassTaskStore from '@/store/modules/classTask'
import { slidesToImg } from '@/utils/ppt' // ppt import { slidesToImg } from '@/utils/ppt' // ppt
import ChatWs from '@/plugins/socket' // socket import ChatWs from '@/plugins/socket' // socket
if (!ChatWs.ws) ChatWs.init() if (!ChatWs.ws) ChatWs.init()
const classTaskStore = useClassTaskStore();
const toolStore = useToolState() const toolStore = useToolState()
const fs = require('fs') const fs = require('fs')
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
@ -992,8 +994,8 @@ export default {
let cata = parseCataByNode(data.node) let cata = parseCataByNode(data.node)
this.currentNode = data.node this.currentNode = data.node
this.uploadData.levelFirstId = cata[0] this.uploadData.levelFirstId = cata[0]
this.uploadData.levelSecondId = cata[1] this.uploadData.levelSecondId = cata[1] ?? ''
this.uploadData.levelThirdId = cata[2] this.uploadData.levelThirdId = cata[2] ?? ''
this.uploadData.textbookId = data.textBook.curBookId this.uploadData.textbookId = data.textBook.curBookId
toolStore.curSubjectNode.querySearch = this.uploadData toolStore.curSubjectNode.querySearch = this.uploadData
this.initHomeWork() this.initHomeWork()
@ -1003,6 +1005,14 @@ export default {
const res = await listEntpcourse(params) const res = await listEntpcourse(params)
this.entp = res?.rows?.[0] || null this.entp = res?.rows?.[0] || null
sessionStore.set('curr.entp', this.entp) // sessionStore.set('curr.entp', this.entp) //
//
const pointParams = {
...this.uploadData,
edustage: data.node.edustage,
edusubject: data.node.edusubject,
}
await classTaskStore.initJYPoint(pointParams);
}, },
// //
async initHomeWork() { async initHomeWork() {