zhuhao_dev #363
|
@ -271,12 +271,13 @@ app.on('window-all-closed', () => {
|
||||||
function handleAll() {
|
function handleAll() {
|
||||||
const chatInstance = chat.initialize() // im-chat 实例
|
const chatInstance = chat.initialize() // im-chat 实例
|
||||||
// 新窗口创建-监听
|
// 新窗口创建-监听
|
||||||
ipcMain.on('new-window', (e, data) => {
|
ipcMain.handle('new-window', (e, data) => {
|
||||||
const { id, type } = data
|
const { id, type } = data
|
||||||
const win = BrowserWindow.fromId(id)
|
const win = BrowserWindow.fromId(id)
|
||||||
win.type = type // 绑定独立标识
|
win.type = type // 绑定独立标识
|
||||||
remote.enable(win.webContents) // 开启远程服务
|
remote.enable(win.webContents) // 开启远程服务
|
||||||
chatInstance.enable(win.webContents) // 开启im-chat
|
chatInstance.enable(win.webContents) // 开启im-chat
|
||||||
|
console.log(`主进程 [${type}]: 窗口注册-远程代理-完毕(${Date.now()})`)
|
||||||
})
|
})
|
||||||
// 用于监听-状态管理变化-同步所有窗口
|
// 用于监听-状态管理变化-同步所有窗口
|
||||||
ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => {
|
ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -18,13 +18,13 @@ export class Chat {
|
||||||
}
|
}
|
||||||
return Chat.instance;
|
return Chat.instance;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化 获取IM签名
|
* 初始化 获取IM签名
|
||||||
* @param {*} isInit : 是否初始化IM
|
* @param {*} isInit : 是否初始化IM
|
||||||
* @param {*} isLogin : 是否登录IM
|
* @param {*} isLogin : 是否登录IM
|
||||||
* @param {*} callback: 监听消息回调函数
|
* @param {*} callback: 监听消息回调函数
|
||||||
* @returns Promise<ImChat>
|
* @returns Promise<ImChat>
|
||||||
*/
|
*/
|
||||||
async init(isInit = true, isLogin = true, callback) {
|
async init(isInit = true, isLogin = true, callback) {
|
||||||
// 特殊处理,只传1个参数且为函数,则默认为callback,isInit和isLogin默认为true
|
// 特殊处理,只传1个参数且为函数,则默认为callback,isInit和isLogin默认为true
|
||||||
if (typeof isInit == 'function'){
|
if (typeof isInit == 'function'){
|
||||||
|
|
|
@ -131,7 +131,7 @@ export const createWindow = async (type, data) => {
|
||||||
data.isConsole = true // 是否开启控制台
|
data.isConsole = true // 是否开启控制台
|
||||||
data.isWeb = false // 是否开启web安全
|
data.isWeb = false // 是否开启web安全
|
||||||
data.option = {...defOption, ...option}
|
data.option = {...defOption, ...option}
|
||||||
wins_tool = await toolWindow(data)
|
wins_tool = await toolWindow(type, data)
|
||||||
wins_tool.type = type // 唯一标识
|
wins_tool.type = type // 唯一标识
|
||||||
wins_tool.show()
|
wins_tool.show()
|
||||||
wins_tool.setFullScreen(true) // 设置窗口为全屏
|
wins_tool.setFullScreen(true) // 设置窗口为全屏
|
||||||
|
@ -161,7 +161,7 @@ export const createWindow = async (type, data) => {
|
||||||
}
|
}
|
||||||
data.isConsole = true // 是否开启控制台
|
data.isConsole = true // 是否开启控制台
|
||||||
data.option = {...defOption, ...option}
|
data.option = {...defOption, ...option}
|
||||||
const win = await toolWindow(data)
|
const win = await toolWindow(type, data)
|
||||||
win.type = type // 唯一标识
|
win.type = type // 唯一标识
|
||||||
win.show()
|
win.show()
|
||||||
win.setFullScreen(true) // 设置窗口为全屏
|
win.setFullScreen(true) // 设置窗口为全屏
|
||||||
|
@ -193,7 +193,7 @@ export const createWindow = async (type, data) => {
|
||||||
}
|
}
|
||||||
data.isConsole = true // 是否开启控制台
|
data.isConsole = true // 是否开启控制台
|
||||||
data.option = {...defOption, ...option}
|
data.option = {...defOption, ...option}
|
||||||
winChild = await toolWindow(data)
|
winChild = await toolWindow(type, data)
|
||||||
winChild.type = type // 唯一标识
|
winChild.type = type // 唯一标识
|
||||||
winChild.show()
|
winChild.show()
|
||||||
winChild.setFullScreen(false) // 设置窗口为全屏
|
winChild.setFullScreen(false) // 设置窗口为全屏
|
||||||
|
@ -213,7 +213,7 @@ export const createWindow = async (type, data) => {
|
||||||
* @author: zdg
|
* @author: zdg
|
||||||
* @date 2021-07-05 14:07:01
|
* @date 2021-07-05 14:07:01
|
||||||
*/
|
*/
|
||||||
export function toolWindow({url, isConsole, isWeb=true, option={}}) {
|
export function toolWindow(type, {url, isConsole, isWeb=true, option={}}) {
|
||||||
// width = window.screen.width
|
// width = window.screen.width
|
||||||
let width = option?.width || 800
|
let width = option?.width || 800
|
||||||
let height = option?.height || 600
|
let height = option?.height || 600
|
||||||
|
@ -221,7 +221,7 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
|
||||||
const devUrl = `${BaseUrl}${url}`
|
const devUrl = `${BaseUrl}${url}`
|
||||||
const buildUrl = path.join(__dirname, 'index.html')
|
const buildUrl = path.join(__dirname, 'index.html')
|
||||||
const urlAll = isDev ? devUrl : buildUrl
|
const urlAll = isDev ? devUrl : buildUrl
|
||||||
return new Promise((resolve) => {
|
return new Promise(async(resolve) => {
|
||||||
const config = {
|
const config = {
|
||||||
width, height,
|
width, height,
|
||||||
icon: path.join(appPath, '/resources/logo2.ico'),
|
icon: path.join(appPath, '/resources/logo2.ico'),
|
||||||
|
@ -236,6 +236,9 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
|
||||||
}
|
}
|
||||||
// 创建-新窗口
|
// 创建-新窗口
|
||||||
let win = new Remote.BrowserWindow(config)
|
let win = new Remote.BrowserWindow(config)
|
||||||
|
// 新窗口-创建事件(如:主进程加载远程服务)
|
||||||
|
await ipcMsgInvoke('new-window', {id:win.id, type})
|
||||||
|
console.log(`渲染进程 [${type}]: 窗口创建-成功${Date.now()}`)
|
||||||
if (!isDev) win.loadFile(urlAll,{hash: url}) // 加载文件
|
if (!isDev) win.loadFile(urlAll,{hash: url}) // 加载文件
|
||||||
else win.loadURL(urlAll) // 加载url
|
else win.loadURL(urlAll) // 加载url
|
||||||
win.once('ready-to-show', () => { // 窗口加载完成
|
win.once('ready-to-show', () => { // 窗口加载完成
|
||||||
|
@ -281,7 +284,7 @@ const eventHandles = (type, win) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// 新窗口-创建事件(如:主进程加载远程服务)
|
// 新窗口-创建事件(如:主进程加载远程服务)
|
||||||
ipcRenderer.send('new-window', {id:win.id, type})
|
// ipcRenderer.send('new-window', {id:win.id, type})
|
||||||
}
|
}
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 'tool-sphere': { // 创建-悬浮球
|
case 'tool-sphere': { // 创建-悬浮球
|
||||||
|
|
|
@ -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();
|
||||||
})
|
})
|
||||||
|
|
|
@ -157,6 +157,7 @@ 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()
|
||||||
|
@ -204,35 +205,38 @@ 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.worktype = data.worktype
|
||||||
|
classWorkAnalysis.workclass = data.workclass
|
||||||
|
// 重置学生列表
|
||||||
|
tableRadio.list = []
|
||||||
|
tableRadio.value = '1'
|
||||||
|
tableRadio.num0 = 0
|
||||||
|
tableRadio.num1 = 0
|
||||||
|
|
||||||
classWorkAnalysis.title = data.uniquekey ? data.uniquekey + '--' : ''
|
classWorkAnalysis.open = true
|
||||||
classWorkAnalysis.worktype = data.worktype
|
// 默认显示是学生作业反馈
|
||||||
classWorkAnalysis.workclass = data.workclass
|
classWorkAnalysis.view = 'studentview'
|
||||||
// 重置学生列表
|
// 当前学习任务所包含的试题ID
|
||||||
tableRadio.list = []
|
classWorkAnalysis.entpcourseworklistarray = data.entpcourseworklistarray
|
||||||
tableRadio.value = '1'
|
// 默认选中的学生
|
||||||
tableRadio.num0 = 0
|
classWorkAnalysis.activeStudentQuizlist = []
|
||||||
tableRadio.num1 = 0
|
// 默认选中的试题
|
||||||
|
classWorkAnalysis.activeQuizAnalysisData = []
|
||||||
|
|
||||||
classWorkAnalysis.open = true
|
classWorkAnalysis.row = data
|
||||||
// 默认显示是学生作业反馈
|
window.test = this
|
||||||
classWorkAnalysis.view = 'studentview'
|
// zdg: 学生列表
|
||||||
// 当前学习任务所包含的试题ID
|
const studentArr = data.classworkdatastudentids
|
||||||
classWorkAnalysis.entpcourseworklistarray = data.entpcourseworklistarray
|
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
||||||
// 默认选中的学生
|
: []
|
||||||
classWorkAnalysis.activeStudentQuizlist = []
|
classWorkActiveData.studentList = studentArr
|
||||||
// 默认选中的试题
|
}
|
||||||
classWorkAnalysis.activeQuizAnalysisData = []
|
|
||||||
|
|
||||||
classWorkAnalysis.row = data
|
|
||||||
window.test = this
|
|
||||||
// zdg: 学生列表
|
|
||||||
const studentArr = data.classworkdatastudentids
|
|
||||||
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
|
||||||
: []
|
|
||||||
classWorkActiveData.studentList = studentArr
|
|
||||||
/** 学生完成情况分析--获取作业学生list数据 */
|
/** 学生完成情况分析--获取作业学生list数据 */
|
||||||
getClassWorkStudentList(data.id)
|
getClassWorkStudentList(data.id)
|
||||||
|
|
||||||
|
@ -638,6 +642,32 @@ const closeDialog = () => {
|
||||||
emit('cle-click')
|
emit('cle-click')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 reloadTimer = ref(0); // 开启定时查询,作业id是否刷新了,刷新了就重新获取
|
||||||
const cutid = ref(0); // 当前初始化的作业id
|
const cutid = ref(0); // 当前初始化的作业id
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -649,6 +679,13 @@ onMounted(() => {
|
||||||
// 开始定时查询
|
// 开始定时查询
|
||||||
cutid.value = data.id;
|
cutid.value = data.id;
|
||||||
isReloadTimer();
|
isReloadTimer();
|
||||||
|
|
||||||
|
// im监听消息
|
||||||
|
if (!Chat.imChat) {
|
||||||
|
Chat.init(true, true, msgHandle);
|
||||||
|
} else {
|
||||||
|
Chat.listenMsg(msgHandle);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const isReloadTimer = () =>{
|
const isReloadTimer = () =>{
|
||||||
clearInterval(reloadTimer.value) // 关闭定时器
|
clearInterval(reloadTimer.value) // 关闭定时器
|
||||||
|
|
Loading…
Reference in New Issue