增加测试用例样例组件
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@import "../../static/css/loading.css";
|
||||
|
||||
@import "../../static/css/bootstrap.css";
|
||||
@import "../../static/css/todc-bootstrap.css";
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
visible: this.announcement.visible
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
route: {
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
<simditor editorid="problem_detail"></simditor>
|
||||
|
||||
<uploader uploaderid="uploader"></uploader>
|
||||
<problem-sample></problem-sample>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import simditor from "../utils/simditor.vue"
|
||||
import uploader from "../utils/uploader.vue"
|
||||
import problemSample from "./problemSample.vue"
|
||||
|
||||
export default({
|
||||
components: {
|
||||
simditor,
|
||||
uploader
|
||||
},
|
||||
ready() {
|
||||
alert("111111");
|
||||
problemSample
|
||||
}
|
||||
})
|
||||
</script>
|
||||
64
frontend/admin/src/components/problem/problemSample.vue
Normal file
64
frontend/admin/src/components/problem/problemSample.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div class="col-md-12"><br>
|
||||
<label>{{ $t("problem.sample") }}</label>
|
||||
<button class="btn btn-primary btn-sm add-sample-btn" v-on:click="addSample">{{ $t("problem.addSample") }}
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<div class="panel panel-default" v-for="sample in samples">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">{{ $t("problem.sample") }} {{ $index + 1 }}</span>
|
||||
<button class="btn btn-primary btn-sm" v-on:click="toggleSample($index)">
|
||||
{{ sample.visible?$t("problem.fold"):$t("problem.show") }}
|
||||
</button>
|
||||
<button class="btn btn-danger btn-sm" v-on:click="delSample($index)">
|
||||
{{ $t("adminUtils.delete") }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="panel-body row" v-show="sample.visible">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>{{ $t("problem.sample") }}{{ $t("adminUtils.input") }}</label>
|
||||
<textarea class="form-control" rows="5" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>{{ $t("problem.sample") }}{{ $t("adminUtils.output") }}</label>
|
||||
<textarea class="form-control" rows="5" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default({
|
||||
data() {
|
||||
return {
|
||||
samples: [{input: "12334", output: "111", visible: true}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addSample() {
|
||||
this.samples.push({input: "", output: "", visible: true})
|
||||
},
|
||||
toggleSample(index) {
|
||||
this.samples[index].visible = !this.samples[index].visible;
|
||||
},
|
||||
delSample(index) {
|
||||
confirm(this.$t("problem.deleteThisSample"), ()=> {
|
||||
this.samples.splice(index, 1)
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-sample-btn {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -2,7 +2,9 @@ export default {
|
||||
"zh-cn": {
|
||||
alert: {
|
||||
alert: "提示",
|
||||
OK: "确定"
|
||||
OK: "确定",
|
||||
confirm: "确认",
|
||||
cancel: "取消"
|
||||
},
|
||||
nav: {
|
||||
userManagement: "用户管理",
|
||||
@@ -49,8 +51,13 @@ export default {
|
||||
editAnnouncement: "编辑公告",
|
||||
createAnnouncement: "创建公告",
|
||||
contentCanNotBeEmpty: "内容不能为空"
|
||||
|
||||
|
||||
},
|
||||
problem: {
|
||||
sample: "样例",
|
||||
addSample: "添加样例",
|
||||
fold: "折叠",
|
||||
show: "展开",
|
||||
deleteThisSample: "删除这组样例?"
|
||||
},
|
||||
adminUtils: {
|
||||
search: "搜索",
|
||||
@@ -72,6 +79,9 @@ export default {
|
||||
|
||||
back: "返回",
|
||||
saveChanges: "保存修改",
|
||||
delete: "删除",
|
||||
input: "输入",
|
||||
output: "输出",
|
||||
|
||||
unsupportedBrowserWarningMsg: "当前网页 <strong>不支持</strong> 你正在使用的浏览器, 为了正常的访问,请到 <a href=\"http://browsehappy.com/\"> 升级你的浏览器</a>"
|
||||
}
|
||||
|
||||
@@ -112,14 +112,17 @@ router.map({
|
||||
"/announcement/edit/:announcementId": {
|
||||
name: "editAnnouncement",
|
||||
component: editAnnouncement
|
||||
},
|
||||
"/problem": {
|
||||
component: problem
|
||||
}
|
||||
});
|
||||
|
||||
// hide loading
|
||||
document.getElementsByClassName("cssload-battery")[0].style.display = "none";
|
||||
document.getElementById("loading").style.display = "none";
|
||||
|
||||
// override window.alert
|
||||
function bootboxAlert(content) {
|
||||
window.alert = function bootboxAlert(content) {
|
||||
bootbox.dialog({
|
||||
message: content,
|
||||
title: locale[lang].alert.alert,
|
||||
@@ -130,8 +133,34 @@ function bootboxAlert(content) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
window.alert = bootboxAlert;
|
||||
};
|
||||
|
||||
// override window.confirm
|
||||
window.confirm = function bootboxConfirm(content, okCallback, cancelCallback) {
|
||||
bootbox.dialog ({
|
||||
message: content,
|
||||
title: locale[lang].alert.confirm,
|
||||
buttons: {
|
||||
cancel: {
|
||||
label: locale[lang].alert.cancel,
|
||||
className: "btn-success",
|
||||
callback: function() {
|
||||
if(cancelCallback) {
|
||||
return cancelCallback;
|
||||
}
|
||||
else {
|
||||
return function(){};
|
||||
}
|
||||
}
|
||||
},
|
||||
main: {
|
||||
label: locale[lang].alert.OK,
|
||||
className: "btn-danger",
|
||||
callback: okCallback
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
router.redirect({"/user": "/user/1"});
|
||||
router.redirect({"/announcement": "/announcement/1"});
|
||||
|
||||
Reference in New Issue
Block a user