Files
shoot-miniprograms/src/pages/mine-bow-data.vue

105 lines
2.5 KiB
Vue
Raw Normal View History

2025-06-24 13:18:03 +08:00
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import BowTarget from "@/components/BowTarget.vue";
import ScorePanel from "@/components/ScorePanel.vue";
import { getPractiseAPI } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const arrows = ref([]);
2025-08-27 18:41:42 +08:00
const total = ref(0);
2025-06-24 13:18:03 +08:00
onLoad(async (options) => {
2026-02-10 14:48:07 +08:00
if (!options.id) return;
const result = await getPractiseAPI(options.id || 176);
arrows.value = result.details;
total.value = result.details.length;
2025-06-24 13:18:03 +08:00
});
</script>
<template>
2025-07-14 13:39:10 +08:00
<Container title="靶纸">
2025-06-24 13:18:03 +08:00
<view class="container">
<!-- <view class="header">
<view>
<Avatar :src="user.avatar" frame />
<view>
<text>{{ user.nickName }}</text>
<text>{{ user.lvlName }}</text>
</view>
</view>
</view> -->
<view :style="{ marginBottom: '20px' }">
2025-07-16 09:33:33 +08:00
<BowTarget :scores="arrows" />
2025-06-24 13:18:03 +08:00
</view>
<view class="desc">
<text>{{ arrows.length }}</text>
<text>支箭</text>
<text>{{ arrows.reduce((a, b) => a + b.ring, 0) }}</text>
<text></text>
</view>
<ScorePanel
2025-06-25 22:02:10 +08:00
:completeEffect="false"
2025-08-27 18:41:42 +08:00
:rowCount="total === 12 ? 6 : 9"
:total="total"
2026-02-09 17:27:44 +08:00
:arrows="arrows"
2025-06-24 13:18:03 +08:00
:margin="arrows.length === 12 ? 4 : 1"
:fontSize="arrows.length === 12 ? 25 : 22"
/>
</view>
</Container>
</template>
<style scoped>
.container {
width: 100%;
flex-direction: column;
justify-content: center;
align-items: center;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
width: calc(100% - 20px);
padding: 10px;
}
.header > view:first-child {
display: flex;
align-items: center;
margin-left: 10px;
}
.header > view:first-child > view:last-child {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-left: 10px;
color: #fff;
}
.header > view:first-child > view:last-child > text:last-child {
font-size: 10px;
color: #fff9;
background-color: #5f51ff;
padding: 2px 5px;
border-radius: 10px;
margin-top: 5px;
}
.header > view:last-child > image {
width: 40px;
}
.desc {
color: #fff;
margin-bottom: 40px;
width: 100%;
text-align: center;
}
2025-06-30 17:28:21 +08:00
.desc > text:nth-child(1),
.desc > text:nth-child(3) {
2025-06-24 13:18:03 +08:00
color: #fed847;
}
</style>