diff --git a/src/renderer/src/store/modules/overview.js b/src/renderer/src/store/modules/overview.js index 46f58f6..40acf50 100644 --- a/src/renderer/src/store/modules/overview.js +++ b/src/renderer/src/store/modules/overview.js @@ -4,13 +4,18 @@ const overviewStore = defineStore( { state: () => { return { - tableList:[] + tableList:[], + allData:[] } }, actions: { getTableList(data){ this.tableList = [...data] - } + }, + //整理的所有列表 + getAllData(data){ + this.allData = [...data] + } } }) export default overviewStore diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index 1c800cd..4791810 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -370,7 +370,7 @@ const eventHandles = (type, win) => { export const toLinkWeb = (path) => { const config = baseConfig() // console.log(config) - const fullPath = config.url + path + const fullPath = ' https://localhost:7860/' + path // 通知主进程 ipcRenderer.send('openWindow', { key: `win-${Date.now()}`, diff --git a/src/renderer/src/views/classTask/container/classOverview.vue b/src/renderer/src/views/classTask/container/classOverview.vue index b6c6d7e..e3d51b7 100644 --- a/src/renderer/src/views/classTask/container/classOverview.vue +++ b/src/renderer/src/views/classTask/container/classOverview.vue @@ -10,7 +10,7 @@ 等级分布 - + @@ -72,7 +72,6 @@ const props = defineProps({ }, }) let studentList = ref([]) // 学生数据 -const stuHasAnswers = ref([]) // 已经答过题的学生不管对错 // 初始-数据处理 const initData = () => { @@ -81,6 +80,7 @@ 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,6 +91,13 @@ 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 == '单选题') { // '单选题','多选题' @@ -215,12 +222,10 @@ const initData = () => { } // 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[0].hasAnswers[0]) return - stuHasAnswers.value = [...data[0].hasAnswers] + useOverview.getAllData([...data]) } // 百分比现在 0-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 } 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) diff --git a/src/renderer/src/views/classTask/container/classOverview/distribution.vue b/src/renderer/src/views/classTask/container/classOverview/distribution.vue index bf55cd5..ab7a702 100644 --- a/src/renderer/src/views/classTask/container/classOverview/distribution.vue +++ b/src/renderer/src/views/classTask/container/classOverview/distribution.vue @@ -3,26 +3,19 @@ - + - +