Compare commits

..

No commits in common. "506f95060bca9dd6a37d4f2176dca16434b09e16" and "944d94a202bc83d3c3f1dae9ad4ed6c79ca43765" have entirely different histories.

7 changed files with 261 additions and 71 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,202 @@
import { nextTick, toRaw } from 'vue'
import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject'
const userStore = useUserStore()
const { edustage, edusubject } = userStore.user
let evaluationList = []; // 教材版本list
let subjectList = []; // 教材list
//当前教材ID
let curBookId = -1;
/**
* 外部链接初始化获取 跳转web端的 unitId 专用
* 暂时 初始化作业设计专用后期可能会取消
*/
export const useGetClassWork = async () => {
const params = {
edusubject,
edustage,
// entpcourseedituserid: userId,
itemgroup: 'textbook',
orderby: 'orderidx asc',
pageSize: 10000
}
if(localStorage.getItem('evaluationList')){
evaluationList = JSON.parse(localStorage.getItem('evaluationList'))
}else{
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList = rows
}
//获取教材版本
await getSubject()
//上册
/**
* 不区分上下册
* 2024/08/20调整
*/
// volumeOne = data.filter(item => item.level == 1 && item.semester == '上册')
// volumeTwo = data.filter(item => item.level == 1 && item.semester == '下册')
getTreeData()
}
//获取教材
const getSubject = async () => {
if(localStorage.getItem('subjectList')){
subjectList = JSON.parse(localStorage.getItem('subjectList'))
}else{
const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 10000,orderby: 'orderidx asc', })
// subjectList = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
subjectList = rows
localStorage.setItem('subjectList', JSON.stringify(subjectList))
}
// 默认第一个
if(!subjectList.length) return
// curBookName = subjectList[0].itemtitle
curBookId = subjectList[0].id
// curBookImg = BaseUrl + subjectList[0].avartar
// curBookPath = subjectList[0].fileurl
}
const getTreeData = () => {
//数据过滤
let upData = transData(evaluationList)
if(upData.length){
// treeData = [...upData]
}else{
// treeData = []
return
}
nextTick(() => {
// defaultExpandedKeys = [treeData[0].id]
// let currentNodeObj = {...getLastLevelData(upData)[0]}
let currentNodeId = getLastLevelData(upData)[0].id
let currentNodeName = getLastLevelData(upData)[0].label
let curNode = {
id: currentNodeId,
label: currentNodeName,
// itemtitle: currentNodeObj.itemtitle,
// edudegree: currentNodeObj.edudegree,
// edustage: currentNodeObj.edustage,
// edusubject: currentNodeObj.edusubject,
}
let parentNode = findParentByChildId(upData, currentNodeId)
curNode.parentNode = toRaw(parentNode)
let levelFirstId = '';
let levelSecondId = '';
if (curNode.parentNode) {
levelFirstId = curNode.parentNode.id
} else {
levelFirstId = curNode.id
levelSecondId = ''
}
let bookeId = curBookId
// 头部 教材分析、作业设计打开外部链接需要当前章节ID
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId}))
// const data = {
// textBook: {
// curBookId: curBookId,
// curBookName: curBookName,
// curBookImg: curBookImg,
// curBookPath: curBookPath
// },
// node: curNode
// }
// emit('changeBook', data)
})
}
const getLastLevelData = (tree) => {
let lastLevelData = [];
// 递归函数遍历树形结构
function traverseTree(nodes) {
nodes.forEach((node) => {
// 如果当前节点有子节点,继续遍历
if (node.children && node.children.length > 0) {
traverseTree(node.children);
} else {
// 如果没有子节点,说明是最后一层的节点
lastLevelData.push(node);
}
});
}
// 调用递归函数开始遍历
traverseTree(tree);
// 返回最后一层的数据
return lastLevelData;
}
// 根据id 拿到父节点数据
const findParentByChildId = (treeData, targetNodeId) => {
// 递归查找函数
// 遍历树中的每个节点
for (let node of treeData) {
// 检查当前节点的子节点是否包含目标子节点 ID
if (node.children && node.children.some(child => child.id === targetNodeId)) {
// 如果当前节点的某个子节点的 ID 匹配目标子节点 ID则当前节点即为父节点
return node;
}
// 如果当前节点没有匹配的子节点,则递归检查当前节点的子节点
if (node.children) {
let parentNode = findParentByChildId(node.children, targetNodeId);
if (parentNode) {
return parentNode;
}
}
}
// 如果未找到匹配的父节点,则返回 null 或者适当的默认值
return null;
}
const transData = (data) => {
let ary = []
data.forEach(item => {
let obj = {}
// 根据当前教材ID 过滤出对应的单元、章节
if (item.rootid == curBookId) {
if(item.level == 1){
obj.label = item.itemtitle
obj.id = item.id
obj.itemtitle = item.itemtitle
obj.edudegree = item.edudegree
obj.edustage = item.edustage
obj.edusubject = item.edusubject
let ary2 = []
evaluationList.forEach(el => {
let obj2 = {}
if (item.id == el.parentid) {
obj2 = {
label: el.itemtitle,
id: el.id,
itemtitle : el.itemtitle,
edudegree : el.edudegree,
edustage : el.edustage,
edusubject : el.edusubject,
}
ary2.push(obj2)
}
obj.children = ary2
})
ary.push(obj)
}
}
})
return ary
}

View File

@ -1,3 +1,8 @@
<!--
* @Author: 苦逼程序猿
* @Date: 2024-09-06 16:58:59
* @Warning: 千行代码Bug露锋芒
-->
<template>
<el-container class="class-reserv-wrap">
<div style="display: flex; justify-content: space-between;">
@ -66,8 +71,7 @@ import { useToolState } from '@/store/modules/tool'
import { getCurrentTime, getTomorrow } from '@/utils/date'
import useUserStore from '@/store/modules/user'
import useClassTaskStore from "@/store/modules/classTask";
import {createWindow} from '@/utils/tool'
import {sessionStore} from '@/utils/store'
import {sessionStore, createWindow} from '@/utils/tool'
import {throttle,debounce } from '@/utils/comm'
@ -116,7 +120,7 @@ const getData = async () => {
classWorkList.value = []
loading.value = true
// 1
// getClassList()
//getClassList()
// 2
await getClassWorkList()
// 3

View File

@ -101,7 +101,11 @@
<!-- 作业内容编辑 -->
<el-dialog v-model="workEdit" title="作业内容详情" width="90%" append-to-body>
<div v-if="currentTag=='学习目标定位'" style="display: flex;">
<degreeevolution :attainmentList="attainmentList" :show-class="true" :courseQualityList="courseQualityList"/>
</div>
<!-- 课标研读 目标设定 教材研读 框架梳理 学科定位 -->
<div v-if="currentTag=='习题训练'" :style="{'padding': '15px', 'overflow': 'auto'}">
<el-table :data="workConfObj.quizlist" style="width: 100%;">
<el-table-column type="index" width="60" />
@ -126,32 +130,6 @@
</el-table>
</div>
<div v-if="currentTag=='框架梳理'" :style="{'padding': '15px', 'overflow': 'auto'}">
<div style="margin: 5px; background-color: white">
<template v-for="(item) in workConfObj.chooseWorkLists" :key="item.id">
<div v-if="item.worktype==workConfObj.worktype">
<div class="choose-work">
<div class="choose-work-title">{{ item.worktype }}</div>
<div class="choose-work-content">
<div style="color: silver; display: flex;align-items: center;flex: 1;">
<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="display: flex;align-items: center;flex: 1;justify-content: flex-end;">
<el-button @click="prevRead(item)">预览</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
</div>
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
<div style="display: flex">
<!-- <el-button v-if="currentTag=='习题训练'" style="margin-right: auto" type="primary"
@ -159,6 +137,7 @@
<el-button type="primary" style="margin-left: auto" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"
@click="submitStudy('submit')"> </el-button>
</div>
</div>
</el-dialog>
@ -488,22 +467,8 @@ const handleWorkTitleEdit = (row, index) => {
};
// --
let classtaskObj = reactive({
id: '', //
bookName: '', //
uniquekey: '', //
title: '', //
worktype: '', //
quizlist: [], //
chooseWorkLists: [],// list
fileHomeworkList: [],// list
whiteboardObj: '',//
})
/**
* 作业内容-查看详情
* */
const handleWorkEdit = (row, index) =>{
// -
const handleWorkEdit = (row, index) =>{
console.log(row, index)
workEdit.value = true
currentWorkEdit.currentTask = row;
@ -584,8 +549,34 @@ let classtaskObj = reactive({
}
}
};
// --
let classtaskObj = reactive({
id: '', //
bookName: '', //
uniquekey: '', //
title: '', //
worktype: '', //
quizlist: [], //
chooseWorkLists: [],// list
fileHomeworkList: [],// list
whiteboardObj: '',//
})
// -
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
// this.newWorkSpace = true;
// this.newWorkSpaceEdit = true;
// this.currentTask = row;
// this.currentIndex = index;
// this.currentTag = row.worktype;
// this.attainmentList = row.workcodesList?.attlist;
// this.courseQualityList = row.workcodesList?.qualist;
//
// this.classWorkForm.uniquekey = this.currentTask.uniquekey;
// this.classWorkForm.title = this.currentTask.title;
//
// this.classWorkForm.worktype = this.currentTask.worktype;
//[]
var listCourseWork = [];
for (var i=0; i < row.entpcourseworklistarray.length; i++) {
@ -609,6 +600,11 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
if (row.worktype == '框架梳理') {
//
// let queryParams = {}
// queryParams.id = listCourseWork[0].id;
// queryParams.ppttype = '';
// queryParams.title = '';
// queryParams.filetype = 'draw';
const res = await getEvaluationclue(listCourseWork[0].id);
if ( res.data==null || res.data==undefined ) {
return;
@ -619,7 +615,6 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
res.data.score = listCourseWork[0].score;
classtaskObj.chooseWorkLists.push(res.data);
//
ToNewClassTask(classtaskObj);
}
else if (row.worktype == '习题训练') {
const ids = listCourseWork.map(item => item.id).join(",");
@ -641,7 +636,6 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
classtaskObj.quizlist = idres.rows;
//
ToNewClassTask(classtaskObj);
}
})
}
@ -650,29 +644,23 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
const workcodes = JSON.parse(row.workcodes);
classtaskObj.whiteboardObj = JSON.stringify(workcodes.json);
//
ToNewClassTask(classtaskObj);
}
else if (row.worktype == '常规作业') {
if(isJson(row.workcodes)){
classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
//
ToNewClassTask(classtaskObj);
}
}
//
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(classtaskObj),
}
})
}
};
/**
* 跳转 作业设计 进行编辑页面
* @param classtaskObj
*/
const ToNewClassTask = (classtaskObj) => {
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(classtaskObj),
}
})
}
const isJson = (str) => {
if (typeof str == 'string') {
@ -889,8 +877,6 @@ const handleWorkConfigUpdate = (key,row) => {
classWorkConfigForm.classWorkConfigList = [];
//
for (var i=0; i<clist.length; i++) {
// clist classWorkConfigForm.studentlist studentlistid
const clsStuList = classWorkConfigForm.studentlist&&classWorkConfigForm.studentlist.filter(item=>item.classid == clist[i].id);
classWorkConfigForm.classWorkConfigList.push({
id: 0,
classid: clist[i].id,
@ -906,7 +892,7 @@ const handleWorkConfigUpdate = (key,row) => {
workdate: '',
title: '',
workcodes: '',
studentlist: clsStuList,
studentlist: classWorkConfigForm.studentlist,
timelength: classWorkConfigForm.timelength,
weights: classWorkConfigForm.weights,
feedtype: classWorkConfigForm.feedtype,
@ -1020,7 +1006,6 @@ const handleTaskAssignToAllClassType = async() => {
var wForm = {};
wForm.classworkarray = JSON.stringify(ttt);
console.log(wForm,'推送的配置信息------------')
saveByClassWorkArray(wForm).then(response => {
console.log(response,'===============response');
// this.classWorkToStudent_Loading = false;

View File

@ -1,7 +1,7 @@
<template>
<el-row class="c-warp" :gutter="10">
<el-col class="left" :span="14">
<el-collapse class="c-item" v-model="activeTopic">
<el-collapse class="c-item" v-model="activeTopic" accordion>
<template v-for="(item, index) in dataList">
<el-collapse-item class="collapse-item" :name="index+1" :id="'collapse-'+(index+1)">
<template #title>

View File

@ -156,7 +156,7 @@ import ItemDialogScore from '@/views/classTask/container/item-dialog-score.vue'
// zdg:
import quizStats from '@/views/classTask/container/quizStats.vue'
import ClassOverview from '@/views/classTask/container/classOverview.vue'
import {sessionStore} from '@/utils/store'
import {sessionStore} from '@/utils/tool'
const { proxy } = getCurrentInstance()
const emit = defineEmits(['cle-click'])
@ -636,7 +636,7 @@ onMounted(() => {
// const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
const data = sessionStore.get('teachClassWorkItem');
console.log(data,'????????????????????' )
// console.log(data,'????????????????????' )
if(data){
openDialog(data)
}

View File

@ -35,8 +35,7 @@ import { ref, onMounted, watch } from 'vue'
import useUserStore from '@/store/modules/user'
import { homeworklist } from '@/api/teaching/classwork'
import { getCurrentTime, getTomorrow } from '@/utils/date'
import {sessionStore} from '@/utils/store'
import {createWindow} from '@/utils/tool'
import {sessionStore, createWindow} from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import {throttle,debounce } from '@/utils/comm'