UI兼容调整

This commit is contained in:
kron
2025-06-15 22:01:06 +08:00
parent c2b2d0bf99
commit 9ffcf67948
6 changed files with 47 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
<script setup> <script setup>
import { ref, onMounted } from "vue";
import AppBackground from "@/components/AppBackground.vue"; import AppBackground from "@/components/AppBackground.vue";
import Header from "@/components/Header.vue"; import Header from "@/components/Header.vue";
defineProps({ defineProps({
@@ -11,13 +12,21 @@ defineProps({
default: 0, default: 0,
}, },
}); });
const isIos = ref(true);
onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
});
</script> </script>
<template> <template>
<view> <view>
<AppBackground :type="bgType" /> <AppBackground :type="bgType" />
<Header :title="title" /> <Header :title="title" />
<view class="content"> <view
class="content"
:style="{ height: `calc(100vh - ${isIos ? 105 : 95}px)` }"
>
<slot></slot> <slot></slot>
</view> </view>
</view> </view>
@@ -26,7 +35,6 @@ defineProps({
<style scoped> <style scoped>
.content { .content {
width: 100vw; width: 100vw;
height: calc(100vh - 95px);
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;

View File

@@ -1,9 +1,11 @@
<script setup> <script setup>
import { ref, onMounted } from "vue";
import useStore from "@/store"; import useStore from "@/store";
import { simulShootAPI } from "@/apis"; import { simulShootAPI } from "@/apis";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
const store = useStore(); const store = useStore();
const { device } = storeToRefs(store); const { device } = storeToRefs(store);
const isIos = ref(true);
defineProps({ defineProps({
title: { title: {
@@ -17,10 +19,15 @@ const simulShoot = async () => {
await simulShootAPI(device.value.deviceId); await simulShootAPI(device.value.deviceId);
} }
}; };
onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
});
</script> </script>
<template> <template>
<view class="container"> <view class="container" :style="{ paddingTop: isIos ? '35px' : '25px' }">
<navigator open-type="navigateBack" class="back-btn"> <navigator open-type="navigateBack" class="back-btn">
<image src="../static/back.png" mode="widthFix" /> <image src="../static/back.png" mode="widthFix" />
</navigator> </navigator>
@@ -37,7 +44,6 @@ const simulShoot = async () => {
width: 72vw; width: 72vw;
height: 60px; height: 60px;
padding-left: 15px; padding-left: 15px;
padding-top: 25px;
} }
.back-btn { .back-btn {
display: flex; display: flex;

View File

@@ -39,7 +39,11 @@ const toUserPage = () => {
<view class="user-details"> <view class="user-details">
<view class="user-name"> <view class="user-name">
<text>{{ user.nickName }}</text> <text>{{ user.nickName }}</text>
<image class="user-name-image" src="../static/vip1.png" mode="widthFix" /> <image
class="user-name-image"
src="../static/vip1.png"
mode="widthFix"
/>
</view> </view>
<view class="user-stats"> <view class="user-stats">
<text class="level-tag level-tag-first">钻石1级</text> <text class="level-tag level-tag-first">钻石1级</text>
@@ -51,9 +55,17 @@ const toUserPage = () => {
</view> </view>
</view> </view>
<view v-if="showRank === true" class="rank-info"> <view v-if="showRank === true" class="rank-info">
<image class="rank-info-image" src="../static/global-rank.png" mode="widthFix" /> <image
class="rank-info-image"
src="../static/global-rank.png"
mode="widthFix"
/>
<text>本赛季全国</text> <text>本赛季全国</text>
<text class="rank-number"><text :style="{ color: '#ffd700' }">{{ user.points }}/{{ user.rankLvl }}</text></text> <text class="rank-number"
><text :style="{ color: '#ffd700' }"
>{{ user.points }}/{{ user.rankLvl }}</text
></text
>
</view> </view>
</view> </view>
</template> </template>
@@ -79,6 +91,14 @@ const toUserPage = () => {
margin-bottom: 5px; margin-bottom: 5px;
} }
.user-name > text:first-child {
font-size: 16px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-name-image { .user-name-image {
margin-left: 5px; margin-left: 5px;
width: 20px; width: 20px;

View File

@@ -43,6 +43,7 @@ defineProps({
.user-item > text { .user-item > text {
margin-left: 15px; margin-left: 15px;
font-size: 14px; font-size: 14px;
color: #000;
} }
.user-item > view { .user-item > view {
display: flex; display: flex;

View File

@@ -13,6 +13,7 @@ const { updateConfig, updateUser, updateDevice } = store;
// 使用storeToRefs用于UI里显示保持响应性 // 使用storeToRefs用于UI里显示保持响应性
const { user, device } = storeToRefs(store); const { user, device } = storeToRefs(store);
const showModal = ref(false); const showModal = ref(false);
const isIos = ref(true);
const toPage = (path) => { const toPage = (path) => {
if (!user.value.id) { if (!user.value.id) {
@@ -26,6 +27,8 @@ const toPage = (path) => {
onMounted(async () => { onMounted(async () => {
try { try {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
const config = await getAppConfig(); const config = await getAppConfig();
console.log("全局配置:", config); console.log("全局配置:", config);
updateConfig(config); updateConfig(config);
@@ -48,7 +51,7 @@ onMounted(async () => {
</script> </script>
<template> <template>
<view class="root-container"> <view class="root-container" :style="{ paddingTop: isIos ? '45px' : '40px' }">
<AppBackground /> <AppBackground />
<!-- 根据登录状态显示用户信息或登录按钮 --> <!-- 根据登录状态显示用户信息或登录按钮 -->
<block v-if="user.id"> <block v-if="user.id">
@@ -162,10 +165,8 @@ onMounted(async () => {
<style scoped> <style scoped>
.root-container { .root-container {
height: calc(100vh - 40px);
color: white; color: white;
position: relative; position: relative;
padding-top: 40px;
} }
.container { .container {

View File

@@ -198,6 +198,7 @@ import Container from "@/components/Container.vue";
border: 1px solid #e4e4e4; border: 1px solid #e4e4e4;
border-radius: 4px; border-radius: 4px;
font-size: 14px; font-size: 14px;
color: #000;
} }
.table-header { .table-header {