From a2d3f987c04a2e5176a8686f1032f7f5bfee4af2 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期二, 30 十一月 2021 11:15:17 +0800 Subject: [PATCH] 优化代码 --- ruoyi-ui/src/plugins/modal.js | 8 ++++++++ ruoyi-ui/src/views/tool/gen/genInfoForm.vue | 3 +-- ruoyi-ui/src/views/tool/gen/basicInfoForm.vue | 3 +-- ruoyi-ui/src/views/monitor/online/index.vue | 2 +- ruoyi-ui/src/views/tool/gen/editTable.vue | 1 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java | 2 +- ruoyi-ui/src/views/system/user/index.vue | 2 +- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 15 +++++++++++++-- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index d764651..be515fd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -72,7 +72,7 @@ && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); - } + } user.setUserId(sysUser.getUserId()); user.setPassword(null); if (userService.updateUserProfile(user) > 0) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index af97f14..d509da2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -179,7 +179,7 @@ router.setPath("/inner"); List<RouterVo> childrenList = new ArrayList<RouterVo>(); RouterVo children = new RouterVo(); - String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + String routerPath = innerLinkReplaceEach(menu.getPath()); children.setPath(routerPath); children.setComponent(UserConstants.INNER_LINK); children.setName(StringUtils.capitalize(routerPath)); @@ -358,7 +358,7 @@ // 鍐呴摼鎵撳紑澶栫綉鏂瑰紡 if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { - routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + routerPath = innerLinkReplaceEach(routerPath); } // 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓虹洰褰曪級 if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) @@ -500,4 +500,15 @@ { return getChildList(list, t).size() > 0 ? true : false; } + + /** + * 鍐呴摼鍩熷悕鐗规畩瀛楃鏇挎崲 + * + * @return + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS }, + new String[] { "", "" }); + } } diff --git a/ruoyi-ui/src/plugins/modal.js b/ruoyi-ui/src/plugins/modal.js index 7df61a8..503a16f 100644 --- a/ruoyi-ui/src/plugins/modal.js +++ b/ruoyi-ui/src/plugins/modal.js @@ -59,6 +59,14 @@ type: "warning", }) }, + // 鎻愪氦鍐呭 + prompt(content) { + return MessageBox.prompt(content, "绯荤粺鎻愮ず", { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: "warning", + }) + }, // 鎵撳紑閬僵灞� loading(content) { loadingInstance = Loading.service({ diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index ab66827..fedf080 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -111,7 +111,7 @@ }, /** 寮洪��鎸夐挳鎿嶄綔 */ handleForceLogout(row) { - this.$modal.confirm('鏄惁纭寮洪��鍚嶇О涓�"' + row.userName + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭寮洪��鍚嶇О涓�"' + row.userName + '"鐨勭敤鎴凤紵').then(function() { return forceLogout(row.tokenId); }).then(() => { this.getList(); diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 3525c9b..c538a69 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -596,7 +596,7 @@ cancelButtonText: "鍙栨秷", closeOnClickModal: false, inputPattern: /^.{5,20}$/, - inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿", + inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿" }).then(({ value }) => { resetUserPwd(row.userId, value).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value); diff --git a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue index f3e8717..75dc3bf 100644 --- a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue @@ -11,7 +11,6 @@ <el-input placeholder="璇疯緭鍏�" v-model="info.tableComment" /> </el-form-item> </el-col> - <el-col :span="12"> <el-form-item label="瀹炰綋绫诲悕绉�" prop="className"> <el-input placeholder="璇疯緭鍏�" v-model="info.className" /> @@ -30,9 +29,9 @@ </el-row> </el-form> </template> + <script> export default { - name: "BasicInfoForm", props: { info: { type: Object, diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index b8f386e..5be5c50 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -124,6 +124,7 @@ </el-form> </el-card> </template> + <script> import { getGenTable, updateGenTable } from "@/api/tool/gen"; import { optionselect as getDictOptionselect } from "@/api/system/dict/type"; diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue index 926376c..bf6382d 100644 --- a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue @@ -11,7 +11,6 @@ </el-select> </el-form-item> </el-col> - <el-col :span="12"> <el-form-item prop="packageName"> <span slot="label"> @@ -213,12 +212,12 @@ </el-row> </el-form> </template> + <script> import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; export default { - name: "BasicInfoForm", components: { Treeselect }, props: { info: { -- Gitblit v1.9.3