From 6e96a7011c97b4cf71be1717717ce71943b0efee Mon Sep 17 00:00:00 2001 From: Himit_ZH <372347736@qq.com> Date: Tue, 8 Jun 2021 17:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0i18n,?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + .../controller/admin/ConfigController.java | 17 +- .../hoj/controller/oj/HomeController.java | 19 +- .../java/top/hcode/hoj/utils/ConfigUtils.java | 17 +- hoj-vue/src/App.vue | 5 +- hoj-vue/src/common/utils.js | 2 +- .../components/admin/ContestAddProblem.vue | 19 +- hoj-vue/src/components/admin/Editor.vue | 2 +- hoj-vue/src/components/admin/Panel.vue | 96 ------ hoj-vue/src/components/oj/common/Login.vue | 2 +- .../components/oj/common/ResetPassword.vue | 6 +- hoj-vue/src/i18n/admin/en-US.js | 246 +++++++++++++++ hoj-vue/src/i18n/admin/zh-CN.js | 245 +++++++++++++++ hoj-vue/src/i18n/index.js | 7 +- hoj-vue/src/i18n/oj/en-US.js | 17 +- hoj-vue/src/i18n/oj/zh-CN.js | 15 +- hoj-vue/src/router/adminRoutes.js | 30 +- hoj-vue/src/router/index.js | 6 +- hoj-vue/src/router/ojRoutes.js | 50 +-- hoj-vue/src/views/admin/Dashboard.vue | 82 +++-- hoj-vue/src/views/admin/Home.vue | 170 +++++++--- hoj-vue/src/views/admin/Login.vue | 112 ++++--- hoj-vue/src/views/admin/contest/Contest.vue | 91 ++++-- .../src/views/admin/contest/ContestList.vue | 56 ++-- .../src/views/admin/discussion/Discussion.vue | 118 ++++--- .../src/views/admin/general/Announcement.vue | 62 ++-- .../src/views/admin/general/SystemConfig.vue | 163 ++++++---- hoj-vue/src/views/admin/general/User.vue | 236 +++++++++----- .../views/admin/problem/ImportAndExport.vue | 34 +- hoj-vue/src/views/admin/problem/Problem.vue | 294 +++++++++++------- .../src/views/admin/problem/ProblemList.vue | 75 +++-- hoj-vue/src/views/oj/Home.vue | 2 +- hoj-vue/src/views/oj/about/Introduction.vue | 2 +- hoj-vue/src/views/oj/contest/ContestList.vue | 6 +- .../oj/contest/children/ACMContestRank.vue | 3 +- .../oj/contest/children/ACMInfoAdmin.vue | 3 +- .../oj/contest/children/ContestComment.vue | 1 - .../views/oj/contest/children/ContestRank.vue | 5 +- .../oj/contest/children/OIContestRank.vue | 3 +- .../src/views/oj/discussion/discussion.vue | 5 +- .../views/oj/discussion/discussionList.vue | 5 +- hoj-vue/src/views/oj/problem/Problem.vue | 2 +- hoj-vue/src/views/oj/problem/ProblemList.vue | 4 +- hoj-vue/src/views/oj/rank/ACMRank.vue | 3 +- hoj-vue/src/views/oj/rank/OIRank.vue | 3 +- .../src/views/oj/status/SubmissionDetails.vue | 4 +- .../src/views/oj/status/SubmissionList.vue | 1 + hoj-vue/src/views/oj/user/Setting.vue | 4 +- 48 files changed, 1551 insertions(+), 800 deletions(-) delete mode 100644 hoj-vue/src/components/admin/Panel.vue create mode 100644 hoj-vue/src/i18n/admin/en-US.js create mode 100644 hoj-vue/src/i18n/admin/zh-CN.js diff --git a/README.md b/README.md index ba9fd360..b49e04fa 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Password: 开启SMTP服务后生成的随机授权码 | 2021-05-28 | 增加导入导出题目,增加用户页面的最近登录,开发正式结束,进入维护摸鱼 | Himit_ZH | | 2021-06-02 | 大更新,完善补充前端页面,修正判题等待超时时间,修补一系列bug | Himit_ZH | | 2021-06-07 | 修正特殊判题,增加前台i18n | Himit_ZH | +| 2021-06-08 | 添加后台i18n,路由懒加载 | Himit_ZH | diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/ConfigController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/ConfigController.java index 8e96b6e7..7cc3a233 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/ConfigController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/ConfigController.java @@ -2,6 +2,7 @@ package top.hcode.hoj.controller.admin; import cn.hutool.core.lang.Validator; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.UnicodeUtil; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -63,15 +64,15 @@ public class ConfigController { public CommonResult getWebConfig() { return CommonResult.successResponse( - MapUtil.builder().put("baseUrl", configVo.getBaseUrl()) - .put("name", configVo.getName()) - .put("shortName", configVo.getShortName()) - .put("description", configVo.getDescription()) + MapUtil.builder().put("baseUrl", UnicodeUtil.toString(configVo.getBaseUrl())) + .put("name", UnicodeUtil.toString(configVo.getName())) + .put("shortName", UnicodeUtil.toString(configVo.getShortName())) + .put("description", UnicodeUtil.toString(configVo.getDescription())) .put("register", configVo.getRegister()) - .put("recordName", configVo.getRecordName()) - .put("recordUrl", configVo.getRecordUrl()) - .put("projectName", configVo.getProjectName()) - .put("projectUrl", configVo.getProjectUrl()).map() + .put("recordName", UnicodeUtil.toString(configVo.getRecordName())) + .put("recordUrl", UnicodeUtil.toString(configVo.getRecordUrl())) + .put("projectName", UnicodeUtil.toString(configVo.getProjectName())) + .put("projectUrl", UnicodeUtil.toString(configVo.getProjectUrl())).map() ); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java index 3d70707b..6ce1c0bf 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java @@ -1,6 +1,7 @@ package top.hcode.hoj.controller.oj; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.UnicodeUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -131,16 +132,16 @@ public class HomeController { public CommonResult getWebConfig() { return CommonResult.successResponse( - MapUtil.builder().put("baseUrl", configVo.getBaseUrl()) - .put("name", configVo.getName()) - .put("shortName", configVo.getShortName()) + MapUtil.builder().put("baseUrl", UnicodeUtil.toString(configVo.getBaseUrl())) + .put("name", UnicodeUtil.toString(configVo.getName())) + .put("shortName", UnicodeUtil.toString(configVo.getShortName())) .put("register", configVo.getRegister()) - .put("recordName", configVo.getRecordName()) - .put("recordUrl", configVo.getRecordUrl()) - .put("description", configVo.getDescription()) - .put("email", configVo.getEmailUsername()) - .put("projectName", configVo.getProjectName()) - .put("projectUrl", configVo.getProjectUrl()).map() + .put("recordName", UnicodeUtil.toString(configVo.getRecordName())) + .put("recordUrl", UnicodeUtil.toString(configVo.getRecordUrl())) + .put("description", UnicodeUtil.toString(configVo.getDescription())) + .put("email", UnicodeUtil.toString(configVo.getEmailUsername())) + .put("projectName", UnicodeUtil.toString(configVo.getProjectName())) + .put("projectUrl", UnicodeUtil.toString(configVo.getProjectUrl())).map() ); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/ConfigUtils.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/ConfigUtils.java index fb57e6f2..59f645fb 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/ConfigUtils.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/ConfigUtils.java @@ -1,5 +1,6 @@ package top.hcode.hoj.utils; +import cn.hutool.core.text.UnicodeUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import top.hcode.hoj.pojo.vo.ConfigVo; @@ -52,18 +53,18 @@ public class ConfigUtils { " port: " + configVo.getRedisPort() + "\n" + " password: " + configVo.getRedisPassword() + "\n" + " web-config:\n" + - " base-url: " + configVo.getBaseUrl() + "\n" + - " name: " + configVo.getName() + "\n" + - " short-name: " + configVo.getShortName() + "\n" + - " description: " + configVo.getDescription() + "\n" + + " base-url: " + UnicodeUtil.toUnicode(configVo.getBaseUrl()) + "\n" + + " name: " + UnicodeUtil.toUnicode(configVo.getName()) + "\n" + + " short-name: " + UnicodeUtil.toUnicode(configVo.getShortName()) + "\n" + + " description: " + UnicodeUtil.toUnicode(configVo.getDescription(),true) + "\n" + " register: " + configVo.getRegister() + "\n" + " footer:\n" + " record:\n" + - " name: " + configVo.getRecordName() + "\n" + - " url: " + configVo.getRecordUrl() + "\n" + + " name: " + UnicodeUtil.toUnicode(configVo.getRecordName()) + "\n" + + " url: " + UnicodeUtil.toUnicode(configVo.getRecordUrl()) + "\n" + " project:\n" + - " name: " + configVo.getProjectName() + "\n" + - " url: " + configVo.getProjectUrl() + "\n" + + " name: " + UnicodeUtil.toUnicode(configVo.getProjectName()) + "\n" + + " url: " + UnicodeUtil.toUnicode(configVo.getProjectUrl()) + "\n" + " hdu:\n" + " account:\n" + " username: " + listToStr(configVo.getHduUsernameList()) + "\n" + diff --git a/hoj-vue/src/App.vue b/hoj-vue/src/App.vue index 30f33789..df76b3e0 100644 --- a/hoj-vue/src/App.vue +++ b/hoj-vue/src/App.vue @@ -13,9 +13,8 @@

{{ toUpper(websiteConfig.shortName) }}

-

- {{ websiteConfig.description }} -

+ +
diff --git a/hoj-vue/src/common/utils.js b/hoj-vue/src/common/utils.js index 8c0f3a5e..3fca3825 100644 --- a/hoj-vue/src/common/utils.js +++ b/hoj-vue/src/common/utils.js @@ -83,7 +83,7 @@ function downloadFile (url) { document.body.appendChild(link) link.click() link.remove() - myMessage.success("Request success, Downloading...") + myMessage.success("Downloading...") resolve() }).catch((error) => { reject(error) diff --git a/hoj-vue/src/components/admin/ContestAddProblem.vue b/hoj-vue/src/components/admin/ContestAddProblem.vue index f73ce5b4..f91a7bfa 100644 --- a/hoj-vue/src/components/admin/ContestAddProblem.vue +++ b/hoj-vue/src/components/admin/ContestAddProblem.vue @@ -2,7 +2,7 @@
- + - +