perf: 优化深色模式

This commit is contained in:
kuaifan 2023-07-25 14:12:51 +08:00
parent c5f7073cc1
commit 40b52d8f3b
6 changed files with 27 additions and 23 deletions

View File

@ -26,7 +26,7 @@
"css-loader": "^6.7.2",
"dexie": "^3.2.3",
"echarts": "^5.2.2",
"element-sea": "^2.15.10-4",
"element-sea": "^2.15.10-5",
"file-loader": "^6.2.0",
"highlight.js": "^11.7.0",
"inquirer": "^8.2.0",

View File

@ -161,6 +161,7 @@ export default {
windowActive(active) {
if (active) {
this.autoTheme()
this.__windowTimer && clearTimeout(this.__windowTimer)
this.__windowTimer = setTimeout(_ => {
this.$store.dispatch("call", {
@ -174,9 +175,6 @@ export default {
}).catch(_ => {
this.$store.dispatch("websocketConnection")
})
if (this.themeMode === "auto") {
this.$store.dispatch("synchTheme")
}
}, 600)
} else {
this.$store.dispatch("audioStop", true)
@ -221,6 +219,12 @@ export default {
});
},
autoTheme() {
if (this.themeMode === "auto") {
this.$store.dispatch("synchTheme")
}
},
synchThemeLanguage() {
if (this.isSoftware) {
this.iframes = this.iframes.filter(({key}) => key != 'synchThemeLanguage')
@ -298,9 +302,7 @@ export default {
}
// APP
window.__onAppActive = () => {
if (this.themeMode === "auto") {
this.$store.dispatch("synchTheme")
}
this.autoTheme()
}
//
window.__onPagePause = () => {
@ -312,6 +314,8 @@ export default {
this.$store.state.windowActive = true;
if (num > 0) {
this.$store.dispatch("getBasicData", 600)
} else {
this.autoTheme()
}
}
//

View File

@ -83,6 +83,11 @@
}
});
},
eeuiAppGetThemeName() {
if (!$A.isEEUiApp) return;
return requireModuleJs("eeui").getThemeName();
},
});
window.$A = $;

View File

@ -1152,19 +1152,11 @@
},
defaultFilter() {
if (this.supportMode() === 'chrome') {
return '-webkit-filter: url(#dark-mode-filter) !important; filter: url(#dark-mode-filter) !important;';
} else if (this.supportMode() === 'webkit') {
return '-webkit-filter: invert(0.92) hue-rotate(180deg) !important; filter: invert(0.92) hue-rotate(180deg) !important;';
}
return '-webkit-filter: invert(0.92) hue-rotate(180deg) !important; filter: invert(0.92) hue-rotate(180deg) !important;';
},
reverseFilter() {
if (this.supportMode() === 'chrome') {
return '-webkit-filter: url(#dark-mode-reverse-filter) !important; filter: url(#dark-mode-reverse-filter) !important;';
} else if (this.supportMode() === 'webkit') {
return '-webkit-filter: invert(0.92) hue-rotate(180deg) !important; filter: invert(0.92) hue-rotate(180deg) !important;';
}
return '-webkit-filter: invert(0.92) hue-rotate(180deg) !important; filter: invert(0.92) hue-rotate(180deg) !important;';
},
noneFilter() {
@ -1322,6 +1314,9 @@
autoDarkMode() {
let darkScheme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
if ($A.isEEUiApp) {
darkScheme = $A.eeuiAppGetThemeName() === "dark"
}
if (darkScheme) {
this.enableDarkMode()
} else {

View File

@ -474,7 +474,7 @@ export default {
components: {
UserSelect,
TaskExistTips,
ChatInput,
ChatInput,
TaskMenu,
ProjectLog,
DialogWrapper,
@ -629,7 +629,7 @@ export default {
'taskContents',
'taskFiles',
'taskPriority',
'dialogId',
]),
@ -981,7 +981,7 @@ export default {
&& (Math.abs($A.Time(this.taskDetail.start_at) - $A.Time(params.start_at)) > 60 || Math.abs($A.Time(this.taskDetail.end_at) - $A.Time(params.end_at)) > 60)
&& typeof params.desc === "undefined") {
$A.modalInput({
title: `修改任务时间`,
title: `修改${this.taskDetail.parent_id > 0 ? '子任务' : '任务'}时间`,
placeholder: `请输入修改备注`,
okText: "确定",
onOk: (desc) => {
@ -989,8 +989,8 @@ export default {
return `请输入修改备注`
}
this.updateParams = Object.assign(params, { desc })
if (params.start_at && params.end_at) {
this.$refs['taskExistTipsRef'].isExistTask({
if (params.start_at && params.end_at && this.$refs.taskExistTipsRef) {
this.$refs.taskExistTipsRef.isExistTask({
taskid: this.taskDetail.id,
userids: this.taskDetail.owner_userid,
timerange: [params.start_at, params.end_at]

@ -1 +1 @@
Subproject commit b95b0a9c439f04f9f19648bb2159187eb2b936ea
Subproject commit 0df0faf4510aca0532784acfcc4feb54bdf37fd4