排名显示错误修复
This commit is contained in:
@@ -124,7 +124,7 @@ onBeforeUnmount(() => {
|
|||||||
<view class="target">
|
<view class="target">
|
||||||
<view v-if="stop" class="stop-sign">中场休息</view>
|
<view v-if="stop" class="stop-sign">中场休息</view>
|
||||||
<view
|
<view
|
||||||
v-if="latestOne && user.id === latestOne.playerId"
|
v-if="latestOne && latestOne.ring && user.id === latestOne.playerId"
|
||||||
class="e-value fade-in-out"
|
class="e-value fade-in-out"
|
||||||
:style="{
|
:style="{
|
||||||
left: calcRealX(latestOne.ring ? latestOne.x : 0, 20),
|
left: calcRealX(latestOne.ring ? latestOne.x : 0, 20),
|
||||||
@@ -143,7 +143,11 @@ onBeforeUnmount(() => {
|
|||||||
>{{ latestOne.ring || "未上靶" }}<text v-if="latestOne.ring">环</text>
|
>{{ latestOne.ring || "未上靶" }}<text v-if="latestOne.ring">环</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
v-if="bluelatestOne && user.id === bluelatestOne.playerId"
|
v-if="
|
||||||
|
bluelatestOne &&
|
||||||
|
bluelatestOne.ring &&
|
||||||
|
user.id === bluelatestOne.playerId
|
||||||
|
"
|
||||||
class="e-value fade-in-out"
|
class="e-value fade-in-out"
|
||||||
:style="{
|
:style="{
|
||||||
left: calcRealX(bluelatestOne.ring ? bluelatestOne.x : 0, 20),
|
left: calcRealX(bluelatestOne.ring ? bluelatestOne.x : 0, 20),
|
||||||
|
|||||||
@@ -251,7 +251,9 @@ const checkBowData = () => {
|
|||||||
src="../static/champ3.png"
|
src="../static/champ3.png"
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
<view v-if="index > 2" class="view-crown">{{ index + 1 }}</view>
|
<view v-if="player.rank > 3" class="view-crown">{{
|
||||||
|
player.rank
|
||||||
|
}}</view>
|
||||||
<Avatar
|
<Avatar
|
||||||
:src="player.avatar"
|
:src="player.avatar"
|
||||||
:size="36"
|
:size="36"
|
||||||
@@ -259,7 +261,7 @@ const checkBowData = () => {
|
|||||||
/>
|
/>
|
||||||
<view class="player-title">
|
<view class="player-title">
|
||||||
<text class="truncate">{{ player.name }}</text>
|
<text class="truncate">{{ player.name }}</text>
|
||||||
<text>{{ getLvlName(player.totalScore) }}</text>
|
<text>{{ getLvlName(player.rank_lvl) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text
|
<text
|
||||||
><text :style="{ color: '#fff' }">{{ player.totalRings }}</text>
|
><text :style="{ color: '#fff' }">{{ player.totalRings }}</text>
|
||||||
|
|||||||
@@ -158,9 +158,7 @@ const subTitles = ["排位赛积分", "MVP次数", "十环次数"];
|
|||||||
<Avatar :src="item.avatar" />
|
<Avatar :src="item.avatar" />
|
||||||
<view class="rank-item-content">
|
<view class="rank-item-content">
|
||||||
<text class="truncate">{{ item.name }}</text>
|
<text class="truncate">{{ item.name }}</text>
|
||||||
<text
|
<text>{{ getLvlName(item.rankLvl) }},{{ item.TotalGames }}场</text>
|
||||||
>{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场</text
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
<text class="rank-item-integral" v-if="selectedIndex === 0">
|
<text class="rank-item-integral" v-if="selectedIndex === 0">
|
||||||
<text
|
<text
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ onShow(async () => {
|
|||||||
<view>
|
<view>
|
||||||
<text>段位</text>
|
<text>段位</text>
|
||||||
<text :style="{ color: '#83CDFF' }">{{
|
<text :style="{ color: '#83CDFF' }">{{
|
||||||
getLvlName(rankData.user.scores) || "-"
|
getLvlName(rankData.user.rankLvl) || "-"
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
@@ -359,7 +359,7 @@ onShow(async () => {
|
|||||||
<view>
|
<view>
|
||||||
<text class="truncate">{{ item.name }}</text>
|
<text class="truncate">{{ item.name }}</text>
|
||||||
<text>
|
<text>
|
||||||
{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场
|
{{ getLvlName(item.rankLvl) }},{{ item.TotalGames }}场
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<text v-if="selectedIndex === 0">
|
<text v-if="selectedIndex === 0">
|
||||||
|
|||||||
19
src/store.js
19
src/store.js
@@ -8,15 +8,13 @@ const defaultUser = {
|
|||||||
lvlName: "",
|
lvlName: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLvlName = (score, rankList = []) => {
|
const getLvlName = (rankLvl, rankList = []) => {
|
||||||
if (!rankList) return;
|
if (!rankList) return;
|
||||||
let lvlName = "";
|
let lvlName = "";
|
||||||
rankList.some((r, index) => {
|
rankList.some((r, index) => {
|
||||||
lvlName = rankList[index].name;
|
lvlName = rankList[index].name;
|
||||||
if (r.upgrade_scores > score) {
|
if (r.rank_id === rankLvl) {
|
||||||
if (rankList[index - 1]) {
|
lvlName = rankList[index].name;
|
||||||
lvlName = rankList[index - 1].name;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -62,8 +60,8 @@ export default defineStore("store", {
|
|||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
actions: {
|
actions: {
|
||||||
getLvlName(score) {
|
getLvlName(rankLvl) {
|
||||||
return getLvlName(score, this.config.randInfos);
|
return getLvlName(rankLvl, this.config.randInfos);
|
||||||
},
|
},
|
||||||
getLvlImage(rankLvl) {
|
getLvlImage(rankLvl) {
|
||||||
return getLvlImage(rankLvl, this.config.randInfos);
|
return getLvlImage(rankLvl, this.config.randInfos);
|
||||||
@@ -78,8 +76,11 @@ export default defineStore("store", {
|
|||||||
const imageInfo = await uni.getImageInfo({ src: user.avatar });
|
const imageInfo = await uni.getImageInfo({ src: user.avatar });
|
||||||
this.user.avatar = imageInfo.path;
|
this.user.avatar = imageInfo.path;
|
||||||
}
|
}
|
||||||
if (this.user.scores !== undefined) {
|
if (this.user.rankLvl !== undefined) {
|
||||||
this.user.lvlName = getLvlName(this.user.scores, this.config.randInfos);
|
this.user.lvlName = getLvlName(
|
||||||
|
this.user.rankLvl,
|
||||||
|
this.config.randInfos
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
||||||
if (lvlImage) {
|
if (lvlImage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user