From dab2fc076d964ecd5b14f8ef7a28d4d3421711d5 Mon Sep 17 00:00:00 2001 From: zhengjie Date: Sat, 11 May 2019 13:46:15 +0800 Subject: [PATCH] =?UTF-8?q?1.8=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- src/components/GithubCorner/index.vue | 51 ----- src/components/Hamburger/index.vue | 17 +- src/components/HeaderSearch/index.vue | 181 ++++++++++++++++++ src/components/RightPanel/index.vue | 157 +++++++++++++++ src/components/placard/index.vue | 27 ++- src/config/index.js | 17 +- src/icons/svg/search.svg | 1 + src/router/index.js | 2 +- src/store/index.js | 4 +- src/store/modules/settings.js | 23 +++ src/store/modules/tagsView.js | 4 +- src/styles/variables.scss | 25 ++- src/utils/index.js | 31 +++ src/views/dashboard/admin/index.vue | 7 +- src/views/layout/Layout.vue | 70 +++++-- src/views/layout/components/AppMain.vue | 16 +- src/views/layout/components/Navbar.vue | 29 ++- .../layout/components/Settings/index.vue | 91 +++++++++ src/views/layout/components/Sidebar/Logo.vue | 39 ++++ src/views/layout/components/Sidebar/index.vue | 19 +- src/views/layout/components/TagsView.vue | 66 ++++++- src/views/layout/components/index.js | 1 + 23 files changed, 738 insertions(+), 143 deletions(-) delete mode 100644 src/components/GithubCorner/index.vue create mode 100644 src/components/HeaderSearch/index.vue create mode 100644 src/components/RightPanel/index.vue create mode 100644 src/icons/svg/search.svg create mode 100644 src/store/modules/settings.js create mode 100644 src/views/layout/components/Settings/index.vue create mode 100644 src/views/layout/components/Sidebar/Logo.vue diff --git a/package.json b/package.json index 3dbb754..6e0d4de 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "stompjs": "2.3.3", "wangeditor": ">=3.0.0", "codemirror": "^5.38.0", - "mavon-editor": "^2.7.0" + "mavon-editor": "^2.7.0", + "path-to-regexp": "2.4.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue deleted file mode 100644 index 6f91c5e..0000000 --- a/src/components/GithubCorner/index.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index f1f9bda..e4cf00a 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -4,24 +4,14 @@ :class="{'is-active':isActive}" t="1492500959545" class="hamburger" - style="" viewBox="0 0 1024 1024" - version="1.1" xmlns="http://www.w3.org/2000/svg" + version="1.1" p-id="1691" - xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64" @click="toggleClick"> - - - + @@ -48,11 +38,10 @@ export default { cursor: pointer; width: 20px; height: 20px; - transform: rotate(90deg); transition: .38s; transform-origin: 50% 50%; } .hamburger.is-active { - transform: rotate(0deg); + transform: rotate(180deg); } diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue new file mode 100644 index 0000000..813e3af --- /dev/null +++ b/src/components/HeaderSearch/index.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue new file mode 100644 index 0000000..c6061d9 --- /dev/null +++ b/src/components/RightPanel/index.vue @@ -0,0 +1,157 @@ + + + + + + + diff --git a/src/components/placard/index.vue b/src/components/placard/index.vue index f6cef7f..d45b219 100644 --- a/src/components/placard/index.vue +++ b/src/components/placard/index.vue @@ -11,28 +11,27 @@ width="32" height="32" @click="click"> - +
1.7版本更新说明
一、后端
    -
  1. 完成部门管理,岗位管理,字典管理,完成数据权限
  2. -
  3. 用户权限加入到缓存,避免重复请求数据库
  4. -
  5. 修复七牛云存储中文名下载失败的bug
  6. +
  7. 修复用户存在多角色时登录失败的bug
  8. +
  9. 修复在修改用户角色时缓存不刷新的bug
  10. +
  11. 修复修改邮箱配置需要重新启动才生效的bug
  12. 修复上级目录选择自己导致列表不显示的bug
  13. -
  14. 大量细节优化
  15. -
  16. 【文档】已更新至1.7版本,访问地址:https://docs.auauz.net
  17. +
  18. 新增部分工具类的单元测试
  19. +
  20. common模块新增 SecurityUtils 工具类、可获取当前用户的 id和 username
  21. +
  22. 配置文件新增 Swagger 的开启开关
