Skip to content

Commit ff371fd

Browse files
committed
更新themeColor
1 parent e386103 commit ff371fd

File tree

11 files changed

+71
-54
lines changed

11 files changed

+71
-54
lines changed

build/utils.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ exports.styleLoaders = function (options) {
6565

6666
const result = [
6767
getCssRule('css', false),
68-
getCssRule('postcss', false),
68+
//getCssRule('postcss', false),
6969
getCssRule('less', 'less'),
7070
getCssRule('sass', 'sass', { implementation: require('sass'), indentedSyntax: true }),
7171
getCssRule('scss', 'sass', { implementation: require('sass') }),
@@ -75,11 +75,3 @@ exports.styleLoaders = function (options) {
7575
return result;
7676
}
7777

78-
function getPostCssLoader(sourceMap) {
79-
return {
80-
loader: 'postcss-loader',
81-
options: {
82-
sourceMap: sourceMap
83-
}
84-
}
85-
}

build/webpack.base.conf.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const webpack = require('webpack')
66
const { VueLoaderPlugin } = require('vue-loader');
77
const appConfig = require('../config/app-config')
88
const ThemeColorReplacer = require('webpack-theme-color-replacer')
9-
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
9+
const themeUtil = require('webpack-theme-color-replacer/themeUtil')
1010
const JoinFileContentPlugin = require('join-file-content-plugin')
1111

1212
function resolve(dir) {
@@ -98,9 +98,8 @@ module.exports = {
9898
new ThemeColorReplacer({
9999
fileName: 'css/theme-colors.[contenthash:8].css',
100100

101-
matchColors: appConfig.getThemeColors(appConfig.themeColor, forElementUI.getElementUISeries, ThemeColorReplacer.varyColor
102-
, ['#0cdd3a', '#c655dd']),
103-
changeSelector: forElementUI.changeSelector,
101+
matchColors: themeUtil.getMyColors(appConfig.themeColor, ['#0cdd3a', '#c655dd']),
102+
changeSelector: themeUtil.changeSelector,
104103
isJsUgly: config.isBuild,
105104
// injectCss: false,
106105
// resolveCss(resultCss) { // optional. Resolve result css code as you wish.

config/app-config.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1+
12
module.exports = {
23
LOGIN_PATH: './',
34
title: 'vue + webpack4 + element-ui脚手架项目',
45
description: 'vue + webpack4 + element-ui脚手架项目',
56

6-
themeColor: '#f67a17',
7-
getThemeColors: function (color, getElementUISeries, varyColor, others) {
8-
var colors = getElementUISeries(color);//element-ui主色系列
9-
colors.push(
10-
varyColor.mix('#000', color, 0.1),
11-
varyColor.mix('#000', color, 0.2),
12-
varyColor.mix('#000', color, 0.7)
13-
);
14-
colors.push.apply(colors, others)
15-
return colors
16-
}
7+
themeColor: '#f67a17'
178
}

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"cross-spawn": "^7.0.3",
5757
"css-loader": "^5.1.1",
5858
"css-minimizer-webpack-plugin": "^1.2.0",
59-
"dynamic-mocker": "^1.2.14",
59+
"dynamic-mocker": "^1.2.16",
6060
"eslint": "^7.21.0",
6161
"eslint-config-standard": "^16.0.2",
6262
"eslint-friendly-formatter": "4.0.1",
@@ -70,13 +70,13 @@
7070
"file-loader": "^6.2.0",
7171
"hard-source-webpack-plugin": "^0.13.1",
7272
"html-webpack-plugin": "^5.2.0",
73-
"join-file-content-plugin": "latest",
74-
"js-conditional-compile-loader": "latest",
73+
"join-file-content-plugin": "^1.0.3",
74+
"js-conditional-compile-loader": "^1.0.14",
7575
"mini-css-extract-plugin": "^1.3.9",
7676
"opn": "^6.0.0",
7777
"ora": "^5.3.0",
78-
"postcss-loader": "^5.0.0",
79-
"postcss-pxtorem": "^5.1.1",
78+
"postcss-loader": "^5.3.0",
79+
"postcss-pxtorem": "5.1.1",
8080
"rimraf": "^3.0.2",
8181
"sass": "^1.32.8",
8282
"sass-loader": "^11.0.1",
@@ -90,9 +90,9 @@
9090
"webpack-dev-middleware": "^4.1.0",
9191
"webpack-dev-server": "^3.11.2",
9292
"webpack-hot-middleware": "^2.25.0",
93-
"webpack-iconfont-plugin-nodejs": "^1.0.18",
93+
"webpack-iconfont-plugin-nodejs": "^1.0.19",
9494
"webpack-merge": "^5.7.3",
95-
"webpack-theme-color-replacer": "^1.3.20"
95+
"webpack-theme-color-replacer": "^1.3.26"
9696
},
9797
"engines": {
9898
"node": ">= 4.0.0",

src/component/leftMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ul class="flex-column white-bg lft-menu">
2+
<ul class="f-column white-bg lft-menu">
33
<li v-for="(menu, index) in leftMenus" :index="String(index)" :key="menu.url"
44
@click="clickMenu(menu,index)" :class="{active: index===curIndex}" class="pointer ellipsis">
55
<i :class="menu.icon"></i>

src/component/topHeader.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<aside class="logo h100 left f-middle">
44
<img src="../images/logo.jpg"/>
55
</aside>
6-
<aside v-if="userInfo" class="flex-center pd-10 right">
6+
<aside v-if="userInfo" class="f-center pd-10 right">
77
<el-avatar icon="el-icon-user-solid" size="small"></el-avatar>
88
<el-dropdown>
99
<span class="pointer el-dropdown-link"
@@ -19,8 +19,8 @@
1919
&emsp;
2020
<a class="el-icon-switch-button" @click="logOut"></a>
2121
</aside>
22-
<div class="h100 flex-center t-menus">
23-
<nav class="h100 pointer flex-center"
22+
<div class="h100 f-center t-menus">
23+
<nav class="h100 pointer f-center"
2424
v-for="(menu, index) in topMenus" :index="String(index)" :key="index"
2525
:class="{active: curIndex==index}" @click="clickMenu(index)">
2626
<i v-if="menu.icon" class="menu.icon"></i>

src/css/utils.scss

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ body, input, select, textarea, button {
9494
}
9595

9696
.radius {
97-
border-radius: 4px;
97+
border-radius: 5px;
9898
}
9999

100100
.pointer, .pointer * {
@@ -154,13 +154,17 @@ body, input, select, textarea, button {
154154
justify-content: center;
155155
}
156156

157-
.flex-center {
157+
.f-wrap {
158+
flex-wrap: wrap;
159+
}
160+
161+
.f-center {
158162
display: flex;
159163
align-items: center;
160164
justify-content: center;
161165
}
162166

163-
.flex-column {
167+
.f-column {
164168
display: flex;
165169
flex-direction: column;
166170
}
@@ -271,3 +275,34 @@ table {
271275
flex-basis: 51%;
272276
}
273277
}
278+
279+
280+
//常用的10px 20px间距和空白
281+
$areas: (t: top, r: right, b: bottom, l: left);
282+
$sizes: 20 10;
283+
@each $size in $sizes {
284+
.pd-#{$size} {
285+
padding: #{$size}px;
286+
}
287+
.mg-#{$size} {
288+
margin: #{$size}px;
289+
}
290+
}
291+
292+
@each $size in $sizes {
293+
@each $key, $area in $areas {
294+
.pd#{$key}-#{$size} {
295+
padding-#{$area}: #{$size}px;
296+
}
297+
.mg#{$key}-#{$size} {
298+
margin-#{$area}: #{$size}px;
299+
}
300+
}
301+
}
302+
303+
//0间距
304+
@each $key, $area in $areas {
305+
.pd#{$key}-0 {
306+
padding-#{$area}: 0;
307+
}
308+
}

src/js/themeColorClient.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import client from 'webpack-theme-color-replacer/client'
2-
import getElementUISeries from 'webpack-theme-color-replacer/forElementUI/getElementUISeries'
2+
import themeUtil from 'webpack-theme-color-replacer/themeUtil'
33

44
import appConfig from '../../config/app-config.js'
55

@@ -10,7 +10,7 @@ export function changeThemeColor(newColor) {
1010
var customB = parseInt(Math.random() * 256).toString(16); // 按你需要生成颜色
1111
if (customB.length == 1) customB = '0' + customB
1212
const options = {
13-
newColors: appConfig.getThemeColors(newColor, getElementUISeries, client.varyColor, ['#88' + customB + customB, '#' + customB + '88' + customB]),
13+
newColors: themeUtil.getMyColors(newColor, ['#88' + customB + customB, '#' + customB + '88' + customB]),
1414
}
1515
return client.changer.changeColor(options, Promise)
1616
.then(t => {

src/views/home/404.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="flex-center flex-column" style="height: 300px">
2+
<div class="f-center f-column" style="height: 300px">
33
<h3>页面正在开发中~</h3>
44
<div><a href="#/">点击返回</a></div>
55
</div>

0 commit comments

Comments
 (0)