| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554 |
- <script setup lang="ts">
- import appStore from "@s"
- import { useDebounceFn, useResizeObserver } from "@vueuse/core"
- import { ref, onBeforeUnmount, onMounted, computed } from "vue"
- import VbQrScan from "@/components/qrcode/VbQrScan.vue"
- import router from "@r"
- const pageRef = ref<HTMLDivElement | null>(null)
- const name = ref(appStore.appConfigStore.getPlatformName())
- const showScanner = ref(false)
- const scanResult = ref("")
- const currentTime = ref(new Date())
- const copyright = computed(() => {
- return appStore.appConfigStore.getConfig().copyrightYear || "2020"
- })
- // 更新当前时间
- onMounted(() => {
- const timer = setInterval(() => {
- currentTime.value = new Date()
- }, 1000)
- onBeforeUnmount(() => {
- clearInterval(timer)
- document.querySelector("body")?.classList.remove("is-mobile-home")
- })
- })
- function handleScan() {
- showScanner.value = true
- }
- function handleScanResult(result: string) {
- scanResult.value = result
- if (result.startsWith("vb@")) {
- const arr = result.split("@")
- if (arr.length > 2) {
- router.push(arr[2])
- return
- }
- }
- message.msgError("无效二维码")
- }
- function handleCloseScanner() {
- showScanner.value = false
- }
- // 格式化时间显示
- const formattedTime = computed(() => {
- return currentTime.value.toLocaleTimeString("zh-CN", {
- hour: "2-digit",
- minute: "2-digit"
- })
- })
- const formattedDate = computed(() => {
- return currentTime.value.toLocaleDateString("zh-CN", {
- year: "numeric",
- month: "long",
- day: "numeric",
- weekday: "long"
- })
- })
- // 问候语
- const greeting = computed(() => {
- const hour = currentTime.value.getHours()
- if (hour < 6) return "夜深了"
- if (hour < 9) return "早上好"
- if (hour < 12) return "上午好"
- if (hour < 14) return "中午好"
- if (hour < 18) return "下午好"
- if (hour < 22) return "晚上好"
- return "夜深了"
- })
- function handleResize() {
- if (pageRef.value) {
- pageRef.value.style.width = window.innerWidth + "px"
- pageRef.value.style.height = window.innerHeight + "px"
- }
- }
- onMounted(() => {
- handleResize()
- useResizeObserver(pageRef.value, useDebounceFn(handleResize, 200, { maxWait: 500 }))
- })
- </script>
- <template>
- <div ref="pageRef" class="mobile-home-page">
- <!-- 动态背景 -->
- <div class="background-decoration">
- <div class="circle circle-1"></div>
- <div class="circle circle-2"></div>
- <div class="circle circle-3"></div>
- </div>
- <div class="home-content">
- <!-- 头部区域 -->
- <header class="header-section">
- <div class="time-display">
- <div class="time">{{ formattedTime }}</div>
- <div class="date">{{ formattedDate }}</div>
- </div>
- <div class="company-name">
- <h1>{{ name }}</h1>
- <p class="tagline">移动工作平台</p>
- </div>
- </header>
- <!-- 主要内容区 -->
- <main class="main-content">
- <!-- 用户信息卡片 -->
- <div class="user-card">
- <div class="user-avatar">
- <vb-symbol
- :text="appStore.authStore.user.nickName"
- :src="appStore.authStore.user.avatar"
- :size="80"
- shape="circle" />
- </div>
- <div class="user-info">
- <div class="greeting">{{ greeting }}</div>
- <div class="nickname">{{ appStore.authStore.user.nickName }}</div>
- <div class="status">在线工作中</div>
- </div>
- </div>
- <!-- 快捷操作区 -->
- <div class="quick-actions">
- <div class="action-card primary" @click="handleScan">
- <div class="action-icon">
- <i class="bi bi-qr-code-scan"></i>
- </div>
- <div class="action-info">
- <div class="action-title">扫一扫</div>
- <div class="action-desc">扫描二维码快速访问</div>
- </div>
- <div class="action-arrow">
- <i class="bi bi-chevron-right"></i>
- </div>
- </div>
- <!-- <div class="action-card">
- <div class="action-icon">
- <i class="bi bi-calendar-check"></i>
- </div>
- <div class="action-info">
- <div class="action-title">工作台</div>
- <div class="action-desc">查看待办事项</div>
- </div>
- <div class="action-arrow">
- <i class="bi bi-chevron-right"></i>
- </div>
- </div>
- <div class="action-card">
- <div class="action-icon">
- <i class="bi bi-bell"></i>
- </div>
- <div class="action-info">
- <div class="action-title">消息通知</div>
- <div class="action-desc">查看系统消息</div>
- </div>
- <div class="action-badge">3</div>
- <div class="action-arrow">
- <i class="bi bi-chevron-right"></i>
- </div>
- </div> -->
- </div>
- <!-- 数据统计区 -->
- <!-- <div class="stats-section">
- <h3 class="section-title">今日概览</h3>
- <div class="stats-grid">
- <div class="stat-item">
- <div class="stat-value">12</div>
- <div class="stat-label">待处理</div>
- </div>
- <div class="stat-item">
- <div class="stat-value">8</div>
- <div class="stat-label">已完成</div>
- </div>
- <div class="stat-item">
- <div class="stat-value">3</div>
- <div class="stat-label">进行中</div>
- </div>
- <div class="stat-item">
- <div class="stat-value">1</div>
- <div class="stat-label">预警</div>
- </div>
- </div>
- </div> -->
- </main>
- <!-- 底部区域 -->
- <footer class="footer-section">
- <p>Copyright ©{{ copyright }}-{{ new Date().getFullYear() }} VAP All Rights Reserved.</p>
- </footer>
- </div>
- <!-- 扫码组件 -->
- <VbQrScan
- v-if="showScanner"
- :enable-torch="true"
- :continuous="false"
- @close="handleCloseScanner"
- @scanSuccess="handleScanResult" />
- </div>
- </template>
- <style lang="scss" scoped>
- .mobile-home-page {
- width: 100%;
- height: 100vh;
- overflow: hidden;
- position: relative;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- .background-decoration {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- overflow: hidden;
- pointer-events: none;
- .circle {
- position: absolute;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.05);
- animation: float 20s infinite ease-in-out;
- &.circle-1 {
- width: 300px;
- height: 300px;
- top: -100px;
- right: -100px;
- animation-delay: 0s;
- }
- &.circle-2 {
- width: 200px;
- height: 200px;
- bottom: -50px;
- left: -50px;
- animation-delay: 5s;
- }
- &.circle-3 {
- width: 150px;
- height: 150px;
- top: 50%;
- left: 50%;
- animation-delay: 10s;
- }
- }
- }
- }
- .home-content {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- position: relative;
- z-index: 1;
- }
- .header-section {
- padding: 40px 20px 20px;
- text-align: center;
- .time-display {
- margin-bottom: 20px;
- .time {
- font-size: 3rem;
- font-weight: 200;
- color: rgba(255, 255, 255, 0.95);
- letter-spacing: 2px;
- text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
- }
- .date {
- font-size: 0.9rem;
- color: rgba(255, 255, 255, 0.7);
- margin-top: 5px;
- letter-spacing: 1px;
- }
- }
- .company-name {
- h1 {
- font-size: 1.8rem;
- font-weight: 700;
- color: white;
- margin-bottom: 5px;
- text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
- }
- .tagline {
- font-size: 0.9rem;
- color: rgba(255, 255, 255, 0.8);
- letter-spacing: 3px;
- }
- }
- }
- .main-content {
- flex: 1;
- overflow-y: auto;
- padding: 0 20px 20px;
- &::-webkit-scrollbar {
- display: none;
- }
- }
- .user-card {
- background: rgba(255, 255, 255, 0.15);
- backdrop-filter: blur(10px);
- border-radius: 20px;
- padding: 25px;
- display: flex;
- align-items: center;
- gap: 20px;
- margin-bottom: 25px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
- border: 1px solid rgba(255, 255, 255, 0.2);
- .user-avatar {
- flex-shrink: 0;
- border: 3px solid rgba(255, 255, 255, 0.3);
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.1);
- :deep(.symbol) {
- border-radius: 50%;
- }
- }
- .user-info {
- flex: 1;
- .greeting {
- font-size: 0.85rem;
- color: rgba(255, 255, 255, 0.7);
- margin-bottom: 5px;
- }
- .nickname {
- font-size: 1.4rem;
- font-weight: 600;
- color: white;
- margin-bottom: 5px;
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
- }
- .status {
- font-size: 0.75rem;
- color: #4ade80;
- display: flex;
- align-items: center;
- gap: 5px;
- &::before {
- content: "";
- width: 6px;
- height: 6px;
- background: #4ade80;
- border-radius: 50%;
- display: inline-block;
- animation: pulse 2s infinite;
- }
- }
- }
- }
- .quick-actions {
- margin-bottom: 25px;
- }
- .action-card {
- background: rgba(255, 255, 255, 0.15);
- backdrop-filter: blur(10px);
- border-radius: 16px;
- padding: 18px;
- display: flex;
- align-items: center;
- gap: 15px;
- margin-bottom: 12px;
- cursor: pointer;
- transition: all 0.3s ease;
- border: 1px solid rgba(255, 255, 255, 0.1);
- position: relative;
- &:active {
- transform: scale(0.98);
- background: rgba(255, 255, 255, 0.2);
- }
- &.primary {
- background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
- border-color: rgba(255, 255, 255, 0.3);
- }
- .action-icon {
- width: 45px;
- height: 45px;
- border-radius: 12px;
- background: rgba(255, 255, 255, 0.2);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 1.5rem;
- color: white;
- flex-shrink: 0;
- i {
- font-size: 1.5rem;
- color: #eee;
- }
- }
- .action-info {
- flex: 1;
- .action-title {
- font-size: 1rem;
- font-weight: 600;
- color: white;
- margin-bottom: 3px;
- }
- .action-desc {
- font-size: 0.8rem;
- color: rgba(255, 255, 255, 0.6);
- }
- }
- .action-arrow {
- color: rgba(255, 255, 255, 0.5);
- font-size: 1.2rem;
- }
- .action-badge {
- position: absolute;
- top: 10px;
- right: 45px;
- background: #ef4444;
- color: white;
- font-size: 0.7rem;
- font-weight: 600;
- padding: 2px 8px;
- border-radius: 10px;
- animation: bounce 2s infinite;
- }
- }
- .stats-section {
- background: rgba(255, 255, 255, 0.1);
- backdrop-filter: blur(10px);
- border-radius: 16px;
- padding: 20px;
- border: 1px solid rgba(255, 255, 255, 0.1);
- .section-title {
- font-size: 1rem;
- font-weight: 600;
- color: white;
- margin-bottom: 15px;
- text-align: left;
- }
- .stats-grid {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: 15px;
- .stat-item {
- text-align: center;
- .stat-value {
- font-size: 1.6rem;
- font-weight: 700;
- color: #fbbf24;
- margin-bottom: 5px;
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
- }
- .stat-label {
- font-size: 0.75rem;
- color: rgba(255, 255, 255, 0.6);
- }
- }
- }
- }
- .footer-section {
- padding: 20px;
- text-align: center;
- p {
- font-size: 0.75rem;
- color: rgba(255, 255, 255, 0.5);
- }
- }
- @keyframes shine {
- 0% {
- background-position: 0% 50%;
- }
- 100% {
- background-position: 200% 50%;
- }
- }
- @keyframes float {
- 0%,
- 100% {
- transform: translate(0, 0) rotate(0deg);
- }
- 33% {
- transform: translate(30px, -30px) rotate(120deg);
- }
- 66% {
- transform: translate(-20px, 20px) rotate(240deg);
- }
- }
- @keyframes pulse {
- 0%,
- 100% {
- opacity: 1;
- }
- 50% {
- opacity: 0.5;
- }
- }
- @keyframes bounce {
- 0%,
- 100% {
- transform: translateY(0);
- }
- 50% {
- transform: translateY(-5px);
- }
- }
- </style>
|