|
|
@ -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 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 快捷键 可提供三种模式 sublime、emacs、vim |
|
|
|
|
|
|
|
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: [], // 有input的情况下,保存每个axios的对象,用于中断请求 |
|
|
|
requestList: [], // 有input的情况下,保存每个axios的对象,用于中断请求 |
|
|
|
sourceCode: '', // 把input替换成exit函数后的代码 |
|
|
|
sourceCode: '', // 把input替换成exit函数后的代码 |
|
|
@ -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}¤t=${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> |