|
|
@ -214,10 +214,6 @@ import "codemirror/theme/base16-light.css"; |
|
|
|
import { mavonEditor } from 'mavon-editor' |
|
|
|
import { mavonEditor } from 'mavon-editor' |
|
|
|
import 'mavon-editor/dist/css/index.css' |
|
|
|
import 'mavon-editor/dist/css/index.css' |
|
|
|
import Stomp from 'stompjs' |
|
|
|
import Stomp from 'stompjs' |
|
|
|
// export const MQTT_USERNAME = 'huoran' // 连接用户名, todo: read from database |
|
|
|
|
|
|
|
// export const MQTT_PASSWORD = 'huoran2024' // 连接密码, todo: read from database |
|
|
|
|
|
|
|
export const MQTT_USERNAME = 'huorantest' // 连接用户名, todo: read from database |
|
|
|
|
|
|
|
export const MQTT_PASSWORD = 'huorantest2024' // 连接密码, todo: read from database |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
data () { |
|
|
@ -331,18 +327,27 @@ export default { |
|
|
|
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) |
|
|
|
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) |
|
|
|
this.getAssList() |
|
|
|
this.getAssList() |
|
|
|
} else { // 练习 |
|
|
|
} else { // 练习 |
|
|
|
if (Cookie.get('doneProjectId')) { |
|
|
|
if (Cookie.get('doneProjectId')) { // 已经做完了实验,则直接恢复项目id |
|
|
|
this.projectId = +Cookie.get('doneProjectId') |
|
|
|
this.projectId = +Cookie.get('doneProjectId') |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 没有初次加载的标识,说明不是第一次进来,而是当前页面刷新后进来这个方法,这时候则查最近一次跑的项目是哪个 |
|
|
|
|
|
|
|
if (Cookie.get('admin-loaded')) { |
|
|
|
|
|
|
|
const { data } = await this.$get(`${this.api.getTheMostRecentlyRunProject}`, { |
|
|
|
|
|
|
|
cid: this.courseId |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (data.length) this.projectId = data[0].projectId |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Cookie.set('admin-loaded', 1) // 初次加载的标识 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Cookie.remove('doneProjectId') |
|
|
|
Cookie.remove('doneProjectId') |
|
|
|
// 获取项目列表 |
|
|
|
// 获取项目列表 |
|
|
|
this.getList().then(() => { |
|
|
|
await this.getList() |
|
|
|
if (!this.isSubmit) { |
|
|
|
if (!this.isSubmit) { |
|
|
|
this.getCache() |
|
|
|
this.getCache() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.closeLoad() |
|
|
|
this.closeLoad() |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => { }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
this.competitionId && this.getCompetitionStatus() // 查询竞赛信息 |
|
|
|
this.competitionId && this.getCompetitionStatus() // 查询竞赛信息 |
|
|
|
this.getUserDetail() |
|
|
|
this.getUserDetail() |
|
|
@ -585,8 +590,8 @@ export default { |
|
|
|
competitionId: this.competitionId, |
|
|
|
competitionId: this.competitionId, |
|
|
|
assessmentId: assessmentId ? Number(assessmentId) : '', |
|
|
|
assessmentId: assessmentId ? Number(assessmentId) : '', |
|
|
|
bcId: e.judgmentId, |
|
|
|
bcId: e.judgmentId, |
|
|
|
projectId, // 项目id,同上 |
|
|
|
projectId, |
|
|
|
cid // 课程id |
|
|
|
cid |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -694,6 +699,17 @@ export default { |
|
|
|
this.startCount() |
|
|
|
this.startCount() |
|
|
|
this.clearReport() |
|
|
|
this.clearReport() |
|
|
|
this.entryTime = await this.getNow() |
|
|
|
this.entryTime = await this.getNow() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清除代码缓存 |
|
|
|
|
|
|
|
this.points.map(async (e) => { |
|
|
|
|
|
|
|
await this.$post(this.api.deleteTheLastUncommittedRecord, { |
|
|
|
|
|
|
|
competitionId: this.competitionId, |
|
|
|
|
|
|
|
assessmentId: this.assessmentId, |
|
|
|
|
|
|
|
bcId: e.judgmentId, |
|
|
|
|
|
|
|
projectId: this.projectId, |
|
|
|
|
|
|
|
cid: this.courseId, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//重新开始 |
|
|
|
//重新开始 |
|
|
|
async reloadConfirm () { |
|
|
|
async reloadConfirm () { |
|
|
@ -715,14 +731,14 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 页面加载完后重置编辑框大小 |
|
|
|
// 页面加载完后重置编辑框大小 |
|
|
|
ready (i) { |
|
|
|
ready (i) { |
|
|
|
if (this.$refs['codemirror' + i]) { |
|
|
|
// if (this.$refs['codemirror' + i]) { |
|
|
|
const code = this.$refs['codemirror' + i].codemirror |
|
|
|
// const code = this.$refs['codemirror' + i].codemirror |
|
|
|
if (code) { |
|
|
|
// if (code) { |
|
|
|
code.on('beforeChange', (istance, change) => { |
|
|
|
// code.on('beforeChange', (istance, change) => { |
|
|
|
change.origin === 'paste' && change.cancel() |
|
|
|
// change.origin === 'paste' && change.cancel() |
|
|
|
}) |
|
|
|
// }) |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
}, |
|
|
|
}, |
|
|
|
vscodeRunCode (data) { |
|
|
|
vscodeRunCode (data) { |
|
|
|
const i = +data.sort |
|
|
|
const i = +data.sort |
|
|
@ -1092,15 +1108,15 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
// 消息队列获取 |
|
|
|
// 消息队列获取 |
|
|
|
connect () { |
|
|
|
connect () { |
|
|
|
let ws = new WebSocket(`ws://139.159.153.48:15674/ws`); |
|
|
|
let ws = new WebSocket(this.$config.isTest ? `ws://139.159.153.48:15674/ws` : `wss://python.occupationlab.com/ws`); |
|
|
|
// let ws = new WebSocket(`wss://python.occupationlab.com/ws`); |
|
|
|
// let ws = new WebSocket(`wss://python.occupationlab.com/ws`); |
|
|
|
this.client = Stomp.over(ws); |
|
|
|
this.client = Stomp.over(ws); |
|
|
|
this.client.heartbeat.outgoing = 0 |
|
|
|
this.client.heartbeat.outgoing = 0 |
|
|
|
this.client.heartbeat.incoming = 0 |
|
|
|
this.client.heartbeat.incoming = 0 |
|
|
|
//初始化连接 |
|
|
|
//初始化连接 |
|
|
|
const headers = { |
|
|
|
const headers = { |
|
|
|
login: MQTT_USERNAME, |
|
|
|
login: this.$config.isTest ? 'huorantest' : 'huoran', |
|
|
|
passcode: MQTT_PASSWORD |
|
|
|
passcode: this.$config.isTest ? 'huorantest2024' : 'huoran2024' |
|
|
|
}; |
|
|
|
}; |
|
|
|
//进行连接 |
|
|
|
//进行连接 |
|
|
|
this.client.connect(headers.login, headers.passcode, this.onConnected, this.onFailed, 'pyhost'); |
|
|
|
this.client.connect(headers.login, headers.passcode, this.onConnected, this.onFailed, 'pyhost'); |
|
|
|