Files
shoot-miniprograms/src/components/ScoreResult.vue

195 lines
4.6 KiB
Vue
Raw Normal View History

2025-05-10 16:57:36 +08:00
<script setup>
import { ref } from "vue";
import IconButton from "@/components/IconButton.vue";
import SButton from "@/components/SButton.vue";
2025-06-02 16:07:11 +08:00
import ImageShare from "@/components/ImageShare.vue";
2025-06-19 21:03:33 +08:00
import ScreenHint from "@/components/ScreenHint.vue";
2025-06-15 15:53:57 +08:00
import BowData from "@/components/BowData.vue";
2025-05-10 16:57:36 +08:00
const props = defineProps({
show: {
type: Boolean,
default: false,
},
onClose: {
type: Function,
default: () => {},
},
rowCount: {
type: Number,
default: 0,
},
total: {
type: Number,
default: 0,
},
2025-05-31 14:57:25 +08:00
result: {
type: Object,
default: () => ({}),
2025-05-29 23:45:44 +08:00
},
2025-05-10 16:57:36 +08:00
});
const showPanel = ref(true);
const showComment = ref(false);
2025-06-02 16:07:11 +08:00
const showShare = ref(false);
2025-06-15 15:53:57 +08:00
const showBowData = ref(false);
2025-05-10 16:57:36 +08:00
const closePanel = () => {
showPanel.value = false;
setTimeout(() => {
props.onClose();
}, 300);
};
setTimeout(() => {
showPanel.value = true;
}, 300);
</script>
<template>
2025-05-31 14:57:25 +08:00
<view
v-if="result.arrows && result.arrows.length > 0"
class="container"
:style="{ display: show ? 'block' : 'none' }"
>
2025-05-10 16:57:36 +08:00
<view :class="['container-header', showPanel ? 'scale-in' : 'scale-out']">
<image src="../static/finish-tip.png" mode="widthFix" />
<image src="../static/finish-frame.png" mode="widthFix" />
2025-05-29 23:45:44 +08:00
<text
2025-05-30 17:34:59 +08:00
>完成<text class="gold-text">{{ total }}</text
>获得<text class="gold-text">{{
2025-05-31 14:57:25 +08:00
result.arrows
.map((a) => a.ring)
.reduce((last, next) => last + next, 0)
2025-05-30 17:34:59 +08:00
}}</text
>点经验</text
2025-05-29 23:45:44 +08:00
>
2025-05-10 16:57:36 +08:00
</view>
<view
class="container-content"
:style="{ transform: `translateY(${showPanel ? '0%' : '100%'})` }"
>
<view>
2025-05-29 23:45:44 +08:00
<text
2025-06-18 21:30:54 +08:00
>本局成绩{{
result.arrows.reduce((last, next) => last + next.ring, 0)
2025-05-29 23:45:44 +08:00
}}</text
>
2025-06-15 15:53:57 +08:00
<button @click="() => (showBowData = true)">
2025-05-10 16:57:36 +08:00
<text>查看靶纸</text>
<image
src="../static/enter-arrow-blue.png"
mode="widthFix"
:style="{ width: '20px' }"
/>
</button>
</view>
<view :style="{ gridTemplateColumns: `repeat(${rowCount}, 1fr)` }">
2025-05-31 14:57:25 +08:00
<view v-for="(score, index) in result.arrows" :key="index">
{{ score.ring }}<text></text>
2025-05-10 16:57:36 +08:00
</view>
</view>
<view>
2025-06-02 16:07:11 +08:00
<IconButton
name="分享"
src="../static/share.png"
:onClick="() => (showShare = true)"
/>
2025-05-10 16:57:36 +08:00
<IconButton
name="教练点评"
src="../static/review.png"
:onClick="() => (showComment = true)"
/>
2025-06-14 22:45:07 +08:00
<SButton width="70vw" :rounded="30" :onClick="closePanel">完成</SButton>
2025-05-10 16:57:36 +08:00
</view>
</view>
2025-06-02 16:07:11 +08:00
<ImageShare :show="showShare" :onClose="() => (showShare = false)" />
2025-06-19 21:03:33 +08:00
<ScreenHint :show="showComment" :onClose="() => (showComment = false)">
2025-05-31 14:57:25 +08:00
{{ result.adjustmentHint }}
2025-06-19 21:03:33 +08:00
</ScreenHint>
2025-06-15 15:53:57 +08:00
<BowData
:arrows="result.arrows"
:show="showBowData"
:onClose="() => (showBowData = false)"
/>
2025-05-10 16:57:36 +08:00
</view>
</template>
<style scoped>
.container {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.6);
2025-06-14 22:45:07 +08:00
z-index: 5;
2025-05-10 16:57:36 +08:00
}
.container-header {
margin-top: 20vh;
display: flex;
flex-direction: column;
align-items: center;
opacity: 0;
}
.container-header > text:last-child {
color: #fff;
text-align: center;
2025-06-19 01:55:40 +08:00
margin-top: -85px;
2025-05-10 16:57:36 +08:00
}
.container-content {
width: calc(100vw - 20px);
background-color: #fff;
position: absolute;
bottom: 0;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 15px 10px;
transition: all 0.3s ease;
transform: translateY(0);
}
.container-content > view:first-child {
display: flex;
justify-content: space-between;
align-items: center;
}
2025-06-18 21:30:54 +08:00
.container-content > view:first-child > text:first-child {
color: #000;
}
2025-05-10 16:57:36 +08:00
.container-content > view:first-child > button {
display: flex;
align-items: center;
color: #287fff;
font-size: 14px;
}
.container-content > view:nth-child(2) {
display: grid;
row-gap: 10px;
column-gap: 5px;
justify-content: flex-start;
margin: 10px 0;
}
.container-content > view:nth-child(2) > view {
background: linear-gradient(#fbfbfb, #f5f5f5);
border: 1px solid #e5e5e5;
border-radius: 5px;
text-align: center;
line-height: 27px;
color: #333333;
}
.container-content > view:nth-child(2) > view > text {
font-size: 12px;
color: #666666;
margin-left: 3px;
}
.container-content > view:nth-child(3) {
width: 100%;
display: flex;
justify-content: space-around;
}
2025-05-30 17:34:59 +08:00
.gold-text {
color: #fed847;
font-size: 20px;
margin: 0 2px;
}
2025-05-10 16:57:36 +08:00
</style>