Files
happy-life-star/mini-program/src/pages/splash/index.vue
T
peanut b9473d5059 fix: 替换已弃用的 getSystemInfoSync API 并优化移动端布局
- 将所有 uni.getSystemInfoSync() 替换为新的推荐 API
  - uni.getDeviceInfo() 获取设备信息
  - uni.getWindowInfo() 获取窗口信息
  - uni.getAppBaseInfo() 获取应用基础信息
- 优化页面布局适配移动端小程序
  - page 添加 height: 100% 和 overflow: hidden
  - 主页面使用 height: 100vh 替代 min-height
  - 移除滚动条显示(::-webkit-scrollbar)
  - 添加 flex-shrink: 0 防止卡片收缩
- 修复隐藏滚动条,提升移动端体验

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:27:04 +08:00

133 lines
2.8 KiB
Vue

<template>
<view class="container">
<view class="bg-decoration">
<view class="aurora-top"></view>
<view class="aurora-bottom"></view>
</view>
<view class="overlay">
<view class="status-bar-space" :style="{ height: statusBarHeight + 'px' }"></view>
<view class="content-area" :style="{ paddingBottom: safeAreaBottom + 'px' }">
<image class="logo" src="/static/logo.svg" mode="widthFix"></image>
<text class="app-name font-serif">人生OS</text>
<text class="app-version">LIFE HARMONY v3.1</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useAppStore } from '../../stores/app.js'
const statusBarHeight = ref(20)
const safeAreaBottom = ref(0)
onLoad(() => {
// 使用新的推荐 API 替代已弃用的 getSystemInfoSync
const windowInfo = uni.getWindowInfo()
statusBarHeight.value = windowInfo.statusBarHeight || 20
safeAreaBottom.value = windowInfo.safeAreaInsets?.bottom || 0
setTimeout(async () => {
const store = useAppStore()
const token = uni.getStorageSync('access_token')
if (token) {
await store.fetchUserProfile()
if (store.hasProfile) {
uni.reLaunch({ url: '/pages/main/index' })
} else {
uni.reLaunch({ url: '/pages/onboarding/index' })
}
} else {
uni.reLaunch({ url: '/pages/login/index' })
}
}, 2000)
})
</script>
<style>
.container {
position: relative;
width: 750rpx;
min-height: 100vh;
height: 100vh;
background: linear-gradient(180deg, #0F071A 0%, #1A0B2E 50%, #0F071A 100%);
}
.status-bar-space {
height: constant(safe-area-inset-top);
height: env(safe-area-inset-top);
width: 100%;
background: transparent;
flex-shrink: 0;
}
.bg-decoration {
position: absolute;
inset: 0;
pointer-events: none;
}
.aurora-top {
position: absolute;
top: -10%;
left: -10%;
width: 120%;
height: 60%;
background: rgba(168, 85, 247, 0.08);
filter: blur(120rpx);
border-radius: 50%;
}
.aurora-bottom {
position: absolute;
bottom: -10%;
right: -10%;
width: 100%;
height: 50%;
background: rgba(139, 92, 246, 0.05);
filter: blur(100rpx);
border-radius: 50%;
}
.overlay {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
z-index: 1;
}
.content-area {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.logo {
width: 180rpx;
margin-bottom: 32rpx;
}
.app-name {
font-size: 52rpx;
font-weight: 300;
color: rgba(255, 255, 255, 0.95);
letter-spacing: 8rpx;
margin-bottom: 20rpx;
}
.app-version {
font-size: 24rpx;
color: rgba(168, 85, 247, 0.7);
letter-spacing: 4rpx;
}
</style>