导入代码及考核大赛时间缓存

openf12
yujialong 10 months ago
parent b8cfa4b26d
commit 5342a2809a
  1. 4
      src/api/index.js
  2. 39
      src/components/TestPanel.vue
  3. 179
      src/components/codemirror.vue
  4. 1
      src/config/index.js
  5. 12
      src/main.js
  6. 8
      src/styles/theme/theme9.scss

@ -39,4 +39,8 @@ export default {
modelClassListByStudent: `nakadai/nakadai/model/student/modelClassListByStudent`, modelClassListByStudent: `nakadai/nakadai/model/student/modelClassListByStudent`,
studentModelListBySystem: `nakadai/nakadai/model/student/studentModelListBySystem`, studentModelListBySystem: `nakadai/nakadai/model/student/studentModelListBySystem`,
detailsOfGoods: `nakadai/mall/detailsOfGoods`, detailsOfGoods: `nakadai/mall/detailsOfGoods`,
importCode: `occupationlab/occupationlab/experimentalReport/importCode`,
removeImport: `occupationlab/occupationlab/experimentalReport/removeImport`,
saveStartTime: `python/python/saveStartTime`,
getProductSystemTheme: `nakadai/mall/getProductSystemTheme`,
} }

@ -405,14 +405,27 @@ export default {
mavonEditor mavonEditor
}, },
mounted () { mounted () {
this.getNow().then(now => { this.init()
this.entryTime = now },
methods: {
//
async init () {
// 210 // 210
this.projectPermissions = this.assessmentId ? this.projectPermissions = this.assessmentId ?
1 : 1 :
this.competitionId ? this.competitionId ?
2 : 2 :
0 0
let now
if (!this.projectPermissions) {
now = await this.getNow()
} else {
now = await this.getSumTime() //
if (!now) now = await this.getNow()
}
this.entryTime = now
if (this.assessmentId) { // assessmentIdcompetitionId) if (this.assessmentId) { // assessmentIdcompetitionId)
this.getAssList() this.getAssList()
} else { // } else { //
@ -435,9 +448,7 @@ export default {
this.getUserDetail() this.getUserDetail()
this.drag() this.drag()
this.tableHeight = window.innerHeight - 360 this.tableHeight = window.innerHeight - 360
})
}, },
methods: {
// //
getList () { getList () {
let data = { let data = {
@ -468,7 +479,7 @@ export default {
this.$get(this.api.getProjectDetail, { this.$get(this.api.getProjectDetail, {
projectId, projectId,
stuAssessent: 1 stuAssessent: 1
}).then(res => { }).then(async (res) => {
const points = res.projectJudgmentVos const points = res.projectJudgmentVos
const project = res.projectManage const project = res.projectManage
const curReq = [] const curReq = []
@ -515,14 +526,14 @@ export default {
this.experimentHint = project.experimentHint this.experimentHint = project.experimentHint
this.hintOpen = project.founder ? !project.hintOpenBySchool : !project.hintOpen // 01 this.hintOpen = project.founder ? !project.hintOpenBySchool : !project.hintOpen // 01
this.$emit('tell', projectId, systemId, this.points) this.$emit('tell', projectId, systemId, this.points)
// this.getSumTime()
const isPrac = this.projectPermissions == 0 // const isPrac = this.projectPermissions == 0 //
this.text = isPrac ? '已用' : '剩余' this.text = isPrac ? '已用' : '剩余'
// //
if (!this.competitionId) { if (!this.competitionId) {
this.getNow().then(now => { const now = await this.getNow()
this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 0 this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 0
this.startCount() this.startCount()
})
} }
resolve() resolve()
}).catch(err => { }).catch(err => {
@ -531,6 +542,16 @@ export default {
}) })
}, },
// //
getSumTime () {
return new Promise(async (resolve, reject) => {
const res = await this.$get(this.api.getStartTime, {
permissions: this.projectPermissions,
projectId: this.projectId
})
resolve(res.startTime ? new Date(res.startTime) : '')
})
},
//
getNow () { getNow () {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const res = await this.$get(this.api.getCurrentTime) const res = await this.$get(this.api.getCurrentTime)
@ -879,11 +900,13 @@ export default {
const attributesReqList = [] const attributesReqList = []
pointList.map(e => { pointList.map(e => {
attributesReqList.push({ attributesReqList.push({
code: e.code,
codeId: e.codeId, codeId: e.codeId,
bcId: e.judgmentId, bcId: e.judgmentId,
isSubmit: e.codeId ? 1 : 0, isSubmit: e.codeId ? 1 : 0,
answer: e.answer, answer: e.answer,
retResult: e.retResult retResult: e.retResult,
judgmentName: e.name
}) })
}) })
const data = { const data = {

@ -9,11 +9,12 @@
<div v-if="isSubmit" <div v-if="isSubmit"
class="code-mask"></div> class="code-mask"></div>
<div class="btns"> <div class="btns">
<el-button class="btn"
type="danger"
@click="myCode">我的代码</el-button>
<span class="el-icon-delete del" <span class="el-icon-delete del"
@click="clearCode"></span> @click="clearCode"></span>
<el-button v-if="isPrac"
class="btn"
type="danger"
@click="myCode">我的代码</el-button>
<el-button v-if="modelIsShow" <el-button v-if="modelIsShow"
class="btn" class="btn"
type="warning" type="warning"
@ -60,7 +61,7 @@
{{errLine}}行出现错误 {{errLine}}行出现错误
<el-button class="tips-btn" <el-button class="tips-btn"
@click="getTips" @click="getTips"
v-show="showTips">提示</el-button> v-show="isPrac">提示</el-button>
<el-dialog title="答案提示" <el-dialog title="答案提示"
center center
:close-on-click-modal="false" :close-on-click-modal="false"
@ -136,13 +137,28 @@
<el-dialog title="我的代码" <el-dialog title="我的代码"
:visible.sync="codeVisible" :visible.sync="codeVisible"
width="1000px" width="1200px"
:close-on-click-modal="false" :close-on-click-modal="false"
custom-class="code-dia"> custom-class="code-dia">
<div class="tool">
<el-input style="width: 250px"
placeholder="请输入项目名称、判分点名称"
v-model="keyword"
suffix-icon="el-icon-search"
clearable
size="small"></el-input>
<div class="action">
<el-button class="cus-btn"
type="primary"
size="small"
@click="delAll">批量删除</el-button>
</div>
</div>
<el-table :data="codeList" <el-table :data="codeList"
class="cus-table" class="cus-table"
ref="table" ref="table"
stripe stripe
max-height="400"
header-align="center" header-align="center"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" <el-table-column type="selection"
@ -152,31 +168,32 @@
label="序号" label="序号"
width="55" width="55"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column prop="fileName" <el-table-column prop="judgmentName"
label="判分点"
min-width="250"
align="center"
show-overflow-tooltip></el-table-column>
<el-table-column prop="projectName"
label="项目名称" label="项目名称"
min-width="150" min-width="250"
align="center" align="center"
show-overflow-tooltip></el-table-column> show-overflow-tooltip></el-table-column>
<el-table-column prop="fileSize" <el-table-column prop="submitTime"
label="判分点"
min-width="150"
align="center"></el-table-column>
<el-table-column prop="createTime"
label="提交时间" label="提交时间"
width="140" width="140"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column prop="fileFormat" <el-table-column prop="score"
label="是否得分" label="是否得分"
width="100" width="80"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column width="200" <el-table-column width="190"
label="操作" label="操作"
align="center"> align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" <el-button type="text"
@click="showCode(scope.row)">查看代码</el-button> @click="showCode(scope.row)">查看代码</el-button>
<el-button type="text" <el-button type="text"
@click="download(scope.row)">导入代码</el-button> @click="importCode(scope.row)">导入代码</el-button>
<el-button type="text" <el-button type="text"
@click="del(scope.row)">删除</el-button> @click="del(scope.row)">删除</el-button>
</template> </template>
@ -199,16 +216,22 @@
<el-dialog title="查看代码" <el-dialog title="查看代码"
:visible.sync="showVisible" :visible.sync="showVisible"
width="500px" width="700px"
:close-on-click-modal="false" :close-on-click-modal="false"
custom-class="code-dia"> custom-class="code-dia">
<el-tabs v-model="showActive"> <el-tabs class="code-tab"
v-model="showActive">
<el-tab-pane label="代码" <el-tab-pane label="代码"
name="code"> name="code">
<codemirror class="code"
v-model="curCode"
:options="cmOptionDia"></codemirror>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="结果" <el-tab-pane label="结果"
name="result"></el-tab-pane> name="result">
<div class="result"
v-html="curResult"></div>
</el-tab-pane>
</el-tabs> </el-tabs>
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
@ -278,7 +301,8 @@ export default {
competitionId: Cookie.get('admin-competitionId'), competitionId: Cookie.get('admin-competitionId'),
fromManager: Cookie.get('admin-fromManager'), // fromManager: Cookie.get('admin-fromManager'), //
courseId: Cookie.get('admin-courseId'), // id courseId: Cookie.get('admin-courseId'), // id
showTips: false, // mallId: Cookie.get('admin-mallId'),
isPrac: false, //
answer: '', // answer: '', //
codeVal: this.code, codeVal: this.code,
runResult: '', // runResult: '', //
@ -314,6 +338,32 @@ export default {
showCursorWhenSelecting: true, showCursorWhenSelecting: true,
theme: "monokai" // theme: "monokai" //
}, },
cmOptionDia: {
readOnly: true,
scrollbarStyle: "native",
tabSize: 2, // tab
styleActiveLine: true, //
lineNumbers: true, //
styleSelectedText: true,
line: true,
foldGutter: true, //
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
highlightSelectionMatches: { showToken: /\w/, annotateScrollbar: true }, //
mode: 'python',
lineWrapping: true, //
autoCloseTags: true,//
autoCloseBrackets: true,//
// hint.js options
hintOptions: {
//
completeSingle: false
},
// sublimeemacsvim
keyMap: "sublime",
matchBrackets: true,
showCursorWhenSelecting: true,
theme: "monokai" //
},
inputTextReg: /^((?!#).*?(,|\s?|\(|\[|\{)+)?input(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, // input() inputTextReg: /^((?!#).*?(,|\s?|\(|\[|\{)+)?input(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, // input()
requestList: [], // inputaxios requestList: [], // inputaxios
sourceCode: '', // inputexit sourceCode: '', // inputexit
@ -342,9 +392,12 @@ export default {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
searchTimer: null,
showVisible: false, showVisible: false,
showActive: 'code', showActive: 'code',
curCode: '',
curResult: '',
}; };
}, },
components: { components: {
@ -353,10 +406,16 @@ export default {
watch: { watch: {
codeVal (val) { codeVal (val) {
this.$emit("update:code", val) this.$emit("update:code", val)
} },
keyword: function (val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
},
}, },
mounted () { mounted () {
if (!this.assessmentId && !this.competitionId) this.showTips = true if (!this.assessmentId && !this.competitionId) this.isPrac = true
// //
newmain.$on("isSubmit", isSubmit => { newmain.$on("isSubmit", isSubmit => {
this.isSubmit = isSubmit this.isSubmit = isSubmit
@ -713,24 +772,36 @@ export default {
}, },
//
async getCodes () {
const { page } = await this.$post(`${this.api.importCode}?mallId=${this.mallId}&curriculumId=${this.courseId}&projectId=${this.projectId}&current=${this.page}&size=${this.pageSize}&projectName=${this.keyword}`)
this.codeList = page.records
this.total = page.total
},
//
initData () {
this.page = 1
this.getCodes()
},
// //
myCode () { myCode () {
this.initData()
this.codeVisible = true this.codeVisible = true
}, },
// //
delAll () { delAll () {
if (this.multipleSelection.length) { if (this.multipleSelection.length) {
const newArr = this.multipleSelection const newArr = this.multipleSelection
const delList = newArr.map(item => { const ids = newArr.map(e => {
return `ids=${item.id}` return `importId=${e.importId}`
}) })
this.$confirm(`此批量删除操作不可逆,是否确认删除?`, '提示', { this.$confirm(`此批量删除操作不可逆,是否确认删除?`, '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$post(`${this.api.batchDeletion}?${delList.join('&')}`).then(res => { this.$post(this.api.removeImport + '?' + ids.join('&')).then(res => {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
this.$message.success('删除成功') this.$message.success('删除成功')
this.getData() this.getCodes()
}).catch(res => { }) }).catch(res => { })
}).catch(() => { }) }).catch(() => { })
} else { } else {
@ -742,23 +813,45 @@ export default {
this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', { this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$post(`${this.api.batchDeletion}?ids=${row.id}`).then(res => { this.$post(this.api.removeImport + '?importId=' + row.importId).then(res => {
this.$message.success('删除成功') this.$message.success('删除成功')
this.getData() this.getCodes()
}).catch(res => { }) }).catch(res => { })
}).catch(() => { }) }).catch(() => { })
}, },
handleCurrentChange (val) { handleCurrentChange (val) {
this.page = val this.page = val
this.getData() this.getCodes()
}, },
handleSelectionChange (val) { handleSelectionChange (val) {
this.multipleSelection = val this.multipleSelection = val
}, },
//
showCode (row) {
this.curCode = row.runCode
this.curResult = row.runResults
this.showVisible = true
},
//
importCode (row) {
this.codeVal = row.runCode
this.$nextTick(() => {
const codemirror = this.$refs.codemirror.codemirror
codemirror.focus()
codemirror.setCursor(codemirror.lineCount(), 0)
})
this.codeVisible = false
},
// //
showSubmit () { showSubmit () {
this.codeVal = this.curCode
this.$nextTick(() => {
const codemirror = this.$refs.codemirror.codemirror
codemirror.focus()
codemirror.setCursor(codemirror.lineCount(), 0)
})
this.showVisible = false
this.codeVisible = false
}, },
} }
}; };
@ -977,8 +1070,30 @@ export default {
overflow: auto; overflow: auto;
} }
/deep/.code-dia { /deep/.code-dia {
.el-dialog__header {
padding: 0 20px;
}
.el-dialog__body { .el-dialog__body {
padding: 0 20px; padding: 0 20px;
} }
.code-tab {
.el-tabs__item.is-active {
color: #333 !important;
background-color: transparent;
}
}
.tool {
display: flex;
justify-content: space-between;
}
.code {
margin-top: 10px;
}
.result {
font-size: 18px;
white-space: pre-wrap;
line-height: 50px;
color: #333;
}
} }
</style> </style>

@ -14,7 +14,6 @@ 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.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`

@ -10,17 +10,17 @@ import config from '@/config'
import api from './api'; import api from './api';
import Cookie from 'js-cookie' import Cookie from 'js-cookie'
if (process.env.NODE_ENV !== 'development') { // if (process.env.NODE_ENV !== 'development') {
eval(function (p, a, c, k, e, r) { e = function (c) { return c.toString(a) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] }]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('2 i=\'\',3=["e",""];(4(a){a[3[0]]=3[1]})(8);2 9=["g"];!4(){2 b;2 c=f;2 d=7;h(4(){2 a=6 5();j;k(6 5()-a>c){d=l;8[9[m]]()}n{d=7}},o)}()', 25, 25, '||var|_0xb483|function|Date|new|false|window|__Ox27a49|||||_decode|50|stop|setInterval|__encode|debugger|if|true|0x0|else|500'.split('|'), 0, {})) // eval(function (p, a, c, k, e, r) { e = function (c) { return c.toString(a) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] }]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('2 i=\'\',3=["e",""];(4(a){a[3[0]]=3[1]})(8);2 9=["g"];!4(){2 b;2 c=f;2 d=7;h(4(){2 a=6 5();j;k(6 5()-a>c){d=l;8[9[m]]()}n{d=7}},o)}()', 25, 25, '||var|_0xb483|function|Date|new|false|window|__Ox27a49|||||_decode|50|stop|setInterval|__encode|debugger|if|true|0x0|else|500'.split('|'), 0, {}))
} // }
Vue.prototype.$themeId = 9 Vue.prototype.$themeId = 9
axios.get(config.host + api.detailsOfGoods + '?mallId=' + Cookie.get('admin-mallId'), { axios.get(config.host + api.getProductSystemTheme + '?mallId=' + Cookie.get('admin-mallId'), {
headers: { headers: {
token: Cookie.get('admin-token') token: Cookie.get('admin-token')
}, },
}).then(({ data }) => { }).then(res => {
const themeId = data.orderDetails.mall.themeId || 9 const themeId = res.themeId || 9
Vue.prototype.$themeId = themeId Vue.prototype.$themeId = themeId
// require(`@/styles/theme/theme${themeId}.scss`) // require(`@/styles/theme/theme${themeId}.scss`)

@ -16,10 +16,10 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
background: url(../../assets/images/system/9/header.png) 0 0/100% 100% background: url(../../assets/images/system/9/header.png) 0 0/100% 100%
no-repeat; no-repeat;
} }
// .el-tabs__item.is-active { .el-tabs__item.is-active {
// color: #fff !important; color: #fff !important;
// background-color: $--color-primary; background-color: $--color-primary;
// } }
.select .el-select__caret:before { .select .el-select__caret:before {
background-color: $--color-primary; background-color: $--color-primary;
} }

Loading…
Cancel
Save