fix(UI): not full screen on apk

This commit is contained in:
Timi
2026-11-16 20:34:37 +08:00
parent 208fdde290
commit 5b22554970
24 changed files with 127 additions and 32 deletions
+23 -3
View File
@@ -3,21 +3,38 @@
</template>
<script setup lang="ts">
import { Capacitor, SystemBars, SystemBarsStyle } from "@capacitor/core";
import { useGlobalUIStore } from "@/store/globalUI";
import { useSettingStore } from "@/store/settingStore";
const globalUIStore = useGlobalUIStore();
const settingStore = useSettingStore();
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
const prefersDark = ref(darkMediaQuery.matches);
const resolvedThemeMode = computed(() => {
const resolvedThemeMode = computed<"light" | "dark">(() => {
if (globalUIStore.themeMode === "system") {
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
return mediaQuery.matches ? "dark" : "light";
return prefersDark.value ? "dark" : "light";
}
return globalUIStore.themeMode;
});
async function syncSystemBars(themeMode: "light" | "dark"): Promise<void> {
if (!Capacitor.isNativePlatform()) {
return;
}
await SystemBars.setStyle({
// DARK 表示深色系统栏配浅色图标,所以深色主题要用它
style: themeMode === "dark" ? SystemBarsStyle.Dark : SystemBarsStyle.Light
});
}
function handleSystemThemeChange(event: MediaQueryListEvent): void {
prefersDark.value = event.matches;
}
async function unlockSoundOnUserGesture(): Promise<void> {
await settingStore.unlockSoundPlayers();
}
@@ -28,6 +45,7 @@ watch(
const rootElement = document.documentElement;
rootElement.classList.toggle("theme-dark", themeMode === "dark");
rootElement.dataset.theme = themeMode;
void syncSystemBars(themeMode).catch(() => undefined);
},
{ immediate: true }
);
@@ -54,10 +72,12 @@ watch(
onMounted(() => {
settingStore.loadSoundPlayers();
darkMediaQuery.addEventListener("change", handleSystemThemeChange);
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
});
onUnmounted(() => {
darkMediaQuery.removeEventListener("change", handleSystemThemeChange);
window.removeEventListener("pointerdown", unlockSoundOnUserGesture);
});
</script>
+1 -1
View File
@@ -119,7 +119,7 @@ html.theme-dark body {
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
padding-bottom: calc(var(--tui-safe-bottom, 0px) + 1rem);
-webkit-overflow-scrolling: touch;
.t-pull-down-refresh__track {
+1 -1
View File
@@ -361,7 +361,7 @@ onUnmounted(() => {
flex: 1;
overflow: auto;
min-height: 0;
padding-bottom: env(safe-area-inset-bottom, 0);
padding-bottom: var(--tui-safe-bottom, 0px);
}
}
+2 -2
View File
@@ -313,7 +313,7 @@ function toDateValue(date: Date): number {
.day-record-panel,
.filter-popup {
gap: .875rem;
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0;
padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex;
background: #f5f5f8;
border-radius: 1rem 1rem 0 0;
@@ -344,7 +344,7 @@ function toDateValue(date: Date): number {
}
.filter-popup {
padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)) 1rem;
padding: 1rem 1rem calc(1rem + var(--tui-safe-bottom, 0px)) 1rem;
.popup-head,
.popup-body {
@@ -311,7 +311,7 @@ function updateSelectedSkuIdList(value: string[]): void {
flex: 1;
min-height: 0;
overflow-y: auto;
padding-bottom: env(safe-area-inset-bottom, 0);
padding-bottom: var(--tui-safe-bottom, 0px);
.selector {
border-radius: 0;
@@ -275,7 +275,7 @@ watch(() => props.sessionKey, async () => {
.ai-conversation-list {
width: min(70vw, 24rem);
height: 100vh;
padding: calc(var(--tui-nav-height) + .5rem) 0 calc(1rem + env(safe-area-inset-bottom, 0px));
padding: calc(var(--tui-nav-height) + .5rem) 0 calc(1rem + var(--tui-safe-bottom, 0px));
display: flex;
overflow: auto;
position: relative;
+1 -1
View File
@@ -528,7 +528,7 @@ onMounted(async () => {
.package-config-edit {
gap: 1rem;
display: flex;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0));
padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
flex-direction: column;
.form {
+1 -1
View File
@@ -280,7 +280,7 @@ onMounted(async () => {
.bottom-actions {
left: 1rem;
right: 1rem;
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
position: fixed;
.t-button {
+1 -1
View File
@@ -554,7 +554,7 @@ onUnmounted(() => {
right: 1rem;
gap: .75rem;
z-index: 20;
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
display: flex;
position: fixed;
+1 -1
View File
@@ -616,7 +616,7 @@ onMounted(async () => {
<style scoped lang="less">
.point-rule-edit {
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0));
padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
.form {
gap: 1rem;
@@ -468,7 +468,7 @@ watch(resolveId, async (id, previousId) => {
}
.revoke-popup {
padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
padding: .5rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
.tip {
margin: 0 0 .75rem;
@@ -179,7 +179,7 @@ function setSkuStatus(value: boolean | string | number): void {
}
.sku-popup {
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0px));
padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px));
max-height: 100%;
overflow-y: auto;
@@ -141,7 +141,7 @@ function setBaseUnit(index: number): void {
.batch-editor {
max-height: 100%;
overflow-y: auto;
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0px));
padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px));
.editor-context {
gap: .25rem;
@@ -174,7 +174,7 @@ function setBaseUnit(index: number): void {
.product-sku-unit-editor {
gap: .75rem;
display: flex;
padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
padding: .5rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
max-height: 100%;
overflow-y: auto;
flex-direction: column;
@@ -232,7 +232,7 @@ watch(() => [visible.value, props.operation] as const, ([isVisible]) => {
<style scoped lang="less">
.operation-popup {
padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
padding-bottom: calc(1rem + var(--tui-safe-bottom, 0px));
.form {
margin: 0;
+3 -3
View File
@@ -603,7 +603,7 @@ onMounted(() => {
.sales-order-create {
gap: 1rem;
display: flex;
padding: calc(var(--tui-nav-height) + 1rem) 0 calc(6.5rem + env(safe-area-inset-bottom, 0));
padding: calc(var(--tui-nav-height) + 1rem) 0 calc(6.5rem + var(--tui-safe-bottom, 0px));
flex-direction: column;
.form {
@@ -753,10 +753,10 @@ onMounted(() => {
left: 1.5rem;
right: 1.5rem;
border: 1px solid rgba(0, 0, 0, .05);
bottom: calc(env(safe-area-inset-bottom, 0) + 1rem);
bottom: calc(var(--tui-safe-bottom, 0px) + 1rem);
z-index: 12;
display: flex;
padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom, 0)) 1rem;
padding: .5rem 1rem calc(.5rem + var(--tui-safe-bottom, 0px)) 1rem;
position: fixed;
align-items: center;
border-radius: 1.75rem;
+1 -1
View File
@@ -195,7 +195,7 @@ onMounted(async () => {
}
.footer {
padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
padding: 1.25rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
text-align: center;
p {
+1 -1
View File
@@ -265,7 +265,7 @@ watch(() => [props.diaryId, route.params.id], () => {
<style scoped lang="less">
.store-diary-detail {
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0));
padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
.header {
margin: 0 1rem;
+1 -1
View File
@@ -262,7 +262,7 @@ async function removeStore(id: string): Promise<void> {
<style scoped lang="less">
.store-edit {
gap: 1rem;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0;
padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex;
flex-direction: column;
+1 -1
View File
@@ -391,7 +391,7 @@ onBeforeRouteLeave(() => {
}
.footer {
padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
padding: 1.25rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
text-align: center;
p {
+1 -1
View File
@@ -244,7 +244,7 @@ onMounted(() => {
<style scoped lang="less">
.profile-page {
gap: 1rem;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0;
padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex;
flex-direction: column;