This commit is contained in:
zdg 2024-10-24 17:02:21 +08:00
commit dc39486620
20 changed files with 779 additions and 363 deletions

View File

@ -0,0 +1,74 @@
<template>
<!-- 试题详情 -->
<el-drawer
v-model="activeExamInfoDrawer"
title="题目详情"
:with-header="false"
direction="rtl"
size="60%"
>
<div style="height: calc(100% - 50px);">
<el-scrollbar style="background: #F3F5F8;border-radius: 8px;">
<el-row class="drawer-main">
<el-col :span="24">
<span>{{activeExam.worktag}}</span>
<span style="margin-left: 4px" v-html="activeExam.titleFormat" ></span>
</el-col>
<el-col :span="24" style="padding: 4px" v-html="activeExam.workdescFormat">
</el-col>
<el-col :span="3" class="drawer-main-col"><em>答案</em></el-col>
<el-col :span="20" class="drawer-main-col" v-html="activeExam.workanswerFormat"></el-col>
<el-col :span="3" class="drawer-main-col"><em>分析</em></el-col>
<el-col :span="20" class="drawer-main-col" v-html="activeExam.method"></el-col>
<el-col :span="3" class="drawer-main-col"><em>解答</em></el-col>
<el-col :span="20" class="drawer-main-col" v-html="activeExam.analyse"></el-col>
<el-col :span="3" class="drawer-main-col" ><em>点评</em></el-col>
<el-col :span="20" class="drawer-main-col" v-html="activeExam.discuss"></el-col>
</el-row>
</el-scrollbar>
</div>
<div class="drawer-footer">
<el-button type="primary" @click="activeExamInfoDrawer = false">关闭</el-button>
</div>
</el-drawer>
</template>
<script setup name="examDetailsDrawerRef">
import {ref, reactive, watch} from 'vue'
const props = defineProps({
});
const activeExamInfoDrawer = ref(false);
const activeExam = ref({});
//
const acceptParams = (params) => {
activeExamInfoDrawer.value = true;
activeExam.value = params.activeExam;
}
defineExpose({
acceptParams
})
</script>
<style lang="scss" scoped>
.drawer-main{
margin: 1%;
padding: 2%;
display: flex;
text-align: left;
.drawer-main-col{
padding: 10px 0px;
}
}
.drawer-footer{
padding-top: 15px;
display: flex;
justify-content: flex-end;
box-sizing: border-box;
}
</style>

View File

