From 5a0db5385a55417c820900ff77c94bce977bd2f8 Mon Sep 17 00:00:00 2001 From: zema1 Date: Wed, 8 Nov 2017 10:07:52 +0800 Subject: [PATCH] =?UTF-8?q?problem=E6=94=AF=E6=8C=81MathJAX=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/api.js | 6 +- admin/src/views/problem/ProblemList.vue | 14 +-- oj/build/webpack.prod.conf.js | 14 +-- oj/index.html | 126 +++++++---------------- oj/src/App.vue | 9 +- oj/src/styles/common.less | 19 ++++ oj/src/views/problem/Problem.vue | 4 +- oj/static/css/loader.css | 129 ++++++++++++++++++++++++ 8 files changed, 202 insertions(+), 119 deletions(-) create mode 100644 oj/static/css/loader.css diff --git a/admin/src/api.js b/admin/src/api.js index b717100..f009064 100644 --- a/admin/src/api.js +++ b/admin/src/api.js @@ -216,11 +216,9 @@ export default { data }) }, - makeContestProblemPublic (problemID) { + makeContestProblemPublic (data) { return ajax('admin/contest_problem/make_public', 'post', { - data: { - problem_id: problemID - } + data }) } } diff --git a/admin/src/views/problem/ProblemList.vue b/admin/src/views/problem/ProblemList.vue index 4668e3c..0f0d829 100644 --- a/admin/src/views/problem/ProblemList.vue +++ b/admin/src/views/problem/ProblemList.vue @@ -91,7 +91,10 @@ loading: false, currentPage: 1, routeName: '', - contestId: '' + contestId: '', + // for make public use + currentProblemID: '', + makePublicDialogVisible: false } }, mounted () { @@ -131,12 +134,9 @@ }) }, makeContestProblemPublic (problemID) { - this.$confirm('Sure to public this problem?', 'Warning', { - type: 'warning' - }).then(() => { - api.makeContestProblemPublic(problemID).catch(() => { - }) - }).catch(() => { + this.$prompt('Please input display id for the public problem', 'confirm').then(({value}) => { + api.makeContestProblemPublic({id: problemID, display_id: value}).catch() + }, () => { }) }, handleVisibleSwitch (row) { diff --git a/oj/build/webpack.prod.conf.js b/oj/build/webpack.prod.conf.js index 4a7191f..dcb239d 100644 --- a/oj/build/webpack.prod.conf.js +++ b/oj/build/webpack.prod.conf.js @@ -88,13 +88,13 @@ const webpackConfig = merge(baseWebpackConfig, { chunks: ['vendor'] }), // copy custom static assets - // new CopyWebpackPlugin([ - // { - // from: path.resolve(__dirname, '../static'), - // to: config.build.assetsSubDirectory, - // ignore: ['.*'] - // } - // ]) + new CopyWebpackPlugin([ + { + from: path.resolve(__dirname, '../static'), + to: config.build.assetsSubDirectory, + ignore: ['.*'] + } + ]) ] }) diff --git a/oj/index.html b/oj/index.html index 8a0777e..4d52437 100644 --- a/oj/index.html +++ b/oj/index.html @@ -1,104 +1,46 @@ + OnlineJudge - OnlineJudge + + + + + - - -
-
-
-
-
-
-
+ +
+
+
+
+
+
+
+
+
+
+
diff --git a/oj/src/App.vue b/oj/src/App.vue index 2f1ab1c..a8b4f5f 100644 --- a/oj/src/App.vue +++ b/oj/src/App.vue @@ -68,14 +68,7 @@ } } - body { - margin: 0; - padding: 0; - font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; - -webkit-font-smoothing: antialiased; - background-color: #eee; - min-width: 800px; - } + .content-app { margin-top: 80px; diff --git a/oj/src/styles/common.less b/oj/src/styles/common.less index f03754a..af271c0 100644 --- a/oj/src/styles/common.less +++ b/oj/src/styles/common.less @@ -1,3 +1,12 @@ +body { + margin: 0; + padding: 0; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + -webkit-font-smoothing: antialiased; + background-color: #eee; + min-width: 800px; +} + .flex-container { display: flex; width: 100%; @@ -44,6 +53,16 @@ position: relative; } +// for mathjax +.MathJax { + outline: 0; +} + +.MathJax_Display { + overflow-x: auto; + overflow-y: hidden; +} + hr { border-top: 1px dashed #b3b3b3; margin: 5px auto; diff --git a/oj/src/views/problem/Problem.vue b/oj/src/views/problem/Problem.vue index c6a9e6e..b16b13d 100644 --- a/oj/src/views/problem/Problem.vue +++ b/oj/src/views/problem/Problem.vue @@ -248,8 +248,10 @@ if (problemCode) { this.code = problemCode.code this.language = problemCode.language - console.log(problemCode) } + this.$nextTick(() => { + window.MathJax.Hub.Queue(['Typeset', window.MathJax.Hub, 'problem-content']) + }) }, () => { this.$Loading.error() }) diff --git a/oj/static/css/loader.css b/oj/static/css/loader.css new file mode 100644 index 0000000..3a9dcf6 --- /dev/null +++ b/oj/static/css/loader.css @@ -0,0 +1,129 @@ +@-webkit-keyframes enter { + 0% { + opacity: 0; + top: -10px; + } + 5% { + opacity: 1; + top: 0px; + } + 50.9% { + opacity: 1; + top: 0px; + } + 55.9% { + opacity: 0; + top: 10px; + } +} +@keyframes enter { + 0% { + opacity: 0; + top: -10px; + } + 5% { + opacity: 1; + top: 0px; + } + 50.9% { + opacity: 1; + top: 0px; + } + 55.9% { + opacity: 0; + top: 10px; + } +} +@-moz-keyframes enter { + 0% { + opacity: 0; + top: -10px; + } + 5% { + opacity: 1; + top: 0px; + } + 50.9% { + opacity: 1; + top: 0px; + } + 55.9% { + opacity: 0; + top: 10px; + } +} +body { + background: #f8f8f9; +} + +#app-loader { + position: absolute; + left: 50%; + top: 50%; + margin-left: -27.5px; + margin-top: -27.5px; +} +#app-loader .square { + background: #2d8cf0; + width: 15px; + height: 15px; + float: left; + top: -10px; + margin-right: 5px; + margin-top: 5px; + position: relative; + opacity: 0; + -webkit-animation: enter 6s infinite; + animation: enter 6s infinite; +} +#app-loader .enter { + top: 0px; + opacity: 1; +} +#app-loader .square:nth-child(1) { + -webkit-animation-delay: 1.8s; + -moz-animation-delay: 1.8s; + animation-delay: 1.8s; +} +#app-loader .square:nth-child(2) { + -webkit-animation-delay: 2.1s; + -moz-animation-delay: 2.1s; + animation-delay: 2.1s; +} +#app-loader .square:nth-child(3) { + -webkit-animation-delay: 2.4s; + -moz-animation-delay: 2.4s; + animation-delay: 2.4s; + background: #ff9900; +} +#app-loader .square:nth-child(4) { + -webkit-animation-delay: 0.9s; + -moz-animation-delay: 0.9s; + animation-delay: 0.9s; +} +#app-loader .square:nth-child(5) { + -webkit-animation-delay: 1.2s; + -moz-animation-delay: 1.2s; + animation-delay: 1.2s; +} +#app-loader .square:nth-child(6) { + -webkit-animation-delay: 1.5s; + -moz-animation-delay: 1.5s; + animation-delay: 1.5s; +} +#app-loader .square:nth-child(8) { + -webkit-animation-delay: 0.3s; + -moz-animation-delay: 0.3s; + animation-delay: 0.3s; +} +#app-loader .square:nth-child(9) { + -webkit-animation-delay: 0.6s; + -moz-animation-delay: 0.6s; + animation-delay: 0.6s; +} +#app-loader .clear { + clear: both; +} +#app-loader .last { + margin-right: 0; +}