This commit is contained in:
kron
2025-07-03 21:12:59 +08:00
parent 23041e460b
commit 18ce93b12f
5 changed files with 72 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ 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";
import ScreenHint from "@/components/ScreenHint.vue"; import ScreenHint from "@/components/ScreenHint.vue";
import { getCurrentGameAPI } from "@/apis";
defineProps({ defineProps({
title: { title: {
type: String, type: String,
@@ -27,16 +28,21 @@ defineProps({
}); });
const isIos = ref(true); const isIos = ref(true);
const showHint = ref(false); const showHint = ref(false);
const hintMessage = ref(""); const hintType = ref(0);
onMounted(() => { onMounted(() => {
const deviceInfo = uni.getDeviceInfo(); const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios"; isIos.value = deviceInfo.osName === "ios";
}); });
const showGlobalHint = (message) => { const showGlobalHint = (type) => {
hintMessage.value = message; hintType.value = type;
showHint.value = true; showHint.value = true;
}; };
uni.$showHint = showGlobalHint; uni.$showHint = showGlobalHint;
const backToGame = async () => {
const result = await getCurrentGameAPI();
console.log(111, result);
};
</script> </script>
<template> <template>
@@ -45,12 +51,23 @@ uni.$showHint = showGlobalHint;
<Header v-if="!isHome" :title="title" :onBack="onBack" /> <Header v-if="!isHome" :title="title" :onBack="onBack" />
<view <view
class="content" class="content"
:style="{ height: isHome ? '100vh' : `calc(100vh - ${isIos ? 98 : 95}px)`, overflow }" :style="{
height: isHome ? '100vh' : `calc(100vh - ${isIos ? 98 : 95}px)`,
overflow,
}"
> >
<slot></slot> <slot></slot>
</view> </view>
<ScreenHint :show="showHint" :onClose="() => (showHint = false)"> <ScreenHint :show="showHint">
{{ hintMessage }} <view v-if="hintType === 1" class="back-to-game">
<text>您还有正在进行中的对局是否进入</text>
<view>
<button hover-class="none" @click="backToGame">进入</button>
<button hover-class="none" @click="() => (showHint = false)">
不进入
</button>
</view>
</view>
</ScreenHint> </ScreenHint>
</view> </view>
</template> </template>
@@ -66,4 +83,32 @@ uni.$showHint = showGlobalHint;
justify-content: space-between; justify-content: space-between;
overflow-x: hidden; overflow-x: hidden;
} }
.back-to-game {
flex-direction: column;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
width: 100%;
font-size: 14px;
}
.back-to-game > view {
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 50rpx;
width: 100%;
}
.back-to-game > view > button {
padding: 12px;
border-radius: 20px;
background-color: #fff6;
color: #fff;
width: 45%;
font-size: 16px;
}
.back-to-game > view > button:first-child {
background-color: #fed847;
color: #000;
}
</style> </style>

View File

@@ -8,20 +8,30 @@ const props = defineProps({
}, },
onClose: { onClose: {
type: Function, type: Function,
default: () => {}, default: null,
}, },
mode: { mode: {
type: String, type: String,
default: "normal", default: "normal",
}, },
}); });
const getContentHeight = () => {
if (props.mode === "tall") return "47vw";
if (props.mode === "square") return "74vw";
return '36vw'
};
</script> </script>
<template> <template>
<view class="container" :style="{ display: show ? 'flex' : 'none' }"> <view class="container" :style="{ display: show ? 'flex' : 'none' }">
<view class="scale-in"> <view class="scale-in" :style="{ height: getContentHeight() }">
<image <image
v-if="mode === 'normal'" v-if="mode === 'normal'"
src="../static/screen-hint-bg.png"
mode="widthFix"
/>
<image
v-if="mode === 'tall'"
src="../static/coach-comment.png" src="../static/coach-comment.png"
mode="widthFix" mode="widthFix"
/> />
@@ -38,6 +48,7 @@ const props = defineProps({
<slot /> <slot />
</view> </view>
<IconButton <IconButton
v-if="!!onClose"
src="../static/close-gold-outline.png" src="../static/close-gold-outline.png"
:width="30" :width="30"
:onClick="onClose" :onClick="onClose"
@@ -64,15 +75,14 @@ const props = defineProps({
justify-content: center; justify-content: center;
position: relative; position: relative;
width: 70vw; width: 70vw;
min-height: 22vh;
margin-bottom: 20px;
color: #fff; color: #fff;
margin-bottom: 15px;
} }
.container > view:first-child > image { .container > view:first-child > image {
position: absolute; position: absolute;
width: 80vw; width: 80vw;
left: -7%; left: -7%;
bottom: -20vw; bottom: -18vw;
z-index: -1; z-index: -1;
transform: translateY(-75px); transform: translateY(-75px);
} }

View File

@@ -212,7 +212,6 @@ const backToHome = () => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 14px; font-size: 14px;
transform: translateX(10px) translateY(-10px);
} }
.scan-tips > text { .scan-tips > text {
margin-bottom: 2px; margin-bottom: 2px;

View File

@@ -136,15 +136,15 @@ const toRankListPage = () => {
</view> </view>
<view> <view>
<text>赛季平均环数</text> <text>赛季平均环数</text>
<text :style="{ color: '#FFD947' }" <text :style="{ color: '#FFD947' }">{{
>{{ user.avg_ring || "-" }}</text user.avg_ring ? user.avg_ring + "" : "-"
> }}</text>
</view> </view>
<view> <view>
<text>赛季胜率</text> <text>赛季胜率</text>
<text :style="{ color: '#FF507E' }" <text :style="{ color: '#FF507E' }">{{
>{{ user.avg_win || "-" }}%</text user.avg_win ? user.avg_win + "%" : "-"
> }}</text>
</view> </view>
</view> </view>
<view class="rank-type"> <view class="rank-type">

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB