@ -1,29 +1,30 @@
< template >
< div : class = "['panel', {active: pannelVisible}]" id = "panel" >
< el -container class = "scrollbar" v-if ="pannelVisible" >
< el -header >
< div : class = "['panel', {active: pannelVisible}]"
id = "panel" >
< el -container class = "scrollbar"
v - if = "pannelVisible" >
< el -header id = "header" >
< div class = "panel-header" >
< div class = "project" >
< div class = "inline-center" >
< p > 实训项目 < / p >
< el -tooltip effect = "dark" content = "点击右侧“下三角”按钮可切换实验项目" placement = "bottom" >
< i class = "info el-icon-warning" style = "margin-left: 10px" > < / i >
< el -tooltip effect = "dark"
content = "点击右侧“下三角”按钮可切换实验项目"
placement = "bottom" >
< i class = "info el-icon-warning"
style = "margin-left: 10px" > < / i >
< / e l - t o o l t i p >
< / div >
< el -select
v - model = "projectId"
placeholder = "请选择"
class = "select"
: disabled = "projectPermissions != 0"
@ change = "selectProject"
style = "flex: 1"
>
< el -option
v - for = "(item, i) in projectList"
: key = "item.projectId"
: label = "i + 1 + '. ' + item.projectName"
: value = "item.projectId"
> < / e l - o p t i o n >
< el -select v -model = " projectId "
placeholder = "请选择"
class = "select"
: disabled = "projectPermissions != 0"
@ change = "selectProject"
style = "flex: 1" >
< el -option v -for = " ( item , i ) in projectList "
: key = "item.projectId"
: label = "i + 1 + '. ' + item.projectName"
: value = "item.projectId" > < / e l - o p t i o n >
< / e l - s e l e c t >
< / div >
< div class = "item" >
@ -35,16 +36,23 @@
< span > { { seconds } } < / span > 秒
< / div >
< / div >
< div v-if ="!competitionId" class="item" >
< div v -if = " ! competitionId "
class = "item" >
< div >
总得分 :
< span class = "total-score" > { { grade } } < / span >
< / div >
< / div >
< div >
< el -button @click ="toReport" v-if ="isSubmit && !competitionId" > 查看实验报告 < / el -button >
< el -button class = "reload" @click ="reload" v-show ="projectPermissions == 0" > 重新开始 < / el -button >
< el -button type = "primary" class = "submit btn" @click ="confirmSubmit" : disabled = "isSubmit || !projectList.length" > 提交 < / e l - b u t t o n >
< el -button @click ="toReport"
v - if = "isSubmit && !competitionId" > 查看实验报告 < / e l - b u t t o n >
< el -button class = "reload"
@ click = "reload"
v - show = "projectPermissions == 0" > 重新开始 < / e l - b u t t o n >
< el -button type = "primary"
class = "submit btn"
@ click = "confirmSubmit"
: disabled = "isSubmit || !projectList.length" > 提交 < / e l - b u t t o n >
< / div >
< / div >
< / e l - h e a d e r >
@ -56,7 +64,8 @@
< p > 实验目标 < / p >
< / div >
< div class = "goal" >
< div class = "ql-editor" v-html ="experimentTarget" > < / div >
< div class = "ql-editor"
v - html = "experimentTarget" > < / div >
< / div >
< / div >
< div class = "aside-footer" >
@ -67,30 +76,38 @@
< div >
< el -row >
< el -col :span ="24" >
< el -card shadow = "never" :border ="false" >
< el -table :data ="taskList" :stripe ="true" >
< el -card shadow = "never"
: border = "false" >
< el -table :data ="taskList"
: stripe = "true" >
< el -table -column type = "index" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "name" label = "判分点" align = "center" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "score" label = "分值" width = "60" align = "center" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "name"
label = "判分点"
align = "center" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "score"
label = "分值"
width = "60"
align = "center" > < / e l - t a b l e - c o l u m n >
< template v-if ="!competitionId" >
< el -table -column label = "结果" width = "60" align = "center" >
< el -table -column label = "结果"
width = "60"
align = "center" >
< template slot -scope = " scope " >
< template v-if ="isSubmit" >
< template v-if ="!competitionId" >
< i
v - if = "scope.row.finishedResult"
class = "el-icon-check right"
> < / i >
< i
v - else
class = "el-icon-close wrong"
> < / i >
< i v -if = " scope.row.finishedResult "
class = "el-icon-check right" > < / i >
< i v -else
class = "el-icon-close wrong" > < / i >
< / template >
< template v-else > - < / template >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "score" label = "得分" width = "60" align = "center" >
< el -table -column prop = "score"
label = "得分"
width = "60"
align = "center" >
< template slot -scope = " scope " >
< template v-if ="isSubmit" > {{ competitionId ? ' - ' : scope.row.examScore }} < / template >
< / template >
@ -104,23 +121,34 @@
< / div >
< / e l - a s i d e >
< el -main >
< el -tabs v-model ="pannelTab" type="card" >
< el -tab -pane label = "项目背景" name = "first" >
< div class = "ql-editor" v-html ="experimentDescription" > < / div >
< el -tabs v -model = " pannelTab "
type = "card" >
< el -tab -pane label = "项目背景"
name = "first" >
< div class = "ql-editor"
v - html = "experimentDescription" > < / div >
< / e l - t a b - p a n e >
< el -tab -pane label = "实验要求" name = "second" >
< el -tab -pane label = "实验要求"
name = "second" >
< el -collapse v-model ="curReq" >
< el -collapse -item v-for ="item in points" :name="item.judgmentId" :key="item.judgmentId" >
< el -collapse -item v -for = " item in points "
: name = "item.judgmentId"
: key = "item.judgmentId" >
< template slot = "title" >
< i class = "el-icon-s-ticket" > < / i >
< div class = "break-all des" v-html ="item.name" > < / div >
< div class = "break-all des"
v - html = "item.name" > < / div >
< / template >
< div class = "ql-editor" v-html ="item.experimentalRequirements" > < / div >
< div class = "ql-editor"
v - html = "item.experimentalRequirements" > < / div >
< / e l - c o l l a p s e - i t e m >
< / e l - c o l l a p s e >
< / e l - t a b - p a n e >
< el -tab -pane label = "实验提示" name = "fifth" v-if ="hintOpen" >
< div class = "ql-editor" v-html ="experimentHint" > < / div >
< el -tab -pane label = "实验提示"
name = "fifth"
v - if = "hintOpen" >
< div class = "ql-editor"
v - html = "experimentHint" > < / div >
< / e l - t a b - p a n e >
< / e l - t a b s >
< / e l - m a i n >
@ -129,8 +157,14 @@
< div : class = "['toggle-panel', {active: pannelVisible}]" >
< div @click ="togglePannel" >
< img :src ="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)" alt class = "c-p" v -if = " pannelVisible " / >
< img :src ="require(`@/assets/images/system/${$config.defaultSystem}/right.png`)" alt class = "c-p" v -if = " ! pannelVisible " / >
< img :src ="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)"
alt
class = "c-p"
v - if = "pannelVisible" / >
< img :src ="require(`@/assets/images/system/${$config.defaultSystem}/right.png`)"
alt
class = "c-p"
v - if = "!pannelVisible" / >
< / div >
< / div >
< / div >
@ -145,7 +179,7 @@ import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css' ;
import 'quill/dist/quill.bubble.css' ;
export default {
data ( ) {
data ( ) {
return {
token : Cookie . get ( 'admin-token' ) ,
systemId : Cookie . get ( 'admin-systemId' ) || 1 ,
@ -189,7 +223,7 @@ export default {
reportId : ''
} ;
} ,
mounted ( ) {
mounted ( ) {
/ / 2 : 竞 赛 , 1 : 考 核 , 0 : 练 习
this . projectPermissions = this . assessmentId ?
1 :
@ -208,7 +242,7 @@ export default {
} else {
this . getCache ( )
}
} ) . catch ( res => { } )
} ) . catch ( res => { } )
if ( this . competitionId ) {
clearInterval ( this . statusTimer )
this . statusTimer = setInterval ( _ => {
@ -220,14 +254,14 @@ export default {
} ,
methods : {
/ / 获 取 项 目 列 表
getList ( ) {
getList ( ) {
let data = {
systemId : this . systemId ,
cId : this . courseId , / / 课 程 i d
permissions : this . projectPermissions / / 练 习 / 考 核 / 竞 赛
}
return new Promise ( ( resolve , reject ) => {
this . $get ( ` ${ this . api . queryTestProject } ` , data ) . then ( res => {
this . $get ( ` ${ this . api . queryTestProject } ` , data ) . then ( res => {
const list = res . projects
this . projectList = list
if ( ! this . projectPermissions && ! this . projectId ) this . projectId = list ? list [ 0 ] . projectId : 0 / / 默 认 取 第 一 个 项 目
@ -242,7 +276,7 @@ export default {
} )
} ,
/ / 获 取 项 目 详 情
getProDetail ( ) {
getProDetail ( ) {
const projectId = this . projectId
return new Promise ( ( resolve , reject ) => {
this . $get ( this . api . getProjectDetail , {
@ -251,6 +285,7 @@ export default {
} ) . then ( res => {
const points = res . projectJudgmentVos
const project = res . projectManage
const mg = res . projectManage
const curReq = [ ]
/ / 跳 转 银 行
if ( project . systemId == 11 ) {
@ -264,8 +299,8 @@ export default {
points . map ( ( e , i ) => {
e . code = '' / / 后 端 返 回 的 字 段 没 有 c o d e , 要 手 动 加 上 以 存 储 运 行 的 代 码
e . codeId = '' / / 代 码 通 过 接 口 传 给 后 端 运 行 后 , 接 口 会 返 回 一 个 c o d e I d , 提 交 的 时 候 需 要 传 这 个 c o d e I d
e . answer = '' / / 代 码 运 行 结 果
e . retResult = '' / / 返 回 结 果 ( 1 为 正 确 0 为 错 误 )
e . answer = '' / / 代 码 运 行 结 果
e . retResult = '' / / 返 回 结 果 ( 1 为 正 确 0 为 错 误 )
curReq . push ( e . judgmentId )
} )
if ( this . projectPermissions ) {
@ -284,7 +319,7 @@ export default {
this . experimentTarget = project . experimentTarget
this . experimentDescription = project . experimentDescription
this . experimentHint = project . experimentHint
this . hintOpen = ! res . projectManage . hintOpen / / 0 显 示 , 1 不 显 示
this . hintOpen = mg . founder ? ! mg . hintOpenBySchool : ! mg . hintOpen / / 0 显 示 , 1 不 显 示
this . $emit ( 'tell' , projectId , systemId , this . points )
const isPrac = this . projectPermissions == 0 / / 是 否 是 练 习
this . text = isPrac ? '已用' : '剩余'
@ -300,12 +335,12 @@ export default {
} )
} ,
/ / 关 闭 父 页 面 的 l o a d i n g , 并 置 加 载 完 成 状 态 为 t r u e
closeLoad ( ) {
closeLoad ( ) {
this . $parent . loadIns . close ( )
this . $parent . loaded = true
} ,
/ / 获 取 考 核 列 表 来 查 询 该 考 核 是 否 已 经 考 过
getAssList ( ) {
getAssList ( ) {
this . $post ( ` ${ this . api . pageStuAssessment } ` , {
pageNum : 1 ,
pageSize : 10000
@ -314,7 +349,7 @@ export default {
const assessmentId = this . assessmentId
let done = false
const classId = this . classId
/ / 匹 配 到 该 考 核 , 并 且 已 经 提 交 过 ( 有 r e p o r t I d 则 说 明 有 实 验 记 录 ) , 并 且 c l a s s I d 跟 当 前 用 户 的 c l a s s I d 相 同 , 就 提 示 提 交 了 考 核 然 后 返 回 上 一 页
/ / 匹 配 到 该 考 核 , 并 且 已 经 提 交 过 ( 有 r e p o r t I d 则 说 明 有 实 验 记 录 ) , 并 且 c l a s s I d 跟 当 前 用 户 的 c l a s s I d 相 同 , 就 提 示 提 交 了 考 核 然 后 返 回 上 一 页
if ( list . find ( e => e . assessmentId == assessmentId && e . reportId && e . classId == classId ) ) {
done = true
this . isSubmit = true
@ -328,16 +363,16 @@ export default {
if ( ! done ) {
this . getList ( ) . then ( ( ) => {
this . getCache ( )
} ) . catch ( res => { } )
} ) . catch ( res => { } )
/ / 查 询 考 核 状 态 定 时 器
this . statusTimer = setInterval ( _ => {
this . getAssStatus ( )
} , 1000 )
}
} ) . catch ( res => { } )
} ) . catch ( res => { } )
} ,
/ / 获 取 上 次 缓 存 记 录
getCache ( cache ) {
getCache ( cache ) {
const pId = cache ? cache . projectId : ''
const projectId = Number ( pId || this . projectId )
const cid = this . courseId
@ -373,7 +408,7 @@ export default {
let hasCache = 0 / / 是 否 有 缓 存
points . map ( ( e , i ) => {
const judgmentId = e . judgmentId
promiseList . push ( new Promise ( ( resolve , reject ) => {
promiseList . push ( new Promise ( ( resolve , reject ) => {
this . $post ( this . api . getLastCache , {
assessmentId : assessmentId ? Number ( assessmentId ) : '' ,
bcId : judgmentId ,
@ -413,7 +448,7 @@ export default {
} )
this . $emit ( 'tell' , projectId , this . curSystemId , this . points )
this . $emit ( 'recoveryCode' , newJudgmentId + '' ) / / 切 换 为 缓 存 的 判 分 点 , t a b 索 引 值 要 为 字 符 串
} ) . catch ( res => { } )
} ) . catch ( res => { } )
} else {
this . points . map ( e => {
const item = points . find ( n => n . judgmentId === e . judgmentId )
@ -432,14 +467,14 @@ export default {
bcId : e . judgmentId ,
projectId ,
cid
} ) . then ( res => { } ) . catch ( ( ) => { } )
} ) . then ( res => { } ) . catch ( ( ) => { } )
} )
} )
} )
}
} ,
/ / 定 时 查 询 考 核 状 态 ( 查 到 考 核 如 果 结 束 后 , 直 接 提 交 考 核 )
getAssStatus ( ) {
getAssStatus ( ) {
/ / 未 提 交 才 需 要 查 询 状 态
this . isSubmit || this . $get ( this . api . getDetailById , {
id : this . assessmentId
@ -453,10 +488,10 @@ export default {
} )
this . submit ( )
}
} ) . catch ( res => { } )
} ) . catch ( res => { } )
} ,
/ / 定 时 查 询 竞 赛 状 态 ( 查 到 竞 赛 如 果 结 束 后 , 直 接 提 交 竞 赛 )
getCompetitionStatus ( ) {
getCompetitionStatus ( ) {
/ / 未 提 交 才 需 要 查 询 状 态
this . isSubmit || this . $post ( ` ${ this . api . getCompetition } ?competitionId= ${ this . competitionId } ` ) . then ( ( { competition } ) => {
const stages = competition . competitionStage
@ -475,14 +510,14 @@ export default {
this . counter ( ( endTime - now ) / 1000 )
}
}
} ) . catch ( res => { } )
} ) . catch ( res => { } )
} ,
/ / 项 目 选 择 回 调
selectProject ( ) {
selectProject ( ) {
this . isSelected = true
this . getProDetail ( ) . then ( ( ) => {
this . getCache ( )
} ) . catch ( res => { } )
} ) . catch ( res => { } )
this . isSubmit = false
this . countVal = 0
this . grade = '00'
@ -491,11 +526,11 @@ export default {
newmain . $emit ( 'isSubmit' , this . isSubmit ) / / 选 择 项 目 后 把 提 交 状 态 重 置 为 未 提 交
} ,
/ / 查 看 实 验 报 告
toReport ( ) {
toReport ( ) {
this . $router . push ( ` /report?reportId= ${ this . reportId } ` )
} ,
/ / 重 新 开 始
reload ( ) {
reload ( ) {
this . reloadCount ( )
this . grade = '00'
localStorage . removeItem ( 'codeCache' )
@ -514,10 +549,10 @@ export default {
this . startCount ( )
} ,
/ / 提 交 询 问
confirmSubmit ( ) {
confirmSubmit ( ) {
const pointList = this . $parent . workbench
let msg = '此操作将视为结束考试,是否继续?'
if ( pointList . find ( e => ! e . codeId && e . code ) ) msg = '有代码没有运行,该代码将不得分,确定提交?'
if ( pointList . find ( e => ! e . codeId && e . code ) ) msg = '有代码没有运行,该代码将不得分,确定提交?'
this . $confirm ( msg , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
@ -534,14 +569,14 @@ export default {
} ) . then ( ( { codeId } ) => {
this . $parent . workbench [ 0 ] . codeId = codeId
this . submit ( )
} ) . catch ( err => { } )
} ) . catch ( err => { } )
} else {
this . submit ( )
}
} ) . catch ( ( ) => { } )
} ) . catch ( ( ) => { } )
} ,
/ / 提 交
submit ( ) {
submit ( ) {
if ( this . isSubmit ) return false
const pointList = this . $parent . workbench
const date = new Date ( )
@ -612,10 +647,10 @@ export default {
this . $parent . back ( )
}
} )
} ) . catch ( err => { } )
} ) . catch ( err => { } )
} ,
/ / 编 辑 实 验 报 告
editReport ( reportId ) {
editReport ( reportId ) {
const data = [ ]
const ans = [ ]
const promises = [ ]
@ -647,20 +682,20 @@ export default {
this . $post ( this . api . editExperimentalData , {
reportId ,
data : JSON . stringify ( data )
} ) . then ( res => { } ) . catch ( err => { } )
} ) . then ( res => { } ) . catch ( err => { } )
} )
} ,
/ / 实 验 面 板 显 示 隐 藏
togglePannel ( ) {
togglePannel ( ) {
document . querySelector ( '#panel' ) . style . left = 0
this . pannelVisible = ! this . pannelVisible
} ,
/ / 倒 计 时
timeFormat ( param ) {
timeFormat ( param ) {
return param < 10 ? '0' + param : param
} ,
/ / 清 除 时 间
reloadCount ( ) {
reloadCount ( ) {
clearInterval ( this . counterTimer )
this . countVal = ''
this . day = '00'
@ -669,7 +704,7 @@ export default {
this . hour = '00'
} ,
/ / 计 时 器 ( 考 核 是 倒 计 时 , 练 习 是 计 时 )
counter ( counterTime ) {
counter ( counterTime ) {
let leave1 = counterTime % ( 24 * 3600 ) / / 计 算 天 数 后 剩 余 的 毫 秒 数
let leave2 = leave1 % 3600 / / 计 算 小 时 数 后 剩 余 的 毫 秒 数
let leave3 = leave2 % 60 / / 计 算 分 钟 数 后 剩 余 的 毫 秒 数
@ -687,25 +722,24 @@ export default {
this . seconds = seconds
} ,
/ / 启 动 倒 计 时
startCount ( ) {
startCount ( ) {
clearInterval ( this . counterTimer )
this . counterTimer = setInterval ( ( ) => {
this . counter ( this . projectPermissions ? this . countVal -- : this . countVal ++ )
} , 1000 )
} ,
/ / 拖 拽 面 板
drag ( ) {
drag ( ) {
const el = document . querySelector ( '#panel' )
let gap = 10 / / 缝 隙 : 小 于 缝 隙 时 , 则 吸 附
let parent = document . body
el . onmousedown = e => {
document . queryS elector ( '#header' ) . onmousedown = e => {
var x = e . clientX - el . offsetLeft
var y = e . clientY - el . offsetTop
var left = 0
var top = 0
var boxer = document . querySelector ( ".boxer" )
document . onmousemove = function ( eve ) {
document . onmousemove = function ( eve ) {
left = eve . clientX - x
top = eve . clientY - y
/ / 左
@ -786,7 +820,7 @@ export default {
}
/deep/ . des {
font - size : 16 px ;
font - family : "Microsoft YaHei" ;
font - family : 'Microsoft YaHei' ;
img {
max - width : 100 % ;
}
@ -836,8 +870,8 @@ export default {
color : # 333 ;
background - color : # fff ;
}
. el - aside / deep / [ class *= " el-icon-" ] ,
[ class ^= "el-icon-" ] {
. el - aside / deep / [ class *= ' el-icon-' ] ,
[ class ^= 'el-icon-' ] {
line - height : 40 px ;
font - size : 16 px ;
}
@ -856,10 +890,13 @@ export default {
& . system4 {
background - size : 100 % 58 px ;
}
& . system5 , & . system7 , & . system9 {
& . system5 ,
& . system7 ,
& . system9 {
background - size : 100 % 40 px ;
}
& . system8 , & . system6 {
& . system8 ,
& . system6 {
background - size : 100 % 61 px ;
}
& . system10 {
@ -902,7 +939,7 @@ export default {
}
/deep/ . select {
. el - select _ _caret : before {
content : "\e78f" ;
content : '\e78f' ;
padding : 3 px ;
font - size : 16 px ;
color : # fff ;
@ -971,7 +1008,7 @@ export default {
color : # bfbfbf ;
cursor : pointer ;
& : hover {
opacity : .9 ;
opacity : 0 .9;
}
}
< / style >