forked from github/dataease
feat: 切换主题基本功能
This commit is contained in:
parent
ad2e93c63e
commit
5ca005b336
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dropdown style="display: flex;align-items: center;" trigger="click" class="international" @command="handleSetLanguage">
|
||||
<div>
|
||||
<svg-icon class-name="international-icon" icon-class="language" />
|
||||
<svg-icon :style="{color: topMenuTextColor}" class-name="international-icon" icon-class="language" />
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :disabled="language==='zh_CN'" command="zh_CN">
|
||||
@ -24,10 +24,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import variables from '@/styles/variables.scss'
|
||||
export default {
|
||||
computed: {
|
||||
language() {
|
||||
return this.$store.getters.language
|
||||
},
|
||||
variables() {
|
||||
return variables
|
||||
},
|
||||
topMenuTextColor() {
|
||||
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuTextColor'] && this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue }
|
||||
return this.variables.topBarMenuText
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -232,7 +232,7 @@ export default {
|
||||
right: 178px;
|
||||
top: 8px;
|
||||
background: red;
|
||||
color: #fff;
|
||||
// color: #fff;
|
||||
border-radius: 17px;
|
||||
padding: 4px 7px;
|
||||
font-size: 16px;
|
||||
|
@ -8,6 +8,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getThemeCluster } from '@/utils/style'
|
||||
const version = require('element-ui/package.json').version // element-ui version from node_modules
|
||||
const ORIGINAL_THEME = '#409EFF' // default color
|
||||
export default {
|
||||
@ -38,12 +39,12 @@ export default {
|
||||
async switch(val) {
|
||||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
||||
if (typeof val !== 'string') return
|
||||
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
||||
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
||||
const themeCluster = getThemeCluster(val.replace('#', ''))
|
||||
const originalCluster = getThemeCluster(oldVal.replace('#', ''))
|
||||
|
||||
const getHandler = (variable, id) => {
|
||||
return () => {
|
||||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
||||
const originalCluster = getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
||||
const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster)
|
||||
|
||||
let styleTag = document.getElementById(id)
|
||||
@ -98,8 +99,8 @@ export default {
|
||||
xhr.open('GET', url)
|
||||
xhr.send()
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
/*
|
||||
getThemeCluster(theme) {
|
||||
const tintColor = (color, tint) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
@ -144,6 +145,8 @@ export default {
|
||||
clusters.push(shadeColor(theme, 0.1))
|
||||
return clusters
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -31,8 +31,6 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "~@/styles/mixin.scss";
|
||||
@import "~@/styles/variables.scss";
|
||||
|
||||
.back-button {
|
||||
cursor: pointer;
|
||||
|
@ -39,11 +39,9 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
@import "~@/styles/mixin.scss";
|
||||
@import "~@/styles/variables.scss";
|
||||
|
||||
.content-container {
|
||||
transition: 0.3s;
|
||||
color: $--color-text-primary;
|
||||
background-color: #FFFFFF;
|
||||
overflow: auto;
|
||||
height: 100%;
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div>
|
||||
<slot name="toolbar" />
|
||||
</div>
|
||||
<fu-search-bar v-bind="searchConfig" @exec="search" ref="search">
|
||||
<fu-search-bar ref="search" v-bind="searchConfig" @exec="search">
|
||||
<template #complex>
|
||||
<slot name="complex" />
|
||||
</template>
|
||||
@ -65,7 +65,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
condition: {},
|
||||
condition: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -86,7 +86,6 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
@import "~@/styles/mixin.scss";
|
||||
@import "~@/styles/variables.scss";
|
||||
.complex-table {
|
||||
.complex-table__header {
|
||||
@include flex-row(flex-start, center);
|
||||
|
@ -79,7 +79,6 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
@import "~@/styles/mixin.scss";
|
||||
@import "~@/styles/variables.scss";
|
||||
.complex-table {
|
||||
.complex-table__header {
|
||||
@include flex-row(flex-start, center);
|
||||
|
@ -1 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1623897748319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23219" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 1024C227.556 1024 0 796.444 0 512S227.556 0 512 0s512 227.556 512 512-227.556 512-512 512z m0-68.267c244.622 0 443.733-199.11 443.733-443.733S756.623 68.267 512 68.267 68.267 267.377 68.267 512 267.377 955.733 512 955.733z m11.378-694.044c45.51 0 85.333 11.378 113.778 39.822 28.444 22.756 45.51 62.578 45.51 102.4 0 34.133-11.377 68.267-28.444 91.022-5.689 5.69-28.444 28.445-62.578 56.89-11.377 11.377-22.755 22.755-28.444 39.821-5.689 17.067-11.378 34.134-11.378 45.512v11.377h-79.644v-11.377c0-28.445 5.689-51.2 17.066-68.267 11.378-22.756 39.823-51.2 79.645-91.022l11.378-11.378c11.377-17.067 22.755-34.133 22.755-51.2 0-22.756-5.689-45.511-22.755-56.889-17.067-17.067-34.134-22.756-62.578-22.756-34.133 0-56.889 11.378-73.956 28.445-11.377 17.067-17.066 39.822-17.066 73.955H352.71c0-51.2 17.067-96.71 45.511-125.155 28.445-34.133 73.956-51.2 125.156-51.2zM512 688.356c17.067 0 28.444 5.688 39.822 17.066 11.378 11.378 17.067 22.756 17.067 39.822 0 17.067-5.689 28.445-17.067 39.823-11.378 11.377-22.755 17.066-39.822 17.066-28.444 0-51.2-22.755-51.2-51.2 0-17.066 5.689-28.444 17.067-39.822 5.689-17.067 22.755-22.755 34.133-22.755z" p-id="23220" fill="#707070"></path></svg>
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1623897748319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23219" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 1024C227.556 1024 0 796.444 0 512S227.556 0 512 0s512 227.556 512 512-227.556 512-512 512z m0-68.267c244.622 0 443.733-199.11 443.733-443.733S756.623 68.267 512 68.267 68.267 267.377 68.267 512 267.377 955.733 512 955.733z m11.378-694.044c45.51 0 85.333 11.378 113.778 39.822 28.444 22.756 45.51 62.578 45.51 102.4 0 34.133-11.377 68.267-28.444 91.022-5.689 5.69-28.444 28.445-62.578 56.89-11.377 11.377-22.755 22.755-28.444 39.821-5.689 17.067-11.378 34.134-11.378 45.512v11.377h-79.644v-11.377c0-28.445 5.689-51.2 17.066-68.267 11.378-22.756 39.823-51.2 79.645-91.022l11.378-11.378c11.377-17.067 22.755-34.133 22.755-51.2 0-22.756-5.689-45.511-22.755-56.889-17.067-17.067-34.134-22.756-62.578-22.756-34.133 0-56.889 11.378-73.956 28.445-11.377 17.067-17.066 39.822-17.066 73.955H352.71c0-51.2 17.067-96.71 45.511-125.155 28.445-34.133 73.956-51.2 125.156-51.2zM512 688.356c17.067 0 28.444 5.688 39.822 17.066 11.378 11.378 17.067 22.756 17.067 39.822 0 17.067-5.689 28.445-17.067 39.823-11.378 11.377-22.755 17.066-39.822 17.066-28.444 0-51.2-22.755-51.2-51.2 0-17.066 5.689-28.444 17.067-39.822 5.689-17.067 22.755-22.755 34.133-22.755z" p-id="23220" ></path></svg>
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@ -1 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1623896817205" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12052" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M616.521143 407.478857h313.417143a69.485714 69.485714 0 0 1 69.705143 69.705143v452.754286a69.485714 69.485714 0 0 1-69.705143 69.705143h-452.754286a69.485714 69.485714 0 0 1-69.705143-69.705143V616.594286H94.061714a69.485714 69.485714 0 0 1-69.705143-69.705143v-452.754286a69.485714 69.485714 0 0 1 69.705143-69.705143h452.754286a69.485714 69.485714 0 0 1 69.705143 69.705143V407.405714z m0 69.705143v69.632a69.485714 69.485714 0 0 1-69.705143 69.705143h-69.632v278.674286c0 19.163429 15.579429 34.742857 34.816 34.742857h383.122286a34.816 34.816 0 0 0 34.816-34.742857V512a34.816 34.816 0 0 0-34.816-34.816h-278.674286zM94.061714 128.731429V512c0 19.236571 15.579429 34.816 34.742857 34.816H512A34.816 34.816 0 0 0 546.816 512V128.877714A34.816 34.816 0 0 0 512 94.061714H128.877714a34.816 34.816 0 0 0-34.816 34.742857z m69.632 265.947428V219.574857h122.733715V146.285714h50.834285c7.021714 1.024 10.532571 1.974857 10.532572 2.998857a11.483429 11.483429 0 0 1-1.462857 4.461715c-3.072 8.045714-4.534857 17.481143-4.534858 28.452571v37.376h130.194286v170.642286h-55.369143v-22.454857H341.796571v128.731428h-53.906285v-128.731428H214.601143v26.989714h-50.907429z m50.834286-133.193143v65.828572h73.362286v-65.828572H214.601143z m202.093714 65.828572v-65.828572H341.796571v65.828572h74.825143z m221.915429 531.163428h-56.905143l100.278857-276.918857h70.363429l97.28 276.918857h-59.830857l-20.992-58.368H659.456l-20.918857 58.368z m35.84-104.813714h79.36L716.361143 635.611429h-1.462857l-40.448 118.198857z m255.561143-450.706286h-69.632a139.337143 139.337143 0 0 0-139.337143-139.337143v-69.632a208.969143 208.969143 0 0 1 208.969143 208.969143zM94.061714 720.969143h69.632c0 76.946286 62.390857 139.337143 139.337143 139.337143v69.632a208.969143 208.969143 0 0 1-208.969143-208.969143z" p-id="12053" fill="#8a8a8a"></path></svg>
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1623896817205" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12052" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M616.521143 407.478857h313.417143a69.485714 69.485714 0 0 1 69.705143 69.705143v452.754286a69.485714 69.485714 0 0 1-69.705143 69.705143h-452.754286a69.485714 69.485714 0 0 1-69.705143-69.705143V616.594286H94.061714a69.485714 69.485714 0 0 1-69.705143-69.705143v-452.754286a69.485714 69.485714 0 0 1 69.705143-69.705143h452.754286a69.485714 69.485714 0 0 1 69.705143 69.705143V407.405714z m0 69.705143v69.632a69.485714 69.485714 0 0 1-69.705143 69.705143h-69.632v278.674286c0 19.163429 15.579429 34.742857 34.816 34.742857h383.122286a34.816 34.816 0 0 0 34.816-34.742857V512a34.816 34.816 0 0 0-34.816-34.816h-278.674286zM94.061714 128.731429V512c0 19.236571 15.579429 34.816 34.742857 34.816H512A34.816 34.816 0 0 0 546.816 512V128.877714A34.816 34.816 0 0 0 512 94.061714H128.877714a34.816 34.816 0 0 0-34.816 34.742857z m69.632 265.947428V219.574857h122.733715V146.285714h50.834285c7.021714 1.024 10.532571 1.974857 10.532572 2.998857a11.483429 11.483429 0 0 1-1.462857 4.461715c-3.072 8.045714-4.534857 17.481143-4.534858 28.452571v37.376h130.194286v170.642286h-55.369143v-22.454857H341.796571v128.731428h-53.906285v-128.731428H214.601143v26.989714h-50.907429z m50.834286-133.193143v65.828572h73.362286v-65.828572H214.601143z m202.093714 65.828572v-65.828572H341.796571v65.828572h74.825143z m221.915429 531.163428h-56.905143l100.278857-276.918857h70.363429l97.28 276.918857h-59.830857l-20.992-58.368H659.456l-20.918857 58.368z m35.84-104.813714h79.36L716.361143 635.611429h-1.462857l-40.448 118.198857z m255.561143-450.706286h-69.632a139.337143 139.337143 0 0 0-139.337143-139.337143v-69.632a208.969143 208.969143 0 0 1 208.969143 208.969143zM94.061714 720.969143h69.632c0 76.946286 62.390857 139.337143 139.337143 139.337143v69.632a208.969143 208.969143 0 0 1-208.969143-208.969143z" p-id="12053" ></path></svg>
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
@ -1246,13 +1246,14 @@ export default {
|
||||
loginTitle: '登录页面标题',
|
||||
title: '系统名称',
|
||||
advice_size: '建议图片大小',
|
||||
theme: '头部背景',
|
||||
theme: '主题颜色',
|
||||
|
||||
topMenuActiveColor: '主题颜色',
|
||||
topMenuColor: '头部背景',
|
||||
topMenuActiveColor: '头部选中背景',
|
||||
|
||||
topMenuTextColor: '字体颜色',
|
||||
topMenuTextColor: '头部字体颜色',
|
||||
|
||||
topMenuTextActiveColor: '字体选中颜色'
|
||||
topMenuTextActiveColor: '头部字体选中颜色'
|
||||
|
||||
},
|
||||
auth: {
|
||||
|
@ -20,7 +20,6 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/styles/variables.scss";
|
||||
|
||||
.app-main {
|
||||
height: 100%;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="{'has-logo':showLogo}">
|
||||
<div :class="{'has-logo':showLogo}" :style="{'--active-bg': activeBg, '--theme':$store.state.settings.theme , '--left-menu-hovor': variables.leftMenuHovor}">
|
||||
<logo v-if="showLogo" :collapse="isCollapse" />
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
@ -18,9 +18,12 @@ import { mapGetters } from 'vuex'
|
||||
import Logo from './Logo'
|
||||
import SidebarItem from './SidebarItem'
|
||||
import variables from '@/styles/variables.scss'
|
||||
import { getThemeCluster } from '@/utils/style'
|
||||
export default {
|
||||
components: { SidebarItem, Logo },
|
||||
|
||||
computed: {
|
||||
|
||||
...mapGetters([
|
||||
'sidebar'
|
||||
]),
|
||||
@ -45,7 +48,38 @@ export default {
|
||||
},
|
||||
isCollapse() {
|
||||
return false
|
||||
},
|
||||
activeBg() {
|
||||
const theme = this.$store.state.settings.theme
|
||||
const styleCluster = getThemeCluster(theme.replace('#', ''))
|
||||
if (styleCluster.length > 2) {
|
||||
const len = styleCluster.length
|
||||
const val = styleCluster[len - 2]
|
||||
return val
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebar-container {
|
||||
>>>li.el-menu-item.is-active {
|
||||
background-color: var(--active-bg) !important;
|
||||
}
|
||||
>>>li.el-submenu.is-active:not(&:hover){
|
||||
background-color: var(--active-bg) ;
|
||||
}
|
||||
|
||||
>>>li.el-submenu__title {
|
||||
&:hover {
|
||||
background-color: var(--left-menu-hovor) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* .is-active > .el-submenu__title {
|
||||
color: var(--theme) !important;
|
||||
} */
|
||||
}
|
||||
</style>
|
||||
|
@ -1,10 +1,14 @@
|
||||
<template>
|
||||
<div class="top-nav">
|
||||
<div class="top-nav" :style="{backgroundColor: topMenuColor, '--active-bg-color': topMenuActiveColor}">
|
||||
<div v-loading="!axiosFinished" class="log">
|
||||
<svg-icon v-if="!logoUrl && axiosFinished" icon-class="DataEase" custom-class="top-nav-logo-icon" />
|
||||
<img v-if="logoUrl && axiosFinished" :src="logoUrl" width="140" alt="" style="padding-top: 10px;">
|
||||
</div>
|
||||
<el-menu
|
||||
class="de-top-menu"
|
||||
:background-color="topMenuColor"
|
||||
:text-color="topMenuTextColor"
|
||||
:active-text-color="topMenuTextActiveColor"
|
||||
:default-active="activeMenu"
|
||||
mode="horizontal"
|
||||
:style="{'margin-left': '260px', 'position': 'absolute'}"
|
||||
@ -20,7 +24,7 @@
|
||||
</div>
|
||||
</el-menu>
|
||||
|
||||
<div class="right-menu">
|
||||
<div class="right-menu" :style=" {color: topMenuTextColor}">
|
||||
<template>
|
||||
|
||||
<notification class="right-menu-item hover-effect" />
|
||||
@ -33,7 +37,7 @@
|
||||
</template>
|
||||
|
||||
<el-dropdown class="top-dropdown" style="display: flex;align-items: center; width:100px;">
|
||||
<span class="el-dropdown-link" style="font-size: 14px;max-width: 80px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
<span :style=" {color: topMenuTextColor}" class="el-dropdown-link" style="font-size: 14px;max-width: 80px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
{{ name }}
|
||||
<i class="el-icon-arrow-down el-icon--right" />
|
||||
</span>
|
||||
@ -59,6 +63,7 @@
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<theme-picker v-show="false" ref="de-theme" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -69,16 +74,17 @@ import AppLink from './Sidebar/Link'
|
||||
import variables from '@/styles/variables.scss'
|
||||
import { isExternal } from '@/utils/validate'
|
||||
import Notification from '@/components/Notification'
|
||||
// import bus from '@/utils/bus'
|
||||
import bus from '@/utils/bus'
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
import { getSysUI } from '@/utils/auth'
|
||||
|
||||
import ThemePicker from '@/components/ThemePicker'
|
||||
export default {
|
||||
name: 'Topbar',
|
||||
components: {
|
||||
AppLink,
|
||||
Notification,
|
||||
LangSelect
|
||||
LangSelect,
|
||||
ThemePicker
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -92,6 +98,26 @@ export default {
|
||||
theme() {
|
||||
return this.$store.state.settings.theme
|
||||
},
|
||||
|
||||
topMenuColor() {
|
||||
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuColor'] && this.$store.getters.uiInfo['ui.topMenuColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuColor'].paramValue }
|
||||
return this.variables.topBarBg
|
||||
},
|
||||
topMenuActiveColor() {
|
||||
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuActiveColor'] && this.$store.getters.uiInfo['ui.topMenuActiveColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuActiveColor'].paramValue }
|
||||
return this.variables.topBarMenuActive
|
||||
},
|
||||
topMenuTextColor() {
|
||||
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuTextColor'] && this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue }
|
||||
return this.variables.topBarMenuText
|
||||
},
|
||||
topMenuTextActiveColor() {
|
||||
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuTextActiveColor'] && this.$store.getters.uiInfo['ui.topMenuTextActiveColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuTextActiveColor'].paramValue }
|
||||
return this.variables.topBarMenuTextActive
|
||||
},
|
||||
/* topMenuColor() {
|
||||
return this.$store.getters.uiInfo.topMenuColor
|
||||
}, */
|
||||
activeMenu() {
|
||||
const route = this.$route
|
||||
const { meta, path } = route
|
||||
@ -122,6 +148,11 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.initCurrentRoutes()
|
||||
bus.$on('set-theme-info', this.setThemeInfo)
|
||||
bus.$on('set-top-menu-info', this.setTopMenuInfo)
|
||||
bus.$on('set-top-menu-active-info', this.setTopMenuActiveInfo)
|
||||
bus.$on('set-top-text-info', this.setTopTextInfo)
|
||||
bus.$on('set-top-text-active-info', this.setTopTextActiveInfo)
|
||||
},
|
||||
created() {
|
||||
this.loadUiInfo()
|
||||
@ -230,6 +261,22 @@ export default {
|
||||
}
|
||||
this.axiosFinished = true
|
||||
})
|
||||
},
|
||||
setThemeInfo(val) {
|
||||
// console.log('切换的主题颜色是:' + val)
|
||||
this.$refs['de-theme'] && this.$refs['de-theme'].switch && this.$refs['de-theme'].switch(val)
|
||||
},
|
||||
setTopMenuInfo(val) {
|
||||
this.loadUiInfo()
|
||||
},
|
||||
setTopMenuActiveInfo(val) {
|
||||
this.loadUiInfo()
|
||||
},
|
||||
setTopTextInfo(val) {
|
||||
this.loadUiInfo()
|
||||
},
|
||||
setTopTextActiveInfo(val) {
|
||||
this.loadUiInfo()
|
||||
}
|
||||
|
||||
}
|
||||
@ -253,4 +300,11 @@ export default {
|
||||
vertical-align: text-bottom;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.de-top-menu {
|
||||
>>>li.is-active {
|
||||
// background-color: #0a7be0 !important;
|
||||
background-color: var(--active-bg-color) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// export { default as Navbar } from './Navbar'
|
||||
export { default as Sidebar } from './Sidebar'
|
||||
export { default as Settings } from './Settings'
|
||||
// export { default as Settings } from './Settings'
|
||||
export { default as AppMain } from './AppMain'
|
||||
export { default as Topbar } from './Topbar'
|
||||
export { default as Licbar } from './Licbar'
|
||||
|
@ -7,6 +7,7 @@ import { getToken } from '@/utils/auth' // get token from cookie
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import { buildMenus } from '@/api/system/menu'
|
||||
import { filterAsyncRouter } from '@/store/modules/permission'
|
||||
// import bus from './utils/bus'
|
||||
|
||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||
|
||||
@ -21,7 +22,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
|
||||
// determine whether the user has logged in
|
||||
const hasToken = getToken()
|
||||
|
||||
// bus.$emit('set-theme-info', store.state.settings.theme)
|
||||
if (hasToken) {
|
||||
if (to.path === '/login') {
|
||||
// if is logged in, redirect to the home page
|
||||
@ -76,7 +77,6 @@ export const loadMenus = (next, to) => {
|
||||
buildMenus().then(res => {
|
||||
const filterDatas = filterRouter(res.data)
|
||||
const asyncRouter = filterAsyncRouter(filterDatas)
|
||||
// addMsgMenu(asyncRouter)
|
||||
asyncRouter.push({ path: '*', redirect: '/404', hidden: true })
|
||||
store.dispatch('permission/GenerateRoutes', asyncRouter).then(() => { // 存储路由
|
||||
router.addRoutes(asyncRouter)
|
||||
@ -89,43 +89,6 @@ export const loadMenus = (next, to) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const addMsgMenu = asyncRouter => {
|
||||
const menu = {
|
||||
path: 'system-msg-web',
|
||||
component: () => import('@/views/msg/index'),
|
||||
name: 'sys-msg-web',
|
||||
meta: { title: '站内消息', icon: 'all-msg' },
|
||||
children: [
|
||||
{
|
||||
path: 'all',
|
||||
component: () => import('@/views/msg/all'),
|
||||
name: 'sys-msg-web-all',
|
||||
meta: { title: '所有消息', icon: 'web-msg' }
|
||||
},
|
||||
{
|
||||
path: 'unread',
|
||||
component: () => import('@/views/msg/unread'),
|
||||
name: 'sys-msg-web-unread',
|
||||
meta: { title: '未读消息', icon: 'unread-msg' }
|
||||
|
||||
},
|
||||
{
|
||||
path: 'readed',
|
||||
component: () => import('@/views/msg/readed'),
|
||||
name: 'sys-msg-web-readed',
|
||||
meta: { title: '已读消息', icon: 'readed-msg' }
|
||||
}
|
||||
]
|
||||
}
|
||||
asyncRouter.forEach(element => {
|
||||
if (element.name === 'system') {
|
||||
if (element.children) {
|
||||
element.children.splice(0, 0, menu)
|
||||
}
|
||||
// element.children.push(menu)
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 验证path是否有效
|
||||
* @param {*} path
|
||||
|
@ -71,9 +71,9 @@
|
||||
height: 100%;
|
||||
width: 100% !important;
|
||||
|
||||
.is-active {
|
||||
/* .is-active {
|
||||
background-color: $leftMenuActive;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
// menu hover
|
||||
@ -84,9 +84,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
.is-active > .el-submenu__title {
|
||||
/* .is-active > .el-submenu__title {
|
||||
color: $leftMenuTextActive !important;
|
||||
}
|
||||
} */
|
||||
|
||||
& .nest-menu .el-submenu > .el-submenu__title,
|
||||
& .el-submenu .el-menu-item {
|
||||
|
@ -18,7 +18,7 @@
|
||||
font-weight: bold;
|
||||
// color: rgb(191, 203, 217);
|
||||
// color: rgba(255, 255, 255, 0.87);
|
||||
color: $topBarBg;
|
||||
// color: $topBarBg;
|
||||
float: left;
|
||||
|
||||
img {
|
||||
@ -30,32 +30,27 @@
|
||||
.el-menu {
|
||||
float: left;
|
||||
border: none !important;
|
||||
// background-color: #304156;
|
||||
background-color: $topBarBg;
|
||||
|
||||
.nav-item {
|
||||
display: inline-block;
|
||||
|
||||
.el-menu-item:not(.is-active) {
|
||||
// color: rgb(191, 203, 217);
|
||||
color: $topBarMenuText;
|
||||
|
||||
&:hover {
|
||||
background-color: $topBarMenuHovor !important;
|
||||
// color: $subMenuActiveText !important;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
background-color: $topBarMenuHovor !important;
|
||||
color: $topBarMenuText !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.is-active {
|
||||
/* .is-active {
|
||||
background-color: $topBarMenuActive !important;
|
||||
color: $topBarMenuTextActive !important;
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +72,7 @@
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
// color: #5a5e66;
|
||||
color: #606266;
|
||||
// color: #606266;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
&.hover-effect {
|
||||
|
44
frontend/src/utils/style.js
Normal file
44
frontend/src/utils/style.js
Normal file
@ -0,0 +1,44 @@
|
||||
export function getThemeCluster(theme) {
|
||||
const tintColor = (color, tint) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
if (tint === 0) { // when primary color is in its rgb space
|
||||
return [red, green, blue].join(',')
|
||||
} else {
|
||||
red += Math.round(tint * (255 - red))
|
||||
green += Math.round(tint * (255 - green))
|
||||
blue += Math.round(tint * (255 - blue))
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
}
|
||||
|
||||
const shadeColor = (color, shade) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
red = Math.round((1 - shade) * red)
|
||||
green = Math.round((1 - shade) * green)
|
||||
blue = Math.round((1 - shade) * blue)
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
|
||||
const clusters = [theme]
|
||||
for (let i = 0; i <= 9; i++) {
|
||||
clusters.push(tintColor(theme, Number((i / 10).toFixed(2))))
|
||||
}
|
||||
clusters.push(shadeColor(theme, 0.1))
|
||||
return clusters
|
||||
}
|
@ -180,8 +180,8 @@ export default {
|
||||
|
||||
>>>.el-radio-button__orig-radio:checked+.el-radio-button__inner {
|
||||
color: #fff;
|
||||
background-color: #0a7be0;
|
||||
border-color: #0a7be0;
|
||||
// background-color: #0a7be0;
|
||||
// border-color: #0a7be0;
|
||||
-webkit-box-shadow: 0px 0 0 0 #0a7be0;
|
||||
box-shadow: 0px 0 0 0 #0a7be0;
|
||||
}
|
||||
|
@ -210,8 +210,8 @@ export default {
|
||||
|
||||
>>>.el-radio-button__orig-radio:checked+.el-radio-button__inner {
|
||||
color: #fff;
|
||||
background-color: #0a7be0;
|
||||
border-color: #0a7be0;
|
||||
/* background-color: #0a7be0;
|
||||
border-color: #0a7be0; */
|
||||
-webkit-box-shadow: 0px 0 0 0 #0a7be0;
|
||||
box-shadow: 0px 0 0 0 #0a7be0;
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ export default {
|
||||
|
||||
>>>.el-radio-button__orig-radio:checked+.el-radio-button__inner {
|
||||
color: #fff;
|
||||
background-color: #0a7be0;
|
||||
border-color: #0a7be0;
|
||||
/* background-color: #0a7be0;
|
||||
border-color: #0a7be0; */
|
||||
-webkit-box-shadow: 0px 0 0 0 #0a7be0;
|
||||
box-shadow: 0px 0 0 0 #0a7be0;
|
||||
}
|
||||
|
@ -25,10 +25,10 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.host')" prop="configuration.host">
|
||||
<el-input v-model="form.configuration.host" autocomplete="off" />
|
||||
<el-input v-model="form.configuration.host" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.data_base')" prop="configuration.dataBase">
|
||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type=='oracle'" :label="$t('datasource.oracle_connection_type')" prop="configuration.connectionType">
|
||||
@ -37,7 +37,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')" prop="configuration.username">
|
||||
<el-input v-model="form.configuration.username" autocomplete="off" />
|
||||
<el-input v-model="form.configuration.username" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.password')" prop="configuration.password">
|
||||
<el-input v-model="form.configuration.password" autocomplete="off" show-password />
|
||||
@ -52,7 +52,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg'" :label="$t('datasource.schema')">
|
||||
<el-select filterable v-model="form.configuration.schema" :placeholder="$t('datasource.please_choose_schema')" class="select-width">
|
||||
<el-select v-model="form.configuration.schema" filterable :placeholder="$t('datasource.please_choose_schema')" class="select-width">
|
||||
<el-option
|
||||
v-for="item in schemas"
|
||||
:key="item"
|
||||
@ -68,19 +68,19 @@
|
||||
<el-input v-model="form.configuration.initialPoolSize" autocomplete="off" type="number" min="0" size="small" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.min_pool_size')" prop="configuration.minPoolSize">
|
||||
<el-input v-model="form.configuration.minPoolSize" autocomplete="off" type="number" min="0"/>
|
||||
<el-input v-model="form.configuration.minPoolSize" autocomplete="off" type="number" min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.max_pool_size')" prop="configuration.maxPoolSize">
|
||||
<el-input v-model="form.configuration.maxPoolSize" autocomplete="off" type="number" min="0"/>
|
||||
<el-input v-model="form.configuration.maxPoolSize" autocomplete="off" type="number" min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.max_idle_time')" prop="configuration.maxIdleTime">
|
||||
<el-input v-model="form.configuration.maxIdleTime" autocomplete="off" type="number" min="0"/>
|
||||
<el-input v-model="form.configuration.maxIdleTime" autocomplete="off" type="number" min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.acquire_increment')" prop="configuration.acquireIncrement">
|
||||
<el-input v-model="form.configuration.acquireIncrement" autocomplete="off" type="number" min="0"/>
|
||||
<el-input v-model="form.configuration.acquireIncrement" autocomplete="off" type="number" min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.connect_timeout')" prop="configuration.connectTimeout">
|
||||
<el-input v-model="form.configuration.connectTimeout" autocomplete="off" type="number" min="0"/>
|
||||
<el-input v-model="form.configuration.connectTimeout" autocomplete="off" type="number" min="0" />
|
||||
</el-form-item>
|
||||
|
||||
</el-collapse-item>
|
||||
@ -144,9 +144,9 @@ export default {
|
||||
'configuration.connectTimeout': [{ required: true, message: this.$t('datasource.please_input_connect_timeout'), trigger: 'change' }]
|
||||
},
|
||||
allTypes: [{ name: 'mysql', label: 'MySQL', type: 'jdbc' },
|
||||
{ name: 'oracle', label: 'Oracle', type: 'jdbc' },
|
||||
{ name: 'sqlServer', label: 'SQL Server', type: 'jdbc' },
|
||||
{ name: 'pg', label: 'PostgreSQL', type: 'jdbc' }],
|
||||
{ name: 'oracle', label: 'Oracle', type: 'jdbc' },
|
||||
{ name: 'sqlServer', label: 'SQL Server', type: 'jdbc' },
|
||||
{ name: 'pg', label: 'PostgreSQL', type: 'jdbc' }],
|
||||
schemas: [],
|
||||
canEdit: false,
|
||||
originConfiguration: {}
|
||||
@ -202,8 +202,8 @@ export default {
|
||||
this.$message.error(this.$t('datasource.please_choose_schema'))
|
||||
return
|
||||
}
|
||||
if (this.form.configuration.initialPoolSize < 0 || this.form.configuration.minPoolSize < 0 || this.form.configuration.maxPoolSize < 0 || this.form.configuration.maxIdleTime < 0
|
||||
|| this.form.configuration.acquireIncrement < 0 || this.form.configuration.idleConnectionTestPeriod < 0 || this.form.configuration.connectTimeout < 0) {
|
||||
if (this.form.configuration.initialPoolSize < 0 || this.form.configuration.minPoolSize < 0 || this.form.configuration.maxPoolSize < 0 || this.form.configuration.maxIdleTime < 0 ||
|
||||
this.form.configuration.acquireIncrement < 0 || this.form.configuration.idleConnectionTestPeriod < 0 || this.form.configuration.connectTimeout < 0) {
|
||||
this.$message.error(this.$t('datasource.no_less_then_0'))
|
||||
return
|
||||
}
|
||||
@ -212,7 +212,7 @@ export default {
|
||||
const method = this.formType === 'add' ? addDs : editDs
|
||||
const form = JSON.parse(JSON.stringify(this.form))
|
||||
form.configuration = JSON.stringify(form.configuration)
|
||||
if(this.formType !== 'add' && this.originConfiguration !== form.configuration) {
|
||||
if (this.formType !== 'add' && this.originConfiguration !== form.configuration) {
|
||||
$confirm(this.$t('datasource.edit_datasource_msg'), () => {
|
||||
method(form).then(res => {
|
||||
this.$success(this.$t('commons.save_success'))
|
||||
@ -220,7 +220,7 @@ export default {
|
||||
this.backToList()
|
||||
})
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
method(form).then(res => {
|
||||
this.$success(this.$t('commons.save_success'))
|
||||
this.refreshTree()
|
||||
@ -255,23 +255,22 @@ export default {
|
||||
if (valid) {
|
||||
const data = JSON.parse(JSON.stringify(this.form))
|
||||
data.configuration = JSON.stringify(data.configuration)
|
||||
if(data.showModel === 'show' && !this.canEdit){
|
||||
if (data.showModel === 'show' && !this.canEdit) {
|
||||
validateDsById(data.id).then(res => {
|
||||
if(res.success){
|
||||
if (res.success) {
|
||||
this.$success(this.$t('datasource.validate_success'))
|
||||
}else {
|
||||
} else {
|
||||
this.$error(this.$t(res.message))
|
||||
}
|
||||
this.refreshTree()
|
||||
}).catch(res => {
|
||||
this.$error(res.message)
|
||||
})
|
||||
|
||||
}else {
|
||||
} else {
|
||||
validateDs(data).then(res => {
|
||||
if(res.success){
|
||||
if (res.success) {
|
||||
this.$success(this.$t('datasource.validate_success'))
|
||||
}else {
|
||||
} else {
|
||||
this.$error(this.$t(res.message))
|
||||
}
|
||||
}).catch(res => {
|
||||
@ -301,8 +300,6 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/styles/mixin.scss";
|
||||
@import "~@/styles/variables.scss";
|
||||
|
||||
.back-button {
|
||||
cursor: pointer;
|
||||
|
@ -18,7 +18,6 @@
|
||||
<el-table-column :show-overflow-tooltip="true" prop="nickName" sortable="custom" :label="$t('commons.nick_name')" />
|
||||
<el-table-column prop="gender" :label="$t('commons.gender')" width="60" />
|
||||
|
||||
<!-- <el-table-column :show-overflow-tooltip="true" prop="phone" :label="$t('commons.phone')" /> -->
|
||||
<el-table-column :show-overflow-tooltip="true" prop="email" :label="$t('commons.email')" />
|
||||
<el-table-column :show-overflow-tooltip="true" prop="dept" sortable="custom" :label="$t('commons.organization')">
|
||||
<template slot-scope="scope">
|
||||
@ -162,7 +161,6 @@
|
||||
<script>
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import ComplexTable from '@/components/business/complex-table'
|
||||
// import { checkPermission } from '@/utils/permission'
|
||||
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
|
||||
import { PHONE_REGEX } from '@/utils/validate'
|
||||
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
|
||||
@ -170,7 +168,6 @@ import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
import { userLists, addUser, editUser, delUser, editPassword, editStatus, allRoles } from '@/api/system/user'
|
||||
// import { allRoles } from '@/api/system/role'
|
||||
import { getDeptTree, treeByDeptId } from '@/api/system/dept'
|
||||
|
||||
export default {
|
||||
@ -192,10 +189,7 @@ export default {
|
||||
label: this.$t('member.edit_password'), icon: 'el-icon-s-tools', type: 'success', click: this.editPassword,
|
||||
show: this.checkPermission(['user:editPwd'])
|
||||
}
|
||||
// , {
|
||||
// label: '权限查看', icon: 'el-icon-lock', type: 'warning', click: this.showAuth,
|
||||
// show: this.checkPermission(['user:editPwd'])
|
||||
// }
|
||||
|
||||
],
|
||||
searchConfig: {
|
||||
useQuickSearch: true,
|
||||
@ -307,7 +301,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.form = Object.assign({}, this.defaultForm);
|
||||
this.allRoles()
|
||||
this.search()
|
||||
},
|
||||
@ -347,28 +340,14 @@ export default {
|
||||
create() {
|
||||
this.$router.push({ name: 'system-user-form' })
|
||||
},
|
||||
// create() {
|
||||
// this.depts = null
|
||||
// this.formType = 'add'
|
||||
// this.form = Object.assign({}, this.defaultForm)
|
||||
// this.dialogVisible = true
|
||||
// },
|
||||
|
||||
edit(row) {
|
||||
this.$router.push({ name: 'system-user-form', params: row })
|
||||
},
|
||||
showAuth(row) {
|
||||
this.$router.push({ name: 'system-user-form', params: row })
|
||||
},
|
||||
// edit(row) {
|
||||
// this.depts = null
|
||||
// this.formType = 'modify'
|
||||
// this.dialogVisible = true
|
||||
// this.form = Object.assign({}, row)
|
||||
// if (this.form.deptId === 0) {
|
||||
// this.form.deptId = null
|
||||
// }
|
||||
// this.initDeptTree()
|
||||
// },
|
||||
|
||||
editPassword(row) {
|
||||
this.editPasswordVisible = true
|
||||
const tempForm = Object.assign({}, row)
|
||||
|
Loading…
Reference in New Issue
Block a user