Compare commits
No commits in common. "eba6727dc0930f20c195cd5eafe07c506388b416" and "24ce28f2e2384f654567bf6311134df972774b08" have entirely different histories.
eba6727dc0
...
24ce28f2e2
|
@ -259,10 +259,9 @@ const onSubmit = (formEl) => {
|
|||
classworkarray: JSON.stringify(ary)
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
setLoading.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emit('on-success', res)
|
||||
emit('on-success', res.data)
|
||||
cloneDialog(formEl)
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
@ -4,18 +4,13 @@ const overviewStore = defineStore(
|
|||
{
|
||||
state: () => {
|
||||
return {
|
||||
tableList:[],
|
||||
allData:[]
|
||||
tableList:[]
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
getTableList(data){
|
||||
this.tableList = [...data]
|
||||
},
|
||||
//整理的所有列表
|
||||
getAllData(data){
|
||||
this.allData = [...data]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
export default overviewStore
|
||||
|
|
|
@ -370,7 +370,7 @@ const eventHandles = (type, win) => {
|
|||
export const toLinkWeb = (path) => {
|
||||
const config = baseConfig()
|
||||
// console.log(config)
|
||||
const fullPath = ' https://localhost:7860/' + path
|
||||
const fullPath = config.url + path
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key: `win-${Date.now()}`,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
等级分布
|
||||
</div>
|
||||
</template>
|
||||
<Distribution></Distribution>
|
||||
<Distribution :stuHasAnswers=stuHasAnswers></Distribution>
|
||||
</el-card>
|
||||
</el-header>
|
||||
<el-main>
|
||||
|
@ -72,6 +72,7 @@ const props = defineProps({
|
|||
},
|
||||
})
|
||||
let studentList = ref([]) // 学生数据
|
||||
const stuHasAnswers = ref([]) // 已经答过题的学生不管对错
|
||||
|
||||
// 初始-数据处理
|
||||
const initData = () => {
|
||||
|
@ -80,7 +81,6 @@ const initData = () => {
|
|||
studentList.value = props.activeData.studentList || []
|
||||
const activeWorkFeedList = props.activeData.workFeedList || []
|
||||
const quizlist = props.activeData.quizlist || []
|
||||
const timeArr = groupByField(props.activeData.workFeedList,'entpcourseworkid')
|
||||
// 习题特殊处理
|
||||
let data = quizlist.map(o => {
|
||||
// 解析题选项
|
||||
|
@ -91,13 +91,6 @@ const initData = () => {
|
|||
let hasAnswers= [] // 答过题的学生
|
||||
let timeAnalyse = [] // 平均时长和编号
|
||||
const quizFeedList = activeWorkFeedList.filter(f => f.entpcourseworkid == o.id) // 做该题的列表
|
||||
// 获取所有的做题时间
|
||||
timeArr.forEach((item,index) => {
|
||||
const arr = item.reduce((acc, cur) => {
|
||||
return acc + (cur.timelength ? Number(cur.timelength) : 0);
|
||||
},0)
|
||||
timeAnalyse.push(arr)
|
||||
})
|
||||
let children = []
|
||||
const allStudents = [];
|
||||
if (o.worktype == '单选题') { // '单选题','多选题'
|
||||
|
@ -222,10 +215,12 @@ const initData = () => {
|
|||
}
|
||||
|
||||
// def: 原始题数据 type 类型 active: 选中 points: 得分率, accSum 题解答人数
|
||||
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, rightSum, children,hasAnswers,timeAnalyse }
|
||||
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, rightSum, children,hasAnswers }
|
||||
})
|
||||
console.log('获取数据: ', data)
|
||||
if (data.length === 0) return
|
||||
useOverview.getAllData([...data])
|
||||
if (!data[0].hasAnswers[0]) return
|
||||
stuHasAnswers.value = [...data[0].hasAnswers]
|
||||
}
|
||||
// 百分比现在 0-100
|
||||
const percent = v => v > 1 ? 1 : v < 0 ? 0 : Math.round(v * 100)
|
||||
|
@ -238,20 +233,6 @@ const isJson = str => {if(typeof str == 'string'){
|
|||
if(typeof res == 'object' && res) return true
|
||||
} catch (error) {}}return false
|
||||
}
|
||||
// 获取到学生的平均回答时间
|
||||
const groupByField = (array, field) => {
|
||||
const groupedMap = {};
|
||||
array.forEach(item => {
|
||||
const key = item[field];
|
||||
if (!groupedMap[key]) {
|
||||
groupedMap[key] = [];
|
||||
}
|
||||
groupedMap[key].push(item);
|
||||
});
|
||||
|
||||
// 将映射对象转换为二维数组
|
||||
return Object.values(groupedMap);
|
||||
}
|
||||
|
||||
watch(() => props.tableList,() => {
|
||||
useOverview.getTableList(props.tableList)
|
||||
|
|
|
@ -3,19 +3,26 @@
|
|||
<el-container>
|
||||
<el-aside width="400px">
|
||||
<!-- 柱状图学情分布-->
|
||||
<Echarts></Echarts>
|
||||
<Echarts :stuHasAnswers=stuHasAnswers></Echarts>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<!-- 列表分布的人员-->
|
||||
<StuList></StuList>
|
||||
<StuList :stuHasAnswers=stuHasAnswers></StuList>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from 'vue'
|
||||
import Echarts from './distribution/echarts.vue'
|
||||
import StuList from "./distribution/stuList.vue";
|
||||
const props = defineProps({
|
||||
stuHasAnswers: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, nextTick, watch } from 'vue';
|
||||
import { ref, nextTick, watch, inject,watchEffect } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
import overviewStore from '@/store/modules/overview';
|
||||
const useOverview = overviewStore();
|
||||
|
@ -13,6 +13,13 @@ const useOverview = overviewStore();
|
|||
// 获取图表容器的引用
|
||||
const chartRef = ref(null);
|
||||
|
||||
const props = defineProps({
|
||||
stuHasAnswers: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
// 数据源
|
||||
const dataList = ref([
|
||||
{ name: '完美', value: 0, rating: 1, max: 100, min: 100 },
|
||||
|
@ -104,7 +111,7 @@ const showEcharts = () => {
|
|||
}
|
||||
//执行
|
||||
watch(() => useOverview.tableList, () => {
|
||||
hasStudents.value = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid)).map(item => item);
|
||||
hasStudents.value = useOverview.tableList.filter(item => props.stuHasAnswers.includes(item.studentid)).map(item => item);
|
||||
showEcharts();
|
||||
nextTick(() => {
|
||||
initChart();
|
||||
|
|
|
@ -22,6 +22,12 @@ import overviewStore from '@/store/modules/overview'
|
|||
const useOverview = overviewStore()
|
||||
const tabPosition = ref('left')
|
||||
|
||||
const props = defineProps({
|
||||
stuHasAnswers: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
//答过题的学生才进行统计
|
||||
const hasStudents = ref([])
|
||||
const leftList = ref([
|
||||
|
@ -81,7 +87,7 @@ const showStudents = (index) => {
|
|||
})
|
||||
}
|
||||
watch(() => useOverview.tableList, () => {
|
||||
hasStudents.value = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid)).map(item => item);
|
||||
hasStudents.value = useOverview.tableList.filter(item => props.stuHasAnswers.includes(item.studentid)).map(item => item);
|
||||
showStudents(0)
|
||||
},{deep: true})
|
||||
</script>
|
||||
|
|
|
@ -14,124 +14,156 @@ const useOverview = overviewStore()
|
|||
// 获取图表容器的引用
|
||||
const chartRef = ref(null);
|
||||
|
||||
const estimateTime = ref([]);
|
||||
|
||||
const avaterTime = ref([]);
|
||||
// x轴
|
||||
const xAxisData = ref([]);
|
||||
|
||||
// 获得 y 轴的数据
|
||||
const getyAxisData = () => {
|
||||
estimateTime.value = [];
|
||||
avaterTime.value = [];
|
||||
useOverview.tableList.forEach(item => {
|
||||
if (item.rating !== 0) {
|
||||
estimateTime.value.push({
|
||||
name: item.scoingRate ? item.scoingRate + '%' : 0 + '%',
|
||||
value: Number(item.timelength)
|
||||
});
|
||||
avaterTime.value.push({
|
||||
name: item.scoingRate ? item.scoingRate + '%' : 0 + '%',
|
||||
value: Number(item.finishtimelength)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// x 轴排序
|
||||
xAxisData.value.sort((a, b) => {
|
||||
const aPercentage = parseInt(a.replace('%', ''));
|
||||
const bPercentage = parseInt(b.replace('%', ''));
|
||||
return aPercentage - bPercentage;
|
||||
});
|
||||
|
||||
// 生成 x 轴数据
|
||||
generateXAxisData();
|
||||
};
|
||||
|
||||
// 生成 x 轴数据
|
||||
function generateXAxisData() {
|
||||
// 超过8条开始计算x轴
|
||||
if(estimateTime.value.length > 8){
|
||||
const minScoreRate = 0;
|
||||
const maxScoreRate = 100;
|
||||
const numPoints = 6; // x 轴上的点数
|
||||
const step = (maxScoreRate - minScoreRate) / (numPoints - 1);
|
||||
|
||||
xAxisData.value = [];
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
const scoreRate = minScoreRate + i * step;
|
||||
xAxisData.value.push(scoreRate + '%');
|
||||
}
|
||||
}else{
|
||||
let uniqueXAxisData = new Set();
|
||||
estimateTime.value.forEach(item => {
|
||||
// 添加元素到 Set 中,自动处理重复问题
|
||||
uniqueXAxisData.add(item.name);
|
||||
});
|
||||
// 将 Set 转换成数组
|
||||
xAxisData.value = Array.from(uniqueXAxisData);
|
||||
// 对数组进行排序
|
||||
xAxisData.value.sort((a, b) => {
|
||||
const aPercentage = parseInt(a.replace('%', ''));
|
||||
const bPercentage = parseInt(b.replace('%', ''));
|
||||
return aPercentage - bPercentage;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化图表
|
||||
function initChart() {
|
||||
const myChart = echarts.init(chartRef.value);
|
||||
// 指定图表的配置项和数据
|
||||
let option = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
||||
},
|
||||
formatter: function(parms) {
|
||||
let str =
|
||||
parms[0].axisValue +
|
||||
"</br>" +
|
||||
parms[0].marker +
|
||||
"平均用时:" +
|
||||
parms[0].value + 's'
|
||||
return str;
|
||||
},
|
||||
|
||||
const options = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['预估时长', '平均用时']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
top: '10%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
name: '得分率',
|
||||
nameTextStyle: {
|
||||
color: '#999',
|
||||
fontSize: 12,
|
||||
padding: [0, 0, 10, 0]
|
||||
},
|
||||
data: xAxisData.value
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: '作业时长',
|
||||
nameTextStyle: {
|
||||
color: '#999',
|
||||
fontSize: 12,
|
||||
padding: [0, 0, 10, 0]
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: `预估时长`,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'circle',
|
||||
symbolSize: 10,
|
||||
lineStyle: {
|
||||
color: '#5793f3'
|
||||
},
|
||||
textStyle: {
|
||||
color: "#333",
|
||||
data: estimateTime.value.map(item => ({
|
||||
name: item.name,
|
||||
value: item.value
|
||||
}))
|
||||
},
|
||||
{
|
||||
name: `平均用时`,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'circle',
|
||||
symbolSize: 10,
|
||||
lineStyle: {
|
||||
color: '#d14a61'
|
||||
},
|
||||
color: ["#7BA9FA", "#4690FA"],
|
||||
grid: {
|
||||
containLabel: true,
|
||||
left: "10%",
|
||||
top: "20%",
|
||||
bottom: "10%",
|
||||
right: "10%",
|
||||
},
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: getXValue(),
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#333",
|
||||
},
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 20, //刻度标签与轴线之间的距离。
|
||||
textStyle: {
|
||||
color: "#000",
|
||||
},
|
||||
},
|
||||
name:'题目编号'
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "#B5B5B5",
|
||||
},
|
||||
},
|
||||
name:'平均时长',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
// 使用深浅的间隔色
|
||||
color: ["#B5B5B5"],
|
||||
type: "dashed",
|
||||
opacity: 0.5,
|
||||
},
|
||||
},
|
||||
axisLabel: {},
|
||||
},
|
||||
series: [{
|
||||
data: getYValue(),
|
||||
stack: "zs",
|
||||
type: "bar",
|
||||
barMaxWidth: "auto",
|
||||
barWidth: 60,
|
||||
itemStyle: {
|
||||
color: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
type: "linear",
|
||||
global: false,
|
||||
colorStops: [{
|
||||
offset: 0,
|
||||
color: "#5EA1FF",
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: "#90BEFF",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
myChart.setOption(option);
|
||||
data: avaterTime.value.map(item => ({
|
||||
name: item.name,
|
||||
value: item.value
|
||||
}))
|
||||
}
|
||||
]
|
||||
};
|
||||
myChart.setOption(options);
|
||||
}
|
||||
//获取平均时长纵坐标
|
||||
const getYValue = () => {
|
||||
const arr = [...useOverview.allData[0].timeAnalyse]
|
||||
const num = useOverview.allData[0].hasAnswers.length
|
||||
|
||||
return arr.map(item => {
|
||||
return item ? (item / num).toFixed(2) : 0
|
||||
})
|
||||
//获取平均时长
|
||||
const getAvaterTime = () => {
|
||||
return useOverview.tableList.reduce((acc, cur) => acc + cur.finishtimelength, 0) / useOverview.tableList.length;
|
||||
}
|
||||
// 获取横纵轴坐标数据
|
||||
const getXValue = () => {
|
||||
return useOverview.allData.map(item => item.id)
|
||||
const getEstimateTime = () => {
|
||||
return useOverview.tableList.reduce((acc, cur) => acc + cur.timelength, 0) / useOverview.tableList.length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
watch(() => useOverview.tableList,() => {
|
||||
//获取横纵坐标
|
||||
getyAxisData()
|
||||
nextTick(() => {
|
||||
initChart();
|
||||
})
|
||||
|
|
|
@ -85,11 +85,10 @@ import FileImage from '@/components/file-image/index.vue'
|
|||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import {createWindow} from '@/utils/tool'
|
||||
import Lesson from './lesson.vue';
|
||||
import { parseCataByNode } from '@/utils/talkFile'
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
||||
import { createHomework, getClassWorkList, getStudentClassWorkData } from '../createHomework'
|
||||
import { createHomework } from '../createHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -112,12 +111,10 @@ const curNode = reactive({
|
|||
})
|
||||
|
||||
const props = defineProps(['curNode'])
|
||||
const emit = defineEmits(['closeActive'])
|
||||
|
||||
|
||||
|
||||
const sendHomework = (row,type) => {
|
||||
|
||||
|
||||
if(type == 'item'){
|
||||
// 布置推送单个作业
|
||||
curRow.value = [row]
|
||||
|
@ -131,28 +128,11 @@ const sendHomework = (row,type) => {
|
|||
const closeHomework = async() => {
|
||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||
}
|
||||
|
||||
|
||||
// 推送成功
|
||||
const successHomework = async (data)=>{
|
||||
// data.msg
|
||||
const successHomework = (data)=>{
|
||||
// console.log('推送成功', data)
|
||||
// 发送im消息-推送作业(app|平板)
|
||||
// ipcMsgInvoke('im-chat:msg', data, MsgEnum.HEADS.MSG_0016)
|
||||
|
||||
/**
|
||||
* 推送成功 打开作业批改
|
||||
* 2024/10/23
|
||||
* 以下两个函数 代码 参照"作业批改" 页面
|
||||
*/
|
||||
let result = await getClassWorkList(data.msg)
|
||||
result = await getStudentClassWorkData()
|
||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
emit('closeActive')
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'}); // 调用新窗口批改页面
|
||||
|
||||
|
||||
}
|
||||
// 章节目录change
|
||||
const changeChapter = async (data)=>{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<div class="c-popover" :style="`--top: ${topPos}px;--height:${hPost}px;`" v-show="isVisible">
|
||||
<div class="content" v-if="isVisible">
|
||||
<slot name="content">
|
||||
<homework v-if="activeObj?.prop === 'resource'" :curNode="curNode" @closeActive="closeActive" />
|
||||
<homework v-if="activeObj?.prop === 'resource'" :curNode="curNode" />
|
||||
<span v-else style="color:red;">{{activeObj}}</span>
|
||||
</slot>
|
||||
</div>
|
||||
|
@ -101,10 +101,6 @@ const clickHandel = (o, e) => {
|
|||
}
|
||||
emit('change', o)
|
||||
}
|
||||
|
||||
const closeActive = () =>{
|
||||
isVisible.value = false
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.warp{
|
||||
|
|
|
@ -1,226 +1,37 @@
|
|||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { addClassworkReturnId } from '@/api/teaching/classwork'
|
||||
import { listClassworkdata } from '@/api/classTask'
|
||||
import { homeworklist } from '@/api/teaching/classwork'
|
||||
|
||||
export const createHomework = ({ uniquekey, evalid, data, entpcourseid }) =>{
|
||||
const usertore = useUserStore().user
|
||||
|
||||
var formObj = {};
|
||||
formObj.id = 0;
|
||||
|
||||
export const createHomework = ({ uniquekey, evalid, data, entpcourseid }) => {
|
||||
const usertore = useUserStore().user
|
||||
|
||||
var formObj = {}
|
||||
formObj.id = 0
|
||||
|
||||
formObj.deaddate = ''
|
||||
formObj.entpid = usertore.deptId
|
||||
formObj.level = 1
|
||||
formObj.parentid = 0
|
||||
formObj.worktype = '常规作业'
|
||||
formObj.workkey = ''
|
||||
formObj.worktag = ''
|
||||
|
||||
formObj.uniquekey = uniquekey
|
||||
|
||||
formObj.classid = 0
|
||||
formObj.classcourseid = 0
|
||||
|
||||
formObj.entpcourseid = entpcourseid
|
||||
|
||||
formObj.slideid = 0
|
||||
|
||||
formObj.workcodes = JSON.stringify(data)
|
||||
|
||||
formObj.edusubject = usertore.edusubject
|
||||
formObj.evalid = evalid
|
||||
|
||||
formObj.edustage = usertore.edustage
|
||||
formObj.status = ''
|
||||
formObj.edituserid = usertore.userId
|
||||
formObj.entpcourseworklist = JSON.stringify([{ id: -2, score: '10' }])
|
||||
return addClassworkReturnId(formObj)
|
||||
}
|
||||
|
||||
let classWorkList = []
|
||||
|
||||
/**
|
||||
* 获取班级作业
|
||||
*/
|
||||
export const getClassWorkList = async (id) => {
|
||||
// 班级作业数据,包含多个班级 homeworklist
|
||||
const response = await homeworklist({ id })
|
||||
|
||||
/**
|
||||
* 2024-10-17 由于 后面截止时间加了 时分,特加判断
|
||||
* 1、进行中、以前是以明天判断。现改为传当天的日期,并根据当前日期的时分与截止日期进行判断,
|
||||
* 2、已结束、以前默认是以明天判断。现依然以明天为判断,并根据当前日期时分大于截止日期时分判断。
|
||||
*/
|
||||
|
||||
let list = response.rows
|
||||
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
// 初始化部分新增字段值
|
||||
list[i].workdatalist = []
|
||||
list[i].workdatacount = 0 // 人数
|
||||
list[i].workdatalistVisible = false
|
||||
list[i].workdatafeedbackcount = 0 // 已交人数
|
||||
list[i].feedtimelength = 0
|
||||
list[i].rightAnswerCount = 0
|
||||
list[i].scoingRate = 0 + '%' // 得分率
|
||||
list[i].averagetime = 0 // 平均用时
|
||||
|
||||
// ----------------------------------------------
|
||||
// 处理任务类型的UI
|
||||
if (list[i].worktype == '学习目标定位') {
|
||||
list[i].workclass = 'success'
|
||||
list[i].workcodesList = JSON.parse(list[i].workcodes)
|
||||
} else if (list[i].worktype == '教材研读') {
|
||||
list[i].workclass = 'primary'
|
||||
} else if (list[i].worktype == '框架梳理') {
|
||||
list[i].workclass = 'warning'
|
||||
} else if (list[i].worktype == '学科定位') {
|
||||
list[i].workclass = 'info'
|
||||
} else if (list[i].worktype == '习题训练') {
|
||||
list[i].workclass = 'danger'
|
||||
} else {
|
||||
list[i].workclass = ''
|
||||
}
|
||||
// 如果是习题训练任务,则检查一共有多少道
|
||||
if (list[i].entpcourseworklist != '') {
|
||||
list[i].entpcourseworklistarray = JSON.parse('[' + list[i].entpcourseworklist + ']')
|
||||
} else {
|
||||
list[i].entpcourseworklistarray = []
|
||||
}
|
||||
// 根据 classworkdatastudentids 初始化判断分配的人数
|
||||
if (
|
||||
list[i].classworkdatastudentids != '' &&
|
||||
list[i].classworkdatastudentids != null &&
|
||||
list[i].classworkdatastudentids != 'null'
|
||||
) {
|
||||
const stuList = JSON.parse('[' + list[i].classworkdatastudentids + ']')
|
||||
list[i].workdatacount = stuList.length
|
||||
}
|
||||
}
|
||||
// 显示分配人数(workdatacount)>0 的
|
||||
if (list && list.length > 0) {
|
||||
classWorkList = list && list.filter((item) => item.workdatacount > 0)
|
||||
//TODO: 这里没分页,貌似这个 total 不重要,后续看
|
||||
} else {
|
||||
classWorkList = []
|
||||
}
|
||||
|
||||
return classWorkList
|
||||
}
|
||||
|
||||
export const getStudentClassWorkData = async () => {
|
||||
const ids = classWorkList.map((item) => item.id).join(',')
|
||||
if (ids == '') {
|
||||
return
|
||||
}
|
||||
const res = await listClassworkdata({
|
||||
classworkids: ids,
|
||||
pageSize: 1000
|
||||
})
|
||||
|
||||
for (var t = 0; t < classWorkList.length; t++) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
if (
|
||||
res.rows[i].classworkid == classWorkList[t].id &&
|
||||
res.rows[i].finishtimelength != '0'
|
||||
) {
|
||||
console.log('==================')
|
||||
// 有几个学生完成/正在完成学习任务
|
||||
// 至少resultcount不是0
|
||||
classWorkList[t].workdatafeedbackcount++
|
||||
|
||||
// 在参与学习任务的人中,汇总计算用时
|
||||
classWorkList[t].feedtimelength += parseInt(res.rows[i].finishtimelength)
|
||||
|
||||
// 计算得分率
|
||||
if (
|
||||
res.rows[i].classworkevallist != '' &&
|
||||
res.rows[i].classworkevallist != null &&
|
||||
res.rows[i].classworkevallist != 'null'
|
||||
) {
|
||||
let replacedString = res.rows[i].classworkevallist.replace(/""/g, '"')
|
||||
// 将标签中双引号改为转义, 测试数据: "{\"id\":172907, \"rating\":0, \"teacherRating\":0, \"entpcourseworkid\":358520, \"feedcontent\":\"④①⑤③②\", \"score\":4, \"rightanswer\":\"④①⑤③②\"},{\"id\":172908, \"rating\":0, \"teacherRating\":0, \"entpcourseworkid\":358521, \"feedcontent\":\"气壮山威,鲲鹏展翅楚云飞\", \"score\":4, \"rightanswer\":\"志远天高,春风杨柳麓山青\"},{\"id\":172909, \"rating\":0, \"teacherRating\":0, \"entpcourseworkid\":363096, \"feedcontent\":\"《红烛》化用“蜡矩”这一古典意象,赋予它新的含义,赞美了红烛以“蜡炬成灰”来点亮世界的奉献精神。\", \"score\":4, \"rightanswer\":\"《立在地球边上放号》中,全诗采用间接抒情的方式,描绘了太平洋的浪潮,吟唱了一曲惊心动魄的力的颂歌,意在赞美摧毁旧世界、创造新生活的“五四”精神。\"},{\"id\":172910, \"rating\":0, \"teacherRating\":0, \"entpcourseworkid\":363098, \"feedcontent\":\"毛泽东重游橘子洲,面对如画的秋色和大好的革命形势,回忆过去战斗的岁月,不禁心潮起伏,<bdo class=\"mathjye-underpoint2\">浮想联翩</bdo>。\", \"score\":4, \"rightanswer\":\"毛泽东重游橘子洲,面对如画的秋色和大好的革命形势,回忆过去战斗的岁月,不禁心潮起伏,<bdo class=\"mathjye-underpoint2\">浮想联翩</bdo>。\"},{\"id\":172911, \"rating\":0, \"teacherRating\":0, \"entpcourseworkid\":363100, \"feedcontent\":\"毛泽东重游橘子洲,面对如画的秋色和大好的革命形势,回忆过去战斗的岁月,不禁心潮起伏,<bdo class=\"mathjye-underpoint2\">浮想联翩</bdo>。\", \"score\":4, \"rightanswer\":\"毛泽东重游橘子洲,面对如画的秋色和大好的革命形势,回忆过去战斗的岁月,不禁心潮起伏,<bdo class=\"mathjye-underpoint2\">浮想联翩</bdo>。\"}"
|
||||
replacedString = escapeHtmlQuotes(res.rows[i].classworkevallist).replace(
|
||||
/"(\[.*\])"/g,
|
||||
'$1'
|
||||
)
|
||||
replacedString = escapeHtmlQuotes(res.rows[i].classworkevallist)
|
||||
var evalarray
|
||||
try {
|
||||
evalarray = JSON.parse('[' + res.rows[i].classworkevallist + ']')
|
||||
} catch {
|
||||
evalarray = JSON.parse('[' + replacedString + ']')
|
||||
}
|
||||
|
||||
for (var e = 0; e < evalarray.length; e++) {
|
||||
if (res.rows[i].worktype == '常规作业') {
|
||||
evalarray[e].feedcontent = escapeHtmlQuotes(evalarray[e].feedcontent).replace(
|
||||
/"(\[.*\])"/g,
|
||||
'$1'
|
||||
)
|
||||
evalarray[e].feedcontent = escapeHtmlQuotes(evalarray[e].feedcontent)
|
||||
}
|
||||
if (evalarray[e].feedcontent == evalarray[e].rightanswer) {
|
||||
// 正确,得分
|
||||
classWorkList[t].rightAnswerCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 当前这个学习任务,共推送给了几个学生,workdatacount
|
||||
if (res.rows[i].classworkid == classWorkList[t].id) {
|
||||
classWorkList[t].workdatalist.push(res.rows[i])
|
||||
}
|
||||
}
|
||||
// 计算完成进度 workdatacount人数要大于0
|
||||
if (
|
||||
classWorkList[t].workdataresultcount > 0 &&
|
||||
classWorkList[t].workdatacount > 0
|
||||
) {
|
||||
classWorkList[t].finishpercent = parseInt(
|
||||
(classWorkList[t].workdataresultcount / classWorkList[t].workdatacount) * 100
|
||||
)
|
||||
} else {
|
||||
classWorkList[t].finishpercent = 0
|
||||
}
|
||||
|
||||
// 以下四个参数,都要计算
|
||||
// 2024-04-12,酉阳,by jackyshen
|
||||
|
||||
// 计算参与学习任务的平均用时
|
||||
if (classWorkList[t].workdatafeedbackcount > 0) {
|
||||
classWorkList[t].averagetime = Math.ceil(
|
||||
classWorkList[t].feedtimelength / classWorkList[t].workdatafeedbackcount / 60
|
||||
).toFixed(0)
|
||||
} else {
|
||||
classWorkList[t].averagetime = 0
|
||||
}
|
||||
|
||||
// 计算批阅异常,需要获取每个题目的类型,找出主观题
|
||||
// 暂缓
|
||||
|
||||
// 计算平均得分率: 正确题数/(题目总数*学生人数)*100
|
||||
if (
|
||||
classWorkList[t].entpcourseworklistarray &&
|
||||
classWorkList[t].entpcourseworklistarray.length > 0
|
||||
) {
|
||||
var dd =
|
||||
(classWorkList[t].rightAnswerCount /
|
||||
(classWorkList[t].entpcourseworklistarray.length *
|
||||
classWorkList[t].workdatacount)) *
|
||||
100
|
||||
classWorkList[t].scoingRate = dd.toFixed(0) + '%'
|
||||
} else {
|
||||
classWorkList[t].scoingRate = '0%'
|
||||
}
|
||||
formObj.deaddate = '';
|
||||
formObj.entpid = usertore.deptId;
|
||||
formObj.level = 1;
|
||||
formObj.parentid = 0;
|
||||
formObj.worktype = '常规作业';
|
||||
formObj.workkey = '';
|
||||
formObj.worktag = '';
|
||||
|
||||
formObj.uniquekey = uniquekey;
|
||||
|
||||
// 设定典型作答,需要获取每个题目的类型,找出主观题
|
||||
// 暂缓
|
||||
}
|
||||
return classWorkList
|
||||
formObj.classid = 0;
|
||||
formObj.classcourseid = 0;
|
||||
|
||||
formObj.entpcourseid = entpcourseid;
|
||||
|
||||
formObj.slideid = 0;
|
||||
|
||||
formObj.workcodes = JSON.stringify(data);
|
||||
|
||||
formObj.edusubject = usertore.edusubject;
|
||||
formObj.evalid = evalid
|
||||
|
||||
formObj.edustage = usertore.edustage;
|
||||
formObj.status = '';
|
||||
formObj.edituserid = usertore.userId;
|
||||
formObj.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
|
||||
return addClassworkReturnId(formObj)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue