From 8bf22e8248f0268b8210b63f468a88f668008cf3 Mon Sep 17 00:00:00 2001 From: zema1 Date: Sun, 14 Jan 2018 16:22:46 +0800 Subject: [PATCH] support problem import and export --- src/pages/admin/api.js | 5 + src/pages/admin/components/SideMenu.vue | 1 + src/pages/admin/router.js | 7 +- src/pages/admin/views/index.js | 3 +- .../admin/views/problem/ImportAndExport.vue | 123 ++++++++++++++++++ src/pages/admin/views/problem/Problem.vue | 12 +- 6 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 src/pages/admin/views/problem/ImportAndExport.vue diff --git a/src/pages/admin/api.js b/src/pages/admin/api.js index 00066a9a2..cecfbecb1 100644 --- a/src/pages/admin/api.js +++ b/src/pages/admin/api.js @@ -289,6 +289,11 @@ export default { }, getSessions () { return ajax('sessions', 'get') + }, + exportProblems (data) { + return ajax('export_problem', 'post', { + data + }) } } diff --git a/src/pages/admin/components/SideMenu.vue b/src/pages/admin/components/SideMenu.vue index 3b190af27..2c31e07a7 100644 --- a/src/pages/admin/components/SideMenu.vue +++ b/src/pages/admin/components/SideMenu.vue @@ -17,6 +17,7 @@ Problem List Create Problem + Import / Export diff --git a/src/pages/admin/router.js b/src/pages/admin/router.js index fd8a23ce5..0e13e75b1 100644 --- a/src/pages/admin/router.js +++ b/src/pages/admin/router.js @@ -2,7 +2,7 @@ import Vue from 'vue' import VueRouter from 'vue-router' // 引入 view 组件 import { Announcement, Conf, Contest, ContestList, Home, JudgeServer, Login, - Problem, ProblemList, User, PruneTestCase, Dashboard } from './views' + Problem, ProblemList, User, PruneTestCase, Dashboard, ProblemImportOrExport } from './views' Vue.use(VueRouter) export default new VueRouter({ @@ -63,6 +63,11 @@ export default new VueRouter({ name: 'edit-problem', component: Problem }, + { + path: '/problem/batch_ops', + name: 'problem_batch_ops', + component: ProblemImportOrExport + }, { path: '/contest/create', name: 'create-contest', diff --git a/src/pages/admin/views/index.js b/src/pages/admin/views/index.js index 78ee648e4..505b7e922 100644 --- a/src/pages/admin/views/index.js +++ b/src/pages/admin/views/index.js @@ -10,8 +10,9 @@ import ContestList from './contest/ContestList.vue' import Contest from './contest/Contest.vue' import Login from './general/Login.vue' import Home from './Home.vue' +import ProblemImportOrExport from './problem/ImportAndExport.vue' export { Announcement, User, Conf, JudgeServer, Problem, ProblemList, Contest, - ContestList, Login, Home, PruneTestCase, Dashboard + ContestList, Login, Home, PruneTestCase, Dashboard, ProblemImportOrExport } diff --git a/src/pages/admin/views/problem/ImportAndExport.vue b/src/pages/admin/views/problem/ImportAndExport.vue new file mode 100644 index 000000000..c3a820eb9 --- /dev/null +++ b/src/pages/admin/views/problem/ImportAndExport.vue @@ -0,0 +1,123 @@ + + + + diff --git a/src/pages/admin/views/problem/Problem.vue b/src/pages/admin/views/problem/Problem.vue index a1210a1df..6694e4f12 100644 --- a/src/pages/admin/views/problem/Problem.vue +++ b/src/pages/admin/views/problem/Problem.vue @@ -1,16 +1,6 @@