update:个人训练优化
This commit is contained in:
@@ -4,7 +4,7 @@ import { onHide, onLoad, onShow, onUnload } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import ShootProgress from "./components/ShootProgress.vue";
|
||||
import BowTarget from "./components/BowTarget.vue";
|
||||
import ScorePanel2 from "./components/ScorePanel2.vue";
|
||||
import ScorePanel2 from "@/components/TrainingScorePanel.vue";
|
||||
import ScoreResult from "./components/ScoreResult.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import BowPower from "@/components/BowPower.vue";
|
||||
@@ -48,6 +48,8 @@ const pageStage = ref(pageStages.LOADING);
|
||||
const scores = ref([]);
|
||||
// 只在实时 ShootResult 新增一箭时递增,避免同步快照重播飞箭特效。
|
||||
const shotEffectToken = ref(0);
|
||||
// 可见区域每次正式提交都递增,同一区域连续刷新也能触发动效。
|
||||
const precisionTargetRefreshToken = ref(0);
|
||||
const defaultTotal = 12;
|
||||
const defaultTargetType = 1;
|
||||
const total = ref(defaultTotal);
|
||||
@@ -253,17 +255,23 @@ const trainingCopy = computed(() => {
|
||||
practiceInfo.value.hitReq,
|
||||
trainingParams.value.hitReq
|
||||
);
|
||||
const arrowsLeft = getPracticeNumber(
|
||||
practiceInfo.value.arrowsLeft,
|
||||
total.value
|
||||
const targetArrows = getPositiveInteger(total.value);
|
||||
const arrowsLeft = Math.min(
|
||||
targetArrows,
|
||||
Math.max(
|
||||
0,
|
||||
getPracticeNumber(practiceInfo.value.arrowsLeft, targetArrows)
|
||||
)
|
||||
);
|
||||
const completedArrows = targetArrows - arrowsLeft;
|
||||
|
||||
return {
|
||||
title: `每箭命中${hitReq}环之上`,
|
||||
inline: true,
|
||||
details: [
|
||||
{ text: "剩余" },
|
||||
{ text: arrowsLeft, highlight: true },
|
||||
{ text: "箭达到条件" },
|
||||
{ text: "计时结束前需要有" },
|
||||
{ text: `(${completedArrows}/${targetArrows})`, highlight: true },
|
||||
{ text: "箭命中" },
|
||||
{ text: `${hitReq}环`, highlight: true },
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -281,35 +289,33 @@ const trainingCopy = computed(() => {
|
||||
const currentRings = getPracticeNumber(practiceInfo.value.currentRings);
|
||||
|
||||
return {
|
||||
title: `完成${targetArrows}箭并累计${targetRings}环`,
|
||||
inline: true,
|
||||
details: [
|
||||
{ text: "已完成" },
|
||||
{ text: currentArrows, highlight: true },
|
||||
{ text: "箭,累计" },
|
||||
{ text: currentRings, highlight: true },
|
||||
{ text: "计时结束前完成" },
|
||||
{ text: `(${currentArrows}/${targetArrows})`, highlight: true },
|
||||
{ text: "箭且累计命中" },
|
||||
{ text: `(${currentRings}/${targetRings})`, highlight: true },
|
||||
{ text: "环" },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (trainingType.value === "precision") {
|
||||
const block = precisionRandomBlock.value;
|
||||
const ring = precisionRandomRingArea.value;
|
||||
const arrowsLeft = getPracticeNumber(
|
||||
practiceInfo.value.arrowsLeft,
|
||||
total.value
|
||||
const targetArrows = getPositiveInteger(total.value);
|
||||
const arrowsLeft = Math.min(
|
||||
targetArrows,
|
||||
Math.max(
|
||||
0,
|
||||
getPracticeNumber(practiceInfo.value.arrowsLeft, targetArrows)
|
||||
)
|
||||
);
|
||||
const title = block
|
||||
? ring
|
||||
? `请命中区域${block}的${ring}环`
|
||||
: `请命中区域${block}`
|
||||
: "等待目标区域";
|
||||
const completedArrows = targetArrows - arrowsLeft;
|
||||
|
||||
return {
|
||||
title,
|
||||
inline: true,
|
||||
details: [
|
||||
{ text: "剩余" },
|
||||
{ text: arrowsLeft, highlight: true },
|
||||
{ text: "射箭命中高亮区域需完成" },
|
||||
{ text: `(${completedArrows}/${targetArrows})`, highlight: true },
|
||||
{ text: "箭" },
|
||||
],
|
||||
};
|
||||
@@ -563,7 +569,10 @@ const commitPrecisionTargetAfterPresentation = async ({
|
||||
) {
|
||||
return;
|
||||
}
|
||||
visiblePrecisionTarget.value = target;
|
||||
applyVisiblePrecisionTarget(target);
|
||||
if (precisionRandomBlock.value > 0) {
|
||||
precisionTargetRefreshToken.value += 1;
|
||||
}
|
||||
};
|
||||
|
||||
const createPracticeEndSnapshot = (message = {}) => {
|
||||
@@ -1329,6 +1338,7 @@ onBeforeUnmount(() => {
|
||||
:sectorCount="precisionBlocks"
|
||||
:activeSector="precisionRandomBlock"
|
||||
:activeRing="precisionRandomRingArea"
|
||||
:highlightRefreshToken="precisionTargetRefreshToken"
|
||||
:showSectorLabels="precisionBlocks > 0"
|
||||
stable-shot-effect
|
||||
@shot-effect-complete="onShotEffectComplete"
|
||||
@@ -1349,7 +1359,7 @@ onBeforeUnmount(() => {
|
||||
重置高亮
|
||||
</button>
|
||||
</view> -->
|
||||
<view class="sound-text-box">
|
||||
<view class="sound-row">
|
||||
<button class="sound-btn" hover-class="none" @click="updateSound">
|
||||
<image
|
||||
class="sound-icon"
|
||||
@@ -1357,6 +1367,8 @@ onBeforeUnmount(() => {
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</button>
|
||||
</view>
|
||||
<view class="sound-text-box">
|
||||
<view class="bat-text-big-box">
|
||||
<image
|
||||
class="dao-icon"
|
||||
@@ -1366,14 +1378,23 @@ onBeforeUnmount(() => {
|
||||
<view v-if="trainingCopy" class="bat-text-box">
|
||||
<view class="bat-text-small-box">
|
||||
<view class="text-round-box">
|
||||
<view class="text1">{{ trainingCopy.title }}</view>
|
||||
<view class="text2">
|
||||
<view v-if="trainingCopy.inline" class="training-copy-inline">
|
||||
<text
|
||||
v-for="(part, index) in trainingCopy.details"
|
||||
:key="index"
|
||||
:class="{ 'text2-yellow': part.highlight }"
|
||||
>{{ part.text }}</text>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="text1">{{ trainingCopy.title }}</view>
|
||||
<view class="text2">
|
||||
<text
|
||||
v-for="(part, index) in trainingCopy.details"
|
||||
:key="index"
|
||||
:class="{ 'text2-yellow': part.highlight }"
|
||||
>{{ part.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -1386,7 +1407,11 @@ onBeforeUnmount(() => {
|
||||
:enhanced="true"
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<ScorePanel2 :arrows="scores" :total="total" />
|
||||
<ScorePanel2
|
||||
:arrows="scores"
|
||||
:total="total"
|
||||
:trainingType="trainingType"
|
||||
/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<ScoreResult
|
||||
@@ -1494,6 +1519,12 @@ onBeforeUnmount(() => {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.sound-row {
|
||||
height: 70rpx;
|
||||
padding: 0 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.sound-text-box{
|
||||
height: 125rpx;
|
||||
padding: 0 56rpx;
|
||||
@@ -1503,6 +1534,9 @@ onBeforeUnmount(() => {
|
||||
.sound-btn {
|
||||
width: 76rpx;
|
||||
height: 70rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
@@ -1515,7 +1549,7 @@ onBeforeUnmount(() => {
|
||||
height: 70rpx;
|
||||
}
|
||||
.bat-text-big-box{
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.dao-icon{
|
||||
@@ -1530,11 +1564,13 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
.bat-text-box{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
.bat-text-small-box{
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
width: auto;
|
||||
width: 100%;
|
||||
min-width: 100rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx 60rpx 60rpx 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -1545,6 +1581,15 @@ onBeforeUnmount(() => {
|
||||
font-size: 30rpx;
|
||||
color: #E7BA80;
|
||||
}
|
||||
.training-copy-inline {
|
||||
width: 100%;
|
||||
color: #FFFFFF;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
line-height: 40rpx;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
.text1{
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
|
||||
Reference in New Issue
Block a user