登录后台,通过添加一个下拉选项【系统设置】来控制系统的后侧系统设置,布局如下:

  • 修改UserMenu.vue文件

1.全局搜索“账户设置”,找到对应的vue文件:UserMenu.vue

2.添加【系统设置】下拉选项

在UserMenu.vue中的“账户设置”的代码

<a-menu-item key="1">
          <router-link :to="{ name: 'account-settings-base' }">
            <a-icon type="setting"/>
            <span>账户设置</span>
          </router-link>
        </a-menu-item>

下面添加代码:

<a-menu-item key="3"  @click="systemSetting">
         <a-icon type="tool"/>
          <span>系统设置</span>
      </a-menu-item>

3.并将【密码修改】、【切换部门】的a-menu-item的key分别设置为4、5
            
            4.引入系统设置页面SettingDrawer.vue
                1)在<depart-select ref="departSelect" :closable="true" title="部门切换"></depart-select>代码下面
                添加代码
                <setting-drawer ref="settingDrawer" :closable="true" title="系统设置"></setting-drawer>
                2)import区域添加代码 import SettingDrawer from "@/components/setting/SettingDrawer";
                3) components中添加 SettingDrawer
            5.为步骤2中的【系统设置】添加click方法
            在methods中添加
                  systemSetting(){
                    this.$refs.settingDrawer.showDrawer()
                  }

  • 修改SettingDrawer.vue文件

将代码     
                 <div class="setting-drawer-index-handle" @click="toggle">
                   <a-icon type="setting" v-if="!visible"/>
                   <a-icon type="close" v-else/>
                 </div>
            更改为:
                  <div class="setting-drawer-index-handle" @click="toggle" v-if="visible">
                    <a-icon type="close" />
                  </div>

  • 最终代码

