定时查询状态及自动提交

ui
jialong.yu 3 years ago
parent aa01c8e99a
commit 0a63968750
  1. 0
      src/api/http.js
  2. 2
      src/api/index.js
  3. BIN
      src/assets/img/新建文件夹/left.png
  4. BIN
      src/assets/img/新建文件夹/right.png
  5. BIN
      src/assets/img/新建文件夹/yes.png
  6. 168
      src/components/TestPanel.vue
  7. 4
      src/config/index.js
  8. 4
      src/main.js
  9. 15
      src/views/Home.vue

@ -6,4 +6,6 @@ export default {
queryTestProject: 'occupationlab/projectManage/getProjectBySystemId', queryTestProject: 'occupationlab/projectManage/getProjectBySystemId',
saveCache: 'python/python/saveCache', saveCache: 'python/python/saveCache',
getLastCache: 'python/python/getLastCache', getLastCache: 'python/python/getLastCache',
getDetailById: 'occupationlab/assessment/getDetailById',
pageStuAssessment: 'occupationlab/assessment/pageStuAssessment'
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

@ -44,7 +44,7 @@
v-show="projectPermissions == 0" v-show="projectPermissions == 0"
@click="reload" @click="reload"
>重新开始</el-button> >重新开始</el-button>
<el-button style="margin-right:7px" @click="submit" :disabled="isSubmit">提交</el-button> <el-button style="margin-right:7px" @click="confirmSubmit" :disabled="isSubmit">提交</el-button>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -170,13 +170,14 @@ export default {
curReq: [], // curReq: [], //
taskList: [], // taskList: [], //
pannelTab: 'first', // pannelTab: 'first', //
isSelected: false // true isSelected: false, // true
statusTimer: null //
}; };
}, },
mounted() { mounted() {
this.projectPermissions = this.projectId ? 1 : 0 // / this.projectPermissions = this.projectId ? 1 : 0 // /
if(this.projectId){ // projectId) if(this.projectId){ // projectId)
this.getList() this.getAssList()
}else{ // }else{ //
// //
this.getList().then(() => { 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) { getCache(pId, jId) {
const projectId = pId || this.projectId const projectId = pId || this.projectId
@ -287,6 +318,19 @@ export default {
} }
}).catch(res => {}) }).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(){ selectProject(){
this.isSelected = true this.isSelected = true
@ -307,6 +351,7 @@ export default {
this.isSubmit = false this.isSubmit = false
newmain.$emit('isSubmit', this.isSubmit) newmain.$emit('isSubmit', this.isSubmit)
const points = this.points const points = this.points
// codecodeId,
points.map(e => { points.map(e => {
e.code = '' e.code = ''
e.codeId = '' e.codeId = ''
@ -316,71 +361,76 @@ export default {
this.$emit('recoveryCode') this.$emit('recoveryCode')
this.startCount() this.startCount()
}, },
// //
submit() { confirmSubmit() {
const pointList = this.$parent.workbench 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("此操作将视为结束考试, 是否继续?", "提示", { this.$confirm("此操作将视为结束考试, 是否继续?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
center: true center: true
}).then(() => { }).then(() => {
const date = new Date() this.submit()
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 => {})
}).catch(() => {}) }).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 // 12
} else {
e.score = 0
}
score += e.score //
})
this.grade = util.handleZero(score) // 0
}).catch(err => {})
},
// //
togglePannel() { togglePannel() {
this.pannelVisible = !this.pannelVisible this.pannelVisible = !this.pannelVisible

@ -7,11 +7,9 @@ if(isHh) {
host = "http://10.196.131.73/"; host = "http://10.196.131.73/";
} else if(isBeta) { } else if(isBeta) {
host = "http://39.108.250.202:9000/"; host = "http://39.108.250.202:9000/";
// host = "http://192.168.31.151:9000/"; host = "http://192.168.31.151:9000/";
} else if(isPro) { } else if(isPro) {
host = "http://www.occupationlab.com/"; host = "http://www.occupationlab.com/";
} else {
console.log("其它");
} }
export default { export default {

@ -4,13 +4,13 @@ import router from "./router";
import store from "./store"; import store from "./store";
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import './assets/element-variables.scss' import './assets/element-variables.scss'
import api from './utils/api'; import api from './api';
import { import {
post, post,
get, get,
del, del,
put put
} from './utils/http'; } from './api/http';
import VueCodeMirror from "vue-codemirror"; import VueCodeMirror from "vue-codemirror";
import "codemirror/lib/codemirror.css"; import "codemirror/lib/codemirror.css";
import vuescroll from "vuescroll"; //引入vuescroll import vuescroll from "vuescroll"; //引入vuescroll

@ -120,20 +120,7 @@ export default {
}, },
// 退 // 退
back() { back() {
if(this.projectPermissions){ history.back()
//
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();
}, },
// id // id
getQueryIndex(projectId, workbench) { getQueryIndex(projectId, workbench) {

Loading…
Cancel
Save