@ -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(() => {

View File

@ -16,8 +16,9 @@ export const isJson = (str) => {
/** /**
* @description processList 格式化试题 * @description processList 格式化试题
* @param {*} row * @param {*} row
* @param {*} aloneOption 选择题中选项是否为每行一个
*/ */
export const processList = (row) => { export const processList = (row, aloneOption=false) => {
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; i++) {
if (isJson(row[i].workanalysis)) { if (isJson(row[i].workanalysis)) {
//1、先默认格式化 格式化各项内容(待优化, 后续界面显示的为format的值) //1、先默认格式化 格式化各项内容(待优化, 后续界面显示的为format的值)
@ -56,18 +57,24 @@ export const processList = (row) => {
let tmp = '' let tmp = ''
let j = 0 let j = 0
for(; j<workDescArr.length; j++){ for(; j<workDescArr.length; j++){
if (j % 2 == 0) { const char = String.fromCharCode(65+j);
tmp += `<div style='width:80%;display:flex;'>` if (aloneOption) {
tmp += `<div style='width:100%;display:flex;padding: 2px 0'>${char}.${workDescArr[j]}</div>`;
} }
const char = String.fromCharCode(65 + j) else {
tmp += `<div style='display:flex;margin-left:2%;width:35%;overflow:hidden;text-overflow:ellipsis;font-size:0.9em;'>${char}.${workDescArr[j]}</div>` if(j%2 == 0){
tmp += `<div style='width:100%;display:flex;'>`;
}
tmp += `<div style='padding-left:10px;width:50%;overflow:hidden;text-overflow:ellipsis;font-size:0.9em;'>${char}.${workDescArr[j]}</div>`;
if(j%2 == 1){ if(j%2 == 1){
tmp += '</div>' tmp += '</div>';
}
} }
} }
// j此刻已自增1, 故当选项为单数时, 需要补充结束标签 // j此刻已自增1, 故当选项为单数时, 需要补充结束标签
if (j % 2 == 1) { if(!aloneOption && j%2 == 1){
tmp += '</div>' tmp += '</div>';
} }
// workDescArr为 [''] 表示为 判断题或者填空题,这里不需要选项 // workDescArr为 [''] 表示为 判断题或者填空题,这里不需要选项
@ -136,31 +143,36 @@ export const processList = (row) => {
* ] * ]
*/ */
let workDescArr = JSON.parse(row[i].workdesc) let workDescArr = JSON.parse(row[i].workdesc)
let workDescHtml = `<div style='width:80%;display:flex;>` let workDescHtml = `<div style='width:100%;display:flex;>`
workDescArr.map((item, index) => { workDescArr.map((item, index) => {
if (item.type == '单选题' || item.type == '多选题') { if (item.type == '单选题' || item.type == '多选题') {
workDescHtml += `<div style='width:80%;display:flex;'>${index + 1}. ${item.title}</div>` workDescHtml += `<div style='width:100%;display:flex;'>${index + 1}. ${item.title}</div>`
let tmp = '' let tmp = ''
let j = 0 let j = 0
let optionsArr = item.options let optionsArr = item.options
for(; j<optionsArr.length; j++){ for(; j<optionsArr.length; j++){
if (j % 2 == 0) { const char = String.fromCharCode(65+j);
tmp += `<div style='width:80%;display:flex;'>` if (aloneOption) {
tmp += `<div style='width:100%;display:flex;padding: 2px 0'>${char}.${optionsArr[j]}</div>`;
} }
const char = String.fromCharCode(65 + j) else {
tmp += `<div style='display:flex;margin-left: 2%; width: 36%'>${char}.${optionsArr[j]}</div>` if(j%2 == 0){
tmp += `<div style='width:100%;display:flex;'>`;
}
tmp += `<div style='padding-left: 10px; width: 50%'>${char}.${optionsArr[j]}</div>`;
if(j%2 == 1){ if(j%2 == 1){
tmp += '</div>' tmp += '</div>';
}
} }
} }
// j此刻已自增1, 故当选项为单数时, 需要补充结束标签 // j此刻已自增1, 故当选项为单数时, 需要补充结束标签
if (j % 2 == 1) { if(!aloneOption && j%2 == 1){
tmp += '</div>' tmp += '</div>';
} }
workDescHtml += tmp workDescHtml += tmp
} else if (item.type == '填空题' || item.type == '判断题' || item.type == '主观题') { } else if (item.type == '填空题' || item.type == '判断题' || item.type == '主观题') {
workDescHtml += `<div style='width:80%;display:flex;'>${index + 1}. ${item.title}</div>` workDescHtml += `<div style='width:100%;display:flex;'>${index + 1}. ${item.title}</div>`
} }
}) })
workDescHtml += '</div>' workDescHtml += '</div>'
@ -266,17 +278,23 @@ export const processList = (row) => {
let tmp = '' let tmp = ''
let j = 0 let j = 0
for(; j<workDescArr.length; j++){ for(; j<workDescArr.length; j++){
if (j % 2 == 0) { const char = String.fromCharCode(65+j);
tmp += `<div style='width:80%;display:flex;'>` if (aloneOption) {
tmp += `<div style='width:100%;display:flex;padding: 2px 0'>${char}.${workDescArr[j]}</div>`;
} }
const char = String.fromCharCode(65 + j) else {
tmp += `<div style='display:flex;margin-left: 2%; width: 36%'>${char}.${workDescArr[j]}</div>` if(j%2 == 0){
tmp += `<div style='width:100%;display:flex;'>`;
}
tmp += `<div style='padding-left: 10px; width: 50%'>${char}.${workDescArr[j]}</div>`;
if(j%2 == 1){ if(j%2 == 1){
tmp += '</div>' tmp += '</div>';
} }
} }
if (j % 2 == 0) { }
tmp += '</div>' if(!aloneOption && j%2== 0){
tmp += '</div>';
} }
row[i].workdescFormat = tmp row[i].workdescFormat = tmp

View File

@ -4,12 +4,17 @@ 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]
} }
} }
}) })

View File

