vscode模式下输入框允许粘贴,刷新页面后查询最近一次运行的项目

master
yujialong 5 months ago
parent d90fcd1df0
commit 13c75433ec
  1. 56
      src/components/TestPanel.vue
  2. 25
      src/views/Home.vue

@ -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) { // assessmentIdcompetitionId) if (this.assessmentId) { // assessmentIdcompetitionId)
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');

@ -95,31 +95,6 @@ export default {
testPanel testPanel
}, },
mounted () { mounted () {
//
const opened = +localStorage.getItem('opened')
if (opened) {
localStorage.setItem('opened', opened + 1)
this.notAllowed = 1
this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', {
confirmButtonText: '退出当前页面',
showClose: false,
callback: action => {
this.back()
}
})
} else {
localStorage.setItem('opened', 1)
}
//
window.addEventListener('unload', function () {
const opened = +localStorage.getItem('opened')
if (opened) {
localStorage.setItem('opened', opened - 1)
} else {
localStorage.removeItem('opened')
}
})
document.onkeydown = function (event) { document.onkeydown = function (event) {
var e = event || window.event || arguments.callee.caller.arguments[0]; var e = event || window.event || arguments.callee.caller.arguments[0];

Loading…
Cancel
Save