diff --git a/src/utils/http.js b/src/api/http.js
similarity index 100%
rename from src/utils/http.js
rename to src/api/http.js
diff --git a/src/utils/api.js b/src/api/index.js
similarity index 75%
rename from src/utils/api.js
rename to src/api/index.js
index 389acf0..40f2bec 100644
--- a/src/utils/api.js
+++ b/src/api/index.js
@@ -6,4 +6,6 @@ export default {
queryTestProject: 'occupationlab/projectManage/getProjectBySystemId',
saveCache: 'python/python/saveCache',
getLastCache: 'python/python/getLastCache',
+ getDetailById: 'occupationlab/assessment/getDetailById',
+ pageStuAssessment: 'occupationlab/assessment/pageStuAssessment'
}
\ No newline at end of file
diff --git a/src/assets/img/新建文件夹/left.png b/src/assets/img/新建文件夹/left.png
deleted file mode 100644
index 65cc5ce..0000000
Binary files a/src/assets/img/新建文件夹/left.png and /dev/null differ
diff --git a/src/assets/img/新建文件夹/right.png b/src/assets/img/新建文件夹/right.png
deleted file mode 100644
index 548a057..0000000
Binary files a/src/assets/img/新建文件夹/right.png and /dev/null differ
diff --git a/src/assets/img/新建文件夹/yes.png b/src/assets/img/新建文件夹/yes.png
deleted file mode 100644
index 5211ef1..0000000
Binary files a/src/assets/img/新建文件夹/yes.png and /dev/null differ
diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue
index 4503f5a..3b235c8 100644
--- a/src/components/TestPanel.vue
+++ b/src/components/TestPanel.vue
@@ -44,7 +44,7 @@
v-show="projectPermissions == 0"
@click="reload"
>重新开始
- 提交
+ 提交
@@ -170,13 +170,14 @@ export default {
curReq: [], // 当前实验要求
taskList: [], // 实验任务列表
pannelTab: 'first', // 面板信息切换值
- isSelected: false // 是否选择过项目的标识,选择了会置为true
+ isSelected: false, // 是否选择过项目的标识,选择了会置为true
+ statusTimer: null // 查询考核状态定时器
};
},
mounted() {
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目)
- this.getList()
+ this.getAssList()
}else{ // 练习
// 获取项目列表
this.getList().then(() => {
@@ -246,6 +247,36 @@ export default {
})
})
},
+ // 获取考核列表来查询该考核是否已经考过
+ getAssList(){
+ this.$post(`${this.api.pageStuAssessment}`, {
+ pageNum: 1,
+ pageSize: 10000
+ }).then(res => {
+ const list = res.list
+ const assessmentId = this.assessmentId
+ let done = false
+ list.map(e => {
+ // 匹配到该考核,并且已经提交过(有reportId则说明有实验记录)
+ if (e.assessmentId == assessmentId && e.reportId) {
+ done = true
+ this.isSubmit = true
+ newmain.$emit('isSubmit', this.isSubmit)
+ this.$message.error('你已经提交过该考核!')
+ setTimeout(_ => {
+ history.back() // 直接返回上一页面
+ }, 1500)
+ }
+ })
+ if (!done) {
+ this.getList()
+ // 查询考核状态定时器
+ this.statusTimer = setInterval(_ => {
+ this.getStatus()
+ }, 1000)
+ }
+ }).catch(res => {})
+ },
// 获取上次缓存记录
getCache(pId, jId) {
const projectId = pId || this.projectId
@@ -287,6 +318,19 @@ export default {
}
}).catch(res => {})
},
+ // 定时查询考核状态(只有考核才需要定时查,查到考核如果结束后,直接提交考核)
+ getStatus() {
+ this.$get(this.api.getDetailById, {
+ id: this.assessmentId
+ }).then(res => {
+ const done = res.data ? res.data.status === 2 : false // 状态(0、待开始 1、进行中 2、已结束)
+ // 如果考核已结束,则清除查询考核状态的定时器,并且自动提交
+ if (done) {
+ clearInterval(this.statusTimer)
+ this.submit()
+ }
+ }).catch(res => {})
+ },
// 项目选择回调
selectProject(){
this.isSelected = true
@@ -307,6 +351,7 @@ export default {
this.isSubmit = false
newmain.$emit('isSubmit', this.isSubmit)
const points = this.points
+ // code和codeId,还有运行结果全部清空
points.map(e => {
e.code = ''
e.codeId = ''
@@ -316,71 +361,76 @@ export default {
this.$emit('recoveryCode')
this.startCount()
},
- // 提交
- submit() {
+ // 提交询问
+ confirmSubmit() {
const pointList = this.$parent.workbench
- if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验')
+ // if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验')
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true
}).then(() => {
- const date = new Date()
- const entryTime = this.entryTime
- const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整
- const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date)
- const projectId = this.projectId
- const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称
- this.reloadCount()
- // 判分点参数
- const attributesReqList = []
- pointList.map(e => {
- attributesReqList.push({
- codeId: e.codeId,
- bcId: e.judgmentId,
- isSubmit: e.codeId ? 1 : 0,
- answer: e.answer
- })
- })
- const data = {
- classId: this.classId ? this.classId : '',
- className: this.className ? this.className : '',
- curriculumId: this.courseId,
- startTime: this.projectPermissions ? this.startTime : util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间)
- endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间)
- submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式)
- timeSum,
- projectId,
- projectName,
- assessmentId: this.assessmentId ? this.assessmentId : '',
- totalScore: 100, // 判分点总分固定为100
- systemId: 1,
- purpose: this.experimentTarget, // 实验目的
- attributesReqList
- }
- this.$post(this.api.submit, data).then(res => {
- localStorage.removeItem('codeCache')
- this.isSubmit = true
- newmain.$emit('isSubmit', this.isSubmit)
- let list = res.retInfo
- let taskList = this.taskList
- var score = 0
- taskList.map(e => {
- let item = list.find(n => n.judgmentPointsId === e.judgmentId)
- if (item) {
- e.score = item.score
- e.finishedResult = item.finishedResult
- } else {
- e.score = 0
- }
- score += e.score
- })
- this.grade = util.handleZero(score)
- })
- .catch(err => {})
+ this.submit()
}).catch(() => {})
},
+ // 提交
+ submit() {
+ const pointList = this.$parent.workbench
+ const date = new Date()
+ const entryTime = this.entryTime
+ const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整
+ const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date)
+ const projectId = this.projectId
+ const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称
+ this.reloadCount()
+ // 判分点参数
+ const attributesReqList = []
+ pointList.map(e => {
+ attributesReqList.push({
+ codeId: e.codeId,
+ bcId: e.judgmentId,
+ isSubmit: e.codeId ? 1 : 0,
+ answer: e.answer
+ })
+ })
+ const data = {
+ classId: this.classId ? this.classId : '',
+ className: this.className ? this.className : '',
+ curriculumId: this.courseId,
+ startTime: this.projectPermissions ? this.startTime : util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间)
+ endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间)
+ submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式)
+ timeSum,
+ projectId,
+ projectName,
+ assessmentId: this.assessmentId ? this.assessmentId : '',
+ totalScore: 100, // 判分点总分固定为100
+ systemId: 1,
+ purpose: this.experimentTarget, // 实验目的
+ attributesReqList
+ }
+ this.$post(this.api.submit, data).then(res => {
+ localStorage.removeItem('codeCache')
+ this.isSubmit = true
+ newmain.$emit('isSubmit', this.isSubmit)
+ let list = res.retInfo
+ let taskList = this.taskList
+ var score = 0
+ // 给判分列表添加分数和运行结果
+ taskList.map(e => {
+ let item = list.find(n => n.judgmentPointsId === e.judgmentId)
+ if (item) {
+ e.score = item.score
+ e.finishedResult = item.finishedResult // 1:正确,2:错误
+ } else {
+ e.score = 0
+ }
+ score += e.score // 计算总分
+ })
+ this.grade = util.handleZero(score) // 前置加0
+ }).catch(err => {})
+ },
// 实验面板显示隐藏
togglePannel() {
this.pannelVisible = !this.pannelVisible
diff --git a/src/config/index.js b/src/config/index.js
index 75e589d..fdfc3c9 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -7,11 +7,9 @@ if(isHh) {
host = "http://10.196.131.73/";
} else if(isBeta) {
host = "http://39.108.250.202:9000/";
- // host = "http://192.168.31.151:9000/";
+ host = "http://192.168.31.151:9000/";
} else if(isPro) {
host = "http://www.occupationlab.com/";
-} else {
- console.log("其它");
}
export default {
diff --git a/src/main.js b/src/main.js
index 0a36d96..d795c18 100644
--- a/src/main.js
+++ b/src/main.js
@@ -4,13 +4,13 @@ import router from "./router";
import store from "./store";
import ElementUI from 'element-ui'
import './assets/element-variables.scss'
-import api from './utils/api';
+import api from './api';
import {
post,
get,
del,
put
-} from './utils/http';
+} from './api/http';
import VueCodeMirror from "vue-codemirror";
import "codemirror/lib/codemirror.css";
import vuescroll from "vuescroll"; //引入vuescroll
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 9e81df9..6c85d85 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -120,20 +120,7 @@ export default {
},
// 退出实验
back() {
- if(this.projectPermissions){
- // 返回到考核列表
- if (this.$config.isBeta) { // 判断是否是职站测试服
- location.href = `http://120.78.198.231/#/ass/list`
- }
- location.href = `${this.$config.host}#/dashboard#2`
- }else{
- // 返回到实验台
- if (this.$config.isBeta) {
- location.href = `http://120.78.198.231/#/station/list`
- }
- // location.href = `${this.$config.host}#/dashboard#1`
- }
- this.$refs.mainindex.getClearTime();
+ history.back()
},
// 赋值项目id、权限、项目列表
getQueryIndex(projectId, workbench) {