自动组卷
This commit is contained in:
parent
15cbd9c4be
commit
97405bb73b
|
@ -90,6 +90,12 @@ export const constantRoutes = [
|
||||||
name: 'questionUpload',
|
name: 'questionUpload',
|
||||||
meta: { title: '习题上传', showBread: true }
|
meta: { title: '习题上传', showBread: true }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'groupTestPaper',
|
||||||
|
component: () => import('@/views/classTask/groupTestPaper/index.vue'),
|
||||||
|
name: 'groupTestPaper',
|
||||||
|
meta: { title: '自动组卷', showBread: true }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'aiKolors',
|
path: 'aiKolors',
|
||||||
component: () => import('@/components/ai-kolors/index.vue'),
|
component: () => import('@/components/ai-kolors/index.vue'),
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
<template>
|
||||||
|
<div class="page-testpaper">
|
||||||
|
<div class="page-center">
|
||||||
|
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||||
|
<el-tab-pane label="自主搜题" name="自主搜题" class="prepare-center-zzst">
|
||||||
|
<SearchQuestion :bookobj="courseObj" @addQuizItem="handleClassWorkQuizItemAdd" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<!-- <el-tab-pane label="校本题库" name="校本题库" class="prepare-center-xbtk">
|
||||||
|
<SchoolQuestion />
|
||||||
|
</el-tab-pane> -->
|
||||||
|
<el-tab-pane label="个人题库" name="个人题库" class="prepare-center-grst">
|
||||||
|
<MyQuestion :bookobj="courseObj" @addQuizItem="handleClassWorkQuizItemAdd"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div class="page-right">
|
||||||
|
<p>总{{ classWorkForm.quizlist.length }}题 <span>进入组卷中心</span></p>
|
||||||
|
<div v-for="(item, index) in classWorkForm.worktypeList" :key="index" class="page-right-item">
|
||||||
|
<span>{{ item.key }}: {{ item.value }}题</span> <span @click="handleDeleteQuizItem(item)">删除</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick, defineEmits } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { processList } from '@/hooks/useProcessList'
|
||||||
|
|
||||||
|
import MyQuestion from '@/views/classTask/newClassTaskAssign/myQuestion/index.vue'
|
||||||
|
import SearchQuestion from '@/views/classTask/newClassTaskAssign/searchQuestion/index.vue'
|
||||||
|
|
||||||
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
|
import { sessionStore } from '@/utils/store'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import useClassTaskStore from '@/store/modules/classTask'
|
||||||
|
|
||||||
|
const userStore = useUserStore().user
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter()
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const emits = defineEmits(['getData'])
|
||||||
|
const props = defineProps({
|
||||||
|
currentCourse: Object,
|
||||||
|
})
|
||||||
|
|
||||||
|
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
|
||||||
|
const courseObj = reactive({
|
||||||
|
// 课程相关参数: 教材id,单元id,章节id,课程名称
|
||||||
|
textbookId: '',
|
||||||
|
levelFirstId: '',
|
||||||
|
levelSecondId: '',
|
||||||
|
coursetitle:'',
|
||||||
|
node: null, // 选择的课程节点
|
||||||
|
//
|
||||||
|
})
|
||||||
|
const activeAptTab = ref("自主搜题");
|
||||||
|
let classWorkForm = reactive({
|
||||||
|
id: '',// ,
|
||||||
|
uniquekey: '',// , // 作业唯一标识 作业名称
|
||||||
|
worktype: '',// '习题训练', //作业类型
|
||||||
|
worktypeList: [],// '习题训练', //作业类型
|
||||||
|
title: '',// // 作业说明
|
||||||
|
quizlist: [],// // 作业习题列表内容
|
||||||
|
}); // 需要提交 提交的作业内容
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if(propsQueryCourseObj){
|
||||||
|
if(JSON.parse(propsQueryCourseObj)){
|
||||||
|
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
||||||
|
courseObj.levelFirstId = JSON.parse(propsQueryCourseObj).levelFirstId // 单元
|
||||||
|
courseObj.levelSecondId = JSON.parse(propsQueryCourseObj).levelSecondId // 章节
|
||||||
|
courseObj.coursetitle = JSON.parse(propsQueryCourseObj).coursetitle // (单元/章节) 名称
|
||||||
|
courseObj.node = JSON.parse(propsQueryCourseObj).node; // 保存当前节点
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加作业
|
||||||
|
* @param entpcourseworkid
|
||||||
|
*/
|
||||||
|
const handleClassWorkQuizItemAdd = (row) => {
|
||||||
|
var exist = false;
|
||||||
|
for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||||
|
if (classWorkForm.quizlist[i].id == row.id) {
|
||||||
|
exist = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exist == false) {
|
||||||
|
// getEntpcoursework(entpcourseworkid).then(res => {
|
||||||
|
// //res.data.titletext = res.data.title.replace(/<[^>]+>/g, '');
|
||||||
|
// // 暂时手动新增试题的分数
|
||||||
|
// if(res.data.score == null){
|
||||||
|
// res.data.score = 4;
|
||||||
|
// }
|
||||||
|
// classWorkForm.quizlist.push(res.data);
|
||||||
|
// // 格式化试题
|
||||||
|
// processList(classWorkForm.quizlist);
|
||||||
|
// })
|
||||||
|
|
||||||
|
// TODO 先写死
|
||||||
|
classWorkForm.quizlist.push(row);
|
||||||
|
// 格式化试题
|
||||||
|
processList(classWorkForm.quizlist);
|
||||||
|
|
||||||
|
console.log(classWorkForm.quizlist)
|
||||||
|
// 作业类型分类
|
||||||
|
classWorkForm.quizlist && classWorkForm.quizlist.forEach(item => {
|
||||||
|
if(!classWorkForm.worktypeList.some(i => i.key.includes(item.worktype))){
|
||||||
|
const num = classWorkForm.quizlist.filter(_item => _item.key == item.worktype).length
|
||||||
|
const obj = {
|
||||||
|
key: item.worktype,
|
||||||
|
value: num
|
||||||
|
}
|
||||||
|
classWorkForm.worktypeList.push(obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(classWorkForm.worktypeList)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ElMessage('试题已经存在')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除作业类型试题
|
||||||
|
* @param row
|
||||||
|
*/
|
||||||
|
const handleDeleteQuizItem = (row) => {
|
||||||
|
for (var i=0; i< classWorkForm.worktypeList.length; i++) {
|
||||||
|
if (classWorkForm.worktypeList[i].key == row.key) {
|
||||||
|
classWorkForm.worktypeList.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var j=0; j< classWorkForm.quizlist.length; j++) {
|
||||||
|
if (classWorkForm.quizlist[j].worktype == row.key) {
|
||||||
|
classWorkForm.quizlist.splice(j, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
watch(() => props.currentCourse, (newVal, oldVal) => {
|
||||||
|
|
||||||
|
},{deep:true})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.page-testpaper {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
.page-center{
|
||||||
|
flex: 1;
|
||||||
|
//min-width: calc(100% - 675px);
|
||||||
|
height: 100%;
|
||||||
|
padding: 0 5px;
|
||||||
|
margin: 0 5px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
|
.prepare-center-zzst{
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
.prepare-center-xbtk{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.prepare-center-grst{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-right{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -38,6 +38,7 @@ const items = shallowRef([
|
||||||
// { title: 'AI设计作业', description: '通过AI助手,根据课标、教材、考试等分析结果,智能创建作业。', icon: '#icon-jiqiren_o',type:'danger' },
|
// { title: 'AI设计作业', description: '通过AI助手,根据课标、教材、考试等分析结果,智能创建作业。', icon: '#icon-jiqiren_o',type:'danger' },
|
||||||
{ title: '习题上传', description: '自己上传个人题库。', icon: '#icon-shangchuan',type:'danger' },
|
{ title: '习题上传', description: '自己上传个人题库。', icon: '#icon-shangchuan',type:'danger' },
|
||||||
{ title: '科学实验', description: '学生完成虚拟仿真实验,并提交实验结果。', icon: '#icon-shangchuan',type:'primary' },
|
{ title: '科学实验', description: '学生完成虚拟仿真实验,并提交实验结果。', icon: '#icon-shangchuan',type:'primary' },
|
||||||
|
{ title: '自主组卷', description: '老师自主选择试题组卷。', icon: '#icon-shangchuan',type:'primary' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleClick = (item) => {
|
const handleClick = (item) => {
|
||||||
|
|
|
@ -285,6 +285,10 @@ const handleItemClick = (itemName) => {
|
||||||
router.push({ path: '/model/questionUpload', query: { courseObj: JSON.stringify(courseObj) } });
|
router.push({ path: '/model/questionUpload', query: { courseObj: JSON.stringify(courseObj) } });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(itemName == '自主组卷'){
|
||||||
|
router.push({ path: '/model/groupTestPaper', query: { courseObj: JSON.stringify(courseObj) } });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
currentRow.value.id = 1; // 作业设计
|
currentRow.value.id = 1; // 作业设计
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
<el-table-column align="left" width="100">
|
<el-table-column align="left" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button v-if="props.isHtml2canvas" type="primary" @click="captureScreenshot(scope.row.id)">选取该题</el-button>
|
<el-button v-if="props.isHtml2canvas" type="primary" @click="captureScreenshot(scope.row.id)">选取该题</el-button>
|
||||||
<el-button v-else type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
<el-button v-else type="primary" @click="handleClassWorkQuizAdd(scope.row, scope.row.id)">添加</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -126,7 +126,7 @@ import useUserStore from '@/store/modules/user'
|
||||||
import useClassTaskStore from '@/store/modules/classTask'
|
import useClassTaskStore from '@/store/modules/classTask'
|
||||||
|
|
||||||
// 定义要发送的emit事件
|
// 定义要发送的emit事件
|
||||||
let emit = defineEmits(['addQuiz', 'addQuizImgBs64'])
|
let emit = defineEmits(['addQuiz', 'addQuizImgBs64', "addQuizItem"])
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
const {
|
const {
|
||||||
|
@ -420,11 +420,13 @@ const getPaginationList = async ( page, limit ) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加资源
|
* 添加资源
|
||||||
* @param fromsrc - 试题来源
|
* @param rw - 试题itemINFO
|
||||||
* @param entpcourseworkid
|
* @param entpcourseworkid
|
||||||
*/
|
*/
|
||||||
const handleClassWorkQuizAdd = (fromsrc, entpcourseworkid) => {
|
const handleClassWorkQuizAdd = (row, entpcourseworkid) => {
|
||||||
emit('addQuiz', entpcourseworkid);
|
emit('addQuiz', entpcourseworkid);
|
||||||
|
emit('addQuizItem', row); // TODO 暂时使用,后面修改逻辑---添加到 自主组卷
|
||||||
|
|
||||||
// var exist = false;
|
// var exist = false;
|
||||||
// for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
// for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||||
// if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
// if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
||||||
|
|
Loading…
Reference in New Issue