mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 12:42:51 +00:00
perf: 优化iOS深色模式
This commit is contained in:
parent
189986dd88
commit
1be7e67655
@ -58,6 +58,7 @@ export default {
|
||||
this.eeuiEvents();
|
||||
this.otherEvents();
|
||||
this.synchThemeLanguage();
|
||||
this.synchAppTheme();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@ -73,7 +74,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['ws', 'themeMode', 'windowOrientation']),
|
||||
...mapState(['ws', 'themeMode', 'themeIsDark', 'windowOrientation']),
|
||||
|
||||
isSoftware() {
|
||||
return this.$Electron || this.$isEEUiApp;
|
||||
@ -174,7 +175,7 @@ export default {
|
||||
this.$store.dispatch("websocketConnection")
|
||||
})
|
||||
if (this.themeMode === "auto") {
|
||||
$A.dark.autoDarkMode()
|
||||
this.$store.dispatch("synchTheme")
|
||||
}
|
||||
}, 600)
|
||||
} else {
|
||||
@ -182,7 +183,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
themeMode() {
|
||||
themeIsDark() {
|
||||
this.synchThemeLanguage();
|
||||
}
|
||||
},
|
||||
@ -225,9 +226,19 @@ export default {
|
||||
this.iframes = this.iframes.filter(({key}) => key != 'synchThemeLanguage')
|
||||
this.iframes.push({
|
||||
key: 'synchThemeLanguage',
|
||||
url: $A.apiUrl(`../setting/theme_language?theme=${this.themeMode}&language=${languageType}`)
|
||||
url: $A.apiUrl(`../setting/theme_language?theme=${this.themeIsDark ? 'dark' : 'light'}&language=${languageType}`)
|
||||
})
|
||||
}
|
||||
this.synchAppTheme()
|
||||
},
|
||||
|
||||
synchAppTheme() {
|
||||
if (this.$isEEUiApp) {
|
||||
$A.eeuiAppSendMessage({
|
||||
action: 'updateTheme',
|
||||
themeName: this.themeIsDark ? 'dark' : 'light',
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
windowSizeListener() {
|
||||
@ -285,6 +296,12 @@ export default {
|
||||
if (!this.$isEEUiApp) {
|
||||
return;
|
||||
}
|
||||
// APP进入前台
|
||||
window.__onAppActive = () => {
|
||||
if (this.themeMode === "auto") {
|
||||
this.$store.dispatch("synchTheme")
|
||||
}
|
||||
}
|
||||
// 页面失活
|
||||
window.__onPagePause = () => {
|
||||
this.$store.state.windowActive = false;
|
||||
@ -301,7 +318,7 @@ export default {
|
||||
window.__onMeetingEvent = ({act,uuid,meetingid}) => {
|
||||
switch (act) {
|
||||
// 获取用户信息
|
||||
case "getInfo":
|
||||
case "getInfo":
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/basic',
|
||||
data: {
|
||||
@ -321,22 +338,21 @@ export default {
|
||||
});
|
||||
break;
|
||||
//加入成功
|
||||
case "success":
|
||||
case "success":
|
||||
this.$store.dispatch("closeMeetingWindow","add")
|
||||
break;
|
||||
// 邀请
|
||||
case "invent":
|
||||
case "invent":
|
||||
this.$store.dispatch("showMeetingWindow",{
|
||||
type: "invitation",
|
||||
meetingid: meetingid
|
||||
})
|
||||
break;
|
||||
//结束会议
|
||||
case "endMeeting":
|
||||
|
||||
case "endMeeting":
|
||||
break;
|
||||
//加入失败
|
||||
case "error":
|
||||
case "error":
|
||||
this.$store.dispatch("closeMeetingWindow","error")
|
||||
break;
|
||||
default:
|
||||
|
||||
34
resources/assets/js/store/actions.js
vendored
34
resources/assets/js/store/actions.js
vendored
@ -55,19 +55,7 @@ export default {
|
||||
}
|
||||
|
||||
// 主题皮肤
|
||||
switch (state.themeMode) {
|
||||
case 'dark':
|
||||
$A.dark.enableDarkMode()
|
||||
break;
|
||||
case 'light':
|
||||
$A.dark.disableDarkMode()
|
||||
break;
|
||||
default:
|
||||
state.themeMode = "auto"
|
||||
$A.dark.autoDarkMode()
|
||||
break;
|
||||
}
|
||||
state.themeIsDark = $A.dark.isDarkEnabled()
|
||||
await dispatch("synchTheme")
|
||||
|
||||
// 客户端ID
|
||||
if (!state.clientId) {
|
||||
@ -488,6 +476,26 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 同步主题
|
||||
* @param state
|
||||
*/
|
||||
synchTheme({state}) {
|
||||
switch (state.themeMode) {
|
||||
case 'dark':
|
||||
$A.dark.enableDarkMode()
|
||||
break;
|
||||
case 'light':
|
||||
$A.dark.disableDarkMode()
|
||||
break;
|
||||
default:
|
||||
state.themeMode = "auto"
|
||||
$A.dark.autoDarkMode()
|
||||
break;
|
||||
}
|
||||
state.themeIsDark = $A.dark.isDarkEnabled()
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取基本数据(项目、对话、仪表盘任务、会员基本信息)
|
||||
* @param state
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 8a4c11011f43f728c5e18a6fc141efd8807102d9
|
||||
Subproject commit b95b0a9c439f04f9f19648bb2159187eb2b936ea
|
||||
Loading…
x
Reference in New Issue
Block a user