计分本修改
This commit is contained in:
@@ -19,6 +19,10 @@ const props = defineProps({
|
|||||||
type: Function,
|
type: Function,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
editMode: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const rect = ref({});
|
const rect = ref({});
|
||||||
@@ -150,6 +154,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view
|
<view
|
||||||
|
:style="{ overflowY: editMode ? 'auto' : 'hidden' }"
|
||||||
class="container"
|
class="container"
|
||||||
@tap="onClick"
|
@tap="onClick"
|
||||||
@touchmove="onDrag"
|
@touchmove="onDrag"
|
||||||
@@ -231,7 +236,6 @@ onMounted(async () => {
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vw;
|
height: 100vw;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
.container::-webkit-scrollbar {
|
.container::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
|
|||||||
@@ -273,6 +273,6 @@ onBeforeUnmount(() => {
|
|||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin: 0 20rpx;
|
margin: 0 20rpx;
|
||||||
max-width: 280rpx;
|
max-width: 300rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
total: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const barColor = (rate) => {
|
const barColor = (rate) => {
|
||||||
@@ -15,20 +19,16 @@ const barColor = (rate) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const bars = computed(() => {
|
const bars = computed(() => {
|
||||||
let data = Object.values(props.data);
|
const newList = new Array(12).fill({ ring: 0, rate: 0 }).map((_, index) => {
|
||||||
if (!data.length) data = new Array(11).fill({ ring: 0, rate: 0 });
|
|
||||||
const newList = data.map((item, index) => {
|
|
||||||
let ring = index;
|
let ring = index;
|
||||||
if (ring === 11) ring = "M";
|
if (ring === 11) ring = "M";
|
||||||
if (ring === 0) ring = "X";
|
if (ring === 0) ring = "X";
|
||||||
return {
|
return {
|
||||||
ring: ring,
|
ring: ring,
|
||||||
rate: item,
|
rate: props.data[index] || 0,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (newList.length >= 12) {
|
|
||||||
[newList[0], newList[11]] = [newList[11], newList[0]];
|
[newList[0], newList[11]] = [newList[11], newList[0]];
|
||||||
}
|
|
||||||
return newList.reverse();
|
return newList.reverse();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,12 +44,12 @@ const ringText = (ring) => {
|
|||||||
<view>
|
<view>
|
||||||
<view v-for="(b, index) in bars" :key="index">
|
<view v-for="(b, index) in bars" :key="index">
|
||||||
<text v-if="b && b.rate">
|
<text v-if="b && b.rate">
|
||||||
{{ Number((b.rate * 100).toFixed(1)) }}%
|
{{ total === 0 ? `${Number((b.rate * 100).toFixed(1))}%` : b.rate }}
|
||||||
</text>
|
</text>
|
||||||
<view
|
<view
|
||||||
:style="{
|
:style="{
|
||||||
background: barColor(b.rate),
|
background: barColor(total === 0 ? b.rate : b.rate / total),
|
||||||
height: b.rate * 300 + 'rpx',
|
height: (total === 0 ? b.rate : b.rate / total) * 300 + 'rpx',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
@@ -64,6 +64,12 @@ const ringText = (ring) => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
min-height: 150rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
.container > view {
|
.container > view {
|
||||||
padding: 0 10rpx;
|
padding: 0 10rpx;
|
||||||
}
|
}
|
||||||
@@ -79,10 +85,11 @@ const ringText = (ring) => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 18rpx;
|
font-size: 18rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
width: 5vw;
|
||||||
}
|
}
|
||||||
.container > view:first-child > view > view {
|
.container > view:first-child > view > view {
|
||||||
|
width: 100%;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
width: 5vw;
|
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
.container > view:last-child {
|
.container > view:last-child {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted, computed } from "vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
||||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
|
import RingBarChart from "@/components/RingBarChart.vue";
|
||||||
|
|
||||||
import { getPointBookDetailAPI } from "@/apis";
|
import { getPointBookDetailAPI } from "@/apis";
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ const showTip = ref(false);
|
|||||||
const showTip2 = ref(false);
|
const showTip2 = ref(false);
|
||||||
const groups = ref([]);
|
const groups = ref([]);
|
||||||
const data = ref({});
|
const data = ref({});
|
||||||
const targetId = ref("");
|
const targetId = ref(0);
|
||||||
const targetSrc = ref("");
|
const targetSrc = ref("");
|
||||||
const arrows = ref([]);
|
const arrows = ref([]);
|
||||||
|
|
||||||
@@ -41,9 +42,18 @@ const goBack = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ringRates = computed(() => {
|
||||||
|
const rates = new Array(12).fill(0);
|
||||||
|
arrows.value.forEach((item) => {
|
||||||
|
if (item.ring === -1) rates[11] += 1;
|
||||||
|
else rates[item.ring] += 1;
|
||||||
|
});
|
||||||
|
return rates.map((r) => r / arrows.value.length);
|
||||||
|
});
|
||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
const result = await getPointBookDetailAPI(options.id);
|
const result = await getPointBookDetailAPI(options.id || 164);
|
||||||
const config = uni.getStorageSync("point-book-config");
|
const config = uni.getStorageSync("point-book-config");
|
||||||
config.targetOption.some((item) => {
|
config.targetOption.some((item) => {
|
||||||
if (item.id === result.targetType) {
|
if (item.id === result.targetType) {
|
||||||
@@ -54,7 +64,7 @@ onLoad(async (options) => {
|
|||||||
if (result.groups) {
|
if (result.groups) {
|
||||||
groups.value = result.groups;
|
groups.value = result.groups;
|
||||||
data.value = result.groups[0];
|
data.value = result.groups[0];
|
||||||
arrows.value = result.groups[0].list.filter((item) => item.x && item.y);
|
arrows.value = result.groups[0].list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -134,8 +144,56 @@ onLoad(async (options) => {
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
<BowTargetEdit :id="targetId" :src="targetSrc" :arrows="arrows" />
|
<BowTargetEdit
|
||||||
<view :style="{ marginTop: '20px' }">
|
:id="targetId"
|
||||||
|
:src="targetSrc"
|
||||||
|
:arrows="arrows.filter((item) => item.x && item.y)"
|
||||||
|
:editMode="false"
|
||||||
|
/>
|
||||||
|
<view class="title-bar">
|
||||||
|
<view />
|
||||||
|
<text>环值分布</text>
|
||||||
|
</view>
|
||||||
|
<view :style="{ padding: '0 30rpx' }">
|
||||||
|
<RingBarChart :data="ringRates" />
|
||||||
|
</view>
|
||||||
|
<view class="title-bar" :style="{ marginTop: '30rpx' }">
|
||||||
|
<view />
|
||||||
|
<text>{{
|
||||||
|
selectedIndex === 0 ? "每组环数" : `第${selectedIndex}组环数`
|
||||||
|
}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ring-text-groups">
|
||||||
|
<view v-for="(item, index) in groups" :key="index">
|
||||||
|
<text v-if="selectedIndex === 0 && index !== 0">{{
|
||||||
|
`第${index}组`
|
||||||
|
}}</text>
|
||||||
|
<view
|
||||||
|
v-if="
|
||||||
|
(selectedIndex === 0 && index !== 0) ||
|
||||||
|
(selectedIndex !== 0 && index === selectedIndex)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<text
|
||||||
|
v-for="(arrow, index2) in item.list"
|
||||||
|
:key="index2"
|
||||||
|
:style="{
|
||||||
|
color:
|
||||||
|
arrow.ring === 0 || arrow.ring === 10 ? '#FFA118' : '#666',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
arrow.ring === 0
|
||||||
|
? "X"
|
||||||
|
: arrow.ring === -1
|
||||||
|
? "M"
|
||||||
|
: arrow.ring + "环"
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view :style="{ marginBottom: '40rpx' }">
|
||||||
<SButton :onClick="goBack" :rounded="50">关闭</SButton>
|
<SButton :onClick="goBack" :rounded="50">关闭</SButton>
|
||||||
</view>
|
</view>
|
||||||
<ScreenHint2 :show="showTip || showTip2" :onClose="closeTip">
|
<ScreenHint2 :show="showTip || showTip2" :onClose="closeTip">
|
||||||
@@ -178,8 +236,7 @@ onLoad(async (options) => {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
width: 24vw;
|
width: 24vw;
|
||||||
height: 13vw;
|
height: 90rpx;
|
||||||
line-height: 13vw;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
@@ -188,6 +245,7 @@ onLoad(async (options) => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.tab-bar > view > text {
|
.tab-bar > view > text {
|
||||||
|
line-height: 90rpx;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
.tab-bar > view > image {
|
.tab-bar > view > image {
|
||||||
@@ -206,21 +264,24 @@ onLoad(async (options) => {
|
|||||||
.detail-data > view {
|
.detail-data > view {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 20rpx;
|
||||||
padding: 12px;
|
padding: 18rpx 24rpx;
|
||||||
}
|
}
|
||||||
.detail-data > view > view {
|
.detail-data > view > view {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
.detail-data > view > view > text {
|
||||||
|
word-break: keep-all;
|
||||||
}
|
}
|
||||||
.detail-data > view > text {
|
.detail-data > view > text {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
.question-mark {
|
.question-mark {
|
||||||
width: 15px;
|
width: 28rpx;
|
||||||
height: 15px;
|
height: 28rpx;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
.title-bar {
|
.title-bar {
|
||||||
@@ -231,15 +292,15 @@ onLoad(async (options) => {
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
.title-bar > view:first-child {
|
.title-bar > view:first-child {
|
||||||
width: 5px;
|
width: 8rpx;
|
||||||
height: 15px;
|
height: 28rpx;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: #fed847;
|
background-color: #fed847;
|
||||||
margin-right: 7px;
|
margin-right: 7px;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
.title-bar > text {
|
.title-bar > button {
|
||||||
margin-bottom: 2px;
|
height: 34rpx;
|
||||||
}
|
}
|
||||||
.tip-content {
|
.tip-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -258,4 +319,34 @@ onLoad(async (options) => {
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
.ring-text-groups {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 20rpx;
|
||||||
|
padding-top: 30rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
.ring-text-groups > view {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.ring-text-groups > view > text {
|
||||||
|
width: 82rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 27rpx;
|
||||||
|
}
|
||||||
|
.ring-text-groups > view > view {
|
||||||
|
flex: 1;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(6, auto);
|
||||||
|
grid-gap: 10rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
.ring-text-groups > view > view > text {
|
||||||
|
width: 60rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const isIOS = computed(() => {
|
|||||||
return systemInfo.osName === "ios";
|
return systemInfo.osName === "ios";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const loadImage = ref(false);
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const showTip = ref(false);
|
const showTip = ref(false);
|
||||||
const data = ref({
|
const data = ref({
|
||||||
@@ -75,6 +76,7 @@ const loadData = async () => {
|
|||||||
else if (result2.checkInCount >= 5) hot = 3;
|
else if (result2.checkInCount >= 5) hot = 3;
|
||||||
else if (result2.checkInCount === 7) hot = 4;
|
else if (result2.checkInCount === 7) hot = 4;
|
||||||
uni.$emit("update-hot", hot);
|
uni.$emit("update-hot", hot);
|
||||||
|
loadImage.value = true;
|
||||||
const generateHeatmapAsync = async () => {
|
const generateHeatmapAsync = async () => {
|
||||||
const weekArrows = result2.weekArrows
|
const weekArrows = result2.weekArrows
|
||||||
.filter((item) => item.x && item.y)
|
.filter((item) => item.x && item.y)
|
||||||
@@ -108,9 +110,11 @@ const loadData = async () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
heatMapImageSrc.value = finalPath;
|
heatMapImageSrc.value = finalPath;
|
||||||
|
loadImage.value = false;
|
||||||
console.log("热力图图片地址:", finalPath);
|
console.log("热力图图片地址:", finalPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("生成热力图图片失败:", error);
|
console.error("生成热力图图片失败:", error);
|
||||||
|
loadImage.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -282,6 +286,9 @@ onShareTimeline(() => {
|
|||||||
:src="heatMapImageSrc"
|
:src="heatMapImageSrc"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
|
<view v-if="loadImage" class="load-image">
|
||||||
|
<text>生成中...</text>
|
||||||
|
</view>
|
||||||
<canvas
|
<canvas
|
||||||
id="heatMapCanvas"
|
id="heatMapCanvas"
|
||||||
canvas-id="heatMapCanvas"
|
canvas-id="heatMapCanvas"
|
||||||
@@ -445,6 +452,17 @@ onShareTimeline(() => {
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
.load-image {
|
||||||
|
position: absolute;
|
||||||
|
width: 160rpx;
|
||||||
|
top: calc(50% - 65rpx);
|
||||||
|
left: calc(50% - 75rpx);
|
||||||
|
color: #525252;
|
||||||
|
font-size: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
.reward {
|
.reward {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -121,6 +121,9 @@ onShow(async () => {
|
|||||||
rankData.value = result;
|
rankData.value = result;
|
||||||
handleSelect(selectedIndex.value);
|
handleSelect(selectedIndex.value);
|
||||||
seasonData.value = result.seasonList;
|
seasonData.value = result.seasonList;
|
||||||
|
if (seasonData.value[0]) {
|
||||||
|
seasonName.value = seasonData.value[0].seasonName;
|
||||||
|
}
|
||||||
updateData();
|
updateData();
|
||||||
showSeasonList.value = false;
|
showSeasonList.value = false;
|
||||||
});
|
});
|
||||||
@@ -596,11 +599,13 @@ onShow(async () => {
|
|||||||
top: -44rpx;
|
top: -44rpx;
|
||||||
right: -30rpx;
|
right: -30rpx;
|
||||||
letter-spacing: 2px;
|
letter-spacing: 2px;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
.season-list > view {
|
.season-list > view {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
|
word-break: keep-all;
|
||||||
}
|
}
|
||||||
.season-list > view > image {
|
.season-list > view > image {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user