页面优化

This commit is contained in:
kron
2025-06-05 22:21:40 +08:00
parent 38019f1100
commit 79ef6d978d
8 changed files with 80 additions and 82 deletions

View File

@@ -75,7 +75,7 @@ function calcRealY(num) {
<style scoped> <style scoped>
.container { .container {
width: calc(100% - 30px); width: calc(100% - 30px);
margin: 15px; padding: 15px;
overflow: hidden; overflow: hidden;
} }
.target { .target {

View File

@@ -26,11 +26,12 @@ defineProps({
<style scoped> <style scoped>
.content { .content {
width: 100%; width: 100%;
height: calc(100vh - 96px); height: calc(100vh - 116px);
overflow: auto; overflow: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding-bottom: 10px;
} }
</style> </style>

View File

@@ -33,15 +33,14 @@ defineProps({
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 15px; padding: 0 15px;
width: 100%; width: clac(100% - 30px);
} }
.container > image { .container > image {
width: 20%; width: 20%;
} }
.container > view { .container > view {
position: relative; position: relative;
width: 75%; width: 80%;
padding-right: 25px;
min-height: 55px; min-height: 55px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -49,7 +48,7 @@ defineProps({
.container > view > image { .container > view > image {
position: absolute; position: absolute;
left: -7%; left: -7%;
width: 98%; width: 108%;
} }
.container > view { .container > view {
color: #fff; color: #fff;

View File

@@ -97,7 +97,7 @@ setTimeout(() => {
:onClick="() => (showComment = true)" :onClick="() => (showComment = true)"
/> />
<SButton width="70vw" :rounded="30" :onClick="closePanel" <SButton width="70vw" :rounded="30" :onClick="closePanel"
>下一步</SButton >完成</SButton
> >
</view> </view>
</view> </view>

View File

@@ -117,7 +117,7 @@ onUnmounted(() => {
<view v-if="step === 3"> <view v-if="step === 3">
<ShootProgress tips="请红队射箭-第一轮" /> <ShootProgress tips="请红队射箭-第一轮" />
<PlayersRow :blueTeam="teams" :redTeam="teams" /> <PlayersRow :blueTeam="teams" :redTeam="teams" />
<BowTarget :power="45" :currentRound="1" :totalRound="3" debug /> <BowTarget :power="45" :currentRound="1" :totalRound="3" />
<BattleFooter :blueTeam="[6, 2, 3]" :redTeam="[4, 5, 2]" /> <BattleFooter :blueTeam="[6, 2, 3]" :redTeam="[4, 5, 2]" />
</view> </view>
</Container> </Container>

View File

@@ -194,11 +194,9 @@ const onClose = () => {
:result="practiseResult" :result="practiseResult"
/> />
</view> </view>
<view :style="{ marginBottom: '25px' }">
<SButton v-if="step !== 4" :onClick="nextStep" :disabled="btnDisabled">{{ <SButton v-if="step !== 4" :onClick="nextStep" :disabled="btnDisabled">{{
stepButtonTexts[step] stepButtonTexts[step]
}}</SButton> }}</SButton>
</view>
</Container> </Container>
</template> </template>

View File

@@ -1,7 +1,6 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onUnmounted } from "vue";
import AppBackground from "@/components/AppBackground.vue"; import Container from "@/components/Container.vue";
import Header from "@/components/Header.vue";
import ShootProgress from "@/components/ShootProgress.vue"; import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue"; import BowTarget from "@/components/BowTarget.vue";
import ScorePanel2 from "@/components/ScorePanel2.vue"; import ScorePanel2 from "@/components/ScorePanel2.vue";
@@ -24,7 +23,7 @@ const onReady = async () => {
async function onReceiveMessage(content) { async function onReceiveMessage(content) {
const messages = JSON.parse(content).data.updates || []; const messages = JSON.parse(content).data.updates || [];
messages.forEach((msg) => { messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) { if (start.value && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target); scores.value.push(msg.target);
power.value = msg.target.battery; power.value = msg.target.battery;
if (scores.value.length === total) { if (scores.value.length === total) {
@@ -40,6 +39,11 @@ async function onReceiveMessage(content) {
}); });
} }
function onComplete() {
uni.navigateBack();
showScore.value = false;
}
onMounted(() => { onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
@@ -50,9 +54,8 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<view class="container"> <Container :bgType="1" title="个人单组练习">
<AppBackground :type="1" /> <view>
<Header title="个人单组练习" />
<ShootProgress <ShootProgress
:tips="`${ :tips="`${
scores.length === 12 scores.length === 12
@@ -74,15 +77,12 @@ onUnmounted(() => {
:total="total" :total="total"
:rowCount="6" :rowCount="6"
:show="showScore" :show="showScore"
:onClose="() => (showScore = false)" :onClose="onComplete"
:result="practiseResult" :result="practiseResult"
/> />
<SButton v-if="!start" :onClick="onReady">准备好了直接开始</SButton>
</view> </view>
<SButton v-if="!start" :onClick="onReady">准备好了直接开始</SButton>
</Container>
</template> </template>
<style scoped> <style scoped></style>
.container {
position: relative;
}
</style>

View File

@@ -1,7 +1,6 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onUnmounted } from "vue";
import AppBackground from "@/components/AppBackground.vue"; import Container from "@/components/Container.vue";
import Header from "@/components/Header.vue";
import ShootProgress from "@/components/ShootProgress.vue"; import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue"; import BowTarget from "@/components/BowTarget.vue";
import ScorePanel from "@/components/ScorePanel.vue"; import ScorePanel from "@/components/ScorePanel.vue";
@@ -24,7 +23,7 @@ const onReady = async () => {
async function onReceiveMessage(content) { async function onReceiveMessage(content) {
const messages = JSON.parse(content).data.updates || []; const messages = JSON.parse(content).data.updates || [];
messages.forEach((msg) => { messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) { if (start.value && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target); scores.value.push(msg.target);
if (scores.value.length === total) { if (scores.value.length === total) {
showScore.value = true; showScore.value = true;
@@ -39,6 +38,11 @@ async function onReceiveMessage(content) {
}); });
} }
function onComplete() {
uni.navigateBack();
showScore.value = false;
}
onMounted(() => { onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
@@ -49,9 +53,8 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<view class="container"> <Container :bgType="1" title="个人单组练习">
<AppBackground :type="1" /> <view>
<Header title="个人耐力挑战" />
<ShootProgress :tips="`请连续射箭${total}支`" :total="120" /> <ShootProgress :tips="`请连续射箭${total}支`" :total="120" />
<BowTarget <BowTarget
:totalRound="total" :totalRound="total"
@@ -70,15 +73,12 @@ onUnmounted(() => {
:total="total" :total="total"
:rowCount="9" :rowCount="9"
:show="showScore" :show="showScore"
:onClose="() => (showScore = false)" :onClose="onComplete"
:result="practiseResult" :result="practiseResult"
/> />
<SButton v-if="!start" :onClick="onReady">准备好了直接开始</SButton>
</view> </view>
<SButton v-if="!start" :onClick="onReady">准备好了直接开始</SButton>
</Container>
</template> </template>
<style scoped> <style scoped></style>
.container {
position: relative;
}
</style>