二、前端
    -
  1. 优化实时控制台全屏后高宽自适应
  2. -
  3. 七牛云列表显示添加【文件类型】字段
  4. -
  5. sm.ms图床列表添加【缩略图】显示
  6. -
  7. 提供外链嵌入内部菜单的组件(可参考Sql监控或者接口文档菜单)
  8. -
  9. 重新设计个人中心页面
  10. -
  11. 取消无意义的前端MD5加密
  12. -
  13. 前端新增全局配置文件,文件位于src/config 下,目前可配置:网站名称、Cookie过期天数、TokenKey、请求超时时间
  14. -
  15. 大量细节优化
  16. +
  17. 新增系统设置,可设置logo、
  18. +
  19. 新增首屏加载动画
  20. +
  21. 新增系统Logo显示
  22. +
  23. 优化首页的 Tag 不可删除,由 affix 属性控制
  24. +
  25. 修复顶级部门不能修改的问题
  26. +
  27. 其他细节优化
diff --git a/src/config/index.js b/src/config/index.js index 31f5b0f..5d655ef 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -22,5 +22,20 @@ export default { /** * @description 请求超时时间,毫秒(默认2分钟) */ - timeout: 1200000 + timeout: 1200000, + + /** + * @description 是否显示 tagsView + */ + tagsView: true, + + /** + * @description 固定头部 + */ + fixedHeader: false, + + /** + * @description 是否显示logo + */ + sidebarLogo: true } diff --git a/src/icons/svg/search.svg b/src/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/src/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index f41b559..587eea8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -55,7 +55,7 @@ export const constantRouterMap = [ path: 'dashboard', component: () => import('@/views/dashboard/index'), name: '首页', - meta: { title: '首页', icon: 'index', noCache: true } + meta: { title: '首页', icon: 'index', noCache: true, affix: true } } ] }, diff --git a/src/store/index.js b/src/store/index.js index cb9f594..1fc27ae 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,6 +5,7 @@ import api from './modules/api' import user from './modules/user' import tagsView from './modules/tagsView' import permission from './modules/permission' +import settings from './modules/settings' import getters from './getters' Vue.use(Vuex) @@ -15,7 +16,8 @@ const store = new Vuex.Store({ api, user, tagsView, - permission + permission, + settings }, getters }) diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js new file mode 100644 index 0000000..2d27f46 --- /dev/null +++ b/src/store/modules/settings.js @@ -0,0 +1,23 @@ +import Config from '@/config' + +const settings = { + state: { + showRightPanel: false, + tagsView: Config.tagsView, + fixedHeader: Config.fixedHeader, + sidebarLogo: Config.sidebarLogo + }, + mutations: { + CHANGE_SETTING: (state, { key, value }) => { + if (state.hasOwnProperty(key)) { + state[key] = value + } + } + }, + actions: { + changeSetting({ commit }, data) { + commit('CHANGE_SETTING', data) + } + } +} +export default settings diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index cbf9eeb..0b457ab 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -56,7 +56,8 @@ const tagsView = { }, DEL_ALL_VISITED_VIEWS: state => { - state.visitedViews = [] + const affixTags = state.visitedViews.filter(tag => tag.meta.affix) + state.visitedViews = affixTags }, DEL_ALL_CACHED_VIEWS: state => { state.cachedViews = [] @@ -129,7 +130,6 @@ const tagsView = { resolve([...state.cachedViews]) }) }, - delAllViews({ dispatch, state }, view) { return new Promise(resolve => { dispatch('delAllVisitedViews', view) diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 2fee827..2130ff5 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,4 +1,27 @@ //sidebar +$menuText:#bfcbd9; +$menuActiveText:#409EFF; +$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951 + $menuBg:#304156; +$menuHover:#263445; + $subMenuBg:#1f2d3d; -$menuHover:#001528; +$subMenuHover:#001528; + +$sideBarWidth: 180px; + +$hideSidebarWidth: 38px; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + menuText: $menuText; + menuActiveText: $menuActiveText; + subMenuActiveText: $subMenuActiveText; + menuBg: $menuBg; + menuHover: $menuHover; + subMenuBg: $subMenuBg; + subMenuHover: $subMenuHover; + sideBarWidth: $sideBarWidth; +} diff --git a/src/utils/index.js b/src/utils/index.js index 79031e1..2514e9a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -116,3 +116,34 @@ export function regMobile(mobile) { } return new_mobile } + +/** + * Check if an element has a class + * @param {HTMLElement} elm + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele, cls) { + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) +} + +/** + * Add class to element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function addClass(ele, cls) { + if (!hasClass(ele, cls)) ele.className += ' ' + cls +} + +/** + * Remove class from element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function removeClass(ele, cls) { + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') + ele.className = ele.className.replace(reg, ' ') + } +} diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/admin/index.vue index 7a75f49..0c8ce3a 100644 --- a/src/views/dashboard/admin/index.vue +++ b/src/views/dashboard/admin/index.vue @@ -1,8 +1,5 @@ - diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 5f2e104..2322299 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -22,7 +22,7 @@ export default { } - diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 45a9814..df97cd8 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -4,28 +4,30 @@
-