From bb87f35797f5955fb4e7a8a7b886fa4c9cdc9069 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sun, 25 Jul 2021 08:57:01 +0800
Subject: [PATCH] 富文本新增上传文件大小限制
---
ruoyi-ui/src/components/TopNav/index.vue | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue
index 6f7b688..edb9c53 100644
--- a/ruoyi-ui/src/components/TopNav/index.vue
+++ b/ruoyi-ui/src/components/TopNav/index.vue
@@ -73,7 +73,9 @@
if(router.path === "/") {
router.children[item].path = "/redirect/" + router.children[item].path;
} else {
- router.children[item].path = router.path + "/" + router.children[item].path;
+ if(!this.ishttp(router.children[item].path)) {
+ router.children[item].path = router.path + "/" + router.children[item].path;
+ }
}
router.children[item].parentPath = router.path;
}
@@ -85,7 +87,7 @@
// 默认激活的菜单
activeMenu() {
const path = this.$route.path;
- let activePath = this.routers[0].path;
+ let activePath = this.defaultRouter();
if (path.lastIndexOf("/") > 0) {
const tmpPath = path.substring(1, path.length);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
@@ -98,7 +100,7 @@
}
var routes = this.activeRoutes(activePath);
if (routes.length === 0) {
- activePath = this.currentIndex || this.routers[0].path
+ activePath = this.currentIndex || this.defaultRouter()
this.activeRoutes(activePath);
}
return activePath;
@@ -119,10 +121,21 @@
const width = document.body.getBoundingClientRect().width / 3;
this.visibleNumber = parseInt(width / 85);
},
+ // 默认激活的路由
+ defaultRouter() {
+ let router;
+ Object.keys(this.routers).some((key) => {
+ if (!this.routers[key].hidden) {
+ router = this.routers[key].path;
+ return true;
+ }
+ });
+ return router;
+ },
// 菜单选择事件
handleSelect(key, keyPath) {
this.currentIndex = key;
- if (key.indexOf("http://") !== -1 || key.indexOf("https://") !== -1) {
+ if (this.ishttp(key)) {
// http(s):// 路径新窗口打开
window.open(key, "_blank");
} else if (key.indexOf("/redirect") !== -1) {
@@ -147,6 +160,9 @@
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
}
return routes;
+ },
+ ishttp(url) {
+ return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
}
},
};
--
Gitblit v1.9.2