教学实践:作业编辑外链改为pc版

This commit is contained in:
白了个白 2024-10-16 16:11:07 +08:00
parent 2b25924213
commit 7c539614fd
3 changed files with 185 additions and 46 deletions

View File

@ -0,0 +1,117 @@
import { listEntpcoursework,getEvaluationclue } from '@/api/classTask';
import { processList } from '@/hooks/useProcessList';
const isJson = (str) => {
if (typeof str == 'string') {
try {
let obj = JSON.parse(str)
if (typeof obj == 'object' && obj) {
return true
} else {
return false
}
} catch (e) {
return false
}
}
}
/**
* @description 编辑作业配置
* @param {*} row
*/
export const editListItem = (row, courseObj) => {
return new Promise((resolve, reject) => {
// 作业内容编辑-跳转到设计界面-传参
let classtaskObj = {
id: '', //
bookName: '', // 课程名称
uniquekey: '', // 设计中的标题
title: '', // 设计中的说明
worktype: '', // 设计中的作业类型
quizlist: [], // 设计中的试题列表
chooseWorkLists: [],// 设计中的框架梳理list
fileHomeworkList: [],// 设计中的常规作业list
whiteboardObj: '',// 设计中的课堂展示对象
};
//重新更新[新任务]中右侧列表数据
var listCourseWork = [];
for (var i=0; i < row.entpcourseworklistarray.length; i++) {
listCourseWork.push(row.entpcourseworklistarray[i]);
}
if (listCourseWork.length > 0) {
classtaskObj.id= row.id; //
classtaskObj.bookObj = courseObj; // 教材对象
classtaskObj.bookName = row.evaltitle? row.evalparenttitle? row.evalparenttitle+'/'+row.evaltitle : row.evaltitle: row.evalparenttitle// 课程名称:单元/章节: 单元
classtaskObj.uniquekey= row.uniquekey; // 设计中的标题
classtaskObj.title= row.title; // 设计中的说明
classtaskObj.worktype= row.worktype; // 设计中的作业类型
classtaskObj.quizlist= []; // 设计中的试题列表
classtaskObj.chooseWorkLists = []; //设计中的 框架梳理list
classtaskObj.fileHomeworkList = []; //设计中的 常规作业list
classtaskObj.whiteboardObj = ''; //设计中的 课堂展示对象
if (row.worktype == '框架梳理') {
// 框架梳理对应只有一个内容
getEvaluationclue(listCourseWork[0].id).then(res => {
if ( res.data==null || res.data==undefined ) {
return ;
}
res.data.worktype = '框架梳理';
res.data.score = listCourseWork[0].score;
classtaskObj.chooseWorkLists.push(res.data);
//
// console.log('框架梳理', classtaskObj);
return resolve(classtaskObj);
});
}
else if (row.worktype == '习题训练') {
const ids = listCourseWork.map(item => item.id).join(",");
listEntpcoursework({ids: ids, pageSize: 50}).then(idres => {
// for (var i=0; i<idres.rows.length; i++) {
// idres.rows[i].titletext = idres.rows[i].title.replace(/<[^>]+>/g, '');
// }
// 格式化试题
if(idres.rows&&idres.rows.length > 0){
processList(idres.rows);
//重新将task中的分值更新
row.entpcourseworklistarray.forEach(item => {
const quizItem = idres.rows.find(quiz => quiz.id === item.id);
if (quizItem) {
quizItem.score = item.score;
quizItem.scoreOrigin = item.score;
}
});
classtaskObj.quizlist = idres.rows;
//
// console.log('习题训练', classtaskObj);
return resolve(classtaskObj);
}
})
}
else if (row.worktype == '课堂展示') {
console.log('row.课堂展示', row.workcodes);
const workcodes = JSON.parse(row.workcodes);
classtaskObj.whiteboardObj = JSON.stringify(workcodes.json);
//
// console.log('课堂展示', classtaskObj);
return resolve(classtaskObj);
}
else if (row.worktype == '常规作业') {
if(isJson(row.workcodes)){
classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
//
// console.log('常规作业', classtaskObj);
return resolve(classtaskObj);
}
}
}
});
}

View File

