Some checks failed
Build and Deploy Front / deploy (push) Failing after 15s
提问卡改为可透点阵的薄玻璃并重排;运营端摄像头扫码改到顶部;登录不再展示领域异常码。 Co-authored-by: Cursor <cursoragent@cursor.com>
185 lines
4.3 KiB
Vue
185 lines
4.3 KiB
Vue
<template>
|
||
<div
|
||
class="login-care-banner"
|
||
:class="{
|
||
'is-after-hours': afterHours,
|
||
'is-visible': visible && settingsEnabled,
|
||
}"
|
||
aria-live="polite"
|
||
>
|
||
<div class="login-care-banner__body">
|
||
<p class="login-care-banner__greeting">{{ greeting }}</p>
|
||
<p class="login-care-banner__note">{{ note }}</p>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue';
|
||
import { useI18n } from 'vue-i18n';
|
||
import { getCarePeriod, getHolidayId, isAfterWorkHours } from '@/utils/admin-login-care';
|
||
import { getAdminCareSettings } from '@/utils/admin-care-settings';
|
||
import { isPortalIrisActive } from '@/utils/page-transition-flag';
|
||
|
||
defineOptions({ name: 'LoginCareBanner' });
|
||
|
||
defineProps<{
|
||
light?: boolean;
|
||
}>();
|
||
|
||
const { t } = useI18n();
|
||
const tick = ref(0);
|
||
const visible = ref(false);
|
||
const settingsEnabled = ref(true);
|
||
let timer: ReturnType<typeof window.setInterval> | null = null;
|
||
let enterTimer: ReturnType<typeof window.setTimeout> | null = null;
|
||
|
||
const period = computed(() => {
|
||
void tick.value;
|
||
return getCarePeriod();
|
||
});
|
||
|
||
const afterHours = computed(() => {
|
||
void tick.value;
|
||
return isAfterWorkHours();
|
||
});
|
||
|
||
const holidayId = computed(() => {
|
||
void tick.value;
|
||
return getHolidayId();
|
||
});
|
||
|
||
const greeting = computed(() => {
|
||
if (holidayId.value) return t(`login.care.holiday.${holidayId.value}`);
|
||
if (afterHours.value) return t('login.care.afterHoursGreeting');
|
||
return t(`login.care.period.${period.value}`);
|
||
});
|
||
|
||
const note = computed(() => {
|
||
if (holidayId.value) return t(`login.care.holidayNote.${holidayId.value}`);
|
||
if (afterHours.value) return t('login.care.afterHoursNote');
|
||
return t(`login.care.periodNote.${period.value}`);
|
||
});
|
||
|
||
onMounted(async () => {
|
||
const s = getAdminCareSettings();
|
||
settingsEnabled.value = s.careEnabled && s.loginBannerEnabled;
|
||
if (!settingsEnabled.value) return;
|
||
await nextTick();
|
||
const reveal = () => {
|
||
if (isPortalIrisActive()) {
|
||
enterTimer = window.setTimeout(reveal, 80);
|
||
return;
|
||
}
|
||
visible.value = true;
|
||
};
|
||
enterTimer = window.setTimeout(reveal, 180);
|
||
timer = window.setInterval(() => {
|
||
tick.value += 1;
|
||
}, 60_000);
|
||
});
|
||
|
||
onBeforeUnmount(() => {
|
||
if (timer) {
|
||
window.clearInterval(timer);
|
||
timer = null;
|
||
}
|
||
if (enterTimer) {
|
||
window.clearTimeout(enterTimer);
|
||
enterTimer = null;
|
||
}
|
||
});
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.login-care-banner {
|
||
/* 与登录卡片同系:贴合页底 + 单层 inset,无彩斑 */
|
||
--care-ink: #1e293b;
|
||
--care-muted: rgba(71, 85, 105, 0.88);
|
||
--care-bg: var(--app-page-bg, #f0f3f4);
|
||
--care-shadow: inset 0 3px 12px rgba(15, 23, 42, 0.1);
|
||
|
||
position: absolute;
|
||
top: calc(16px + env(safe-area-inset-top, 0px));
|
||
right: 20px;
|
||
z-index: 40;
|
||
width: min(360px, calc(100vw - 40px));
|
||
padding: 16px 18px;
|
||
border-radius: 20px;
|
||
text-align: left;
|
||
pointer-events: none;
|
||
box-sizing: border-box;
|
||
overflow: hidden;
|
||
isolation: isolate;
|
||
border: none;
|
||
background: var(--care-bg);
|
||
backdrop-filter: none;
|
||
-webkit-backdrop-filter: none;
|
||
box-shadow: var(--care-shadow);
|
||
opacity: 0;
|
||
transform: translate3d(12px, -8px, 0);
|
||
transform-origin: top right;
|
||
transition:
|
||
opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
|
||
transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
|
||
box-shadow 0.3s ease;
|
||
|
||
&.is-visible {
|
||
opacity: 1;
|
||
transform: translate3d(0, 0, 0);
|
||
box-shadow: inset 0 4px 14px rgba(15, 23, 42, 0.12);
|
||
}
|
||
|
||
&.is-after-hours {
|
||
--care-ink: #1e293b;
|
||
--care-muted: rgba(71, 85, 105, 0.88);
|
||
}
|
||
}
|
||
|
||
.login-care-banner__body {
|
||
position: relative;
|
||
z-index: 1;
|
||
}
|
||
|
||
.login-care-banner__greeting {
|
||
margin: 0 0 6px;
|
||
font-size: 18px;
|
||
font-weight: 700;
|
||
letter-spacing: 0.01em;
|
||
line-height: 1.35;
|
||
color: var(--care-ink);
|
||
}
|
||
|
||
.login-care-banner__note {
|
||
margin: 0;
|
||
font-size: 12px;
|
||
line-height: 1.55;
|
||
color: var(--care-muted);
|
||
}
|
||
|
||
@media screen and (max-width: 768px) {
|
||
.login-care-banner {
|
||
top: calc(12px + env(safe-area-inset-top, 0px));
|
||
right: 12px;
|
||
left: 12px;
|
||
width: auto;
|
||
transform-origin: top center;
|
||
|
||
&:not(.is-visible) {
|
||
transform: translate3d(0, -8px, 0);
|
||
}
|
||
}
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.login-care-banner {
|
||
transition: opacity 0.2s ease;
|
||
transform: none;
|
||
|
||
&.is-visible {
|
||
transform: none;
|
||
}
|
||
}
|
||
}
|
||
</style>
|