1.UserMenu.vue

  1. <template>
  2. <div class="user-wrapper" :class="theme">
  3. <span class="action">
  4. <a class="logout_title" target="_blank" href="http://jeecg-boot.mydoc.io">
  5. <a-icon type="question-circle-o"></a-icon>
  6. </a>
  7. </span>
  8. <header-notice class="action"/>
  9. <a-dropdown>
  10. <span class="action action-full ant-dropdown-link user-dropdown-menu">
  11. <a-avatar class="avatar" size="small" :src="getAvatar()"/>
  12. <span v-if="isDesktop()">欢迎您,{{ nickname() }}</span>
  13. </span>
  14. <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
  15. <a-menu-item key="0">
  16. <router-link :to="{ name: 'account-center' }">
  17. <a-icon type="user"/>
  18. <span>个人中心</span>
  19. </router-link>
  20. </a-menu-item>
  21. <a-menu-item key="1">
  22. <router-link :to="{ name: 'account-settings-base' }">
  23. <a-icon type="setting"/>
  24. <span>账户设置</span>
  25. </router-link>
  26. </a-menu-item>
  27. <a-menu-item key="3" @click="systemSetting">
  28. <a-icon type="tool"/>
  29. <span>系统设置</span>
  30. </a-menu-item>
  31. <a-menu-item key="4" @click="updatePassword">
  32. <a-icon type="setting"/>
  33. <span>密码修改</span>
  34. </a-menu-item>
  35. <a-menu-item key="5" @click="updateCurrentDepart">
  36. <a-icon type="cluster"/>
  37. <span>切换部门</span>
  38. </a-menu-item>
  39. <!-- <a-menu-item key="2" disabled>
  40. <a-icon type="setting"/>
  41. <span>测试</span>
  42. </a-menu-item>
  43. <a-menu-divider/>
  44. <a-menu-item key="3">
  45. <a href="javascript:;" @click="handleLogout">
  46. <a-icon type="logout"/>
  47. <span>退出登录</span>
  48. </a>
  49. </a-menu-item>-->
  50. </a-menu>
  51. </a-dropdown>
  52. <span class="action">
  53. <a class="logout_title" href="javascript:;" @click="handleLogout">
  54. <a-icon type="logout"/>
  55. <span v-if="isDesktop()">&nbsp;退出登录</span>
  56. </a>
  57. </span>
  58. <user-password ref="userPassword"></user-password>
  59. <depart-select ref="departSelect" :closable="true" title="部门切换"></depart-select>
  60. <setting-drawer ref="settingDrawer" :closable="true" title="系统设置"></setting-drawer>
  61. </div>
  62. </template>
  63. <script>
  64. import HeaderNotice from './HeaderNotice'
  65. import UserPassword from './UserPassword'
  66. import SettingDrawer from "@/components/setting/SettingDrawer";
  67. import DepartSelect from './DepartSelect'
  68. import { mapActions, mapGetters } from 'vuex'
  69. import { mixinDevice } from '@/utils/mixin.js'
  70. export default {
  71. name: "UserMenu",
  72. mixins: [mixinDevice],
  73. components: {
  74. HeaderNotice,
  75. UserPassword,
  76. DepartSelect,
  77. SettingDrawer
  78. },
  79. props: {
  80. theme: {
  81. type: String,
  82. required: false,
  83. default: 'dark'
  84. }
  85. },
  86. methods: {
  87. ...mapActions(["Logout"]),
  88. ...mapGetters(["nickname", "avatar","userInfo"]),
  89. getAvatar(){
  90. console.log('url = '+ window._CONFIG['imgDomainURL']+"/"+this.avatar())
  91. return window._CONFIG['imgDomainURL']+"/"+this.avatar()
  92. },
  93. handleLogout() {
  94. const that = this
  95. this.$confirm({
  96. title: '提示',
  97. content: '真的要注销登录吗 ?',
  98. onOk() {
  99. return that.Logout({}).then(() => {
  100. window.location.href="/";
  101. //window.location.reload()
  102. }).catch(err => {
  103. that.$message.error({
  104. title: '错误',
  105. description: err.message
  106. })
  107. })
  108. },
  109. onCancel() {
  110. },
  111. });
  112. },
  113. updatePassword(){
  114. let username = this.userInfo().username
  115. this.$refs.userPassword.show(username)
  116. },
  117. updateCurrentDepart(){
  118. this.$refs.departSelect.show()
  119. },
  120. systemSetting(){
  121. this.$refs.settingDrawer.showDrawer()
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped>
  127. .logout_title {
  128. color: inherit;
  129. text-decoration: none;
  130. }
  131. </style>

2.SettingDrawer.vue

  1. <template>
  2. <div class="setting-drawer">
  3. <a-drawer
  4. width="300"
  5. placement="right"
  6. :closable="false"
  7. @close="onClose"
  8. :visible="visible"
  9. :style="{}"
  10. >
  11. <div class="setting-drawer-index-content">
  12. <div :style="{ marginBottom: '24px' }">
  13. <h3 class="setting-drawer-index-title">整体风格设置</h3>
  14. <div class="setting-drawer-index-blockChecbox">
  15. <a-tooltip>
  16. <template slot="title">
  17. 暗色菜单风格
  18. </template>
  19. <div class="setting-drawer-index-item" @click="handleMenuTheme('dark')">
  20. <img src="https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg" alt="dark">
  21. <div class="setting-drawer-index-selectIcon" v-if="navTheme === 'dark'">
  22. <a-icon type="check"/>
  23. </div>
  24. </div>
  25. </a-tooltip>
  26. <a-tooltip>
  27. <template slot="title">
  28. 亮色菜单风格
  29. </template>
  30. <div class="setting-drawer-index-item" @click="handleMenuTheme('light')">
  31. <img src="https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg" alt="light">
  32. <div class="setting-drawer-index-selectIcon" v-if="navTheme !== 'dark'">
  33. <a-icon type="check"/>
  34. </div>
  35. </div>
  36. </a-tooltip>
  37. </div>
  38. </div>
  39. <div :style="{ marginBottom: '24px' }">
  40. <h3 class="setting-drawer-index-title">主题色</h3>
  41. <div style="height: 20px">
  42. <a-tooltip class="setting-drawer-theme-color-colorBlock" v-for="(item, index) in colorList" :key="index">
  43. <template slot="title">
  44. {{ item.key }}
  45. </template>
  46. <a-tag :color="item.color" @click="changeColor(item.color)">
  47. <a-icon type="check" v-if="item.color === primaryColor"></a-icon>
  48. </a-tag>
  49. </a-tooltip>
  50. </div>
  51. </div>
  52. <a-divider />
  53. <div :style="{ marginBottom: '24px' }">
  54. <h3 class="setting-drawer-index-title">导航模式</h3>
  55. <div class="setting-drawer-index-blockChecbox">
  56. <a-tooltip>
  57. <template slot="title">
  58. 侧边栏导航
  59. </template>
  60. <div class="setting-drawer-index-item" @click="handleLayout('sidemenu')">
  61. <img src="https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg" alt="sidemenu">
  62. <div class="setting-drawer-index-selectIcon" v-if="layoutMode === 'sidemenu'">
  63. <a-icon type="check"/>
  64. </div>
  65. </div>
  66. </a-tooltip>
  67. <a-tooltip>
  68. <template slot="title">
  69. 顶部栏导航
  70. </template>
  71. <div class="setting-drawer-index-item" @click="handleLayout('topmenu')">
  72. <img src="https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg" alt="topmenu">
  73. <div class="setting-drawer-index-selectIcon" v-if="layoutMode !== 'sidemenu'">
  74. <a-icon type="check"/>
  75. </div>
  76. </div>
  77. </a-tooltip>
  78. </div>
  79. <div :style="{ marginTop: '24px' }">
  80. <a-list :split="false">
  81. <a-list-item>
  82. <a-tooltip slot="actions">
  83. <template slot="title">
  84. 该设定仅 [顶部栏导航] 时有效
  85. </template>
  86. <a-select size="small" style="width: 80px;" :defaultValue="contentWidth" @change="handleContentWidthChange">
  87. <a-select-option value="Fixed">固定</a-select-option>
  88. <a-select-option value="Fluid" v-if="layoutMode !== 'sidemenu'">流式</a-select-option>
  89. </a-select>
  90. </a-tooltip>
  91. <a-list-item-meta>
  92. <div slot="title">内容区域宽度</div>
  93. </a-list-item-meta>
  94. </a-list-item>
  95. <a-list-item>
  96. <a-switch slot="actions" size="small" :defaultChecked="fixedHeader" @change="handleFixedHeader" />
  97. <a-list-item-meta>
  98. <div slot="title">固定 Header</div>
  99. </a-list-item-meta>
  100. </a-list-item>
  101. <a-list-item>
  102. <a-switch slot="actions" size="small" :disabled="!fixedHeader" :defaultChecked="autoHideHeader" @change="handleFixedHeaderHidden" />
  103. <a-list-item-meta>
  104. <div slot="title" :style="{ textDecoration: !fixedHeader ? 'line-through' : 'unset' }">下滑时隐藏 Header</div>
  105. </a-list-item-meta>
  106. </a-list-item>
  107. <a-list-item >
  108. <a-switch slot="actions" size="small" :disabled="(layoutMode === 'topmenu')" :checked="dataFixSiderbar" @change="handleFixSiderbar" />
  109. <a-list-item-meta>
  110. <div slot="title" :style="{ textDecoration: layoutMode === 'topmenu' ? 'line-through' : 'unset' }">固定侧边菜单</div>
  111. </a-list-item-meta>
  112. </a-list-item>
  113. </a-list>
  114. </div>
  115. </div>
  116. <a-divider />
  117. <div :style="{ marginBottom: '24px' }">
  118. <h3 class="setting-drawer-index-title">其他设置</h3>
  119. <div>
  120. <a-list :split="false">
  121. <a-list-item>
  122. <a-switch slot="actions" size="small" :defaultChecked="colorWeak" @change="onColorWeak" />
  123. <a-list-item-meta>
  124. <div slot="title">色弱模式</div>
  125. </a-list-item-meta>
  126. </a-list-item>
  127. <a-list-item>
  128. <a-switch slot="actions" size="small" :defaultChecked="multipage" @change="onMultipageWeak" />
  129. <a-list-item-meta>
  130. <div slot="title">多页签模式</div>
  131. </a-list-item-meta>
  132. </a-list-item>
  133. </a-list>
  134. </div>
  135. </div>
  136. <a-divider />
  137. <div :style="{ marginBottom: '24px' }">
  138. <a-alert type="warning">
  139. <span slot="message">
  140. 配置栏只在开发环境用于预览,生产环境不会展现,请手动修改配置文件
  141. <a href="https://github.com/sendya/ant-design-pro-vue/blob/master/src/defaultSettings.js" target="_blank">src/defaultSettings.js</a>
  142. </span>
  143. </a-alert>
  144. </div>
  145. </div>
  146. <div class="setting-drawer-index-handle" @click="toggle" v-if="visible">
  147. <!-- <a-icon type="setting" v-if="!visible"/>-->
  148. <!-- <a-icon type="close" v-else/>-->
  149. <a-icon type="close" />
  150. </div>
  151. </a-drawer>
  152. </div>
  153. </template>
  154. <script>import DetailList from '@/components/tools/DetailList'
  155. import SettingItem from '@/components/setting/SettingItem'
  156. import config from '@/defaultSettings'
  157. import { updateTheme, updateColorWeak, colorList } from '@/components/tools/setting'
  158. import { mixin, mixinDevice } from '@/utils/mixin.js'
  159. import { triggerWindowResizeEvent } from '@/utils/util'
  160. export default {
  161. components: {
  162. DetailList,
  163. SettingItem
  164. },
  165. mixins: [mixin, mixinDevice],
  166. data() {
  167. return {
  168. visible: true,
  169. colorList,
  170. dataFixSiderbar: false
  171. }
  172. },
  173. watch: {
  174. },
  175. mounted () {
  176. const vm = this
  177. setTimeout(() => {
  178. vm.visible = false
  179. }, 16)
  180. // 当主题色不是默认色时,才进行主题编译
  181. if (this.primaryColor !== config.primaryColor) {
  182. updateTheme(this.primaryColor)
  183. }
  184. if (this.colorWeak !== config.colorWeak) {
  185. updateColorWeak(this.colorWeak)
  186. }
  187. if (this.multipage !== config.multipage) {
  188. this.$store.dispatch('ToggleMultipage', this.multipage)
  189. }
  190. },
  191. methods: {
  192. showDrawer() {
  193. this.visible = true
  194. },
  195. onClose() {
  196. this.visible = false
  197. },
  198. toggle() {
  199. this.visible = !this.visible
  200. },
  201. onColorWeak (checked) {
  202. this.$store.dispatch('ToggleWeak', checked)
  203. updateColorWeak(checked)
  204. },
  205. onMultipageWeak (checked) {
  206. this.$store.dispatch('ToggleMultipage', checked)
  207. },
  208. handleMenuTheme (theme) {
  209. this.$store.dispatch('ToggleTheme', theme)
  210. },
  211. handleLayout (mode) {
  212. this.$store.dispatch('ToggleLayoutMode', mode)
  213. // 因为顶部菜单不能固定左侧菜单栏,所以强制关闭
  214. this.handleFixSiderbar(false)
  215. // 触发窗口resize事件
  216. triggerWindowResizeEvent()
  217. },
  218. handleContentWidthChange (type) {
  219. this.$store.dispatch('ToggleContentWidth', type)
  220. },
  221. changeColor (color) {
  222. if (this.primaryColor !== color) {
  223. this.$store.dispatch('ToggleColor', color)
  224. updateTheme(color)
  225. }
  226. },
  227. handleFixedHeader (fixed) {
  228. this.$store.dispatch('ToggleFixedHeader', fixed)
  229. },
  230. handleFixedHeaderHidden (autoHidden) {
  231. this.$store.dispatch('ToggleFixedHeaderHidden', autoHidden)
  232. },
  233. handleFixSiderbar (fixed) {
  234. if (this.layoutMode === 'topmenu') {
  235. fixed = false
  236. }
  237. this.dataFixSiderbar = fixed
  238. this.$store.dispatch('ToggleFixSiderbar', fixed)
  239. }
  240. },
  241. }
  242. </script>
  243. <style lang="scss" scoped>
  244. .setting-drawer-index-content {
  245. .setting-drawer-index-blockChecbox {
  246. display: flex;
  247. .setting-drawer-index-item {
  248. margin-right: 16px;
  249. position: relative;
  250. border-radius: 4px;
  251. cursor: pointer;
  252. img {
  253. width: 48px;
  254. }
  255. .setting-drawer-index-selectIcon {
  256. position: absolute;
  257. top: 0;
  258. right: 0;
  259. width: 100%;
  260. padding-top: 15px;
  261. padding-left: 24px;
  262. height: 100%;
  263. color: #1890ff;
  264. font-size: 14px;
  265. font-weight: 700;
  266. }
  267. }
  268. }
  269. .setting-drawer-theme-color-colorBlock {
  270. width: 20px;
  271. height: 20px;
  272. border-radius: 2px;
  273. float: left;
  274. cursor: pointer;
  275. margin-right: 8px;
  276. padding-left: 0px;
  277. padding-right: 0px;
  278. text-align: center;
  279. color: #fff;
  280. font-weight: 700;
  281. i {
  282. font-size: 14px;
  283. }
  284. }
  285. }
  286. .setting-drawer-index-handle {
  287. position: absolute;
  288. top: 240px;
  289. background: #1890ff;
  290. width: 48px;
  291. height: 48px;
  292. right: 300px;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. cursor: pointer;
  297. pointer-events: auto;
  298. z-index: 1001;
  299. text-align: center;
  300. font-size: 16px;
  301. border-radius: 4px 0 0 4px;
  302. i {
  303. color: rgb(255, 255, 255);
  304. font-size: 20px;
  305. }
  306. }
  307. </style>

隐藏/显示jeecg-boot 后端管理页面的右侧的系统设置的更多相关文章

  1. 微信分享功能引入页面-控制分享时候调用的标题、图片、url和微信按钮隐藏显示控制

    1.设置分享调用的标题.图片.url预览. 2.控制右上角三个点按钮的隐藏显示(和底部工具栏的显示隐藏--未测试). 3.判断网页是否在微信中被调用. <!doctype html> &l ...

  2. Django(四) 后台管理:创建管理员、注册模型类、自定义管理页面显示内容

    后台管理 第1步.本地化:设置语言.时区 修改project1/settings.py #LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'zh-hans' #设置语言 ...

  3. Spring Boot事务管理(中)

    在上一篇 Spring Boot事务管理(上)的基础上介绍Spring Boot事务属性和事务回滚规则 . 4 Spring Boot事务属性 什么是事务属性呢?事务属性可以理解成事务的一些基本配置, ...

  4. python 全栈开发,Day132(玩具管理页面,控制玩具通讯录,基于请求的好友关系建立)

    先下载github代码,下面的操作,都是基于这个版本来的! https://github.com/987334176/Intelligent_toy/archive/v1.5.zip 注意:由于涉及到 ...

  5. python 全栈开发,Day127(app端内容播放,web端的玩具,app通过websocket远程遥控玩具播放内容,玩具管理页面)

    昨日内容回顾 1. 小爬爬 内容采集 XMLY 的 儿童频道 requests 2. 登陆 注册 自动登陆 退出 mui.post("请求地址",{数据},function(){} ...

  6. app端内容播放,web端的玩具,app通过websocket远程遥控玩具播放内容,玩具管理页面

    一.app端内容播放 下载代码 https://github.com/987334176/Intelligent_toy/archive/v1.0.zip 注意:由于涉及到版权问题,此附件没有图片和音 ...

  7. .net工作流引擎ccflow开发平台属性功能的隐藏显示介绍

    关键字: 工作流程管理系统 工作流引擎 asp.net工作流引擎 java工作流引擎. 表单引擎 工作流功能说明  工作流设计 工作流快速开发平台   业务流程管理   bpm工作流系统  java工 ...

  8. 预约系统(四) 管理页面框架搭建easyUI

    Manage控制器用于管理页面 Index视图为管理页面首页,采用easyUi的后台管理框架 Html头部调用,jquery库,easyui库,easyui.css,icon.css,语言包 < ...

  9. JQuery中隐藏/显示事件函数

    1.$("button").click(function(){ $("p").hide(); });2.如果您的网站包含许多页面,并且您希望您的 jQuery ...

随机推荐

  1. Lucene 搜索方式

    Lucene 的搜索方式包括:词项查询(TermQuery) / 布尔查询(BooleanQuery) / 短语查询(PhraseQuery) / 范围查询(RangeQuery) / 百搭查询(Wi ...

  2. linux安装openoffice,并解决中文乱码

    1.安装openoffice 官网http://www.openoffice.org/zh-cn/download/下载 2.解压并进入文件夹: cd /zh-cn/RPMS yum localins ...

  3. python 取出aws中ip有,zabbix中没有的ip

    #!/usr/bin/env python3# coding=utf-8import requestsimport jsonimport boto3 headers = {'Content-Type' ...

  4. 【学术篇】luogu1351 [NOIP2014提高组] 联合权值

    一道提高组的题..... 传送门:题目在这里.... 现在都懒得更自己的blog了,怕是太颓废了_ (:з」∠) _ 好久没做题了,手都生了.(好吧其实是做题方面手太生了) 这题我都不想讲了,把代码一 ...

  5. CF475F meta-universe

    题意:给你一个无限大矩形中有一些planet,每次可以选择某一没有planet的行或列分割开矩形(分割开以后要求矩形不为空).问最后能分割成几个矩形? 标程: #include<bits/std ...

  6. Batch - C:\Progra~1是什么意思

    就是那种DOS下的8.3的规范,可以这样写 C:\Progra~1也可以这样写全名字的 "C:\Program File",因为这个路径中的文件夹名有空格,要用两个英文输入法下的双 ...

  7. [JZOJ4616] 【NOI2016模拟7.12】二进制的世界

    题目 题目大意 给你一个数列,每个数为[0,65535][0,65535][0,65535]内的整数. 给定一个位运算操作optoptopt,是andandand.ororor.xorxorxor中的 ...

  8. C/C++ Microsoft Visual Studio c++ DOC Home

    { // https://docs.microsoft.com/zh-cn/cpp/overview/visual-cpp-in-visual-studio?view=vs-2017 // https ...

  9. net.sf.jsqlparser.statement.select.PlainSelect.getGroupBy()Lnet/sf/jsqlparse

    添加pom依赖 <dependency> <groupId>com.github.jsqlparser</groupId> <artifactId>js ...

  10. hysbz3676 回文串 回文自动机

    回文自动机模板题 头铁了一下午hdu6599,最后发现自己的板有问题 先放这里一个正确性得到基本确认的板,过两天肝hdu6599 #pragma GCC optimize(2) #include< ...