@ -343,7 +343,7 @@ const eventHandles = (type, win) => {
// 监听窗口的激活事件 // 监听窗口的激活事件
win.on('focus', async () => { win.on('focus', async () => {
toolState.isTaskWin=true toolState.isTaskWin=true
win&&win.reload(); //刷新该窗口 // win&&win.reload(); //刷新该窗口
}); });
// 监听窗口关闭事件 // 监听窗口关闭事件
win.on('closed', function () { win.on('closed', function () {

View File

@ -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)

View File

@ -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>

View File

@ -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();

View File

@ -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>

View File

@ -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() {
// 8x
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 = { //
let option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
axisPointer: { axisPointer: {
type: 'cross' type: "shadow", // 线'line' | 'shadow'
}
}, },
legend: { formatter: function(parms) {
data: ['预估时长', '平均用时'] let str =
parms[0].axisValue +
"</br>" +
parms[0].marker +
"平均用时:" +
parms[0].value + 's'
return str;
}, },
},
textStyle: {
color: "#333",
},
color: ["#7BA9FA", "#4690FA"],
grid: { grid: {
left: '3%', containLabel: true,
right: '4%', left: "10%",
bottom: '3%', top: "20%",
top: '10%', bottom: "10%",
containLabel: true right: "10%",
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
boundaryGap: false, data: getXValue(),
name: '得分率', axisLine: {
nameTextStyle: { lineStyle: {
color: '#999', color: "#333",
fontSize: 12,
padding: [0, 0, 10, 0]
}, },
data: xAxisData.value },
axisTick: {
show: false,
},
axisLabel: {
margin: 20, //线
textStyle: {
color: "#000",
},
},
name:'题目编号'
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
name: '作业时长', axisLine: {
nameTextStyle: { show: true,
color: '#999',
fontSize: 12,
padding: [0, 0, 10, 0]
},
},
series: [
{
name: `预估时长`,
type: 'line',
smooth: true,
symbol: 'circle',
symbolSize: 10,
lineStyle: { lineStyle: {
color: '#5793f3' color: "#B5B5B5",
}, },
data: estimateTime.value.map(item => ({ },
name: item.name, name:'平均时长',
value: item.value 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",
}, },
{ {
name: `平均用时`, offset: 1,
type: 'line', color: "#90BEFF",
smooth: true,
symbol: 'circle',
symbolSize: 10,
lineStyle: {
color: '#d14a61'
}, },
data: avaterTime.value.map(item => ({ ],
name: item.name, },
value: item.value },
})) },
} ],
]
}; };
myChart.setOption(options); 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();
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<el-form ref="classWorkFormScoreRef" :model="classWorkFormScore" style="height: 100%"> <el-form ref="classWorkFormScoreRef" :model="classWorkFormScore" style="height: 100%">
<!-- <div class="teacher_content" :style="{ height: dialogProps.maxheight + 'px' }"> --> <!-- <div class="teacher_content" :style="{ height: dialogProps.maxheight + 'px' }"> -->
<div class="teacher_content" :style="{ height: '100%' }"> <div class="teacher_content" :style="{ height: '100%',fontSize: '18px' }">
<div style="font-size: 18px; width: 100%; padding: 5px 10px; flex: 0 0 auto;"> <div style="font-size: 18px; width: 100%; padding: 5px 10px; flex: 0 0 auto;">
{{ classWorkFormScore.name }} 答题详情 {{ classWorkFormScore.name }} 答题详情
</div> </div>
@ -284,59 +284,27 @@
<!-- 批改评价与评语 --> <!-- 批改评价与评语 -->
<div class="tacher_conten_foot"> <div class="tacher_conten_foot">
<el-row style="padding: 1% 4%; border: 2px dotted"> <el-row style=" padding: 1% 4%; border: 2px dotted;">
<el-col :span="24" style="display: flex; flex-direction: column"> <el-col :span="24" style="display: flex;flex-direction: column;">
<el-row> <el-row>
<el-col :span="14"> <el-col :span="24">
<div style="display: flex; margin: 10px auto"> <div class="greenLine" style="text-align: left;" v-if="dialogProps.studentObj.worktype == '习题训练'">
<span style="display: flex; align-items: center"> <span style="font-weight: bold;">老师点评</span>
<span v-if="dialogProps.studentObj.worktype == '习题训练'"> <span style="margin: 0;">{{ classWorkFormScore.teacherRating.reduce((a, b) => a + b.score, 0).toFixed(2)}}</span>
<span>得分 </span> </div>
<span style="margin: 0; color: red">{{ <div style="display: flex; margin: 10px auto;align-items: center;justify-content: space-between;">
classWorkFormScore.teacherRating.reduce((a, b) => a + b.score, 0).toFixed(2)
}}</span>
<span></span>
</span>
<span v-else>
<span>得分 </span>
<span v-if="classWorkFormScore.teacherRating.length > 0">
<el-input-number
v-model="classWorkFormScore.teacherRating[0].score"
:controls="false"
type="number"
:min="0"
:max="classWorkFormScore.teacherRating[0].maxScore"
size="small"
style="width: 60px"
@change="handleChange"
></el-input-number>
</span>
<span></span>
</span>
</span>
<div class="score-container"> <div class="score-container">
<div <div
v-for="(score, index) in teacherRatingList" v-for="(score, index) in teacherRatingList"
:key="index" :key="index"
style="white-space: nowrap;" style="white-space: nowrap;"
:class="[ :class="['score-circle', { 'active': classWorkFormScore.rating == score.ratingKey }]"
'score-circle',
{ active: classWorkFormScore.rating == score.ratingKey }
]"
@click="selectScore(score)" @click="selectScore(score)"
> >
{{ score.ratingValue }} <el-text :style="{fontWeight:'bold', color: classWorkFormScore.rating == score.ratingKey ? 'rgb(225,12,8)':'rgb(131,131,131)' }">{{ score.ratingValue }}</el-text>
</div> </div>
</div> </div>
</div> <el-select v-model="value" placeholder="常用评语" style="width: 240px" @change="onSelectOption">
</el-col>
<el-col :span="10" style="display: flex; align-items: center">
<el-select
v-model="value"
placeholder="常用评语"
style="width: 240px"
@change="onSelectOption"
>
<el-option <el-option
v-for="item in cities" v-for="item in cities"
:key="item.value" :key="item.value"
@ -354,23 +322,21 @@
placeholder="输入新的常用语" placeholder="输入新的常用语"
size="small" size="small"
/> />
<el-button type="primary" size="small" @click="onConfirm"> 确定 </el-button> <el-button type="primary" size="small" @click="onConfirm">
确定
</el-button>
<el-button size="small" @click="clear">取消</el-button> <el-button size="small" @click="clear">取消</el-button>
</template> </template>
</template> </template>
</el-select> </el-select>
</div>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="24" style="display: flex; flex-direction: column"> <el-col :span="24" style="display: flex;flex-direction: column;">
<el-form-item label="评语说明"> <el-form-item>
<el-col :span="15" style="padding: 0px"> <el-col :span="24" style="padding: 0px">
<el-input <el-input row="5" type="textarea" v-model="classWorkFormScore.teacherremark" rows="1" placeholder="输入评语" />
v-model="classWorkFormScore.teacherremark"
type="textarea"
rows="1"
placeholder="请输入评语说明"
/>
</el-col> </el-col>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -644,7 +610,33 @@ const selectScore = (score) => {
console.log(score, 'score----') console.log(score, 'score----')
classWorkFormScore.rating = score.ratingKey classWorkFormScore.rating = score.ratingKey
} }
const checkWorkType = (params) => {
//
const subType = params.quizlist.map(item => item.worktype)
const objectiveQuestion = ['单选题','多选题','判断题']
//
if(subType.every(item => objectiveQuestion.includes(item))){
//
const score = extractedNumber(params.studentObj.scoingRate)
if(0<=score<=59){
classWorkFormScore.rating = 5
}else if(60<=score<=69){
classWorkFormScore.rating = 4
}else if(70<=score<=79){
classWorkFormScore.rating = 3
}else if(80<=score<=99){
classWorkFormScore.rating = 2
}else{
classWorkFormScore.rating = 1
}
}
}
//
const extractedNumber = (score) => {
const match = score.match(/\d+/);
return match ? parseInt(match[0], 10) : null;
}
// //
const acceptParams = async (params) => { const acceptParams = async (params) => {
console.log(params) console.log(params)
@ -665,7 +657,7 @@ const acceptParams = async (params) => {
teacherFeedContentList.value = [] teacherFeedContentList.value = []
teachImageList.value = [] teachImageList.value = []
teachFileList.value = [] teachFileList.value = []
checkWorkType(params)
// ----------------- // -----------------
dialogProps.value = params dialogProps.value = params
classWorkFormScore.name = params.studentObj.studentname classWorkFormScore.name = params.studentObj.studentname
@ -803,7 +795,7 @@ const acceptParams = async (params) => {
console.log(params.studentQuizAllList[0].rating, '----------------------------') console.log(params.studentQuizAllList[0].rating, '----------------------------')
// null 0 0 // null 0 0
classWorkFormScore.rating = classWorkFormScore.rating =
params.studentQuizAllList[0].rating == 0 ? 0 : params.studentQuizAllList[0].rating params.studentQuizAllList[0].rating == 0 ? classWorkFormScore.rating : params.studentQuizAllList[0].rating
} }
analysisScoreOpen.value = true analysisScoreOpen.value = true
@ -975,23 +967,23 @@ defineExpose({
} }
.score-circle { .score-circle {
width: 30px; border: 1px solid rgb(131,131,131,.5);
height: 30px; padding: 5px 0;
border-radius: 50%; background-color: #fff;
background-color: pink;
color: red;
display: flex;
justify-content: center;
align-items: center;
font-size: 13px;
margin: 0 10px;
cursor: pointer; cursor: pointer;
transition: background-color 0.3s; margin-right: 5px;
width: 60px;
text-align: center;
} }
.score-circle.active { .score-circle.active {
background-color: red; background-color: rgb(253, 236, 224);
color: white; color: white;
border: 1px solid rgb(253, 236, 224);
}
.greenLine{
border-left: 5px solid rgb(14, 209, 22);
padding-left: 5px
} }
.card-header{ .card-header{

View File

@ -261,6 +261,7 @@ const openDialog = (data) => {
} }
classWorkAnalysis.quizlist = idres.rows classWorkAnalysis.quizlist = idres.rows
classWorkActiveData.quizlist = idres.rows // zdg: 使 classWorkActiveData.quizlist = idres.rows // zdg: 使
processList(classWorkActiveData.quizlist);
// //
// + , pageSize: 100 // + , pageSize: 100

View File

@ -99,7 +99,7 @@
</div> </div>
</template> </template>
<template #default="scope"> <template #default="scope">
<div> <div @click="showExamAnalyseDrawer(scope.row)">
<div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div> <div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div>
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div> <div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
<el-col :span="24" style="display: flex"> <el-col :span="24" style="display: flex">
@ -224,6 +224,9 @@
<!-- 预览框 --> <!-- 预览框 -->
<prevReadMsgDialog ref="prevReadMsgDialogRef" :bookobj="props.bookobj"/> <prevReadMsgDialog ref="prevReadMsgDialogRef" :bookobj="props.bookobj"/>
<!-- 试题详细信息 -->
<examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
</div> </div>
</template> </template>
@ -246,6 +249,7 @@ import { getCurrentTime } from '@/utils/date'
import FileUpload from "@/components/FileUpload/index.vue"; import FileUpload from "@/components/FileUpload/index.vue";
import whiteboard from '@/components/whiteboard/whiteboard.vue' import whiteboard from '@/components/whiteboard/whiteboard.vue'
import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue' import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue'
import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue'
import { useToolState } from '@/store/modules/tool' import { useToolState } from '@/store/modules/tool'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
@ -858,6 +862,19 @@ const editWork = async (cform) =>{
} }
} }
/**
* 查看试题详细信息
* @param row 单题数据
*/
const showExamAnalyseDrawer = (row) => {
nextTick(() => {
const activeParams = {
activeExam: row,
}
proxy.$refs.examDetailsDrawerRef.acceptParams(activeParams);
})
}
onMounted(() => { onMounted(() => {

View File

@ -1,9 +1,9 @@
<template> <template>
<el-row class="c-warp" :gutter="10"> <el-row class="c-warp" :gutter="10">
<el-col class="left" :span="14"> <el-col class="left" :span="10">
<el-collapse class="c-item" v-model="activeTopic"> <el-collapse class="c-item" v-model="activeTopic" accordion>
<template v-for="(item, index) in dataList"> <template v-for="(item, index) in dataList">
<el-collapse-item class="collapse-item" :name="index+1" :id="'collapse-'+(index+1)"> <el-collapse-item class="collapse-item" :name="index+1" :id="'collapse-'+(index+1)" @click="clickItem(index)">
<template #title> <template #title>
<el-popover :width="500" placement="right"> <el-popover :width="500" placement="right">
<p>{{item.def?.titletext}}</p> <p>{{item.def?.titletext}}</p>
@ -54,13 +54,13 @@
</template> </template>
</el-collapse> </el-collapse>
</el-col> </el-col>
<el-col class="right" :span="10"> <el-col class="right" :span="14">
<div class="c-item"> <div class="c-item">
<div class="title">提交情况</div> <!-- <div class="title">提交情况</div>
<div class="respond"> <div class="respond">
<el-space wrap> <el-space wrap> -->
<!-- <template v-for="it in 11"> --> <!-- <template v-for="it in 11"> -->
<template v-for="(item, index) in dataList"> <!-- <template v-for="(item, index) in dataList">
<el-card shadow="hover" class="card-warp"> <el-card shadow="hover" class="card-warp">
<div class="card-body"> <div class="card-body">
<el-progress type="dashboard" :color="colorArr" :width="80" :percentage="ratio_2(item)" /> <el-progress type="dashboard" :color="colorArr" :width="80" :percentage="ratio_2(item)" />
@ -70,7 +70,41 @@
</el-card> </el-card>
</template> </template>
</el-space> </el-space>
</div> -->
<div class="title">试题详情</div>
<!-- 习题训练 -->
<el-card style="max-width: 100%; margin-bottom: 10px; text-align: left;">
<el-row>
<el-col :span="24" style="padding: 10px">
<!-- 题源题目标题题目选项 -->
<span>{{ activeExam.worktag }}</span>
<span style="margin-left: 4px" v-html="activeExam.titleFormat"></span>
<div :span="24" style="padding: 6px" v-html="activeExam.workdescFormat"></div>
<!-- 折叠 详情分析解答 -->
<div class="demo-collapse">
<el-collapse v-model="activeExamFlag">
<el-collapse-item title="详情分析解答" name="1">
<el-row style=" padding: 6px 10px; border: 2px dotted;">
<template #default="scope">
<el-col :span="2" style="padding: 6px 0px"><em>答案</em></el-col>
<el-col :span="21" style="padding: 6px 0px" v-html="activeExam.workanswerFormat"></el-col>
<el-col :span="2" style="padding: 6px 0px"><em>分析</em></el-col>
<el-col :span="21" style="padding: 6px 0px" v-html="activeExam.method"></el-col>
<el-col :span="2" style="padding: 6px 0px"><em>解答</em></el-col>
<el-col :span="21" style="padding: 6px 0px" v-html="activeExam.analyse"></el-col>
<el-col :span="2" style="padding: 6px 0px"><em>点评</em></el-col>
<el-col :span="21" style="padding: 6px 0px" v-html="activeExam.discuss"></el-col>
<!-- <el-col :span="21" style="padding: 6px 0px" v-html="dataList[activeTopic-1].def.discuss"></el-col> -->
</template>
</el-row>
</el-collapse-item>
</el-collapse>
</div> </div>
</el-col>
</el-row>
</el-card>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -84,7 +118,9 @@ import { ref, defineExpose, onMounted, reactive, computed, watch, nextTick, watc
// import * as elementPlus from 'element-plus' // ElMessage ElMessageBox // import * as elementPlus from 'element-plus' // ElMessage ElMessageBox
let colorArr = [] // -- let colorArr = [] // --
// const attrs = useAttrs() // props // const attrs = useAttrs() // props
const activeTopic = ref(0) // const activeTopic = ref(1) //
const activeExam = ref({}) //
const activeExamFlag = ref(['1']) //
let dataList = ref([]) // let dataList = ref([]) //
let studentList = ref([]) // let studentList = ref([]) //
const props = defineProps({ // defineProps const props = defineProps({ // defineProps
@ -115,7 +151,10 @@ colorArr = [
// === === // === ===
onMounted(() => { onMounted(() => {
activeTopic.value = dataList.value.map((_, index) => index + 1); //activeTopic.value = dataList.value.map((_, index) => index + 1);
if (dataList.value[activeTopic.value-1].def != null && dataList.value[activeTopic.value-1].def != undefined) {
activeExam.value = dataList.value[activeTopic.value-1].def;
}
}) })
// === (methods) === // === (methods) ===
@ -285,6 +324,18 @@ const clickInfo = async ind => {
setTimeout(() => {scrollToElement('collapse-' + ind)}, 300); setTimeout(() => {scrollToElement('collapse-' + ind)}, 300);
// elementPlus.ElMessage.warning('!') // elementPlus.ElMessage.warning('!')
} }
//
const clickItem = async (index) => {
if (index > dataList.length-1 ) {
return
}
if (dataList.value[index].def == null || dataList.value[index].def == undefined) {
return;
}
activeExam.value = dataList.value[index].def;
}
// === === // === ===
// //
const scrollToElement = id => { const scrollToElement = id => {
@ -313,8 +364,14 @@ watchEffect(() => { initData() })
background: #F2F3F5; background: #F2F3F5;
height: 100%; height: 100%;
margin: 0 !important; margin: 0 !important;
.left{padding-left: 0 !important; height: 100%;} .left{
.right{padding-right: 0 !important;} padding-left: 0 !important;
height: 100%;
}
.right{
padding-right: 0 !important;
height: 100%;
}
.c-item{ .c-item{
padding: 10px; padding: 10px;
background: #fff; background: #fff;
@ -362,7 +419,7 @@ watchEffect(() => { initData() })
margin-bottom: 10px; margin-bottom: 10px;
} }
.respond{ .respond{
height: calc(100% - 65px); /* height: calc(100% - 65px);*/
overflow: auto; overflow: auto;
.el-space{padding: 5px;} .el-space{padding: 5px;}
.card-warp{ .card-warp{

View File

@ -157,6 +157,8 @@ import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-s
import quizStats from '@/views/classTask/container/quizStats.vue' import quizStats from '@/views/classTask/container/quizStats.vue'
import ClassOverview from '@/views/classTask/container/classOverview.vue' import ClassOverview from '@/views/classTask/container/classOverview.vue'
import {sessionStore} from '@/utils/store' import {sessionStore} from '@/utils/store'
import Chat from '@/utils/chat' // im
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const emit = defineEmits(['cle-click']) const emit = defineEmits(['cle-click'])
@ -203,9 +205,10 @@ const classWorkAnalysisScore = reactive({
// form.name = newValue.label // form.name = newValue.label
// } // }
// ) // )
const openDialog = (data) => { const openDialog = (data, isInit=true) => {
console.log(data, '点击的item完成情况') console.log(data, '点击的item完成情况')
if (isInit) {
classWorkAnalysis.title = data.uniquekey ? data.uniquekey + '--' : '' classWorkAnalysis.title = data.uniquekey ? data.uniquekey + '--' : ''
classWorkAnalysis.worktype = data.worktype classWorkAnalysis.worktype = data.worktype
classWorkAnalysis.workclass = data.workclass classWorkAnalysis.workclass = data.workclass
@ -232,6 +235,8 @@ const openDialog = (data) => {
? JSON.parse(`[${data.classworkdatastudentids}]`) ? JSON.parse(`[${data.classworkdatastudentids}]`)
: [] : []
classWorkActiveData.studentList = studentArr classWorkActiveData.studentList = studentArr
}
/** 学生完成情况分析--获取作业学生list数据 */ /** 学生完成情况分析--获取作业学生list数据 */
getClassWorkStudentList(data.id) getClassWorkStudentList(data.id)
@ -248,6 +253,7 @@ const openDialog = (data) => {
} }
classWorkAnalysis.quizlist = idres.rows classWorkAnalysis.quizlist = idres.rows
classWorkActiveData.quizlist = idres.rows // zdg: 使 classWorkActiveData.quizlist = idres.rows // zdg: 使
processList(classWorkActiveData.quizlist);
// //
// + , pageSize: 100 // + , pageSize: 100
@ -343,7 +349,7 @@ const getClassWorkStudentList = (rowId) => {
response.rows[i].classworkevallist != 'null' response.rows[i].classworkevallist != 'null'
) { ) {
// , : "{\"id\":172910, \"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>\"}" // , : "{\"id\":172910, \"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>\"}"
// .replace(/"(\[.*\])"/g, '$1'); eg: "feedcontent\":\"[{\"name\":\"Bliss.jpg\",\"url\":\"https://wzyzoss.3b8daa474.jpg\"}]\", // .replace(/"(\[.*\])"/g, '$1'); eg: "feedcontent\":\"[{\"name\":\"Bliss.jpg\",\"url\":\"https://wzyzoss.3b8daa474.jpg\"}]\",
// json .replace(/""/g, '"') eg: """" // json .replace(/""/g, '"') eg: """"
response.rows[i].classworkevallist = escapeHtmlQuotes(response.rows[i].classworkevallist) response.rows[i].classworkevallist = escapeHtmlQuotes(response.rows[i].classworkevallist)
//console.log('classworkevallist', response.rows[i].classworkevallist) //console.log('classworkevallist', response.rows[i].classworkevallist)
@ -636,16 +642,62 @@ const closeDialog = () => {
emit('cle-click') emit('cle-click')
} }
onMounted(() => { // im
const msgHandle = (msg) => {
const { type, data } = msg
switch(type) {
case 'TIMAddRecvNewMsgCallback': // data=[]
{
(data||[]).forEach(o => {
const msgArr = o?.message_elem_array||[]
msgArr.forEach(info => {
const msgType = info?.elem_type // TIMElemType
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
//
//console.log('msgData->', msgData);
if (msgData.msgKey == "finishHomework"){
//
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
//console.log('data->', data);
openDialog(data, false);
}
})
})
}
break
}
}
const reloadTimer = ref(0); // id
const cutid = ref(0); // id
onMounted(() => {
const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
// const data = sessionStore.get('teachClassWorkItem'); // const data = sessionStore.get('teachClassWorkItem');
// const data = localStorage.getItem('teachClassWorkItem');
console.log(data,'????????????????????' )
if(data){ if(data){
openDialog(data) openDialog(data)
} }
//
cutid.value = data.id;
isReloadTimer();
// im
if (!Chat.imChat) {
Chat.init(true, true, msgHandle);
} else {
Chat.listenMsg(msgHandle);
}
}) })
const isReloadTimer = () =>{
clearInterval(reloadTimer.value) //
// id
reloadTimer.value = setInterval(() => {
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
if(cutid.value != data.id){
cutid.value = data.id;
openDialog(data)
}
}, 1000)
}
watch(classWorkAnalysis, (newVal, oldVal) => { watch(classWorkAnalysis, (newVal, oldVal) => {
if(newVal.view != 'quizStats'){ if(newVal.view != 'quizStats'){
@ -656,6 +708,7 @@ watch(classWorkAnalysis, (newVal, oldVal) => {
onUnmounted(() => { onUnmounted(() => {
clearInterval(classWorkActiveData.timerId) // clearInterval(classWorkActiveData.timerId) //
clearInterval(reloadTimer.value) // id
}) })
// defineExpose({ // defineExpose({
@ -701,7 +754,7 @@ onUnmounted(() => {
overflow: hidden; overflow: hidden;
.classwork-score{ .classwork-score{
// overflow-y: auto; /* overflow-y: auto; */
height: 100%; height: 100%;
} }
} }

View File

@ -17,10 +17,12 @@
<el-table-column align="center" prop="worktag" width="120"></el-table-column> <el-table-column align="center" prop="worktag" width="120"></el-table-column>
</el-table> </el-table>
<!-- 试题详情 --> <!-- 试题详细信息 -->
<el-drawer v-model="activeExamInfoDrawer" title="题目详情" :with-header="false" direction="rtl" size="60%"> <examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
<!-- <el-drawer v-model="activeExamInfoDrawer" title="题目详情" :with-header="false" direction="rtl" size="60%">
<div style="height: calc(100% - 50px);"> <div style="height: calc(100% - 50px);">
<el-scrollbar style="background: #e9e9e9;border-radius: 8px;"> <el-scrollbar style="background: #F3F5F8;border-radius: 8px;">
<el-row class="drawer-main"> <el-row class="drawer-main">
<el-col :span="24"> <el-col :span="24">
<span>{{activeExam.worktag}}</span> <span>{{activeExam.worktag}}</span>
@ -42,11 +44,13 @@
<div class="drawer-footer"> <div class="drawer-footer">
<el-button type="primary" @click="activeExamInfoDrawer = false">关闭</el-button> <el-button type="primary" @click="activeExamInfoDrawer = false">关闭</el-button>
</div> </div>
</el-drawer> </el-drawer> -->
</template> </template>
<script setup> <script setup>
import {ref, reactive} from 'vue' import {ref, reactive, getCurrentInstance, nextTick} from 'vue'
import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue'
const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({
listExamQuestion: {type: Array}, listExamQuestion: {type: Array},
@ -57,8 +61,12 @@ const activeExamInfoDrawer = ref(false);
const activeExam = ref({}); const activeExam = ref({});
const showExamAnalyseDrawer = (row) => { const showExamAnalyseDrawer = (row) => {
activeExam.value = row; nextTick(() => {
activeExamInfoDrawer.value = true; const activeParams = {
activeExam: row,
}
proxy.$refs.examDetailsDrawerRef.acceptParams(activeParams);
})
} }

View File

@ -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();
@ -110,7 +111,13 @@ const curNode = reactive({
data: {} data: {}
}) })
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]
@ -124,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)=>{
@ -222,7 +246,8 @@ onMounted(async () => {
entpcourseid.value = route.query.entpcourseid entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label lesson.value = route.query.label
// mounted // mounted
curNode.data = sessionStore.get('subject.curNode') // curNode.data = sessionStore.get('subject.curNode')
curNode.data = props.curNode
getHomework() getHomework()
getResource() getResource()
}) })

View File

@ -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'" /> <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>
@ -35,6 +35,7 @@
</template> </template>
<script setup> <script setup>
import { computed, defineProps, ref, reactive, watchEffect, onMounted } from 'vue' import { computed, defineProps, ref, reactive, watchEffect, onMounted } from 'vue'
import { sessionStore } from '@/utils/store'
import homework from './homework.vue'; import homework from './homework.vue';
// - // -
@ -63,6 +64,8 @@ const topPos = ref(30) // 顶部距离-内容的距离
const hPost = ref(0) // - const hPost = ref(0) // -
const isFold = ref(false) // const isFold = ref(false) //
let posBtnAll = {} // let posBtnAll = {} //
let curNode = null //
// === === // === ===
const list = computed(() => props.data.map((o,i) => { const list = computed(() => props.data.map((o,i) => {
o.style = getStyle(o.style, i) o.style = getStyle(o.style, i)
@ -71,6 +74,8 @@ const list = computed(() => props.data.map((o,i) => {
onMounted(() => { onMounted(() => {
posBtnAll = btnRef.value.getBoundingClientRect() posBtnAll = btnRef.value.getBoundingClientRect()
hPost.value = posBtnAll.height hPost.value = posBtnAll.height
curNode = sessionStore.get('subject.curNode')
}) })
// === === // === ===
// //
@ -96,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{

View File

@ -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 }) => { export const createHomework = ({ uniquekey, evalid, data, entpcourseid }) => {
const usertore = useUserStore().user const usertore = useUserStore().user
var formObj = {}; var formObj = {}
formObj.id = 0; formObj.id = 0
formObj.deaddate = ''; formObj.deaddate = ''
formObj.entpid = usertore.deptId; formObj.entpid = usertore.deptId
formObj.level = 1; formObj.level = 1
formObj.parentid = 0; formObj.parentid = 0
formObj.worktype = '常规作业'; formObj.worktype = '常规作业'
formObj.workkey = ''; formObj.workkey = ''
formObj.worktag = ''; formObj.worktag = ''
formObj.uniquekey = uniquekey; formObj.uniquekey = uniquekey
formObj.classid = 0; formObj.classid = 0
formObj.classcourseid = 0; formObj.classcourseid = 0
formObj.entpcourseid = entpcourseid; formObj.entpcourseid = entpcourseid
formObj.slideid = 0; formObj.slideid = 0
formObj.workcodes = JSON.stringify(data); formObj.workcodes = JSON.stringify(data)
formObj.edusubject = usertore.edusubject; formObj.edusubject = usertore.edusubject
formObj.evalid = evalid formObj.evalid = evalid
formObj.edustage = usertore.edustage; formObj.edustage = usertore.edustage
formObj.status = ''; formObj.status = ''
formObj.edituserid = usertore.userId; formObj.edituserid = usertore.userId
formObj.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]); formObj.entpcourseworklist = JSON.stringify([{ id: -2, score: '10' }])
return addClassworkReturnId(formObj) 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
}