diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging index a47af9a21..730af3426 100644 --- a/ruoyi-ui/.env.staging +++ b/ruoyi-ui/.env.staging @@ -1,6 +1,8 @@ # 页面标题 VUE_APP_TITLE = 若依管理系统 +BABEL_ENV = production + NODE_ENV = production # 测试环境配置 diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 8df9c8dd8..ff861ec34 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -52,6 +52,7 @@ "quill": "2.0.2", "screenfull": "5.0.2", "sortablejs": "1.10.2", + "splitpanes": "2.4.1", "vue": "2.6.12", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss index 168500442..359e8c242 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -118,7 +118,7 @@ /** 表格布局 **/ .pagination-container { position: relative; - height: 25px; + height: 32px; margin-bottom: 10px; margin-top: 15px; padding: 10px 20px !important; @@ -289,3 +289,8 @@ position: relative; float: right; } + +/* 分割面板样式 */ +.splitpanes.default-theme .splitpanes__pane { + background-color: #fff!important; +} diff --git a/ruoyi-ui/src/components/Breadcrumb/index.vue b/ruoyi-ui/src/components/Breadcrumb/index.vue index a5f907ac4..cd2841468 100644 --- a/ruoyi-ui/src/components/Breadcrumb/index.vue +++ b/ruoyi-ui/src/components/Breadcrumb/index.vue @@ -1,7 +1,7 @@ - + {{ item.meta.title }} {{ item.meta.title }} @@ -31,15 +31,45 @@ export default { methods: { getBreadcrumb() { // only show routes with meta.title - let matched = this.$route.matched.filter(item => item.meta && item.meta.title) - const first = matched[0] - - if (!this.isDashboard(first)) { - matched = [{ path: '/index', meta: { title: '首页' }}].concat(matched) + let matched = [] + const router = this.$route + const pathNum = this.findPathNum(router.path) + // multi-level menu + if (pathNum > 2) { + const reg = /\/\w+/gi + const pathList = router.path.match(reg).map((item, index) => { + if (index !== 0) item = item.slice(1) + return item + }) + this.getMatched(pathList, this.$store.getters.defaultRoutes, matched) + } else { + matched = router.matched.filter(item => item.meta && item.meta.title) + } + // 判断是否为首页 + if (!this.isDashboard(matched[0])) { + matched = [{ path: "/index", meta: { title: "首页" } }].concat(matched) } - this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) }, + findPathNum(str, char = "/") { + let index = str.indexOf(char) + let num = 0 + while (index !== -1) { + num++ + index = str.indexOf(char, index + 1) + } + return num + }, + getMatched(pathList, routeList, matched) { + let data = routeList.find(item => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0]) + if (data) { + matched.push(data) + if (data.children && pathList.length) { + pathList.shift() + this.getMatched(pathList, data.children, matched) + } + } + }, isDashboard(route) { const name = route && route.name if (!name) { @@ -65,7 +95,6 @@ export default { font-size: 14px; line-height: 50px; margin-left: 8px; - .no-redirect { color: #97a8be; cursor: text; diff --git a/ruoyi-ui/src/components/HeaderSearch/index.vue b/ruoyi-ui/src/components/HeaderSearch/index.vue index a01325a5b..5dd4ca9e4 100644 --- a/ruoyi-ui/src/components/HeaderSearch/index.vue +++ b/ruoyi-ui/src/components/HeaderSearch/index.vue @@ -22,6 +22,7 @@ // make search results more in line with expectations import Fuse from 'fuse.js/dist/fuse.min.js' import path from 'path' +import { isHttp } from '@/utils/validate' export default { name: 'HeaderSearch', @@ -72,7 +73,7 @@ export default { change(val) { const path = val.path; const query = val.query; - if(this.ishttp(val.path)) { + if(isHttp(val.path)) { // http(s):// 路径新窗口打开 const pindex = path.indexOf("http"); window.open(path.substr(pindex, path.length), "_blank"); @@ -115,7 +116,7 @@ export default { if (router.hidden) { continue } const data = { - path: !this.ishttp(router.path) ? path.resolve(basePath, router.path) : router.path, + path: !isHttp(router.path) ? path.resolve(basePath, router.path) : router.path, title: [...prefixTitle] } @@ -149,9 +150,6 @@ export default { } else { this.options = [] } - }, - ishttp(url) { - return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1 } } } diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue index 86a91c4cf..75e2bb61e 100644 --- a/ruoyi-ui/src/components/TopNav/index.vue +++ b/ruoyi-ui/src/components/TopNav/index.vue @@ -14,7 +14,7 @@ - + 更多菜单 import { constantRoutes } from "@/router"; +import { isHttp } from "@/utils/validate"; // 隐藏侧边栏路由 const hideList = ['/index', '/user/profile']; @@ -78,7 +79,7 @@ export default { if(router.path === "/") { router.children[item].path = "/" + router.children[item].path; } else { - if(!this.ishttp(router.children[item].path)) { + if(!isHttp(router.children[item].path)) { router.children[item].path = router.path + "/" + router.children[item].path; } } @@ -126,7 +127,7 @@ export default { handleSelect(key, keyPath) { this.currentIndex = key; const route = this.routers.find(item => item.path === key); - if (this.ishttp(key)) { + if (isHttp(key)) { // http(s):// 路径新窗口打开 window.open(key, "_blank"); } else if (!route || !route.children) { @@ -160,9 +161,6 @@ export default { } else { this.$store.dispatch('app/toggleSideBarHide', true); } - }, - ishttp(url) { - return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1 } }, }; diff --git a/ruoyi-ui/src/layout/components/AppMain.vue b/ruoyi-ui/src/layout/components/AppMain.vue index c206a18a7..d88c67cef 100644 --- a/ruoyi-ui/src/layout/components/AppMain.vue +++ b/ruoyi-ui/src/layout/components/AppMain.vue @@ -22,6 +22,22 @@ export default { key() { return this.$route.path } + }, + watch: { + $route() { + this.addIframe() + } + }, + mounted() { + this.addIframe() + }, + methods: { + addIframe() { + const {name} = this.$route + if (name && this.$route.meta.link) { + this.$store.dispatch('tagsView/addIframeView', this.$route) + } + } } } diff --git a/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue b/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue index ca3ae1837..3a81d29a0 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue @@ -62,11 +62,10 @@ export default { const showingChildren = children.filter(item => { if (item.hidden) { return false - } else { - // Temp set(will be used if only has one showing child) - this.onlyOneChild = item - return true } + // Temp set(will be used if only has one showing child) + this.onlyOneChild = item + return true }) // When there is only one child router, the child router is displayed by default diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue index 1fc232352..44eff7d4e 100644 --- a/ruoyi-ui/src/layout/components/TagsView/index.vue +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -133,11 +133,7 @@ export default { const { name } = this.$route if (name) { this.$store.dispatch('tagsView/addView', this.$route) - if (this.$route.meta.link) { - this.$store.dispatch('tagsView/addIframeView', this.$route) - } } - return false }, moveToCurrentTag() { const tags = this.$refs.tag diff --git a/ruoyi-ui/src/plugins/cache.js b/ruoyi-ui/src/plugins/cache.js index 6f71b8e5c..e912c9a2d 100644 --- a/ruoyi-ui/src/plugins/cache.js +++ b/ruoyi-ui/src/plugins/cache.js @@ -26,6 +26,7 @@ const sessionCache = { if (value != null) { return JSON.parse(value) } + return null }, remove (key) { sessionStorage.removeItem(key); @@ -59,6 +60,7 @@ const localCache = { if (value != null) { return JSON.parse(value) } + return null }, remove (key) { localStorage.removeItem(key); diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 7c9b0c700..6c5e2b54e 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -1,5 +1,7 @@ import { login, logout, getInfo, refreshToken } from '@/api/login' import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth' +import { isEmpty } from "@/utils/validate" +import defAva from '@/assets/images/profile.jpg' const user = { state: { @@ -61,7 +63,7 @@ const user = { return new Promise((resolve, reject) => { getInfo().then(res => { const user = res.user - const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar; + const avatar = (isEmpty(user.avatar)) ? defAva : user.avatar if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 commit('SET_ROLES', res.roles) commit('SET_PERMISSIONS', res.permissions) diff --git a/ruoyi-ui/src/utils/validate.js b/ruoyi-ui/src/utils/validate.js index 798643313..287d51847 100644 --- a/ruoyi-ui/src/utils/validate.js +++ b/ruoyi-ui/src/utils/validate.js @@ -1,4 +1,26 @@ /** + * 判断value字符串是否为空 + * @param {string} value + * @returns {Boolean} + */ +export function isEmpty(value) { + if (value == null || value == "" || value == undefined || value == "undefined") { + return true; + } + return false; +} + +/** + * 判断url是否是http或https + * @param {string} url + * @returns {Boolean} + */ +export function isHttp(url) { + return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1 +} + +/** + * 判断path是否为外链 * @param {string} path * @returns {Boolean} */ diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index a6047223f..d7ff28806 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -157,7 +157,7 @@ - + diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index cc9e5410b..db861e5f4 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -522,8 +522,8 @@ export default { }) }); }); - this.title = "修改角色"; }); + this.title = "修改角色"; }, /** 选择角色权限范围触发 */ dataScopeSelectChange(value) { @@ -543,8 +543,8 @@ export default { this.$refs.dept.setCheckedKeys(res.checkedKeys); }); }); - this.title = "分配数据权限"; }); + this.title = "分配数据权限"; }, /** 分配用户操作 */ handleAuthUser: function(row) { diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index ff798945a..6a0ffcf34 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -1,205 +1,97 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - 搜索 - 重置 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + - - - 新增 - - - 修改 - - - 删除 - - - 导入 - - - 导出 - - - + + + 新增 + + + 修改 + + + 删除 + + + 导入 + + + 导出 + + + - - - - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - - - 修改 - 删除 - handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']"> - 更多 - - 重置密码 - 分配角色 - - - - - + + + + + + + + + + + + + + + {{ parseTime(scope.row.createTime) }} + + + + + 修改 + 删除 + handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']"> + 更多 + + 重置密码 + 分配角色 + + + + + - - + + + + @@ -237,7 +129,7 @@ - + @@ -245,23 +137,14 @@ - + - {{dict.label}} + {{ dict.label }} @@ -270,26 +153,14 @@ - + - + @@ -310,26 +181,15 @@ - + 将文件拖到此处,或点击上传 - 是否更新已经存在的用户数据 + 是否更新已经存在的用户数据 仅允许导入xls、xlsx格式文件。 - 下载模板 + 下载模板