diff --git a/frontend/admin/src/components/problem/problemSample.vue b/frontend/admin/src/components/problem/problemSample.vue index 3e710aa9..b445cead 100644 --- a/frontend/admin/src/components/problem/problemSample.vue +++ b/frontend/admin/src/components/problem/problemSample.vue @@ -38,19 +38,32 @@ export default({ data() { return { - samples: [{input: "12334", output: "111", visible: true}] + samples: [{input: "", output: "", visible: true}] } }, methods: { + setSample(samples) { + for(let sample of samples) { + sample[visible] = false; + } + this.samples = samples; + }, + getSample() { + var samples = this.samples; + for(let sample of samples) { + delete sample.visible; + } + return samples; + }, addSample() { - this.samples.push({input: "", output: "", visible: true}) + 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) + this.samples.splice(index, 1); }); } } diff --git a/frontend/admin/src/components/problem/testCaseMgnt.vue b/frontend/admin/src/components/problem/testCaseMgnt.vue index 0aa4cdb7..2e666fb9 100644 --- a/frontend/admin/src/components/problem/testCaseMgnt.vue +++ b/frontend/admin/src/components/problem/testCaseMgnt.vue @@ -8,6 +8,8 @@ {{ $t("adminUtils.download") }}
+ {{ $t("problem.OIMode") }} +
ID {{ $t("adminUtils.input") }} {{ $t("adminUtils.output") }} + {{ $t("problem.score") }} {{ $index + 1 }} - {{ testCase.input }} - {{ testCase.output }} + {{ testCase.input_name }} + {{ testCase.output_name }} +
@@ -50,7 +54,8 @@ return { downloadUrl: "", uploadProgress: 0, - testCaseList: [] + testCaseList: [], + OIMode: false } }, components: { @@ -58,12 +63,37 @@ }, methods: { uploadSuccess(f, response){ - alert("success"); + // todo }, uploadError(f, reason){ this.uploadProgress = 0; - alert("error"); + alert($t("request.error")); + }, + setTestCase(mode, testCaseList) { + this.OIMode = mode == "OI"; + // attr must be set firstly so vue can track it's changes + if (this.OIMode) { + for(let item of testCaseList) { + item.score = 0; + } + } + this.testCaseList = testCaseList; + }, + getTestCase() { + var testCaseList = this.testCaseList; + if (!this.OIMode) { + for(let item of testCaseList) { + delete item.score; + } + } + return {testCaseList: testCaseList, mode: this.mode == "OI"}; } } }) - \ No newline at end of file + + + \ No newline at end of file diff --git a/frontend/admin/src/locales.js b/frontend/admin/src/locales.js index ec830104..07bbf198 100644 --- a/frontend/admin/src/locales.js +++ b/frontend/admin/src/locales.js @@ -60,6 +60,8 @@ export default { deleteThisSample: "删除这组样例?", testCase: "测试用例", uploadProgress: "上传进度", + OIMode: "OI模式", + score: "分数" }, adminUtils: {