重新开始弹框

master
yujialong 7 months ago
parent cf67d8a099
commit e0f0ed0092
  1. 6
      src/api/http.js
  2. 24
      src/components/TestPanel.vue
  3. 53
      src/components/breadcrumb/index.vue
  4. 7
      src/components/codemirror.vue
  5. 2
      src/config/index.js

@ -30,6 +30,7 @@ service.interceptors.request.use(config => {
return Promise.reject(err); return Promise.reject(err);
}) })
let logouted = 0;
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
@ -49,11 +50,14 @@ service.interceptors.response.use(
switch (error.response.status) { switch (error.response.status) {
// 401: 未登录 // 401: 未登录
case 401: case 401:
if (!logouted) {
Message.error('登录过期,请重新登录') Message.error('登录过期,请重新登录')
setTimeout(() => { setTimeout(() => {
history.back() history.back()
}, 1500) }, 1500)
break; logouted = 1
}
break;
default: default:
// Message.error(error.response.data.message) // Message.error(error.response.data.message)
Promise.reject(error.response); Promise.reject(error.response);

@ -51,7 +51,7 @@
<el-button @click="toReport" <el-button @click="toReport"
v-if="isSubmit && !competitionId">查看实验报告</el-button> v-if="isSubmit && !competitionId">查看实验报告</el-button>
<el-button class="reload" <el-button class="reload"
@click="reload" @click="reloadConfirm"
v-show="projectPermissions == 0">重新开始</el-button> v-show="projectPermissions == 0">重新开始</el-button>
<el-button type="primary" <el-button type="primary"
class="submit btn" class="submit btn"
@ -821,7 +821,6 @@ export default {
location.href = href location.href = href
} }
}, },
//
async reload () { async reload () {
this.reloadCount() this.reloadCount()
this.grade = '00' this.grade = '00'
@ -843,6 +842,24 @@ export default {
this.clearReport() this.clearReport()
this.entryTime = await this.getNow() this.entryTime = await this.getNow()
}, },
//
async reloadConfirm () {
//
if (this.isSubmit) {
this.reload()
} else {
try {
await this.$confirm('<p style="color: #f56c6c;">点击重新开始,之前操作会清空。</p><p>确定重新开始吗?</p>', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false,
dangerouslyUseHTMLString: true,
})
this.reload()
} catch (e) { }
}
},
// //
ready (i) { ready (i) {
if (this.$refs['codemirror' + i]) { if (this.$refs['codemirror' + i]) {
@ -1583,4 +1600,7 @@ export default {
} }
} }
} }
.text-danger {
color: #f56c6c;
}
</style> </style>

@ -3,15 +3,12 @@
<div class="breadcrumb"> <div class="breadcrumb">
<el-breadcrumb separator=">"> <el-breadcrumb separator=">">
<template v-for="(item, index) in pages"> <template v-for="(item, index) in pages">
<el-breadcrumb-item <el-breadcrumb-item v-if="index != pages.length - 1"
v-if="index != pages.length - 1" :key="index">
:key="index"
>
<span @click="toPath">{{item}}</span> <span @click="toPath">{{item}}</span>
</el-breadcrumb-item> </el-breadcrumb-item>
<el-breadcrumb-item <el-breadcrumb-item v-else
v-else :key="index">
:key="index">
{{item}} {{item}}
</el-breadcrumb-item> </el-breadcrumb-item>
</template> </template>
@ -21,33 +18,25 @@
<script> <script>
export default { export default {
props: { props: {
data: { data: {
type: String, type: String,
required: true required: true
},
route: {
type: String,
default: '/'
},
query: {
type: Object
}
}, },
data() { },
return { data () {
pages: this.data.split('/') return {
}; pages: this.data.split('/')
};
},
methods: {
update (data) {
this.pages = data.split('/')
}, },
methods: { toPath () {
update(data){ this.$router.back()
this.pages = data.split('/')
},
toPath() {
console.log(33)
this.$router.back()
}
} }
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -63,7 +52,7 @@ export default {
} }
&:last-child { &:last-child {
.is-link { .is-link {
color: #0B1D30; color: #0b1d30;
} }
} }
} }

@ -591,8 +591,11 @@ export default {
// //
async stopRunCode () { async stopRunCode () {
this.isStopRunCode = 1 this.isStopRunCode = 1
if (this.pid) await this.$post(`${this.api.endRunningProcess}?pid=${this.pid}`) if (this.pid) {
this.pid = '' const { pid } = this
this.pid = ''
await this.$post(`${this.api.endRunningProcess}?pid=${pid}`)
}
if (this.loadIns) this.loadIns.close() if (this.loadIns) this.loadIns.close()
}, },
inputRunCode (data) { inputRunCode (data) {

@ -13,7 +13,7 @@ let host = location.origin + '/'
let bankPath = `${location.origin}/banksystem` // 银行系统 let bankPath = `${location.origin}/banksystem` // 银行系统
// 121.37.12.51 | 192.168.31.151 // 121.37.12.51 | 192.168.31.151
if (isDev) { if (isDev) {
host = 'http://192.168.31.51:9000/' host = 'http://192.168.31.217:9000/'
// host = 'http://121.37.12.51:9000/' // host = 'http://121.37.12.51:9000/'
// host = 'https://occupationlab.com/' // host = 'https://occupationlab.com/'
bankPath = `http://${location.hostname}:8093` bankPath = `http://${location.hostname}:8093`

Loading…
Cancel
Save