胶囊高度适配

This commit is contained in:
kron
2025-08-07 10:48:05 +08:00
parent 91ab946699
commit aa815849b1
5 changed files with 28 additions and 26 deletions

View File

@@ -23,7 +23,6 @@ const { updateConfig, updateUser, updateDevice, updateRank, getLvlName } =
// 使用storeToRefs用于UI里显示保持响应性
const { user, device, rankData } = storeToRefs(store);
const showModal = ref(false);
const isIos = ref(true);
const showGuide = ref(false);
const toPage = (path) => {
@@ -88,8 +87,6 @@ onShow(async () => {
onMounted(async () => {
uni.removeStorageSync("point-book-config");
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
const config = await getAppConfig();
updateConfig(config);
console.log("全局配置:", config);
@@ -105,7 +102,7 @@ const comingSoon = () => {
<template>
<Container :isHome="true" :showBackToGame="true">
<view class="container" :style="{ paddingTop: isIos ? '100rpx' : '70rpx' }">
<view class="container">
<UserHeader showRank :onSignin="() => (showModal = true)" />
<view :style="{ padding: '12px 10px' }">
<view class="feature-grid">

View File

@@ -7,15 +7,15 @@ const store = useStore();
const { user, rankData } = storeToRefs(store);
const { getLvlName } = store;
const isIos = ref(true);
const capsuleHeight = ref(0);
const selectedIndex = ref(0);
const currentList = ref([]);
const myData = ref({});
const addBg = ref("");
onMounted(async () => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
const menuBtnInfo = uni.getMenuButtonBoundingClientRect();
capsuleHeight.value = menuBtnInfo.top - 9;
currentList.value = rankData.value.rank;
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
});
@@ -47,7 +47,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
<view
class="header"
:style="{
paddingTop: isIos ? '38px' : '25px',
paddingTop: capsuleHeight + 'px',
}"
>
<image
@@ -59,7 +59,9 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
<navigator open-type="navigateBack">
<image class="header-back" src="../static/back.png" mode="widthFix" />
</navigator>
<text :style="{ opacity: addBg ? 1 : 0, color: '#fff' }">
<text
:style="{ opacity: addBg ? 1 : 0, color: '#fff', fontWeight: 'bold' }"
>
本赛季排行榜
</text>
</view>
@@ -152,7 +154,10 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
</view>
</view>
<view class="my-rank-data" v-if="myData.userId">
<image src="https://static.shelingxingqiu.com/attachment/2025-08-05/dbuaf19pf7qd8ps0uh.png" mode="widthFix" />
<image
src="https://static.shelingxingqiu.com/attachment/2025-08-05/dbuaf19pf7qd8ps0uh.png"
mode="widthFix"
/>
<text>{{ myData.rank }}</text>
<Avatar :src="user.avatar" />
<view class="rank-item-content">
@@ -186,9 +191,9 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
}
.header {
width: 100%;
height: 60px;
height: 50px;
display: flex;
align-items: flex-center;
align-items: center;
position: fixed;
top: 0;
transition: all 0.3s ease;
@@ -197,7 +202,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
}
.header text {
transition: all 0.3s ease;
line-height: 60px;
line-height: 50px;
position: relative;
}
.rank-tabs {
@@ -346,7 +351,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
.header-back {
width: 22px;
height: 22px;
margin: 20px 15px;
margin: 0px 15px;
position: relative;
}
.bg-image {