Compare commits
4 Commits
24ce28f2e2
...
eba6727dc0
Author | SHA1 | Date |
---|---|---|
小杨 | eba6727dc0 | |
lyc | 8a759479bd | |
lyc | e891259413 | |
yangws | 14340e211d |
|
@ -259,9 +259,10 @@ const onSubmit = (formEl) => {
|
||||||
classworkarray: JSON.stringify(ary)
|
classworkarray: JSON.stringify(ary)
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
setLoading.value = false
|
setLoading.value = false
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success('操作成功')
|
||||||
emit('on-success', res.data)
|
emit('on-success', res)
|
||||||
cloneDialog(formEl)
|
cloneDialog(formEl)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
|
@ -4,13 +4,18 @@ const overviewStore = defineStore(
|
||||||
{
|
{
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
tableList:[]
|
tableList:[],
|
||||||
|
allData:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
getTableList(data){
|
getTableList(data){
|
||||||
this.tableList = [...data]
|
this.tableList = [...data]
|
||||||
}
|
},
|
||||||
|
//整理的所有列表
|
||||||
|
getAllData(data){
|
||||||
|
this.allData = [...data]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default overviewStore
|
export default overviewStore
|
||||||
|
|
|
@ -370,7 +370,7 @@ const eventHandles = (type, win) => {
|
||||||
export const toLinkWeb = (path) => {
|
export const toLinkWeb = (path) => {
|
||||||
const config = baseConfig()
|
const config = baseConfig()
|
||||||
// console.log(config)
|
// console.log(config)
|
||||||
const fullPath = config.url + path
|
const fullPath = ' https://localhost:7860/' + path
|
||||||
// 通知主进程
|
// 通知主进程
|
||||||
ipcRenderer.send('openWindow', {
|
ipcRenderer.send('openWindow', {
|
||||||
key: `win-${Date.now()}`,
|
key: `win-${Date.now()}`,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
等级分布
|
等级分布
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<Distribution :stuHasAnswers=stuHasAnswers></Distribution>
|
<Distribution></Distribution>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
|
@ -72,7 +72,6 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let studentList = ref([]) // 学生数据
|
let studentList = ref([]) // 学生数据
|
||||||
const stuHasAnswers = ref([]) // 已经答过题的学生不管对错
|
|
||||||
|
|
||||||
// 初始-数据处理
|
// 初始-数据处理
|
||||||
const initData = () => {
|
const initData = () => {
|
||||||
|
@ -81,6 +80,7 @@ const initData = () => {
|
||||||
studentList.value = props.activeData.studentList || []
|
studentList.value = props.activeData.studentList || []
|
||||||
const activeWorkFeedList = props.activeData.workFeedList || []
|
const activeWorkFeedList = props.activeData.workFeedList || []
|
||||||
const quizlist = props.activeData.quizlist || []
|
const quizlist = props.activeData.quizlist || []
|
||||||
|
const timeArr = groupByField(props.activeData.workFeedList,'entpcourseworkid')
|
||||||
// 习题特殊处理
|
// 习题特殊处理
|
||||||
let data = quizlist.map(o => {
|
let data = quizlist.map(o => {
|
||||||
// 解析题选项
|
// 解析题选项
|
||||||
|
@ -91,6 +91,13 @@ const initData = () => {
|
||||||
let hasAnswers= [] // 答过题的学生
|
let hasAnswers= [] // 答过题的学生
|
||||||
let timeAnalyse = [] // 平均时长和编号
|
let timeAnalyse = [] // 平均时长和编号
|
||||||
const quizFeedList = activeWorkFeedList.filter(f => f.entpcourseworkid == o.id) // 做该题的列表
|
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 = []
|
let children = []
|
||||||
const allStudents = [];
|
const allStudents = [];
|
||||||
if (o.worktype == '单选题') { // '单选题','多选题'
|
if (o.worktype == '单选题') { // '单选题','多选题'
|
||||||
|
@ -215,12 +222,10 @@ const initData = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// def: 原始题数据 type 类型 active: 选中 points: 得分率, accSum 题解答人数
|
// def: 原始题数据 type 类型 active: 选中 points: 得分率, accSum 题解答人数
|
||||||
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, rightSum, children,hasAnswers }
|
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, rightSum, children,hasAnswers,timeAnalyse }
|
||||||
})
|
})
|
||||||
console.log('获取数据: ', data)
|
|
||||||
if (data.length === 0) return
|
if (data.length === 0) return
|
||||||
if (!data[0].hasAnswers[0]) return
|
useOverview.getAllData([...data])
|
||||||
stuHasAnswers.value = [...data[0].hasAnswers]
|
|
||||||
}
|
}
|
||||||
// 百分比现在 0-100
|
// 百分比现在 0-100
|
||||||
const percent = v => v > 1 ? 1 : v < 0 ? 0 : Math.round(v * 100)
|
const percent = v => v > 1 ? 1 : v < 0 ? 0 : Math.round(v * 100)
|
||||||
|
@ -233,6 +238,20 @@ const isJson = str => {if(typeof str == 'string'){
|
||||||
if(typeof res == 'object' && res) return true
|
if(typeof res == 'object' && res) return true
|
||||||
} catch (error) {}}return false
|
} 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,() => {
|
watch(() => props.tableList,() => {
|
||||||
useOverview.getTableList(props.tableList)
|
useOverview.getTableList(props.tableList)
|
||||||
|
|
|
@ -3,26 +3,19 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside width="400px">
|
<el-aside width="400px">
|
||||||
<!-- 柱状图学情分布-->
|
<!-- 柱状图学情分布-->
|
||||||
<Echarts :stuHasAnswers=stuHasAnswers></Echarts>
|
<Echarts></Echarts>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main>
|
<el-main>
|
||||||
<!-- 列表分布的人员-->
|
<!-- 列表分布的人员-->
|
||||||
<StuList :stuHasAnswers=stuHasAnswers></StuList>
|
<StuList></StuList>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps } from 'vue'
|
|
||||||
import Echarts from './distribution/echarts.vue'
|
import Echarts from './distribution/echarts.vue'
|
||||||
import StuList from "./distribution/stuList.vue";
|
import StuList from "./distribution/stuList.vue";
|
||||||
const props = defineProps({
|
|
||||||
stuHasAnswers: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick, watch, inject,watchEffect } from 'vue';
|
import { ref, nextTick, watch } from 'vue';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
import overviewStore from '@/store/modules/overview';
|
import overviewStore from '@/store/modules/overview';
|
||||||
const useOverview = overviewStore();
|
const useOverview = overviewStore();
|
||||||
|
@ -13,13 +13,6 @@ const useOverview = overviewStore();
|
||||||
// 获取图表容器的引用
|
// 获取图表容器的引用
|
||||||
const chartRef = ref(null);
|
const chartRef = ref(null);
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
stuHasAnswers: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 数据源
|
// 数据源
|
||||||
const dataList = ref([
|
const dataList = ref([
|
||||||
{ name: '完美', value: 0, rating: 1, max: 100, min: 100 },
|
{ name: '完美', value: 0, rating: 1, max: 100, min: 100 },
|
||||||
|
@ -111,7 +104,7 @@ const showEcharts = () => {
|
||||||
}
|
}
|
||||||
//执行
|
//执行
|
||||||
watch(() => useOverview.tableList, () => {
|
watch(() => useOverview.tableList, () => {
|
||||||
hasStudents.value = useOverview.tableList.filter(item => props.stuHasAnswers.includes(item.studentid)).map(item => item);
|
hasStudents.value = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid)).map(item => item);
|
||||||
showEcharts();
|
showEcharts();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
initChart();
|
initChart();
|
||||||
|
|
|
@ -22,12 +22,6 @@ import overviewStore from '@/store/modules/overview'
|
||||||
const useOverview = overviewStore()
|
const useOverview = overviewStore()
|
||||||
const tabPosition = ref('left')
|
const tabPosition = ref('left')
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
stuHasAnswers: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
//答过题的学生才进行统计
|
//答过题的学生才进行统计
|
||||||
const hasStudents = ref([])
|
const hasStudents = ref([])
|
||||||
const leftList = ref([
|
const leftList = ref([
|
||||||
|
@ -87,7 +81,7 @@ const showStudents = (index) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
watch(() => useOverview.tableList, () => {
|
watch(() => useOverview.tableList, () => {
|
||||||
hasStudents.value = useOverview.tableList.filter(item => props.stuHasAnswers.includes(item.studentid)).map(item => item);
|
hasStudents.value = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid)).map(item => item);
|
||||||
showStudents(0)
|
showStudents(0)
|
||||||
},{deep: true})
|
},{deep: true})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,156 +14,124 @@ const useOverview = overviewStore()
|
||||||
// 获取图表容器的引用
|
// 获取图表容器的引用
|
||||||
const chartRef = ref(null);
|
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() {
|
function initChart() {
|
||||||
const myChart = echarts.init(chartRef.value);
|
const myChart = echarts.init(chartRef.value);
|
||||||
const options = {
|
// 指定图表的配置项和数据
|
||||||
tooltip: {
|
let option = {
|
||||||
trigger: 'axis',
|
tooltip: {
|
||||||
axisPointer: {
|
trigger: "axis",
|
||||||
type: 'cross'
|
axisPointer: {
|
||||||
}
|
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
||||||
},
|
},
|
||||||
legend: {
|
formatter: function(parms) {
|
||||||
data: ['预估时长', '平均用时']
|
let str =
|
||||||
},
|
parms[0].axisValue +
|
||||||
grid: {
|
"</br>" +
|
||||||
left: '3%',
|
parms[0].marker +
|
||||||
right: '4%',
|
"平均用时:" +
|
||||||
bottom: '3%',
|
parms[0].value + 's'
|
||||||
top: '10%',
|
return str;
|
||||||
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'
|
|
||||||
},
|
},
|
||||||
data: estimateTime.value.map(item => ({
|
textStyle: {
|
||||||
name: item.name,
|
color: "#333",
|
||||||
value: item.value
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `平均用时`,
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
symbol: 'circle',
|
|
||||||
symbolSize: 10,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#d14a61'
|
|
||||||
},
|
},
|
||||||
data: avaterTime.value.map(item => ({
|
color: ["#7BA9FA", "#4690FA"],
|
||||||
name: item.name,
|
grid: {
|
||||||
value: item.value
|
containLabel: true,
|
||||||
}))
|
left: "10%",
|
||||||
}
|
top: "20%",
|
||||||
]
|
bottom: "10%",
|
||||||
};
|
right: "10%",
|
||||||
myChart.setOption(options);
|
},
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
//获取平均时长
|
//获取平均时长纵坐标
|
||||||
const getAvaterTime = () => {
|
const getYValue = () => {
|
||||||
return useOverview.tableList.reduce((acc, cur) => acc + cur.finishtimelength, 0) / useOverview.tableList.length;
|
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 getEstimateTime = () => {
|
// 获取横纵轴坐标数据
|
||||||
return useOverview.tableList.reduce((acc, cur) => acc + cur.timelength, 0) / useOverview.tableList.length;
|
const getXValue = () => {
|
||||||
|
return useOverview.allData.map(item => item.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
watch(() => useOverview.tableList,() => {
|
watch(() => useOverview.tableList,() => {
|
||||||
getyAxisData()
|
//获取横纵坐标
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
initChart();
|
initChart();
|
||||||
})
|
})
|
||||||
|
|
|
@ -85,10 +85,11 @@ import FileImage from '@/components/file-image/index.vue'
|
||||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
|
import {createWindow} from '@/utils/tool'
|
||||||
import Lesson from './lesson.vue';
|
import Lesson from './lesson.vue';
|
||||||
import { parseCataByNode } from '@/utils/talkFile'
|
import { parseCataByNode } from '@/utils/talkFile'
|
||||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
||||||
import { createHomework } from '../createHomework'
|
import { createHomework, getClassWorkList, getStudentClassWorkData } from '../createHomework'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -111,10 +112,12 @@ const curNode = reactive({
|
||||||
})
|
})
|
||||||
|
|
||||||
const props = defineProps(['curNode'])
|
const props = defineProps(['curNode'])
|
||||||
|
const emit = defineEmits(['closeActive'])
|
||||||
|
|
||||||
|
|
||||||
const sendHomework = (row,type) => {
|
const sendHomework = (row,type) => {
|
||||||
|
|
||||||
|
|
||||||
if(type == 'item'){
|
if(type == 'item'){
|
||||||
// 布置推送单个作业
|
// 布置推送单个作业
|
||||||
curRow.value = [row]
|
curRow.value = [row]
|
||||||
|
@ -128,11 +131,28 @@ const sendHomework = (row,type) => {
|
||||||
const closeHomework = async() => {
|
const closeHomework = async() => {
|
||||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 推送成功
|
// 推送成功
|
||||||
const successHomework = (data)=>{
|
const successHomework = async (data)=>{
|
||||||
|
// data.msg
|
||||||
// console.log('推送成功', data)
|
// console.log('推送成功', data)
|
||||||
// 发送im消息-推送作业(app|平板)
|
// 发送im消息-推送作业(app|平板)
|
||||||
// ipcMsgInvoke('im-chat:msg', data, MsgEnum.HEADS.MSG_0016)
|
// 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
|
// 章节目录change
|
||||||
const changeChapter = async (data)=>{
|
const changeChapter = async (data)=>{
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div class="c-popover" :style="`--top: ${topPos}px;--height:${hPost}px;`" v-show="isVisible">
|
<div class="c-popover" :style="`--top: ${topPos}px;--height:${hPost}px;`" v-show="isVisible">
|
||||||
<div class="content" v-if="isVisible">
|
<div class="content" v-if="isVisible">
|
||||||
<slot name="content">
|
<slot name="content">
|
||||||
<homework v-if="activeObj?.prop === 'resource'" :curNode="curNode" />
|
<homework v-if="activeObj?.prop === 'resource'" :curNode="curNode" @closeActive="closeActive" />
|
||||||
<span v-else style="color:red;">{{activeObj}}</span>
|
<span v-else style="color:red;">{{activeObj}}</span>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,6 +101,10 @@ const clickHandel = (o, e) => {
|
||||||
}
|
}
|
||||||
emit('change', o)
|
emit('change', o)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const closeActive = () =>{
|
||||||
|
isVisible.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.warp{
|
.warp{
|
||||||
|
|
|
@ -1,37 +1,226 @@
|
||||||
|
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { addClassworkReturnId } from '@/api/teaching/classwork'
|
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;
|
|
||||||
|
|
||||||
formObj.deaddate = '';
|
export const createHomework = ({ uniquekey, evalid, data, entpcourseid }) => {
|
||||||
formObj.entpid = usertore.deptId;
|
const usertore = useUserStore().user
|
||||||
formObj.level = 1;
|
|
||||||
formObj.parentid = 0;
|
|
||||||
formObj.worktype = '常规作业';
|
|
||||||
formObj.workkey = '';
|
|
||||||
formObj.worktag = '';
|
|
||||||
|
|
||||||
formObj.uniquekey = uniquekey;
|
var formObj = {}
|
||||||
|
formObj.id = 0
|
||||||
formObj.classid = 0;
|
|
||||||
formObj.classcourseid = 0;
|
|
||||||
|
|
||||||
formObj.entpcourseid = entpcourseid;
|
formObj.deaddate = ''
|
||||||
|
formObj.entpid = usertore.deptId
|
||||||
|
formObj.level = 1
|
||||||
|
formObj.parentid = 0
|
||||||
|
formObj.worktype = '常规作业'
|
||||||
|
formObj.workkey = ''
|
||||||
|
formObj.worktag = ''
|
||||||
|
|
||||||
formObj.slideid = 0;
|
formObj.uniquekey = uniquekey
|
||||||
|
|
||||||
formObj.workcodes = JSON.stringify(data);
|
formObj.classid = 0
|
||||||
|
formObj.classcourseid = 0
|
||||||
|
|
||||||
formObj.edusubject = usertore.edusubject;
|
formObj.entpcourseid = entpcourseid
|
||||||
formObj.evalid = evalid
|
|
||||||
|
|
||||||
formObj.edustage = usertore.edustage;
|
formObj.slideid = 0
|
||||||
formObj.status = '';
|
|
||||||
formObj.edituserid = usertore.userId;
|
formObj.workcodes = JSON.stringify(data)
|
||||||
formObj.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
|
|
||||||
return addClassworkReturnId(formObj)
|
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%'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 设定典型作答,需要获取每个题目的类型,找出主观题
|
||||||
|
// 暂缓
|
||||||
|
}
|
||||||
|
return classWorkList
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue