diff --git a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java index 8fd47d8dc0..bcc25df6f9 100644 --- a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java +++ b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java @@ -39,6 +39,11 @@ public class SystemParameterController { return SystemParameterService.getVersion(); } + @GetMapping("/theme") + public String getTheme() { + return SystemParameterService.getValue("ui.theme"); + } + @GetMapping("/mail/info") @RequiresRoles(value = {RoleConstants.ADMIN}) public MailInfo mailInfo() { diff --git a/frontend/src/business/App.vue b/frontend/src/business/App.vue index d547ff19dd..76368547c8 100644 --- a/frontend/src/business/App.vue +++ b/frontend/src/business/App.vue @@ -8,18 +8,20 @@ - + - - + + + + @@ -29,12 +31,14 @@ import MsView from "./components/common/router/View"; import MsUser from "./components/common/head/HeaderUser"; import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs"; import MsLanguageSwitch from "./components/common/head/LanguageSwitch"; -import {saveLocalStorage} from "@/common/js/utils"; +import {hasLicense, saveLocalStorage, setColor, setOriginColor} from "@/common/js/utils"; import {registerRequestHeaders} from "@/common/js/ajax"; +import {ORIGIN_COLOR} from "@/common/js/constants"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {}; const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {}; +const theme = requireComponent.keys().length > 0 ? requireComponent("./display/Theme.vue") : {}; export default { name: 'app', @@ -45,16 +49,27 @@ export default { auth: false, header: {}, logoId: '_blank', + color: '' } }, created() { + registerRequestHeaders(); + if (!hasLicense()) { + setOriginColor() + this.color = ORIGIN_COLOR; + } else { + // + this.$get('/system/theme', res => { + this.color = res.data ? res.data : ORIGIN_COLOR; + setColor(this.color, this.color, this.color, this.color); + }) + } if (localStorage.getItem("store")) { this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(localStorage.getItem("store")))) } window.addEventListener("beforeunload", () => { localStorage.setItem("store", JSON.stringify(this.$store.state)) }) - registerRequestHeaders(); }, beforeCreate() { this.$get("/isLogin").then(response => { @@ -83,7 +98,8 @@ export default { MsView, MsTopMenus, MsHeaderOrgWs, - "LicenseMessage": header.default + "LicenseMessage": header.default, + "Theme": theme.default } } @@ -93,7 +109,7 @@ export default { #header-top { width: 100%; padding: 0 10px; - background-color: rgb(44, 42, 72); + background-color: var(--color); color: rgb(245, 245, 245); font-size: 14px; height: 40px; diff --git a/frontend/src/business/components/api/definition/components/list/ApiListContainerWithDoc.vue b/frontend/src/business/components/api/definition/components/list/ApiListContainerWithDoc.vue index 53dcb75a05..f3544bbe7c 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiListContainerWithDoc.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiListContainerWithDoc.vue @@ -74,16 +74,16 @@ export default { .active { border: solid 1px #6d317c; - background-color: #7C3985; + background-color: var(--color); color: #FFFFFF; } .case-button { - border-left: solid 1px #6d317c; + border-left: solid 1px var(--color); } .item{ - border: solid 1px #6d317c; + border: solid 1px var(--color); } diff --git a/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue b/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue index 5785c09907..a1988d2a19 100644 --- a/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue +++ b/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue @@ -147,7 +147,7 @@ export default { .count-number{ font-family:'ArialMT', 'Arial', sans-serif; font-size:33px; - color: #6C317C; + color: var(--count_number); } .main-number-show { @@ -155,7 +155,7 @@ export default { height: 100px; border-style: solid; border-width: 7px; - border-color: #CDB9D2; + border-color: var(--count_number_shallow); border-radius:50%; } diff --git a/frontend/src/business/components/api/homepage/components/SceneInfoCard.vue b/frontend/src/business/components/api/homepage/components/SceneInfoCard.vue index 0f5a5db41f..e048e5c050 100644 --- a/frontend/src/business/components/api/homepage/components/SceneInfoCard.vue +++ b/frontend/src/business/components/api/homepage/components/SceneInfoCard.vue @@ -137,7 +137,7 @@ export default { .count-number{ font-family:'ArialMT', 'Arial', sans-serif; font-size:33px; - color: #6C317C; + color: var(--count_number); margin:20px auto; } @@ -146,7 +146,7 @@ export default { height: 100px; border-style: solid; border-width: 7px; - border-color: #CDB9D2; + border-color: var(--count_number_shallow); border-radius:50%; } diff --git a/frontend/src/business/components/api/homepage/components/ScheduleTaskInfoCard.vue b/frontend/src/business/components/api/homepage/components/ScheduleTaskInfoCard.vue index 6f9d952ab6..158d819c6b 100644 --- a/frontend/src/business/components/api/homepage/components/ScheduleTaskInfoCard.vue +++ b/frontend/src/business/components/api/homepage/components/ScheduleTaskInfoCard.vue @@ -124,7 +124,7 @@ export default { .count-number{ font-family:'ArialMT', 'Arial', sans-serif; font-size:33px; - color: #6C317C; + color: var(--count_number); } .main-number-show { @@ -132,7 +132,7 @@ export default { height: 100px; border-style: solid; border-width: 7px; - border-color: #CDB9D2; + border-color: var(--count_number_shallow); border-radius:50%; } diff --git a/frontend/src/business/components/api/homepage/components/TestCaseInfoCard.vue b/frontend/src/business/components/api/homepage/components/TestCaseInfoCard.vue index 51c80c0f69..7e61bfbde7 100644 --- a/frontend/src/business/components/api/homepage/components/TestCaseInfoCard.vue +++ b/frontend/src/business/components/api/homepage/components/TestCaseInfoCard.vue @@ -173,7 +173,7 @@ export default { .count-number{ font-family:'ArialMT', 'Arial', sans-serif; font-size:33px; - color: #6C317C; + color: var(--count_number); } .main-number-show { @@ -181,7 +181,7 @@ export default { height: 100px; border-style: solid; border-width: 7px; - border-color: #CDB9D2; + border-color: var(--count_number_shallow); border-radius:50%; } diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index 7a88e5947c..afb0f29954 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -1,7 +1,7 @@