fix: avatar page

This commit is contained in:
zzc
2026-01-31 22:37:24 +08:00
parent e6b22d608b
commit 417195ff09
3 changed files with 126 additions and 84 deletions

View File

@@ -1,18 +1,6 @@
<template>
<view class="avatar-detail-page" :style="{ paddingTop: navBarHeight + 'px' }">
<!-- Custom Navbar -->
<view
class="nav-bar"
:style="{
height: navBarHeight + 'px',
paddingTop: statusBarHeight + 'px',
}"
>
<view class="nav-content">
<view class="back" @tap="goBack"></view>
<text class="nav-title">专属头像</text>
</view>
</view>
<view class="avatar-detail-page">
<NavBar title="专属头像" />
<view class="content-wrap">
<!-- User Info -->
@@ -138,10 +126,10 @@
<script setup>
import { ref, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { getBavBarHeight } from "@/utils/system";
import { getPageDetail } from "@/api/system.js";
import { getAvatarRecommendList } from "@/api/avatar.js";
import { saveViewRequest } from "@/utils/common.js";
import NavBar from "@/components/NavBar/NavBar.vue";
const defaultAvatar =
"https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png";
@@ -149,9 +137,6 @@ const detailData = ref(null);
const frameList = ref([]);
const shareToken = ref("");
const navBarHeight = ref(64);
const statusBarHeight = ref(20);
onLoad((options) => {
if (options.shareToken) {
shareToken.value = options.shareToken;
@@ -160,22 +145,6 @@ onLoad((options) => {
fetchFrames();
});
onMounted(() => {
const sysInfo = uni.getSystemInfoSync();
statusBarHeight.value = sysInfo.statusBarHeight;
navBarHeight.value = getBavBarHeight();
});
const goBack = () => {
// Check if can go back, otherwise go home
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack();
} else {
uni.switchTab({ url: "/pages/index/index" });
}
};
const fetchDetail = async () => {
try {
// uni.showLoading({ title: "加载中..." });
@@ -239,42 +208,6 @@ const goToWallpaper = () => {
box-sizing: border-box;
}
.nav-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
box-sizing: border-box;
background: #ffffff;
}
.nav-content {
display: flex;
align-items: center;
height: 100%;
padding: 0 24rpx;
}
.back {
font-size: 50rpx;
margin-right: 24rpx;
line-height: 1;
color: #333;
/* 增大点击区域 */
padding: 20rpx;
margin-left: -20rpx;
}
.nav-title {
font-size: 34rpx;
font-weight: bold;
color: #333;
flex: 1;
text-align: center;
margin-right: 50rpx; /* Balance back button */
}
.content-wrap {
padding: 30rpx 40rpx 60rpx;
}