style(系统设置): 样式调整,给默认开源版设置系统主题

This commit is contained in:
fit2-zhao 2022-07-05 09:56:36 +08:00 committed by fit2-zhao
parent 862f6ca5f6
commit 0eebb5289a
1 changed files with 16 additions and 11 deletions

View File

@ -86,6 +86,7 @@ export default {
this.initSessionTimer(); this.initSessionTimer();
if (!hasLicense()) { if (!hasLicense()) {
setDefaultTheme(); setDefaultTheme();
setCustomizeColor();
this.color = ORIGIN_COLOR; this.color = ORIGIN_COLOR;
} else { } else {
this.$get('/system/theme', res => { this.$get('/system/theme', res => {
@ -93,7 +94,7 @@ export default {
setColor(this.color, 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);
}); });
this.query(); this.getDisplayInfo();
} }
// OIDC redirect // OIDC redirect
if (window.location.href.endsWith('#/refresh')) { if (window.location.href.endsWith('#/refresh')) {
@ -147,25 +148,29 @@ export default {
}; };
}, },
methods: { methods: {
query() { getDisplayInfo() {
this.result = this.$get("/display/info", response => { this.result = this.$get("/display/info", response => {
let theme = ""; let theme = "";
if (response.data && response.data[5] && response.data[5].paramValue) { if (response.data && response.data[5] && response.data[5].paramValue) {
theme = response.data[5].paramValue; theme = response.data[5].paramValue;
} }
if (response.data && response.data[7] && response.data[7].paramValue) { if (response.data && response.data[7] && response.data[7].paramValue) {
this.setAsideTheme(response.data[7].paramValue, theme); this.sideTheme = response.data[7].paramValue;
} }
this.setAsideTheme(theme);
}) })
}, },
setAsideTheme(sideTheme, theme) { setAsideTheme(theme) {
this.sideTheme = sideTheme; switch (this.sideTheme) {
if (sideTheme === "theme-light") { case "theme-light":
setLightColor(); setLightColor();
} else if (sideTheme === "theme-default") { break;
setAsideColor(); case "theme-default":
} else { setAsideColor();
setCustomizeColor(theme); break;
default:
setCustomizeColor(theme);
break;
} }
}, },
fixedChange(isFixed) { fixedChange(isFixed) {