Skip to content

Commit f3aefe5

Browse files
committed
refine theme color
1 parent a80999e commit f3aefe5

File tree

5 files changed

+41
-17
lines changed

5 files changed

+41
-17
lines changed

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Cookies from 'js-cookie'
55
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
66

77
import Element from 'element-ui'
8-
import 'element-ui/lib/theme-chalk/index.css'
8+
import './styles/element-variables.scss'
99

1010
import '@/styles/index.scss' // global css
1111

src/store/modules/permission.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { asyncRouterMap, constantRouterMap } from '@/router'
1+
import { asyncRoutes, constantRoutes } from '@/router'
22

33
/**
44
* 通过meta.role判断是否与当前用户权限匹配
@@ -15,17 +15,17 @@ function hasPermission(roles, route) {
1515

1616
/**
1717
* 递归过滤异步路由表,返回符合用户角色权限的路由表
18-
* @param routes asyncRouterMap
18+
* @param routes asyncRoutes
1919
* @param roles
2020
*/
21-
function filterAsyncRouter(routes, roles) {
21+
export function filterAsyncRoutes(routes, roles) {
2222
const res = []
2323

2424
routes.forEach(route => {
2525
const tmp = { ...route }
2626
if (hasPermission(roles, tmp)) {
2727
if (tmp.children) {
28-
tmp.children = filterAsyncRouter(tmp.children, roles)
28+
tmp.children = filterAsyncRoutes(tmp.children, roles)
2929
}
3030
res.push(tmp)
3131
}
@@ -36,27 +36,27 @@ function filterAsyncRouter(routes, roles) {
3636

3737
const permission = {
3838
state: {
39-
routers: [],
40-
addRouters: []
39+
routes: [],
40+
addRoutes: []
4141
},
4242
mutations: {
43-
SET_ROUTERS: (state, routers) => {
44-
state.addRouters = routers
45-
state.routers = constantRouterMap.concat(routers)
43+
SET_ROUTES: (state, routes) => {
44+
state.addRoutes = routes
45+
state.routes = constantRoutes.concat(routes)
4646
}
4747
},
4848
actions: {
4949
GenerateRoutes({ commit }, data) {
5050
return new Promise(resolve => {
5151
const { roles } = data
52-
let accessedRouters
52+
let accessedRoutes
5353
if (roles.includes('admin')) {
54-
accessedRouters = asyncRouterMap
54+
accessedRoutes = asyncRoutes
5555
} else {
56-
accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
56+
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
5757
}
58-
commit('SET_ROUTERS', accessedRouters)
59-
resolve()
58+
commit('SET_ROUTES', accessedRoutes)
59+
resolve(accessedRoutes)
6060
})
6161
}
6262
}

src/styles/element-variables.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* I think element-ui's default theme color is too light for long-term use.
3+
* So I modified the default color and you can modify it to your liking.
4+
**/
5+
6+
/* theme color */
7+
$--color-primary: #1890ff;
8+
$--color-success: #13ce66;
9+
$--color-warning: #FFBA00;
10+
$--color-danger: #ff4949;
11+
// $--color-info: #1E1E1E;
12+
13+
$--button-font-weight: 400;
14+
15+
// $--color-text-regular: #1f2d3d;
16+
17+
$--border-color-light: #dfe4ed;
18+
$--border-color-lighter: #e6ebf5;
19+
20+
$--table-border:1px solid#dfe6ec;
21+
22+
/* icon font path, required */
23+
$--font-path: '~element-ui/lib/theme-chalk/fonts';
24+
25+
@import "~element-ui/packages/theme-chalk/src/index";

src/views/table/complexTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
style="width: 100%;"
3636
@sort-change="sortChange"
3737
>
38-
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="65">
38+
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="80">
3939
<template slot-scope="scope">
4040
<span>{{ scope.row.id }}</span>
4141
</template>

vue.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ module.exports = {
5555
// import ES2015 module from common.js module
5656
const { default: mocks } = require('./mock')
5757
for (const mock of mocks) {
58-
console.log(mock, mock.response)
5958
app.all(mock.route, mock.response)
6059
}
6160
}

0 commit comments

Comments
 (0)