diff --git a/JY-Artist-Frontend/src/App.vue b/JY-Artist-Frontend/src/App.vue index 485e0247..d619f5b3 100644 --- a/JY-Artist-Frontend/src/App.vue +++ b/JY-Artist-Frontend/src/App.vue @@ -366,6 +366,10 @@ onUnmounted(() => { .jayu-cloud-time-panel .ant-picker-time-panel-column { width: 76px; padding: 8px 6px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + overscroll-behavior: contain; + touch-action: pan-y; } .jayu-cloud-date-time-panel .ant-picker-time-panel-cell-inner, diff --git a/JY-Artist-Frontend/src/components/admin/AdminResponsiveModal.vue b/JY-Artist-Frontend/src/components/admin/AdminResponsiveModal.vue index e9a52e16..35d3ba77 100644 --- a/JY-Artist-Frontend/src/components/admin/AdminResponsiveModal.vue +++ b/JY-Artist-Frontend/src/components/admin/AdminResponsiveModal.vue @@ -114,11 +114,17 @@ const mergedBodyStyle = computed(() => ( /** handleOpenChange is a local helper used by this page script. */ const handleOpenChange = (value: boolean) => { + if (!value && typeof document !== 'undefined' && document.visibilityState === 'hidden') { + return + } emit('update:open', value) } /** handleCancel is a local helper used by this page script. */ const handleCancel = (event?: unknown) => { + if (typeof document !== 'undefined' && document.visibilityState === 'hidden') { + return + } emit('update:open', false) emit('cancel', event) } diff --git a/JY-Artist-Frontend/src/views/admin/ShopsView.vue b/JY-Artist-Frontend/src/views/admin/ShopsView.vue index ecd3dbe4..33a8f39b 100644 --- a/JY-Artist-Frontend/src/views/admin/ShopsView.vue +++ b/JY-Artist-Frontend/src/views/admin/ShopsView.vue @@ -601,7 +601,7 @@ * ShopsView page script. * Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events. */ -import { computed, ref, reactive, onMounted } from 'vue' +import { computed, ref, reactive, onBeforeUnmount, onMounted } from 'vue' import { message } from 'ant-design-vue' import type { FormInstance, UploadProps } from 'ant-design-vue' import { PlusOutlined } from '@ant-design/icons-vue' @@ -2177,6 +2177,21 @@ const handleSaveDraft = () => { message.success('已暂存到本地') } +const saveDraftSilently = () => { + if (!modalVisible.value || isUploadPending.value) { + return + } + syncBusinessHoursValue() + const draft = saveDraftRecord(getDraftKey(), buildDraftPayload()) + draftSavedAt.value = draft.savedAt +} + +const handleDocumentVisibilityChange = () => { + if (document.visibilityState === 'hidden') { + saveDraftSilently() + } +} + /** handleClearDraft is a local helper used by this page script. */ const handleClearDraft = (showMessage = true) => { clearDraftRecord(getDraftKey()) @@ -2382,10 +2397,15 @@ const handleStatusChange = async (record: Shop | Record, enabled: b } onMounted(async () => { + document.addEventListener('visibilitychange', handleDocumentVisibilityChange) loadCustomThemeTemplates() await loadUserPermissions() fetchShopList() }) + +onBeforeUnmount(() => { + document.removeEventListener('visibilitychange', handleDocumentVisibilityChange) +})