baigl #40
|
@ -0,0 +1,34 @@
|
|||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
|
||||
/**
|
||||
* @description 操作单条数据信息(二次确认【删除、禁用、启用、重置密码】)
|
||||
* @param {Function} api 操作数据接口的api方法(必传)
|
||||
* @param {Object} params 携带的操作数据参数 {id,params}(必传)
|
||||
* @param {String} message 提示信息(必传)
|
||||
* @param {String} confirmType icon类型(不必传,默认为 warning) | "success" | "warning" | "info" | "error"
|
||||
* @return Promise
|
||||
*/
|
||||
|
||||
export const useHandleData = (
|
||||
api,
|
||||
params,
|
||||
message,
|
||||
confirmType= "warning"
|
||||
) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
ElMessageBox.confirm(`是否${message}?`, "温馨提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: confirmType,
|
||||
draggable: true
|
||||
}).then(async () => {
|
||||
const res = await api(params);
|
||||
if (!res) return reject(false);
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: `${message}成功!`
|
||||
});
|
||||
resolve(true);
|
||||
}).catch(() => { });
|
||||
});
|
||||
};
|
|
@ -131,6 +131,12 @@ const dynamicRoutes = [
|
|||
name: 'classTaskAssign',
|
||||
meta: { title: '作业布置', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'newClassTaskAssign',
|
||||
component: () => import('@/views/classTask/newClassTaskAssign/index.vue'),
|
||||
name: 'newClassTaskAssign',
|
||||
meta: { title: '新作业设计', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'classTask',
|
||||
component: () => import('@/views/classTask/classTask.vue'),
|
||||
|
|
|
@ -513,13 +513,6 @@ const handleQueryFromEntpCourseWork= async (queryType) => {
|
|||
|
||||
pageParams.value.loading = true;
|
||||
|
||||
|
||||
// 初中政治特殊处理( warn: 需确认是否修改 )
|
||||
// if (this.courseObj.edusubject=='政治' && this.courseObj.edustage=='初中') {
|
||||
// // [初中+政治]需改为[初中+道德与法治]
|
||||
// queryForm.edusubject = '道德与法治';
|
||||
// }
|
||||
|
||||
client(t('任务1', 1500)).then(res => {
|
||||
//console.log("请求返回",res);
|
||||
// if(paginationParams.pageNum == 1){
|
||||
|
@ -741,10 +734,6 @@ const handleClassWorkSave = async () => {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (classWorkForm.worktype === "课堂展示") {
|
||||
boardLoading.value = true
|
||||
let canvasJson = proxy.$refs.boardref.getCanvasJson()
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<!-- <i v-if="!isCollapse" class="iconfont icon-xiangzuo" style="color: blue;"></i> -->
|
||||
<span>作业设计</span>
|
||||
<!-- <i v-if="isCollapse" class="iconfont icon-xiangyou" style="color: blue;"></i> -->
|
||||
<!-- <el-button type="primary" @click="goToNewClassTaskAssign">新版作业管理</el-button> -->
|
||||
</div>
|
||||
<div v-else class="unit-top-left">
|
||||
<i class="iconfont icon-xiangzuo cursor-pointer" style="color: blue;" @click="goBack">返回上页</i>
|
||||
|
@ -80,6 +81,9 @@ const courseObj = reactive({
|
|||
})
|
||||
// ---------------------------------------------------
|
||||
|
||||
const goToNewClassTaskAssign = () => {
|
||||
router.push({ path: '/newClassTaskAssign', query: { courseObj: JSON.stringify(courseObj)} });
|
||||
}
|
||||
|
||||
// 查询
|
||||
const getData = (data) => {
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<template>
|
||||
<div class="list-container">
|
||||
<div class="content-list" v-for="(item, index) in items" :key="index" @click="handleClick(item)">
|
||||
<div class="item-content">
|
||||
<div class="item-text">
|
||||
<div class="item-title">{{ item.title }}</div>
|
||||
<div class="item-description">{{ item.description }}</div>
|
||||
</div>
|
||||
<el-icon class="item-icon"><component :is="item.icon" /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { shallowRef } from 'vue';
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Plus, ArrowDown, Document, User, Setting } from '@element-plus/icons-vue';
|
||||
|
||||
const emit = defineEmits(['itemClick'])
|
||||
const items = shallowRef([
|
||||
{ title: '自主搜题', description: '1111111', icon: Document },
|
||||
{ title: '校本题库', description: '222222', icon: User },
|
||||
{ title: '个人题库', description: '333333', icon: Setting },
|
||||
{ title: '智能推荐', description: '444444', icon: Plus },
|
||||
{ title: '课堂展示', description: '555555', icon: ArrowDown },
|
||||
{ title: '常规作业', description: '555555', icon: ArrowDown },
|
||||
{ title: 'AI设计作业', description: '555555', icon: ArrowDown },
|
||||
]);
|
||||
|
||||
const handleClick = (item) => {
|
||||
console.log('Clicked on:', item.title);
|
||||
if(item.title === '智能推荐' || item.title === 'AI设计作业') {
|
||||
ElMessage({
|
||||
message: '该作业类型暂未开放!',
|
||||
type: 'warning',
|
||||
})
|
||||
return;
|
||||
}
|
||||
emit('itemClick', item.title)
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.list-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
/* background-color: #f5f5f5; */
|
||||
}
|
||||
|
||||
.content-list {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
padding: 16px;
|
||||
width: calc(33.333% - 32px); /* 3列布局,每列减去gap */
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.content-list:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.item-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
font-size: 24px;
|
||||
color: #409eff;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.item-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.item-description {
|
||||
font-size: 14px;
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,813 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<div class="page-top">
|
||||
<div class="page-top-left">
|
||||
<el-button type="danger" :icon="Delete" @click="handleDelete">删除</el-button>
|
||||
<el-button type="success" @click="handleTaskAssignToAllClass()">批量推送</el-button>
|
||||
</div>
|
||||
<div v-if="currentRow.id > 0" class="page-top-right">
|
||||
<el-button type="primary" @click="handleNewAllClass">设计新作业</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-resource">
|
||||
<div class="page-left">
|
||||
<el-table
|
||||
ref="taskTable"
|
||||
v-loading="loading"
|
||||
:data="taskList"
|
||||
:tree-props="{checkStrictly: true}"
|
||||
row-key="id"
|
||||
style="width: 100%;height: 100%; border: 1px solid #dcdfe6;border-radius: 3px;flex:1"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="2%" align="center" :selectable="selectable"/>
|
||||
<el-table-column label="作业布置" min-width="18%" align="center">
|
||||
<template #default="scope">
|
||||
<div style="height: 100px;">
|
||||
<div class="pageleft-table-top">
|
||||
<span>{{ scope.row.uniquekey }}</span>
|
||||
</div>
|
||||
<div class="pageleft-table-top">
|
||||
<el-tag :type="scope.row.workclass" size="default">{{ scope.row.worktype }}</el-tag>
|
||||
<span>{{ scope.row.timestamp }}</span>
|
||||
</div>
|
||||
<div class="pageleft-table-cont">
|
||||
<p class="ellipsis "> {{ scope.row.worktype == "课堂展示" ? scope.row.worktag : scope.row.title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div v-if="currentRow.id == 0" style="width: 100%; height: 100%;">
|
||||
<!-- 默认的习题类型卡片 -->
|
||||
<Right @itemClick="handleItemClick" />
|
||||
</div>
|
||||
|
||||
<div v-if="(currentRow.worktype == '习题训练' || classWorkForm.worktype == '习题训练') && currentRow.id>0" class="page-center">
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="自主搜题" name="自主搜题" class="prepare-center-zzst">
|
||||
<SearchQuestion :bookobj="courseObj" @addQuiz="handleClassWorkQuizAdd" />
|
||||
</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" @addQuiz="handleClassWorkQuizAdd"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div v-if="(currentRow.worktype == '课堂展示' || classWorkForm.worktype == '课堂展示') && currentRow.id>0" class="page-center">
|
||||
<div v-loading="boardLoading" class="board-wrap" style="height: 100%; flex: 1; overflow: hidden;">
|
||||
<!-- <whiteboard v-if="isShowBoard" ref="boardref" :height="mainHeight - 150" :isShowSave="false" :data="whiteboardObj"/> -->
|
||||
<whiteboard ref="boardref" height=" 100%" :isShowSave="false" :data="classWorkForm.whiteboardObj"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(currentRow.worktype == '常规作业' || classWorkForm.worktype == '常规作业')&& currentRow.id>0" class="page-center">
|
||||
<div v-loading="fileLoading" class="upload-homework">
|
||||
<FileUpload v-model="classWorkForm.fileHomeworkList" :fileSize="800" :fileType="['mp3','mp4','doc','docx','xlsx','xls','pdf','ppt','pptx','jpg','jpeg','gif','png','txt']"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="currentRow.id>0 " class="page-right">
|
||||
<div class="prepare-top" >
|
||||
<el-button v-if="currentRow.id != 1 " type="success" @click="openSet(currentRow,'item')">推 送</el-button>
|
||||
<el-button type="primary" @click="handleClassWorkSave">保 存</el-button>
|
||||
</div>
|
||||
<div class="prepare-con" >
|
||||
<el-form
|
||||
ref="classWorkFormRef"
|
||||
:model="classWorkForm"
|
||||
label-width="90"
|
||||
style=" height: 100%; overflow: hidden;display: flex;flex-direction: column;"
|
||||
>
|
||||
<div >
|
||||
<el-form-item label="作业名称">
|
||||
<el-input v-model="classWorkForm.uniquekey" type="text" placeholder="请输入作业名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作业说明" style="margin: 10px 0;">
|
||||
<el-input v-if="classWorkForm.worktype != '课堂展示'" v-model="classWorkForm.title" style="width: 400px" placeholder="请输入作业说明"/>
|
||||
<!-- 课堂展示 这里字段不一样 -->
|
||||
<el-input v-if="classWorkForm.worktype == '课堂展示'" v-model="classWorkForm.question" type="textarea" placeholder="请输入作业说明" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div v-if="classWorkForm.worktype == '习题训练'" class="pageRight-list">
|
||||
<div :style="{height: '100%', 'overflow': 'auto', 'border':'1px dotted blue','border-radius':'5px', 'background-color': '#f7f7f7'}">
|
||||
<template v-for="(item,index) in classWorkForm.quizlist" :key="item.id">
|
||||
<div style="margin: 5px; background-color: white">
|
||||
<div v-html="item.titleFormat" style="padding: 15px 20px 5px 20px"></div>
|
||||
<div style="display: flex;">
|
||||
<el-form-item label="分值">
|
||||
<el-input-number v-model="item.score" :min="1" :max="100" size="small"></el-input-number >
|
||||
</el-form-item>
|
||||
<div style="margin-left: auto; padding: 0px 20px"><el-button size="small" type="danger" @click="handleClassWorkFormQuizRemove(index)">删除</el-button></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推送作业的配置对话框 -->
|
||||
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :rows="rowsList" @on-close="closeHomework" @on-success="successHomework"/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { delClasswork } from '@/api/teaching/classwork'
|
||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
import { addClassworkReturnId } from '@/api/teaching/classwork'
|
||||
import { updateClasswork, listEvaluationclue, listClassworkeval,delClassworkeval,addClassworkeval,updateClassworkeval } from '@/api/classTask'
|
||||
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import { editListItem } from '@/hooks/useClassTask'
|
||||
import MyQuestion from '@/views/classTask/newClassTaskAssign/myQuestion/index.vue'
|
||||
import SchoolQuestion from '@/views/classTask/newClassTaskAssign/schoolQuestion/index.vue'
|
||||
import SearchQuestion from '@/views/classTask/newClassTaskAssign/searchQuestion/index.vue'
|
||||
import whiteboard from '@/components/whiteboard/whiteboard.vue'
|
||||
import FileUpload from "@/components/FileUpload/index.vue";
|
||||
import Right from './Right/index.vue'
|
||||
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
})
|
||||
|
||||
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
|
||||
const courseObj = reactive({
|
||||
// 课程相关参数: 教材id,单元id,章节id,课程名称
|
||||
textbookId: '',
|
||||
levelFirstId: '',
|
||||
levelSecondId: '',
|
||||
coursetitle:'',
|
||||
node: null, // 选择的课程节点
|
||||
//
|
||||
})
|
||||
const taskTable = ref(null);
|
||||
const activeAptTab = ref("自主搜题");
|
||||
const taskList = ref([]); // 作业列表
|
||||
const tasklist_loading = ref(false); // 加载中
|
||||
const classWorkFormRef = ref(null);
|
||||
|
||||
// 推送相关
|
||||
const setDialog = ref(false); // 推送配置 弹窗
|
||||
const rowsList = ref([]) // 当前需要推送行的数据
|
||||
const entpcourseid = ref('') // 当前课程id
|
||||
|
||||
const currentRow = ref({id:0}); // 当前选中的行--左侧作业布置模版列表
|
||||
|
||||
// 课堂展示-------
|
||||
const boardLoading = ref(false);
|
||||
//常规作业----------
|
||||
const fileLoading = ref(false); // 常规作业loading
|
||||
|
||||
onMounted(() => {
|
||||
currentRow.value = {id:0};
|
||||
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
||||
if(propsQueryCourseObj&&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; // 保存当前节点
|
||||
}
|
||||
initHomeWork();
|
||||
})
|
||||
//---------作业设计---
|
||||
const handleItemClick = (itemName) => {
|
||||
console.log('itemName', itemName);
|
||||
currentRow.value = {id:1}; // 作业设计
|
||||
/**
|
||||
* 智能推荐?AI设计作业?
|
||||
* 习题训练: 自主搜题 校本题库 个人题库
|
||||
* 课堂展示
|
||||
* 常规作业
|
||||
*/
|
||||
const typeName = itemName == "自主搜题" || itemName == "校本题库"|| itemName == "个人题库" ? "习题训练" : itemName;
|
||||
activeAptTab.value = itemName;
|
||||
//提交内容清空 重置
|
||||
classWorkForm.id = 0;
|
||||
classWorkForm.uniquekey = ""; // 作业唯一标识 作业名称
|
||||
classWorkForm.worktype = typeName; //作业类型
|
||||
classWorkForm.title = ""; // 作业说明
|
||||
classWorkForm.quizlist = []; // 作业习题列表内容
|
||||
classWorkForm.chooseWorkLists = []; // 作业框架梳理list
|
||||
classWorkForm.fileHomeworkList = []; // 常规作业文件列表
|
||||
classWorkForm.whiteboardObj = ""; // 作业资源 - 课堂展示 白板
|
||||
classWorkForm.question = ""; // 作业资源 - 课堂展示 输入的问题
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------作业布置列表相关--------------
|
||||
const selectable=(row, index)=>{
|
||||
return row.status == '10';
|
||||
};
|
||||
/**
|
||||
* 获取 entpcourseid 获取作业列表
|
||||
*/
|
||||
const initHomeWork = async()=> {
|
||||
tasklist_loading.value = true;
|
||||
// const { res, chapterId } = await useGetHomework(courseObj.node);
|
||||
const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode'));
|
||||
console.log('entpcourseid', chapterId);
|
||||
console.log('res', res);
|
||||
entpcourseid.value = chapterId;
|
||||
taskList.value = res;
|
||||
tasklist_loading.value = false;
|
||||
}
|
||||
|
||||
const handleNewAllClass = () => {
|
||||
taskTable.value.setCurrentRow({});// 清除表格选中项背景色
|
||||
currentRow.value = {id:0}; // 作业设计
|
||||
//--------
|
||||
classWorkForm.id = 0;
|
||||
classWorkForm.uniquekey = ""; // 作业唯一标识 作业名称
|
||||
classWorkForm.worktype = ''; //作业类型
|
||||
classWorkForm.title = ""; // 作业说明
|
||||
classWorkForm.quizlist = []; // 作业习题列表内容
|
||||
classWorkForm.chooseWorkLists = []; // 作业框架梳理list
|
||||
classWorkForm.fileHomeworkList = []; // 常规作业文件列表
|
||||
classWorkForm.whiteboardObj = ""; // 作业资源 - 课堂展示 白板
|
||||
classWorkForm.question = ""; // 作业资源 - 课堂展示 输入的问题
|
||||
|
||||
}
|
||||
/**
|
||||
* 删除按钮操作
|
||||
* */
|
||||
const handleDelete =() => {
|
||||
let rows = proxy.$refs.taskTable.getSelectionRows();
|
||||
if (rows.length > 0) {
|
||||
proxy.$modal.confirm('是否确认选中的学习任务?').then(()=> {
|
||||
let ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
return delClasswork(ids.join(','));
|
||||
}).then(() => {
|
||||
taskTable.value.setCurrentRow({});// 清除表格选中项背景色
|
||||
currentRow.value = {id:0}; // 作业设计
|
||||
taskList.value = [];
|
||||
// initHomeWork();
|
||||
setTimeout(() => {
|
||||
initHomeWork();
|
||||
}, 1500);
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
|
||||
}).catch(() => {})
|
||||
}else{
|
||||
proxy.$modal.alertWarning("请选择删除项")
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 一键推送
|
||||
*/
|
||||
const handleTaskAssignToAllClass = () => {
|
||||
let rows = proxy.$refs.taskTable.getSelectionRows();
|
||||
if (rows.length > 0) {
|
||||
proxy.$modal.confirm('是否确认推送选中的学习任务?').then(()=> {
|
||||
}).then(() => {
|
||||
// 弹出配置窗口 ,让用户配置推送策略
|
||||
openSet(rows,'list');
|
||||
}).catch(() => {})
|
||||
}else{
|
||||
return proxy.$modal.alertWarning("请选择需要推送的任务!");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 推送作业配置
|
||||
* //改为list形式,有地方需要批量布置推送
|
||||
*/
|
||||
// 打开布置作业窗口
|
||||
const openSet=(row, type)=> {
|
||||
if(type == 'list'){
|
||||
// 批量布置推送 row 是多个rows,直接赋值
|
||||
rowsList.value = row;
|
||||
setDialog.value = true;
|
||||
}else{
|
||||
// 单个布置推送 row 是单个row,变成数组
|
||||
rowsList.value = [row];
|
||||
setDialog.value = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 关闭布置作业窗口
|
||||
*/
|
||||
const closeHomework = () => {
|
||||
rowsList.value = [];
|
||||
setDialog.value = false;
|
||||
}
|
||||
/**
|
||||
* 推送布置作业成功
|
||||
*/
|
||||
const successHomework = () => {
|
||||
rowsList.value = [];
|
||||
setDialog.value = false;
|
||||
// 刷新布置列表
|
||||
nextTick(() => {
|
||||
initHomeWork();
|
||||
})
|
||||
}
|
||||
|
||||
// --------------------作业编辑
|
||||
let classWorkForm = reactive({
|
||||
id: '',// cloneDeep(props.propsformobj.id),
|
||||
uniquekey: '',// props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):'', // 作业唯一标识 作业名称
|
||||
worktype: '',// props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //作业类型
|
||||
title: '',// props.propsformobj.title?cloneDeep(props.propsformobj.title):'',// 作业说明
|
||||
quizlist: [],// props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[], // 作业习题列表内容
|
||||
chooseWorkLists: [],// props.propsformobj.chooseWorkLists?cloneDeep(props.propsformobj.chooseWorkLists):[], // 作业框架梳理list
|
||||
fileHomeworkList: [],// props.propsformobj.fileHomeworkList?cloneDeep(props.propsformobj.fileHomeworkList):[], // 常规作业文件列表
|
||||
whiteboardObj: '',// props.propsformobj.whiteboardObj?cloneDeep(props.propsformobj.whiteboardObj):'', // 作业资源 - 课堂展示 白板
|
||||
question: '',// props.propsformobj.question?cloneDeep(props.propsformobj.question):'', // 作业资源 - 课堂展示 输入的问题
|
||||
}); // 需要提交 提交的作业内容
|
||||
let propsformobj = reactive({
|
||||
id: '',// cloneDeep(props.propsformobj.id),
|
||||
uniquekey: '',// props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):'', // 作业唯一标识 作业名称
|
||||
worktype: '',// props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //作业类型
|
||||
title: '',// props.propsformobj.title?cloneDeep(props.propsformobj.title):'',// 作业说明
|
||||
quizlist: [],// props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[], // 作业习题列表内容
|
||||
chooseWorkLists: [],// props.propsformobj.chooseWorkLists?cloneDeep(props.propsformobj.chooseWorkLists):[], // 作业框架梳理list
|
||||
fileHomeworkList: [],// props.propsformobj.fileHomeworkList?cloneDeep(props.propsformobj.fileHomeworkList):[], // 常规作业文件列表
|
||||
whiteboardObj: '',// props.propsformobj.whiteboardObj?cloneDeep(props.propsformobj.whiteboardObj):'', // 作业资源 - 课堂展示 白板
|
||||
question: '',// props.propsformobj.question?cloneDeep(props.propsformobj.question):'', // 作业资源 - 课堂展示 输入的问题
|
||||
}); // 左边布置作业列表选中的旧数据
|
||||
/***
|
||||
* 选中的布置作业行
|
||||
*/
|
||||
const handleCurrentChange = (val) => {
|
||||
|
||||
console.log(val,'???????????')
|
||||
if(val && val.id >0 ) {
|
||||
currentRow.value = val;
|
||||
editListItem(val, courseObj).then((obj) => {
|
||||
if(obj){
|
||||
propsformobj = obj;
|
||||
// 新赋值的作业内容
|
||||
classWorkForm.id = obj.id;
|
||||
classWorkForm.uniquekey = cloneDeep(obj.uniquekey); // 作业唯一标识 作业名称
|
||||
classWorkForm.worktype = cloneDeep(obj.worktype); //作业类型
|
||||
classWorkForm.title = cloneDeep(obj.title); // 作业说明
|
||||
classWorkForm.quizlist = cloneDeep(obj.quizlist); // 作业习题列表内容
|
||||
classWorkForm.chooseWorkLists = cloneDeep(obj.chooseWorkLists); // 作业框架梳理list
|
||||
classWorkForm.fileHomeworkList = cloneDeep(obj.fileHomeworkList); // 常规作业文件列表
|
||||
classWorkForm.whiteboardObj = cloneDeep(obj.whiteboardObj); // 作业资源 - 课堂展示 白板
|
||||
classWorkForm.question = cloneDeep(obj.question); // 作业资源 - 课堂展示 输入的问题
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加作业
|
||||
* @param entpcourseworkid
|
||||
*/
|
||||
const handleClassWorkQuizAdd = (entpcourseworkid) => {
|
||||
var exist = false;
|
||||
for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
||||
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);
|
||||
})
|
||||
} else {
|
||||
ElMessage('试题已经存在')
|
||||
}
|
||||
}
|
||||
/** 右侧资源删除按钮 习题list */
|
||||
const handleClassWorkFormQuizRemove = (index) =>{
|
||||
classWorkForm.quizlist.splice(index, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作业设计-提交
|
||||
*/
|
||||
const handleClassWorkSave = async () => {
|
||||
await nextTick(); // 确保DOM更新完成
|
||||
proxy.$refs["classWorkFormRef"].validate(async valid => {
|
||||
if (valid) {
|
||||
//
|
||||
// const { chapterId } = await useGetHomework(courseObj.node)
|
||||
// this.entpcourseid = chapterId
|
||||
|
||||
const cform = {
|
||||
id: 0,
|
||||
workdate: classWorkForm.workdate, // //作业类型?web端这里貌似没有这个时间
|
||||
deaddate: '', // 截止时间
|
||||
entpid: userStore.deptId, //
|
||||
level: 1,
|
||||
parentid: 0,
|
||||
worktype: classWorkForm.worktype, // 作业类型
|
||||
workkey: '',
|
||||
worktag: '',
|
||||
uniquekey: classWorkForm.uniquekey,// 作业名称、编码
|
||||
classid: 0,
|
||||
classcourseid: 0,
|
||||
entpcourseid: entpcourseid.value, // 这个字段很特别
|
||||
slideid: 0,
|
||||
title: classWorkForm.title, // 作业说明?
|
||||
workcodes: JSON.stringify(classWorkForm.workcodes), // 作业内容?
|
||||
edusubject: userStore.edusubject, // 学科 语文 数学
|
||||
evalid: courseObj.levelSecondId, //userStore.evalid, // // 单元下的课ID
|
||||
edustage: userStore.edustage, // 学段 年纪 高中,初中,小学
|
||||
status: '10', //2024-09-11 作业布置分离后的 新模版数据; 之前老版本为空
|
||||
edituserid: userStore.userId, // 当前用户id
|
||||
entpcourseworklist: '', // 选择的 习题训练 list 需要转字符串
|
||||
};
|
||||
|
||||
|
||||
// 当前为[编辑]状态下点进来得处理 newWorkSpaceEdit true 为编辑状态
|
||||
if(classWorkForm.id != '' ) {// 编辑状态 有id
|
||||
|
||||
editWork(cform); // 编辑作业
|
||||
return;
|
||||
}
|
||||
|
||||
if (classWorkForm.worktype === "课堂展示") {
|
||||
boardLoading.value = true
|
||||
let canvasJson = proxy.$refs.boardref.getCanvasJson()
|
||||
let canvasBase64 = await proxy.$refs.boardref.getCanvasBase64()
|
||||
// 课堂展示提交内容
|
||||
cform.worktag = classWorkForm.question;
|
||||
cform.title = classWorkForm.title;
|
||||
cform.workcodes = JSON.stringify({json: canvasJson, base64: canvasBase64});
|
||||
cform.entpcourseworklist = JSON.stringify([{'id':-1, 'score': '10'}]);
|
||||
try {
|
||||
addClassworkReturnId(cform).then(() => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "课堂展示";
|
||||
classWorkForm.uniquekey = '';// classWorkForm.uniquekey, // 作业唯一标识 作业名称
|
||||
classWorkForm.title = "";
|
||||
classWorkForm.question = "";
|
||||
classWorkForm.quizlist = [], // 作业习题列表内容
|
||||
|
||||
// 情况选择的资源缓存
|
||||
classWorkForm.chooseWorkLists = []; // 框架梳理list
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
|
||||
boardLoading.value = false
|
||||
})
|
||||
} finally {
|
||||
boardLoading.value = false
|
||||
}
|
||||
}
|
||||
else if(classWorkForm.worktype === "常规作业"){
|
||||
fileLoading.value = true
|
||||
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
|
||||
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
|
||||
try {
|
||||
addClassworkReturnId(cform).then(() => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "常规作业";
|
||||
classWorkForm.uniquekey = ''; // props.propsformobj.uniquekey, // 作业唯一标识 作业名称
|
||||
classWorkForm.title = "";
|
||||
classWorkForm.quizlist = [], // 作业习题列表内容
|
||||
|
||||
// 情况选择的资源缓存
|
||||
classWorkForm.chooseWorkLists = []; // 框架梳理list
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
classWorkForm.fileHomeworkList = []; // 常规作业list
|
||||
|
||||
fileLoading.value = false
|
||||
})
|
||||
} finally {
|
||||
fileLoading.value = false
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 正常新任务
|
||||
var ll = [];
|
||||
if (classWorkForm.worktype === "习题训练") {
|
||||
for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
// 更新 题目分值
|
||||
ll.push({'id': classWorkForm.quizlist[i].id, 'score': classWorkForm.quizlist[i].score});
|
||||
}
|
||||
}else if( classWorkForm.worktype === "框架梳理") {
|
||||
classWorkForm.chooseWorkLists.filter((item) => {
|
||||
if (item.worktype === classWorkForm.worktype) {
|
||||
ll.push({'id':item.id, 'score': item.score});
|
||||
}
|
||||
})
|
||||
}
|
||||
// 习题训练 右侧选择的资源list
|
||||
if (ll.length > 0) {
|
||||
cform.entpcourseworklist = JSON.stringify(ll);
|
||||
} else {
|
||||
cform.entpcourseworklist = '';
|
||||
}
|
||||
console.log(cform,'提交的数据');
|
||||
if(cform.entpcourseworklist == '') return ElMessage({ type: 'warning', message: '请先添加作业资源!'});
|
||||
|
||||
addClassworkReturnId(cform).then(workres => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "习题训练";
|
||||
classWorkForm.uniquekey = '',// props.propsformobj.uniquekey, // 作业唯一标识 作业名称
|
||||
classWorkForm.title = "";
|
||||
classWorkForm.quizlist = [], // 作业习题列表内容
|
||||
|
||||
// 情况选择的资源缓存
|
||||
classWorkForm.chooseWorkLists = [];
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
// refresh the list
|
||||
//这里分离了,所以不需要更新表单数据了
|
||||
// this.getClassWorkAllList();
|
||||
|
||||
})
|
||||
}
|
||||
console.log('该清空左侧列表数据了');
|
||||
// 清空左侧 选中的布置列表 并刷新列表
|
||||
currentRow.value = {id:0};
|
||||
initHomeWork();
|
||||
|
||||
|
||||
// if(props.isback){
|
||||
// // 其他页面进入的 返回上一页
|
||||
// router.back();
|
||||
// }else{
|
||||
// // 首页进入的,跳转到作业布置页面
|
||||
// router.push({ path: '/classTaskAssign' });
|
||||
// }
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 编辑作业内容
|
||||
* @param cform 表单数据
|
||||
*/
|
||||
const editWork = async (cform) =>{
|
||||
// 基础参数
|
||||
cform.id= classWorkForm.id;
|
||||
|
||||
// 0.右侧作业资源添加检测
|
||||
if (classWorkForm.worktype == '习题训练') {
|
||||
if (classWorkForm.quizlist.length == 0) {
|
||||
ElMessage.error('请先添加作业资源!');
|
||||
return;
|
||||
}
|
||||
}else if (classWorkForm.worktype == '课堂展示' || classWorkForm.worktype == '常规作业') {
|
||||
// 不做校验
|
||||
|
||||
}else {
|
||||
if (classWorkForm.chooseWorkLists.length == 0) {
|
||||
// 框架梳理
|
||||
ElMessage.error('请先添加作业资源!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 根据作业类型分类处理
|
||||
if (classWorkForm.worktype=='习题训练'){
|
||||
|
||||
// 1.判断当前添加的作业是否与原来不同(跟父组件传来的值对比)
|
||||
let needUplEval = false;
|
||||
if (classWorkForm.quizlist.length != propsformobj.quizlist.length) {
|
||||
needUplEval = true;
|
||||
}else {
|
||||
// 只要有一个不一致则说明需要更新
|
||||
needUplEval = classWorkForm.quizlist.some(cur =>
|
||||
!propsformobj.quizlist.some(last =>
|
||||
last.id === cur.id && last.score === cur.score
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 2.需要重新更新eval的数据
|
||||
if (needUplEval) {
|
||||
// 说明: 因试题分值也需修改, 故无法通过按钮的增长删除来处理, 故将原作业全部删除后再重新添加
|
||||
// 2.1.先查询该workid下所有的id
|
||||
let arrEvalids = [];
|
||||
const wevalres = await listClassworkeval({'workid': classWorkForm.id});
|
||||
wevalres.rows.forEach(element => {
|
||||
arrEvalids.push(element.id);
|
||||
});
|
||||
const ids = arrEvalids.join(',');
|
||||
|
||||
// 2.2.删除原作业
|
||||
const delRes = await delClassworkeval(ids);
|
||||
|
||||
// 2.3.重新添加新作业
|
||||
for(let i=0; i< classWorkForm.quizlist.length; i++){
|
||||
const addRes = await addClassworkeval({
|
||||
'workid': classWorkForm.id,
|
||||
'entpcourseworkid': classWorkForm.quizlist[i].id,
|
||||
'workdataid': 0,
|
||||
'score': classWorkForm.quizlist[i].score}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 3.更新作业任务信息-判断最后更新了
|
||||
}
|
||||
else if (classWorkForm.worktype=='框架梳理') {
|
||||
// 1.先查询该workid下所有的id
|
||||
const wevalres = await listClassworkeval({'workid': classWorkForm.id});
|
||||
if (wevalres.rows.length == 0) {
|
||||
ElMessage.error('未找到原框架梳理任务,请或退出重试');
|
||||
return;
|
||||
}
|
||||
|
||||
// 2.更新作业任务下的框架梳理
|
||||
let needUplEval = false;
|
||||
if (classWorkForm.chooseWorkLists.length !== propsformobj.chooseWorkLists.length) {
|
||||
needUplEval = true;
|
||||
}else {
|
||||
// 只要有一个不一致则说明需要更新
|
||||
needUplEval = classWorkForm.chooseWorkLists.some(cur =>
|
||||
!propsformobj.chooseWorkLists.some(last =>
|
||||
last.id === cur.id && last.score === cur.score
|
||||
)
|
||||
);
|
||||
}
|
||||
if (needUplEval) {
|
||||
const uplParams = {
|
||||
id: wevalres.rows[0].id,
|
||||
entpcourseworkid: classWorkForm.chooseWorkLists[0].id,
|
||||
score: classWorkForm.chooseWorkLists[0].score,
|
||||
}
|
||||
// 更新作业任务下的框架梳理
|
||||
let res = await updateClassworkeval(uplParams);
|
||||
}
|
||||
}
|
||||
else if (classWorkForm.worktype=='课堂展示') {
|
||||
let canvasJson = proxy.$refs.boardref.getCanvasJson()
|
||||
let canvasBase64 = await proxy.$refs.boardref.getCanvasBase64()
|
||||
cform.workcodes = JSON.stringify({json: canvasJson, base64: canvasBase64});
|
||||
cform.worktag = classWorkForm.question;
|
||||
}
|
||||
else if (classWorkForm.worktype=='常规作业') {
|
||||
// 1.更新作业任务下的课堂展示内容 (这里未做校验, 直接将当前文件对象更新过去)
|
||||
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
|
||||
}
|
||||
|
||||
// 3.更新作业任务本身
|
||||
let res = await updateClasswork(cform);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('更新成功');
|
||||
// 清空左侧 选中的布置列表 并刷新列表
|
||||
currentRow.value = {id:0};
|
||||
initHomeWork();
|
||||
// // 返回上一页
|
||||
// router.back()
|
||||
}
|
||||
|
||||
}
|
||||
//----
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
.page-top {
|
||||
height: 50px;
|
||||
margin-bottom: 5px;
|
||||
padding: 0 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
align-items: center;
|
||||
}
|
||||
.page-resource {
|
||||
user-select: none;
|
||||
height: calc(100% - 55px);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
:deep(.el-tabs__nav) {
|
||||
.el-tabs__item{
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
.page-left {
|
||||
width: 300px;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
|
||||
.pageleft-table-top {
|
||||
height: 35px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.pageleft-table-cont {
|
||||
height: 35px;
|
||||
// width: 100%;
|
||||
// text-align: justify;
|
||||
// display: flex;
|
||||
// overflow: hidden;
|
||||
// flex-direction: row;
|
||||
// text-overflow: ellipsis;
|
||||
width: 230px; /* 设置容器的宽度 */
|
||||
overflow: hidden; /* 隐藏超出容器的部分 */
|
||||
white-space: nowrap; /* 防止文本换行 */
|
||||
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
||||
.ellipsis {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.page-center{
|
||||
flex: 1;
|
||||
// width: 100%;
|
||||
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%;
|
||||
}
|
||||
|
||||
|
||||
.upload-homework{
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.page-right {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
min-width: 375px;
|
||||
width: 375px;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.prepare-top {
|
||||
display: flex;
|
||||
height: 40px;
|
||||
margin: 0 10px;
|
||||
border-bottom: 2px solid #e5e7eb;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.prepare-con{
|
||||
height: 100%;
|
||||
padding: 5px 10px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.pageRight-list {
|
||||
height: 100%;
|
||||
padding: 0 0 0 5px;
|
||||
overflow: auto;
|
||||
line-height: 26px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,420 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<!-- 习题筛选1 -->
|
||||
<el-row style="width: 100%; height: 50px;">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="题型" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.worktype" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkTypeList" :key="index" :label="item.label" :value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="题源" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.workgroup" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkGroupList" :key="index" :label="item.Value" :value="item.Key" ></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="年份" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkYearList" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题筛选2 -->
|
||||
<el-row style="width: 100%; height: 50px;">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关键词" label-width="70">
|
||||
<el-input
|
||||
v-model="entpCourseWorkQueryParams.keyWord"
|
||||
type="text"
|
||||
placeholder="请输入关键词"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> 查找</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题表格 -->
|
||||
<div class="page-table" >
|
||||
<el-table
|
||||
:data="workResource.entpCourseWorkList"
|
||||
style="width: 100%; height: calc(100% - 55px);"
|
||||
v-loading="pageParams.loading"
|
||||
>
|
||||
<el-table-column type="index" width="60" />
|
||||
<el-table-column align="left" >
|
||||
<template #header>
|
||||
<div style="display: flex">
|
||||
<div style="align-items: center;">题目内容</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div @click="showExamAnalyseDrawer(scope.row)">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
|
||||
<el-col :span="24" style="display: flex">
|
||||
<div style="font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.entpname }} {{ scope.row.editusername }}</div>
|
||||
<div style="margin-left: 30px; font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.worktag }}</div>
|
||||
</el-col>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<el-button type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
<div style="padding: 5px;"></div>
|
||||
<el-button type="danger" @click="handleDelete(scope.row, scope.$index)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页-->
|
||||
<div style="height: 55px;">
|
||||
<el-pagination
|
||||
v-show="workResource.entpCourseWorkTotal > 0"
|
||||
v-model:page="paginationParams.pageNum"
|
||||
v-model:limit="paginationParams.pageSize"
|
||||
:total="workResource.entpCourseWorkTotal"
|
||||
:style="{ position: 'relative', 'margin-top': '5px' }"
|
||||
@change="getPaginationList" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 试题详细信息 -->
|
||||
<examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import { listEntpcoursework } from '@/api/education/entpCourseWork'
|
||||
import { listEvaluationclue } from '@/api/classTask'
|
||||
import { delEntpcoursework } from "@/api/education/entpCourseWork";
|
||||
|
||||
import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue'
|
||||
import { useHandleData } from "@/hooks/useHandleData";
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {throttle,debounce } from '@/utils/comm'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['addQuiz'])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore().user
|
||||
const props = defineProps({
|
||||
bookobj: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
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'},
|
||||
]); // 习题查询条件 - 年份
|
||||
|
||||
|
||||
// 习题查询参数条件
|
||||
const entpCourseWorkQueryParams = reactive({
|
||||
worktype: {
|
||||
label: '不限',
|
||||
value: 0,
|
||||
},
|
||||
workgroup: 0,
|
||||
yearStr: '-1',
|
||||
point: [],
|
||||
keyWord: '',
|
||||
});
|
||||
|
||||
const paginationParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}); // 分页传参
|
||||
|
||||
const pageParams = ref({
|
||||
loading: false, // 是否正在加载中
|
||||
originCount: 0, // 初始条目数量
|
||||
isFirst: true, // 是否是第一次加载
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const workResource = reactive({
|
||||
options: ['学习任务', '云题库'],
|
||||
worktype: '全部',
|
||||
activeIndex: "3",
|
||||
dialogOfTaskOpen: false,
|
||||
dislogOfAssignOpen: false,
|
||||
quiztype: '',
|
||||
queryForm: {},
|
||||
classWorkList: [], // 教学分析里产生的学习任务
|
||||
entpCourseWorkList: [], // 习题列表
|
||||
entpCourseWorkTotal: 0, // 习题总数
|
||||
}); // 作业资源
|
||||
|
||||
onMounted(() => {
|
||||
debounceQueryData(); // 查询习题列表
|
||||
})
|
||||
|
||||
const initPageParams = () => {
|
||||
// 初始化作业习题列表
|
||||
workResource.entpCourseWorkList = [];
|
||||
workResource.entpCourseWorkTotal = 0
|
||||
|
||||
// 初始化下拉滚动条参数
|
||||
pageParams.value.loading = false;
|
||||
pageParams.value.isFirst = true;
|
||||
pageParams.value.originCount = 0;
|
||||
pageParams.value.total = 0;
|
||||
|
||||
// 初始化分页参数
|
||||
paginationParams.pageNum = 1;
|
||||
paginationParams.pageSize = 10;
|
||||
}
|
||||
/**
|
||||
* @desc: 1、习题训练 - 新查询试题
|
||||
* @return: {*}
|
||||
* @param {*} queryType
|
||||
* 0 - 标准查询
|
||||
* 1 - 按条件查询
|
||||
* 2 - 按关键词查询
|
||||
*/
|
||||
let obj = {};
|
||||
function Apis(key) {
|
||||
obj[key] = [];
|
||||
return function(task) {
|
||||
return new Promise((resolve, reject) => {
|
||||
obj[key].push(task);
|
||||
Promise.all([...obj[key]]).then(res => {
|
||||
const i = obj[key].findIndex(item => {
|
||||
return item == task;
|
||||
});
|
||||
resolve(obj[key][i]);
|
||||
//arr.splice(i, 1);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const client = new Apis('/paht');
|
||||
const t = function(name, time) {
|
||||
return new Promise(resolve => {
|
||||
const queryForm = {
|
||||
// 题类
|
||||
worktype: entpCourseWorkQueryParams.worktype.label == '不限' ? '' : entpCourseWorkQueryParams.worktype.label,
|
||||
// 题源 TODO 估计后端没做相应的查询处理 web端也没有返回
|
||||
// workgroup: entpCourseWorkQueryParams.workgroup,
|
||||
// 年份 TODO 估计后端没做相应的查询处理 web端也没有返回
|
||||
// yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'',
|
||||
// 关键字
|
||||
title: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'',
|
||||
|
||||
// 分页参数
|
||||
pageNum: paginationParams.pageNum,
|
||||
pageSize: paginationParams.pageSize,
|
||||
// 课程相关参数
|
||||
edustage: userStore.edustage, // this.userStore.edustage,
|
||||
edusubject: userStore.edusubject, // this.userStore.edusubject,
|
||||
evalid: props.bookobj.levelSecondId, // this.activeParams.lession.id,
|
||||
|
||||
orderby: 'concat(worktype,timestamp) DESC',
|
||||
|
||||
}
|
||||
const entpcourseworkres = listEntpcoursework(queryForm);
|
||||
|
||||
resolve(entpcourseworkres);
|
||||
})
|
||||
}
|
||||
const handleQueryFromEntpCourseWork= async (queryType) => {
|
||||
|
||||
pageParams.value.loading = true;
|
||||
|
||||
client(t('任务1', 1500)).then(res => {
|
||||
const data = res.rows || [];
|
||||
if(data && data.length>0){
|
||||
// data.forEach(item=> {
|
||||
// if (item.worktype == '选择题') {
|
||||
// item.worktype = '单选题'
|
||||
// }
|
||||
// })
|
||||
|
||||
// 格式化试题信息
|
||||
processList(data);
|
||||
workResource.entpCourseWorkList = data;
|
||||
workResource.entpCourseWorkTotal = res.total;
|
||||
}
|
||||
pageParams.value.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 教学资源,从课标分析、教材分析里来
|
||||
/**
|
||||
* 2、框架设计、教学资源,从课标分析、教材分析里来
|
||||
*/
|
||||
const getQueryFromEvaluationclue = () => {
|
||||
// props.bookobj.levelSecondId, //userStore.evalid, // // 单元下的课ID
|
||||
listEvaluationclue({ cluegroup: 'teachresource', evalid: props.bookobj.levelSecondId, pageSize: 1000 }).then((clueres) => {
|
||||
for (var i=0; i<clueres.rows.length; i++) {
|
||||
|
||||
if (clueres.rows[i].cluetag == 'standardview') {
|
||||
clueres.rows[i].worktype = '课标研读';
|
||||
} else if (clueres.rows[i].cluetag == 'targetview') {
|
||||
clueres.rows[i].worktype = '目标设定';
|
||||
} else if (clueres.rows[i].cluetag == 'contentview') {
|
||||
clueres.rows[i].worktype = '教材研读';
|
||||
} else if (clueres.rows[i].cluetag == 'frameview') {
|
||||
clueres.rows[i].worktype = '框架梳理';
|
||||
} else if (clueres.rows[i].cluetag == 'mapview') {
|
||||
clueres.rows[i].worktype = '学科定位';
|
||||
}
|
||||
console.log("clueres.rows[i].childlist",clueres.rows[i].childlist);
|
||||
if (clueres.rows[i].childlist != '') {
|
||||
clueres.rows[i].childArray = JSON.parse('['+clueres.rows[i].childlist+']');
|
||||
for (var j=0; j<clueres.rows[i].childArray.length; j++) {
|
||||
clueres.rows[i].childArray[j].title = clueres.rows[i].childArray[j].title.replace(/(<([^>]+)>)/ig, '');
|
||||
}
|
||||
} else {
|
||||
clueres.rows[i].childArray = {};
|
||||
}
|
||||
}
|
||||
console.log("框架梳理、课标研读、目标设定、教材研读、学科定位的资源",clueres.rows);
|
||||
workResource.teachResourceList = clueres.rows;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 根据查询参数查询试题
|
||||
* @return: {*}
|
||||
* @param {*} queryType
|
||||
* 1 - 按条件查询
|
||||
* 2 - 按关键词查询
|
||||
*/
|
||||
const handleQueryParamFromEntpCourseWork = (queryType) => {
|
||||
// 确保更改了搜索参数后从第一页开始查询
|
||||
// this.paginationParams = {pageNum: 1,pageSize: 10}; 分页这里展示弃用了
|
||||
// 清空作业列表
|
||||
initPageParams();
|
||||
handleQueryFromEntpCourseWork(queryType);
|
||||
};
|
||||
/**
|
||||
* 查看试题详细信息
|
||||
* @param row 单题数据
|
||||
*/
|
||||
const showExamAnalyseDrawer = (row) => {
|
||||
nextTick(() => {
|
||||
const activeParams = {
|
||||
activeExam: row,
|
||||
}
|
||||
proxy.$refs.examDetailsDrawerRef.acceptParams(activeParams);
|
||||
})
|
||||
}
|
||||
const getPaginationList = ( page, limit ) => {
|
||||
paginationParams.pageNum = page;
|
||||
paginationParams.pageSize = limit;
|
||||
console.log(page, limit)
|
||||
handleQueryFromEntpCourseWork(0);
|
||||
}
|
||||
|
||||
|
||||
/** 删除题目按钮操作 */
|
||||
const handleDelete = async(item, index) => {
|
||||
await useHandleData(delEntpcoursework, item.id, `确认删除编号为【${index+1}】的题目?` );
|
||||
debounceQueryData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加资源
|
||||
* @param fromsrc - 试题来源
|
||||
* @param entpcourseworkid
|
||||
*/
|
||||
const handleClassWorkQuizAdd = (fromsrc, entpcourseworkid) => {
|
||||
emit('addQuiz', entpcourseworkid);
|
||||
// var exist = false;
|
||||
// for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
// if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
||||
// 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);
|
||||
// })
|
||||
// } else {
|
||||
// ElMessage('试题已经存在')
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
// 防抖
|
||||
const debounceQueryData = debounce(() => {
|
||||
console.log("防抖 加载数据中...")
|
||||
// 初始化滚动加载参数
|
||||
initPageParams();
|
||||
// // 习题资源
|
||||
handleQueryFromEntpCourseWork(0);
|
||||
// // 框架梳理
|
||||
// getQueryFromEvaluationclue();
|
||||
}, 1000);
|
||||
|
||||
|
||||
watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => {
|
||||
console.log(props.bookobj,'课程选择')
|
||||
debounceQueryData();
|
||||
})
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.page-table {
|
||||
width: 100%;
|
||||
height: calc(100% - 100px);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<style src="@/assets/styles/JYStyle.css"></style>
|
|
@ -0,0 +1,34 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
校本题库
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import { delClasswork } from '@/api/teaching/classwork'
|
||||
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
// courseObj: {
|
||||
// type: Object,
|
||||
// default: () => ({})
|
||||
// }
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,498 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<!-- 习题筛选1 -->
|
||||
<el-row style="width: 100%; height: 50px;">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="题型" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.worktype" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkTypeList" :key="index" :label="item.label" :value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="题源" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.workgroup" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkGroupList" :key="index" :label="item.Value" :value="item.Key" ></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="知识点" label-width="70">
|
||||
<el-cascader
|
||||
v-model="entpCourseWorkQueryParams.point"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:options="entpCourseWorkPointList"
|
||||
:props="knowledgePointProps"
|
||||
popper-class="my-popper"
|
||||
:show-all-levels="false"
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题筛选2 -->
|
||||
<el-row style="width: 100%; height: 50px;">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="年份" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkYearList" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关键词" label-width="70">
|
||||
<el-input
|
||||
v-model="entpCourseWorkQueryParams.keyWord"
|
||||
type="text"
|
||||
placeholder="请输入关键词"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> 查找</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题表格 -->
|
||||
<div class="page-table" >
|
||||
<el-table
|
||||
:data="workResource.entpCourseWorkList"
|
||||
style="width: 100%; height: calc(100% - 55px);"
|
||||
v-loading="pageParams.loading"
|
||||
>
|
||||
<el-table-column type="index" width="60" />
|
||||
<el-table-column align="left" >
|
||||
<template #header>
|
||||
<div style="display: flex">
|
||||
<div style="align-items: center;">题目内容</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div @click="showExamAnalyseDrawer(scope.row)">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
|
||||
<el-col :span="24" style="display: flex">
|
||||
<div style="font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.entpname }} {{ scope.row.editusername }}</div>
|
||||
<div style="margin-left: 30px; font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.worktag }}</div>
|
||||
</el-col>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" width="100">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页-->
|
||||
<div style="height: 55px;">
|
||||
<el-pagination
|
||||
v-show="pageParams.total > 0"
|
||||
v-model:page="paginationParams.pageNum"
|
||||
v-model:limit="paginationParams.pageSize"
|
||||
:total="pageParams.total"
|
||||
:style="{ position: 'relative', 'margin-top': '5px' }"
|
||||
@change="getPaginationList" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 试题详细信息 -->
|
||||
<examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
import { updateClasswork, listEvaluationclue, listClassworkeval,delClassworkeval,addClassworkeval,updateClassworkeval } from '@/api/classTask'
|
||||
import { listEvaluation } from '@/api/subject'
|
||||
import { listKnowledgePoint } from "@/api/knowledge/knowledgePoint";
|
||||
|
||||
import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {throttle,debounce } from '@/utils/comm'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['addQuiz'])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore().user
|
||||
const props = defineProps({
|
||||
bookobj: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
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 entpCourseWorkQueryParams = reactive({
|
||||
worktype: {
|
||||
label: '不限',
|
||||
value: 0,
|
||||
},
|
||||
workgroup: 0,
|
||||
yearStr: '-1',
|
||||
point: [],
|
||||
keyWord: '',
|
||||
});
|
||||
|
||||
const paginationParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}); // 分页传参
|
||||
|
||||
const pageParams = ref({
|
||||
loading: false, // 是否正在加载中
|
||||
originCount: 0, // 初始条目数量
|
||||
isFirst: true, // 是否是第一次加载
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const workResource = reactive({
|
||||
options: ['学习任务', '云题库'],
|
||||
worktype: '全部',
|
||||
activeIndex: "3",
|
||||
dialogOfTaskOpen: false,
|
||||
dislogOfAssignOpen: false,
|
||||
quiztype: '',
|
||||
queryForm: {},
|
||||
classWorkList: [], // 教学分析里产生的学习任务
|
||||
entpCourseWorkList: [], // 习题列表
|
||||
entpCourseWorkTotal: 0, // 习题总数
|
||||
}); // 作业资源
|
||||
|
||||
onMounted(() => {
|
||||
debounceQueryData(); // 查询习题列表
|
||||
})
|
||||
|
||||
const initPageParams = () => {
|
||||
// 初始化作业习题列表
|
||||
workResource.entpCourseWorkList = [];
|
||||
workResource.entpCourseWorkTotal = 0
|
||||
|
||||
// 初始化下拉滚动条参数
|
||||
pageParams.value.loading = false;
|
||||
pageParams.value.isFirst = true;
|
||||
pageParams.value.originCount = 0;
|
||||
pageParams.value.total = 0;
|
||||
|
||||
// 初始化分页参数
|
||||
paginationParams.pageNum = 1;
|
||||
paginationParams.pageSize = 10;
|
||||
}
|
||||
/**
|
||||
* @desc: 1、习题训练 - 新查询试题
|
||||
* @return: {*}
|
||||
* @param {*} queryType
|
||||
* 0 - 标准查询
|
||||
* 1 - 按条件查询
|
||||
* 2 - 按关键词查询
|
||||
*/
|
||||
let obj = {};
|
||||
function Apis(key) {
|
||||
obj[key] = [];
|
||||
return function(task) {
|
||||
return new Promise((resolve, reject) => {
|
||||
obj[key].push(task);
|
||||
Promise.all([...obj[key]]).then(res => {
|
||||
const i = obj[key].findIndex(item => {
|
||||
return item == task;
|
||||
});
|
||||
resolve(obj[key][i]);
|
||||
//arr.splice(i, 1);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const client = new Apis('/paht');
|
||||
const t = function(name, time) {
|
||||
return new Promise(resolve => {
|
||||
const queryForm = {
|
||||
// 分页参数
|
||||
currentPage: paginationParams.pageNum,
|
||||
pageSize: paginationParams.pageSize,
|
||||
// 课程相关参数
|
||||
eid: props.bookobj.levelSecondId,
|
||||
sectionName: props.bookobj.coursetitle,
|
||||
edusubject: userStore.edusubject,
|
||||
edustage: userStore.edustage,
|
||||
//
|
||||
// 题类
|
||||
worktype: entpCourseWorkQueryParams.worktype.label,
|
||||
workTypeId: entpCourseWorkQueryParams.worktype.value,
|
||||
// 题源
|
||||
workgroup: entpCourseWorkQueryParams.workgroup,
|
||||
// 年份
|
||||
yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'',
|
||||
// 知识点
|
||||
thirdId: entpCourseWorkQueryParams.point&&entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'',
|
||||
// 关键字
|
||||
keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'',
|
||||
|
||||
}
|
||||
const entpcourseworkres = listEntpcourseworkNew(queryForm);
|
||||
|
||||
resolve(entpcourseworkres);
|
||||
})
|
||||
}
|
||||
const handleQueryFromEntpCourseWork= async (queryType) => {
|
||||
|
||||
pageParams.value.loading = true;
|
||||
|
||||
client(t('任务1', 1500)).then(res => {
|
||||
//console.log("请求返回",res);
|
||||
// if(paginationParams.pageNum == 1){
|
||||
// workResource.entpCourseWorkList = [];
|
||||
// workResource.entpCourseWorkTotal = 0;
|
||||
|
||||
// // 初始化下拉滚动条参数
|
||||
// // pageParams.value.loading = false;
|
||||
// // pageParams.value.isFirst = true;
|
||||
// // pageParams.value.originCount = 0;
|
||||
// }
|
||||
const data = res.data || [];
|
||||
if(data && data.length>0){
|
||||
// workResource.entpCourseWorkList = entpcourseworkres.data;
|
||||
// workResource.entpCourseWorkTotal = entpcourseworkres.data.length;
|
||||
|
||||
data.forEach(item=> {
|
||||
if (item.worktype == '选择题') {
|
||||
item.worktype = '单选题'
|
||||
}
|
||||
})
|
||||
|
||||
// 格式化试题信息
|
||||
processList(data);
|
||||
//workResource.entpCourseWorkList.push(...data);
|
||||
workResource.entpCourseWorkList = data;
|
||||
|
||||
// 初次加载时更新当前试题数量
|
||||
if (pageParams.value.isFirst) {
|
||||
pageParams.value.isFirst = false;
|
||||
pageParams.value.originCount = workResource.entpCourseWorkList.length;
|
||||
pageParams.value.total = parseInt(res.msg);
|
||||
paginationParams.pageNum = Math.ceil(parseInt(res.msg)/paginationParams.pageSize);
|
||||
console.log('first->', pageParams.value, paginationParams);
|
||||
}
|
||||
}
|
||||
pageParams.value.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 教学资源,从课标分析、教材分析里来
|
||||
/**
|
||||
* 2、框架设计、教学资源,从课标分析、教材分析里来
|
||||
*/
|
||||
const getQueryFromEvaluationclue = () => {
|
||||
// props.bookobj.levelSecondId, //userStore.evalid, // // 单元下的课ID
|
||||
listEvaluationclue({ cluegroup: 'teachresource', evalid: props.bookobj.levelSecondId, pageSize: 1000 }).then((clueres) => {
|
||||
for (var i=0; i<clueres.rows.length; i++) {
|
||||
|
||||
if (clueres.rows[i].cluetag == 'standardview') {
|
||||
clueres.rows[i].worktype = '课标研读';
|
||||
} else if (clueres.rows[i].cluetag == 'targetview') {
|
||||
clueres.rows[i].worktype = '目标设定';
|
||||
} else if (clueres.rows[i].cluetag == 'contentview') {
|
||||
clueres.rows[i].worktype = '教材研读';
|
||||
} else if (clueres.rows[i].cluetag == 'frameview') {
|
||||
clueres.rows[i].worktype = '框架梳理';
|
||||
} else if (clueres.rows[i].cluetag == 'mapview') {
|
||||
clueres.rows[i].worktype = '学科定位';
|
||||
}
|
||||
console.log("clueres.rows[i].childlist",clueres.rows[i].childlist);
|
||||
if (clueres.rows[i].childlist != '') {
|
||||
clueres.rows[i].childArray = JSON.parse('['+clueres.rows[i].childlist+']');
|
||||
for (var j=0; j<clueres.rows[i].childArray.length; j++) {
|
||||
clueres.rows[i].childArray[j].title = clueres.rows[i].childArray[j].title.replace(/(<([^>]+)>)/ig, '');
|
||||
}
|
||||
} else {
|
||||
clueres.rows[i].childArray = {};
|
||||
}
|
||||
}
|
||||
console.log("框架梳理、课标研读、目标设定、教材研读、学科定位的资源",clueres.rows);
|
||||
workResource.teachResourceList = clueres.rows;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 3、知识点
|
||||
*/
|
||||
const getEntpCourseWorkPointList = () => {
|
||||
// 更新考点
|
||||
// 拿到当前章节下得所有知识点
|
||||
listEvaluation({ itemkey: "subject", pageSize: 10, edustage: userStore.edustage, edusubject: userStore.edusubject }).then((res) => {
|
||||
const evalId = res.rows
|
||||
const queryParams = {
|
||||
evalId: evalId[0]?.id,
|
||||
pageNum: 1,
|
||||
pageSize: 5000,
|
||||
}
|
||||
listKnowledgePoint(queryParams).then(res => {
|
||||
entpCourseWorkPointList.value = res.rows;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 根据查询参数查询试题
|
||||
* @return: {*}
|
||||
* @param {*} queryType
|
||||
* 1 - 按条件查询
|
||||
* 2 - 按关键词查询
|
||||
*/
|
||||
const handleQueryParamFromEntpCourseWork = (queryType) => {
|
||||
// 确保更改了搜索参数后从第一页开始查询
|
||||
// this.paginationParams = {pageNum: 1,pageSize: 10}; 分页这里展示弃用了
|
||||
// 清空作业列表
|
||||
initPageParams();
|
||||
handleQueryFromEntpCourseWork(queryType);
|
||||
};
|
||||
/**
|
||||
* 查看试题详细信息
|
||||
* @param row 单题数据
|
||||
*/
|
||||
const showExamAnalyseDrawer = (row) => {
|
||||
nextTick(() => {
|
||||
const activeParams = {
|
||||
activeExam: row,
|
||||
}
|
||||
proxy.$refs.examDetailsDrawerRef.acceptParams(activeParams);
|
||||
})
|
||||
}
|
||||
const getPaginationList = ( page, limit ) => {
|
||||
paginationParams.pageNum = page;
|
||||
paginationParams.pageSize = limit;
|
||||
console.log(page, limit)
|
||||
handleQueryFromEntpCourseWork(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加资源
|
||||
* @param fromsrc - 试题来源
|
||||
* @param entpcourseworkid
|
||||
*/
|
||||
const handleClassWorkQuizAdd = (fromsrc, entpcourseworkid) => {
|
||||
emit('addQuiz', entpcourseworkid);
|
||||
// var exist = false;
|
||||
// for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
// if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
||||
// 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);
|
||||
// })
|
||||
// } else {
|
||||
// ElMessage('试题已经存在')
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
// 防抖
|
||||
const debounceQueryData = debounce(() => {
|
||||
console.log("防抖 加载数据中...")
|
||||
// 初始化滚动加载参数
|
||||
initPageParams();
|
||||
// 习题资源
|
||||
handleQueryFromEntpCourseWork(0);
|
||||
// 框架梳理
|
||||
getQueryFromEvaluationclue();
|
||||
// 知识点
|
||||
getEntpCourseWorkPointList();
|
||||
}, 1000);
|
||||
|
||||
|
||||
watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => {
|
||||
console.log(props.bookobj,'课程选择')
|
||||
debounceQueryData();
|
||||
})
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.page-table {
|
||||
width: 100%;
|
||||
height: calc(100% - 100px);
|
||||
}
|
||||
|
||||
// .el-form-work-list{
|
||||
// display: flex;
|
||||
// flex: 1;
|
||||
// font-size: var(--font-size);
|
||||
// line-height: 32px;
|
||||
// min-width: 0;
|
||||
// position: relative;
|
||||
// flex-direction: column;
|
||||
|
||||
// :deep(.el-form-item__content){
|
||||
// display: flex;
|
||||
// flex: 1;
|
||||
// font-size: var(--font-size);
|
||||
// line-height: 32px;
|
||||
// min-width: 0;
|
||||
// position: relative;
|
||||
// flex-direction: column;
|
||||
// }
|
||||
|
||||
// .page-table {
|
||||
// width: 100%;
|
||||
// height: calc(100% - 100px);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
</style>
|
||||
<style src="@/assets/styles/JYStyle.css"></style>
|
Loading…
Reference in New Issue