UI调整
This commit is contained in:
@@ -90,9 +90,7 @@ function calcRealY(num) {
|
|||||||
class="e-value fade-in"
|
class="e-value fade-in"
|
||||||
>经验 +1</view
|
>经验 +1</view
|
||||||
>
|
>
|
||||||
<view
|
<view v-if="scores.length && showRoundTips" class="round-tip fade-in"
|
||||||
v-if="scores.length && showRoundTips && scores[scores.length - 1].ring"
|
|
||||||
class="round-tip fade-in"
|
|
||||||
>{{ scores[scores.length - 1].ring }}<text>环</text></view
|
>{{ scores[scores.length - 1].ring }}<text>环</text></view
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
|
|||||||
@@ -9,37 +9,34 @@ const getSum = (a, b, c) => {
|
|||||||
const sum = (Number(a) || 0) + (Number(b) || 0) + (Number(c) || 0);
|
const sum = (Number(a) || 0) + (Number(b) || 0) + (Number(c) || 0);
|
||||||
return sum > 0 ? sum + "环" : "-";
|
return sum > 0 ? sum + "环" : "-";
|
||||||
};
|
};
|
||||||
|
const roundsName = ["第一轮", "第二轮", "第三轮", "第四轮"];
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view>
|
<view>
|
||||||
<text>总成绩</text>
|
<text :style="{ transform: 'translateX(-10%)' }">总成绩</text>
|
||||||
<text>{{ scores.reduce((last, next) => last + next, 0) }}环</text>
|
<text>{{ scores.reduce((last, next) => last + next, 0) }}环</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
v-for="(title, index) in ['第一轮', '第二轮', '第三轮']"
|
v-for="(_, index) in new Array(Math.ceil(scores.length / 3)).fill(1)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="score-item"
|
class="score-item"
|
||||||
>
|
>
|
||||||
<text>{{ title }}</text>
|
<text>{{ roundsName[index] }}</text>
|
||||||
<text>{{
|
<text>{{
|
||||||
scores[index * 4 + 0] ? scores[index * 4 + 0] + "环" : "-"
|
scores[index * 3 + 0] ? scores[index * 3 + 0] + "环" : "-"
|
||||||
}}</text>
|
}}</text>
|
||||||
<text>{{
|
<text>{{
|
||||||
scores[index * 4 + 1] ? scores[index * 4 + 1] + "环" : "-"
|
scores[index * 3 + 1] ? scores[index * 3 + 1] + "环" : "-"
|
||||||
}}</text>
|
}}</text>
|
||||||
<text>{{
|
<text>{{
|
||||||
scores[index * 4 + 2] ? scores[index * 4 + 2] + "环" : "-"
|
scores[index * 3 + 2] ? scores[index * 3 + 2] + "环" : "-"
|
||||||
}}</text>
|
}}</text>
|
||||||
<text>{{
|
<text :style="{ width: '40%', transform: 'translateX(20%)' }">{{
|
||||||
scores[index * 4 + 3] ? scores[index * 4 + 3] + "环" : "-"
|
|
||||||
}}</text>
|
|
||||||
<text>{{
|
|
||||||
getSum(
|
getSum(
|
||||||
scores[index * 4 + 0],
|
scores[index * 3 + 0],
|
||||||
scores[index * 4 + 1],
|
scores[index * 3 + 1],
|
||||||
scores[index * 4 + 2],
|
scores[index * 3 + 2]
|
||||||
scores[index * 4 + 3]
|
|
||||||
)
|
)
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -54,11 +51,11 @@ const getSum = (a, b, c) => {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
.container > view {
|
.container > view {
|
||||||
width: 100%;
|
width: calc(100% - 30px);
|
||||||
color: aliceblue;
|
color: aliceblue;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 12px 0;
|
padding: 12px 15px;
|
||||||
border-bottom: 1px solid #ffffff66;
|
border-bottom: 1px solid #ffffff66;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #fffc;
|
color: #fffc;
|
||||||
@@ -69,7 +66,7 @@ const getSum = (a, b, c) => {
|
|||||||
}
|
}
|
||||||
.container text {
|
.container text {
|
||||||
display: block;
|
display: block;
|
||||||
width: 20vw;
|
width: 20%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ watch(
|
|||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
color: #fed847;
|
color: #fed847;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
transform: translateX(-10px);
|
||||||
}
|
}
|
||||||
.container > view:first-child > image:first-child {
|
.container > view:first-child > image:first-child {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import BowTarget from "@/components/BowTarget.vue";
|
|||||||
import ScorePanel2 from "@/components/ScorePanel2.vue";
|
import ScorePanel2 from "@/components/ScorePanel2.vue";
|
||||||
import ScoreResult from "@/components/ScoreResult.vue";
|
import ScoreResult from "@/components/ScoreResult.vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
import BowPower from "@/components/BowPower.vue";
|
||||||
import { createPractiseAPI } from "@/apis";
|
import { createPractiseAPI } from "@/apis";
|
||||||
import { MESSAGETYPES, roundsName } from "@/constants";
|
import { MESSAGETYPES, roundsName } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -16,8 +18,9 @@ const start = ref(false);
|
|||||||
const showScore = ref(false);
|
const showScore = ref(false);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const total = 12;
|
const total = 12;
|
||||||
|
const currentRound = ref(0);
|
||||||
const practiseResult = ref({});
|
const practiseResult = ref({});
|
||||||
const power = ref(0);
|
const power = ref(10);
|
||||||
|
|
||||||
const onReady = async () => {
|
const onReady = async () => {
|
||||||
await createPractiseAPI(total);
|
await createPractiseAPI(total);
|
||||||
@@ -30,6 +33,10 @@ async function onReceiveMessage(content) {
|
|||||||
messages.forEach((msg) => {
|
messages.forEach((msg) => {
|
||||||
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
||||||
scores.value.push(msg.target);
|
scores.value.push(msg.target);
|
||||||
|
currentRound.value += 1;
|
||||||
|
if (currentRound.value === 4) {
|
||||||
|
currentRound.value = 1;
|
||||||
|
}
|
||||||
power.value = msg.target.battery;
|
power.value = msg.target.battery;
|
||||||
if (scores.value.length === total) {
|
if (scores.value.length === total) {
|
||||||
showScore.value = true;
|
showScore.value = true;
|
||||||
@@ -65,16 +72,18 @@ onUnmounted(() => {
|
|||||||
:tips="`${
|
:tips="`${
|
||||||
!start || scores.length === 12
|
!start || scores.length === 12
|
||||||
? ''
|
? ''
|
||||||
: `请开始射箭第${roundsName[Math.ceil((scores.length + 1) / 4)]}轮`
|
: `请开始射箭第${roundsName[Math.ceil((scores.length + 1) / 3)]}轮`
|
||||||
}`"
|
}`"
|
||||||
:start="start"
|
:start="start"
|
||||||
:total="120"
|
:total="120"
|
||||||
/>
|
/>
|
||||||
|
<view class="infos">
|
||||||
|
<Avatar :src="user.avatarUrl" :size="35" />
|
||||||
|
<BowPower :power="power" />
|
||||||
|
</view>
|
||||||
<BowTarget
|
<BowTarget
|
||||||
:totalRound="total"
|
:totalRound="total / 4"
|
||||||
:currentRound="start ? scores.length + 1 : 0"
|
:currentRound="currentRound"
|
||||||
:avatar="user.avatarUrl"
|
|
||||||
:power="power"
|
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:tips="
|
:tips="
|
||||||
!start && scores.length > 0
|
!start && scores.length > 0
|
||||||
@@ -99,4 +108,12 @@ onUnmounted(() => {
|
|||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped>
|
||||||
|
.infos {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 15px;
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user