@ -125,7 +125,7 @@ onMounted(() => {
watch(() => props.bookobj.levelSecondId, (newVal) => {
console.log(props.bookobj,'课程选择')
// console.log(props.bookobj,'')
})

View File

@ -106,7 +106,7 @@
:item="item"
:index="index"
@on-set="openSet"
@on-reSet="openReSet"
@on-reSet="openReSet"
@on-delhomework="delhomework"
>
</file-list-item>
@ -170,6 +170,7 @@ import { delClasswork, listEntpcourse } from '@/api/teaching/classwork'
import { updateClasscourse } from '@/api/teaching/classcourse'
import { getClassInfo, getSelfReserv, endClass } from '@/api/classManage'
import { useGetHomework } from '@/hooks/useGetHomework'
import { editListItem } from '@/hooks/useClassTask'
import { addEntpcoursefileReturnId } from '@/api/education/entpcoursefile'
import ClassReserv from '@/views/classManage/classReserv.vue'
import classStart from './container/class-start.vue' //
@ -647,35 +648,35 @@ export default {
this.$refs['reservDialog'].openDialog()
},
//
handleOutLink(key) {
if (key == 'homeWork') {
this.isOpenHomework = true
}
// key linkConfig.js
let configObj = outLink()[key]
let fullPath = configObj.fullPath
// urlunitId ID
if (key != 'standard' && key != 'aiModel') {
let unitId = this.uploadData.levelSecondId
? this.uploadData.levelSecondId
: this.uploadData.levelFirstId
let bookId = this.uploadData.textbookId;
if(fullPath.indexOf('?') == -1){
fullPath += `?unitId=${unitId}&bookId=${bookId}&openDialog=newClassTask`
}
else{
fullPath += `&unitId=${unitId}&bookId=${bookId}&openDialog=newClassTask`
}
}
//
// handleOutLink(key) {
// if (key == 'homeWork') {
// this.isOpenHomework = true
// }
// // key linkConfig.js
// let configObj = outLink()[key]
// let fullPath = configObj.fullPath
// // urlunitId ID
// if (key != 'standard' && key != 'aiModel') {
// let unitId = this.uploadData.levelSecondId
// ? this.uploadData.levelSecondId
// : this.uploadData.levelFirstId
// let bookId = this.uploadData.textbookId;
// if(fullPath.indexOf('?') == -1){
// fullPath += `?unitId=${unitId}&bookId=${bookId}&openDialog=newClassTask`
// }
// else{
// fullPath += `&unitId=${unitId}&bookId=${bookId}&openDialog=newClassTask`
// }
// }
//
ipcRenderer.send('openWindow', {
key,
fullPath: fullPath,
cookieData: { ...configObj.data }
})
},
// //
// ipcRenderer.send('openWindow', {
// key,
// fullPath: fullPath,
// cookieData: { ...configObj.data }
// })
// },
//
goNewClassTask(){
// router.push({ path: '/newClassTask' });
@ -694,24 +695,45 @@ export default {
},
//
openReSet(row) {
//
this.isOpenHomework = true;
// key linkConfig.js
let configObj = outLink()['homeWork']
let fullPath = configObj.fullPath
//
const courseObj = {
textbookId: this.uploadData.textbookId,
levelFirstId: this.uploadData.levelFirstId,
levelSecondId: this.uploadData.levelSecondId,
coursetitle: this.currentNode.itemtitle, // (/) ,
node: this.currentNode, //
}
console.log('courseObj', courseObj)
editListItem(row, courseObj).then((obj) => {
if(obj){
//
this.$router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(obj),
}
})
}
});
//---------------------
//
// this.isOpenHomework = true;
// // key linkConfig.js
// let configObj = outLink()['homeWork']
// let fullPath = configObj.fullPath
let unitId = this.uploadData.levelSecondId
? this.uploadData.levelSecondId
: this.uploadData.levelFirstId
let bookId = this.uploadData.textbookId;
fullPath += `&unitId=${unitId}&bookId=${bookId}&courseWorkId=${row.id}`
// let unitId = this.uploadData.levelSecondId
// ? this.uploadData.levelSecondId
// : this.uploadData.levelFirstId
// let bookId = this.uploadData.textbookId;
// fullPath += `&unitId=${unitId}&bookId=${bookId}&courseWorkId=${row.id}`
//
ipcRenderer.send('openWindow', {
key: 'homeWork',
fullPath: fullPath,
cookieData: { ...configObj.data }
})
// //
// ipcRenderer.send('openWindow', {
// key: 'homeWork',
// fullPath: fullPath,
// cookieData: { ...configObj.data }
// })
},
//
delhomework(item) {