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

148 lines
3.0 KiB
Vue
Raw Normal View History

2025-07-30 09:55:15 +08:00
<script setup>
2025-08-05 11:51:09 +08:00
import { ref, onMounted } from "vue";
2025-07-30 09:55:15 +08:00
const props = defineProps({
2025-08-05 11:51:09 +08:00
data: {
type: Object,
2025-07-30 09:55:15 +08:00
default: () => {},
},
2025-11-04 11:54:22 +08:00
longPress: {
type: Function,
default: () => {},
},
2025-07-30 09:55:15 +08:00
});
2025-08-05 11:51:09 +08:00
const bowOptions = ref({});
const targetOptions = ref({});
2025-09-24 21:05:06 +08:00
const toDetailPage = () => {
uni.navigateTo({
url: `/pages/point-book-detail?id=${props.data.id}`,
});
};
2025-08-05 11:51:09 +08:00
onMounted(() => {
const result = uni.getStorageSync("point-book-config");
(result.bowOption || []).forEach((item) => {
bowOptions.value[item.id] = item;
});
(result.targetOption || []).forEach((item) => {
targetOptions.value[item.id] = item;
});
});
2025-07-30 09:55:15 +08:00
</script>
<template>
2025-11-04 14:18:44 +08:00
<view
class="container"
@click="toDetailPage"
@longpress="longPress(props.data)"
>
<view class="left-part">
2025-07-30 09:55:15 +08:00
<view class="labels">
2025-09-24 21:05:06 +08:00
<view></view>
2025-08-05 11:51:09 +08:00
<text>{{
bowOptions[data.bowType] ? bowOptions[data.bowType].name : ""
}}</text>
<text>{{ data.distance }} </text>
<text>{{
targetOptions[data.targetType]
? targetOptions[data.targetType].name
: ""
}}</text>
2025-07-30 09:55:15 +08:00
</view>
<view>
2025-08-05 11:51:09 +08:00
<text>{{ data.createAt }}</text>
2025-07-30 09:55:15 +08:00
</view>
2025-09-24 21:05:06 +08:00
<view>
2025-10-09 09:30:05 +08:00
<text>黄心率{{ Number((data.yellowRate * 100).toFixed(2)) }}%</text>
2025-09-24 21:05:06 +08:00
<text>10环数{{ data.tenRings }}</text>
<text>平均{{ data.averageRing }}</text>
</view>
2025-07-30 09:55:15 +08:00
</view>
2025-11-04 14:18:44 +08:00
<view class="right-part">
2025-07-30 09:55:15 +08:00
<image src="../static/bow-target.png" mode="widthFix" />
2025-09-24 21:05:06 +08:00
<view class="arrow-amount">
2025-11-04 11:54:22 +08:00
<text>{{ data.actualTotalRing }}</text>
<text>/</text>
<text>{{ data.totalRing }}</text>
2025-07-30 09:55:15 +08:00
</view>
</view>
</view>
</template>
<style scoped>
.container {
background-color: #fff;
display: flex;
2025-09-24 21:05:06 +08:00
align-items: center;
border-radius: 25rpx;
margin-bottom: 25rpx;
height: 200rpx;
2025-10-03 11:15:48 +08:00
border: 2rpx solid #fed848;
2025-11-04 14:18:44 +08:00
padding-left: 30rpx;
padding-right: 10rpx;
2025-07-30 09:55:15 +08:00
}
.container > view {
position: relative;
}
2025-11-04 14:18:44 +08:00
.left-part {
2025-09-24 21:05:06 +08:00
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100% - 50rpx);
color: #333333;
2025-07-30 09:55:15 +08:00
}
2025-11-04 14:18:44 +08:00
.left-part > view {
2025-07-30 09:55:15 +08:00
width: 100%;
2025-09-24 21:05:06 +08:00
display: flex;
position: relative;
}
2025-11-04 14:18:44 +08:00
.left-part > view:nth-child(3) {
2025-07-30 09:55:15 +08:00
display: flex;
align-items: center;
2025-09-24 21:05:06 +08:00
font-size: 20rpx;
color: #666;
2025-07-30 09:55:15 +08:00
}
2025-11-04 14:18:44 +08:00
.left-part > view:nth-child(3) > text {
2025-09-24 21:05:06 +08:00
margin-right: 10rpx;
2025-08-05 15:58:43 +08:00
}
2025-11-04 14:18:44 +08:00
.right-part > image {
width: 180rpx;
}
2025-07-30 09:55:15 +08:00
.labels {
align-items: flex-end !important;
}
2025-09-24 21:05:06 +08:00
.labels > view:first-child {
position: absolute;
bottom: 0;
height: 10rpx;
background: #fee947;
border-radius: 5rpx;
width: 300rpx;
}
2025-07-30 09:55:15 +08:00
.labels > text {
2025-09-24 21:05:06 +08:00
font-size: 26rpx;
2025-07-30 09:55:15 +08:00
margin-right: 10px;
2025-09-24 21:05:06 +08:00
position: relative;
2025-09-27 10:09:02 +08:00
color: #333;
2025-07-30 09:55:15 +08:00
}
2025-09-24 21:05:06 +08:00
.arrow-amount {
2025-07-30 09:55:15 +08:00
position: absolute;
background-color: #0009;
2025-11-04 11:54:22 +08:00
border-radius: 12px;
2025-07-30 09:55:15 +08:00
color: #fffc;
2025-11-04 11:54:22 +08:00
font-size: 24rpx;
line-height: 26px;
width: 64px;
2025-07-30 09:55:15 +08:00
display: flex;
justify-content: center;
2025-11-04 11:54:22 +08:00
top: calc(50% - 15px);
left: calc(50% - 32px);
2025-07-30 09:55:15 +08:00
}
2025-11-04 11:54:22 +08:00
.arrow-amount > text:nth-child(1) {
font-size: 30rpx;
2025-07-30 09:55:15 +08:00
color: #fff;
}
</style>