perf: 优化页面
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<view class="profile-page">
|
||||
<!-- Custom nav bar (transparent, blends with UserCard gradient) -->
|
||||
<CustomNavBar title="我的" transparent />
|
||||
|
||||
<!-- User card -->
|
||||
<UserCard
|
||||
:logged-in="loggedIn"
|
||||
@@ -8,6 +11,7 @@
|
||||
:stats="stats"
|
||||
:memberships="memberships"
|
||||
:loading="loginLoading"
|
||||
:nav-bar-height="navBarHeight"
|
||||
@login="handleLogin"
|
||||
/>
|
||||
|
||||
@@ -28,17 +32,26 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useUserStore } from '../../stores/user'
|
||||
import UserCard from '../../components/UserCard.vue'
|
||||
import ProfileMenu from '../../components/ProfileMenu.vue'
|
||||
import CustomNavBar from '../../components/CustomNavBar.vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { loggedIn, hasProfile, user, stats, memberships, isAdmin } = storeToRefs(userStore)
|
||||
|
||||
const loginLoading = ref(false)
|
||||
const navBarHeight = ref(64)
|
||||
|
||||
onMounted(() => {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
const statusBarPx = sysInfo.statusBarHeight ?? 20
|
||||
const navTitlePx = 88 * (sysInfo.windowWidth / 750)
|
||||
navBarHeight.value = Math.round(statusBarPx + navTitlePx)
|
||||
})
|
||||
|
||||
onShow(async () => {
|
||||
if (loggedIn.value) {
|
||||
|
||||
Reference in New Issue
Block a user