教学实践:作业编辑外链改为pc版
This commit is contained in:
parent
2b25924213
commit
7c539614fd
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ onMounted(() => {
|
|||
|
||||
|
||||
watch(() => props.bookobj.levelSecondId, (newVal) => {
|
||||
console.log(props.bookobj,'课程选择')
|
||||
// console.log(props.bookobj,'课程选择')
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -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
|
||||
//打开作业 高考 url增加unitId 章节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
|
||||
// //打开作业 高考 url增加unitId 章节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) {
|
||||
|
|
Loading…
Reference in New Issue