fix: 主题色修改

This commit is contained in:
shiziyuan9527 2021-03-15 15:26:56 +08:00
parent 4243cfdf7b
commit 82d7be618c
8 changed files with 50 additions and 37 deletions

View File

@ -541,6 +541,11 @@
<include name="*.html"/> <include name="*.html"/>
</fileset> </fileset>
</move> </move>
<copy todir="src/main/resources/static/css">
<fileset dir="../frontend/src/assets/theme">
<include name="index.css"/>
</fileset>
</copy>
</target> </target>
</configuration> </configuration>
<goals> <goals>

View File

@ -42,6 +42,8 @@ public class ShiroUtils {
//api-对外文档页面提供的查询接口 //api-对外文档页面提供的查询接口
filterChainDefinitionMap.put("/api/document/**", "anon"); filterChainDefinitionMap.put("/api/document/**", "anon");
// filterChainDefinitionMap.put("/document/**", "anon"); // filterChainDefinitionMap.put("/document/**", "anon");
filterChainDefinitionMap.put("/system/theme", "anon");
} }
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) { public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {

View File

@ -31,7 +31,7 @@ import MsView from "./components/common/router/View";
import MsUser from "./components/common/head/HeaderUser"; import MsUser from "./components/common/head/HeaderUser";
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs"; import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
import MsLanguageSwitch from "./components/common/head/LanguageSwitch"; import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
import {hasLicense, saveLocalStorage, setColor, setOriginColor} from "@/common/js/utils"; import {hasLicense, saveLocalStorage, setColor, setDefaultTheme} from "@/common/js/utils";
import {registerRequestHeaders} from "@/common/js/ajax"; import {registerRequestHeaders} from "@/common/js/ajax";
import {ORIGIN_COLOR} from "@/common/js/constants"; import {ORIGIN_COLOR} from "@/common/js/constants";
@ -55,13 +55,13 @@ export default {
created() { created() {
registerRequestHeaders(); registerRequestHeaders();
if (!hasLicense()) { if (!hasLicense()) {
setOriginColor() setDefaultTheme();
this.color = ORIGIN_COLOR; this.color = ORIGIN_COLOR;
} else { } else {
// //
this.$get('/system/theme', res => { this.$get('/system/theme', res => {
this.color = res.data ? res.data : ORIGIN_COLOR; this.color = res.data ? res.data : ORIGIN_COLOR;
setColor(this.color, this.color, this.color, this.color); setColor(this.color, this.color, this.color, this.color, this.color);
this.$store.commit('setTheme', res.data); this.$store.commit('setTheme', res.data);
}) })
} }

@ -1 +1 @@
Subproject commit 4c33b9c3b12a83da6d9bd2740262c6c8baaab819 Subproject commit b2571e06e8b211821409115cc2c4a7c52cbac1db

View File

@ -17,6 +17,7 @@ body {
/*--color: #2c2a48;*/ /*--color: #2c2a48;*/
/*--color_shallow: #595591;*/ /*--color_shallow: #595591;*/
--color: ''; --color: '';
--primary_color: '';
--color_shallow: ''; --color_shallow: '';
--count_number: ''; --count_number: '';
--count_number_shallow: ''; --count_number_shallow: '';

View File

@ -173,3 +173,4 @@ export const ORIGIN_COLOR = '#2c2a48';
export const ORIGIN_COLOR_SHALLOW = '#595591'; export const ORIGIN_COLOR_SHALLOW = '#595591';
export const COUNT_NUMBER = '#6C317C'; export const COUNT_NUMBER = '#6C317C';
export const COUNT_NUMBER_SHALLOW = '#CDB9D2'; export const COUNT_NUMBER_SHALLOW = '#CDB9D2';
export const PRIMARY_COLOR = '#783887';

View File

@ -1,17 +1,17 @@
import { import {
COUNT_NUMBER, COUNT_NUMBER,
COUNT_NUMBER_SHALLOW, COUNT_NUMBER_SHALLOW,
LicenseKey, LicenseKey,
ORIGIN_COLOR, ORIGIN_COLOR,
ORIGIN_COLOR_SHALLOW, ORIGIN_COLOR_SHALLOW, PRIMARY_COLOR,
PROJECT_ID, PROJECT_ID,
REFRESH_SESSION_USER_URL, REFRESH_SESSION_USER_URL,
ROLE_ADMIN, ROLE_ADMIN,
ROLE_ORG_ADMIN, ROLE_ORG_ADMIN,
ROLE_TEST_MANAGER, ROLE_TEST_MANAGER,
ROLE_TEST_USER, ROLE_TEST_USER,
ROLE_TEST_VIEWER, ROLE_TEST_VIEWER,
TokenKey TokenKey
} from "./constants"; } from "./constants";
import axios from "axios"; import axios from "axios";
import {jsPDF} from "jspdf"; import {jsPDF} from "jspdf";
@ -354,19 +354,19 @@ export function objToStrMap(obj) {
return strMap; return strMap;
} }
export function getColor() { export function setColor(a, b, c, d, e) {
return localStorage.getItem('color'); // 顶部菜单背景色
}
export function setColor(a, b, c, d) {
document.body.style.setProperty('--color', a); document.body.style.setProperty('--color', a);
document.body.style.setProperty('--color_shallow', b); document.body.style.setProperty('--color_shallow', b);
// 首页颜色
document.body.style.setProperty('--count_number', c); document.body.style.setProperty('--count_number', c);
document.body.style.setProperty('--count_number_shallow', d); document.body.style.setProperty('--count_number_shallow', d);
// 主颜色
document.body.style.setProperty('--primary_color', e);
} }
export function setOriginColor() { export function setDefaultTheme() {
setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW); setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW, PRIMARY_COLOR);
} }
export function publicKeyEncrypt(input, publicKey) { export function publicKeyEncrypt(input, publicKey) {

View File

@ -56,7 +56,7 @@
<script> <script>
import {publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils'; import {publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
import {DEFAULT_LANGUAGE} from "@/common/js/constants"; import {DEFAULT_LANGUAGE, PRIMARY_COLOR} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {}; const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
@ -91,6 +91,10 @@ export default {
} }
}, },
beforeCreate() { beforeCreate() {
this.$get('/system/theme', res => {
this.color = res.data ? res.data : PRIMARY_COLOR;
document.body.style.setProperty('--primary_color', this.color);
})
this.result = this.$get("/isLogin").then(response => { this.result = this.$get("/isLogin").then(response => {
if (display.default !== undefined) { if (display.default !== undefined) {
@ -230,7 +234,7 @@ export default {
margin-top: 12px; margin-top: 12px;
margin-bottom: 75px; margin-bottom: 75px;
font-size: 14px; font-size: 14px;
color: #843697; color: var(--primary_color);
line-height: 14px; line-height: 14px;
text-align: center; text-align: center;
} }
@ -243,18 +247,18 @@ export default {
.btn > .submit { .btn > .submit {
border-radius: 70px; border-radius: 70px;
border-color: #8B479B; border-color: var(--primary_color);
background-color: #8B479B; background-color: var(--primary_color);
} }
.btn > .submit:hover { .btn > .submit:hover {
border-color: rgba(139, 71, 155, 0.9); border-color: var(--primary_color);
background-color: rgba(139, 71, 155, 0.9); background-color: var(--primary_color);
} }
.btn > .submit:active { .btn > .submit:active {
border-color: rgba(139, 71, 155, 0.8); border-color: var(--primary_color);
background-color: rgba(139, 71, 155, 0.8); background-color: var(--primary_color);
} }
.el-form-item:first-child { .el-form-item:first-child {
@ -262,13 +266,13 @@ export default {
} }
/deep/ .el-radio__input.is-checked .el-radio__inner { /deep/ .el-radio__input.is-checked .el-radio__inner {
background-color: #783887; background-color: var(--primary_color);
background: #783887; background: var(--primary_color);
border-color: #783887; border-color: var(--primary_color);
} }
/deep/ .el-radio__input.is-checked + .el-radio__label { /deep/ .el-radio__input.is-checked + .el-radio__label {
color: #783887; color: var(--primary_color);
} }
/deep/ .el-input__inner { /deep/ .el-input__inner {
@ -284,7 +288,7 @@ export default {
} }
/deep/ .el-input__inner:focus { /deep/ .el-input__inner:focus {
border: 1px solid #783887 !important; border: 1px solid var(--primary_color) !important;
} }
.divider { .divider {