2025-07-30 09:55:15 +08:00
|
|
|
|
<script setup>
|
2025-11-05 09:36:37 +08:00
|
|
|
|
import { ref, onMounted, computed } from "vue";
|
2025-08-05 11:51:09 +08:00
|
|
|
|
|
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 14:38:16 +08:00
|
|
|
|
onRemove: {
|
2025-11-04 11:54:22 +08:00
|
|
|
|
type: Function,
|
2025-11-05 09:36:37 +08:00
|
|
|
|
default: null,
|
2025-11-04 11:54:22 +08:00
|
|
|
|
},
|
2025-07-30 09:55:15 +08:00
|
|
|
|
});
|
2025-08-05 11:51:09 +08:00
|
|
|
|
const bowOptions = ref({});
|
|
|
|
|
|
const targetOptions = ref({});
|
2025-11-04 17:41:50 +08:00
|
|
|
|
// 使用插槽自定义右侧按钮为图标,若需要文字按钮可恢复 rightOptions
|
2025-08-05 11:51:09 +08:00
|
|
|
|
|
2025-11-05 09:36:37 +08:00
|
|
|
|
// 根据是否传入 onRemove 来决定是否允许左滑
|
|
|
|
|
|
const canSwipe = computed(() => typeof props.onRemove === "function");
|
|
|
|
|
|
|
2025-09-24 21:05:06 +08:00
|
|
|
|
const toDetailPage = () => {
|
2025-11-05 13:38:37 +08:00
|
|
|
|
const config = uni.getStorageSync("point-book-config");
|
|
|
|
|
|
const bowType = config.bowOption.find(
|
|
|
|
|
|
(item) => item.id === props.data.bowType
|
|
|
|
|
|
);
|
|
|
|
|
|
const bowtargetType = config.targetOption.find(
|
|
|
|
|
|
(item) => item.id === props.data.targetType
|
|
|
|
|
|
);
|
|
|
|
|
|
uni.setStorageSync("point-book", {
|
|
|
|
|
|
bowType,
|
|
|
|
|
|
bowtargetType,
|
|
|
|
|
|
distance: props.data.distance,
|
|
|
|
|
|
amountGroup: props.data.groups,
|
|
|
|
|
|
});
|
2025-09-24 21:05:06 +08:00
|
|
|
|
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-11-04 14:38:16 +08:00
|
|
|
|
|
|
|
|
|
|
const onSwipeActionClick = () => {
|
|
|
|
|
|
if (typeof props.onRemove === "function") props.onRemove(props.data);
|
|
|
|
|
|
};
|
2025-07-30 09:55:15 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-11-04 14:38:16 +08:00
|
|
|
|
<uni-swipe-action>
|
2025-11-05 09:36:37 +08:00
|
|
|
|
<uni-swipe-action-item :disabled="!canSwipe" @change="() => {}">
|
|
|
|
|
|
<template v-slot:right v-if="canSwipe">
|
2025-11-04 17:41:50 +08:00
|
|
|
|
<view class="swipe-right" @click="onSwipeActionClick">
|
2025-11-05 09:36:37 +08:00
|
|
|
|
<image
|
|
|
|
|
|
class="swipe-icon"
|
|
|
|
|
|
src="../static/delete-white.png"
|
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
|
/>
|
2025-11-04 17:41:50 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
2025-11-04 14:38:16 +08:00
|
|
|
|
<view class="container" @click="toDetailPage">
|
|
|
|
|
|
<view class="left-part">
|
|
|
|
|
|
<view class="labels">
|
|
|
|
|
|
<view></view>
|
|
|
|
|
|
<text>{{
|
|
|
|
|
|
bowOptions[data.bowType] ? bowOptions[data.bowType].name : ""
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
<text>{{ data.distance }} 米</text>
|
|
|
|
|
|
<text>{{
|
|
|
|
|
|
targetOptions[data.targetType]
|
|
|
|
|
|
? targetOptions[data.targetType].name
|
|
|
|
|
|
: ""
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<text>{{ data.createAt }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<text
|
|
|
|
|
|
>黄心率:{{ Number((data.yellowRate * 100).toFixed(2)) }}%</text
|
|
|
|
|
|
>
|
|
|
|
|
|
<text>10环数:{{ data.tenRings }}</text>
|
|
|
|
|
|
<text>平均:{{ data.averageRing }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="right-part">
|
|
|
|
|
|
<image src="../static/bow-target.png" mode="widthFix" />
|
|
|
|
|
|
<view class="arrow-amount">
|
|
|
|
|
|
<text>{{ data.actualTotalRing }}</text>
|
|
|
|
|
|
<text>/</text>
|
|
|
|
|
|
<text>{{ data.totalRing }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-07-30 09:55:15 +08:00
|
|
|
|
</view>
|
2025-11-04 14:38:16 +08:00
|
|
|
|
</uni-swipe-action-item>
|
|
|
|
|
|
</uni-swipe-action>
|
2025-07-30 09:55:15 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.container {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
display: flex;
|
2025-09-24 21:05:06 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
border-radius: 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-11-04 14:38:16 +08:00
|
|
|
|
height: 180rpx;
|
2025-11-04 14:18:44 +08:00
|
|
|
|
}
|
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;
|
|
|
|
|
|
}
|
2025-11-04 17:41:50 +08:00
|
|
|
|
|
|
|
|
|
|
/* 右侧滑动按钮(自定义宽度与图标) */
|
|
|
|
|
|
.swipe-right {
|
|
|
|
|
|
width: 120rpx; /* 这里可按需调整按钮宽度 */
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
background-color: #ff7c7c;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.swipe-icon {
|
|
|
|
|
|
width: 44rpx;
|
|
|
|
|
|
height: 44rpx;
|
|
|
|
|
|
}
|
2025-07-30 09:55:15 +08:00
|
|
|
|
</style>
|