diff --git a/src/components/ScoreResult.vue b/src/components/ScoreResult.vue
index bac37d6..379540d 100644
--- a/src/components/ScoreResult.vue
+++ b/src/components/ScoreResult.vue
@@ -7,6 +7,10 @@ import BowData from "@/components/BowData.vue";
import UserUpgrade from "@/components/UserUpgrade.vue";
import { wxShare } from "@/util";
import { directionAdjusts } from "@/constants";
+import useStore from "@/store";
+import { storeToRefs } from "pinia";
+const store = useStore();
+const { user } = storeToRefs(store);
const props = defineProps({
onClose: {
type: Function,
@@ -42,7 +46,7 @@ const closePanel = () => {
}, 300);
};
onMounted(() => {
- if (props.result.lvl) {
+ if (props.result.lvl > user.value.lvl) {
showUpgrade.value = true;
}
if (props.result.arrows) {
diff --git a/src/components/UserUpgrade.vue b/src/components/UserUpgrade.vue
index 336d594..c78fb6c 100644
--- a/src/components/UserUpgrade.vue
+++ b/src/components/UserUpgrade.vue
@@ -20,7 +20,9 @@ const props = defineProps({
},
});
onMounted(() => {
- updateUser({ ...user.value, lvl: props.lvl });
+ if (props.lvl > user.value.lvl) {
+ updateUser({ ...user.value, lvl: props.lvl });
+ }
});
diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue
index 118db61..5d53f6e 100644
--- a/src/pages/battle-room.vue
+++ b/src/pages/battle-room.vue
@@ -164,7 +164,7 @@ onLoad(async (options) => {
});
tips.value = `${
scores.value.length ? "下半场-" : "上半场-"
- }请连续射出6支箭`;
+ }请连续射6箭`;
const remain = Date.now() / 1000 - battleInfo.startTime;
console.log(`当前局剩余${remain}秒`);
if (remain <= 90) {
@@ -352,7 +352,7 @@ async function onReceiveMessage(messages = []) {
timerSeq.value = 0;
tips.value = `${
scores.value.length ? "下半场-" : "上半场-"
- }请连续射出6支箭`;
+ }请连续射6箭`;
total.value = 90;
halfTimeTip.value = false;
}
diff --git a/src/pages/first-try.vue b/src/pages/first-try.vue
index 1bd3238..9c58cfb 100644
--- a/src/pages/first-try.vue
+++ b/src/pages/first-try.vue
@@ -19,7 +19,6 @@ import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
-const { updateUser } = store;
const scores = ref([]);
const step = ref(0);
const total = 12;
@@ -80,6 +79,7 @@ async function onReceiveMessage(messages = []) {
practiseResult.value = {
...msg.practice,
arrows: JSON.parse(msg.practice.arrows),
+ lvl: msg.lvl,
};
generateCanvasImage(
"shareCanvas",
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 2a253ca..93d588c 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -8,12 +8,7 @@ import SModal from "@/components/SModal.vue";
import Signin from "@/components/Signin.vue";
import BubbleTip from "@/components/BubbleTip.vue";
import BackToGame from "@/components/BackToGame.vue";
-import {
- getAppConfig,
- getHomeData,
- getMyDevicesAPI,
- getRankListAPI,
-} from "@/apis";
+import { getAppConfig, getHomeData, getMyDevicesAPI } from "@/apis";
import { topThreeColors } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
@@ -64,9 +59,8 @@ onMounted(async () => {
const config = await getAppConfig();
updateConfig(config);
console.log("全局配置:", config);
- const rankList = await getRankListAPI();
- updateRank(rankList);
const result = await getHomeData();
+ updateRank(result);
console.log("首页数据:", result);
if (result.user) {
updateUser(result.user);
diff --git a/src/pages/melee-bow-data.vue b/src/pages/melee-bow-data.vue
index fbae1c3..21c97a0 100644
--- a/src/pages/melee-bow-data.vue
+++ b/src/pages/melee-bow-data.vue
@@ -52,11 +52,7 @@ onLoad(async (options) => {
}"
class="player-bg"
/>
-
+
{{ player.name }}
diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue
index 3dc5871..f0c2f49 100644
--- a/src/pages/melee-match.vue
+++ b/src/pages/melee-match.vue
@@ -69,9 +69,7 @@ onLoad(async (options) => {
scores.value = p.arrows;
}
});
- tips.value = `${
- scores.value.length ? "下半场-" : "上半场-"
- }请连续射出6支箭`;
+ tips.value = `${scores.value.length ? "下半场-" : "上半场-"}请连续射6箭`;
const remain = Date.now() / 1000 - battleInfo.startTime;
console.log(`当前局剩余${remain}秒`);
if (remain <= 90) {
@@ -137,9 +135,7 @@ async function onReceiveMessage(messages = []) {
startCount.value = true;
seq.value += 1;
timerSeq.value = 0;
- tips.value = `${
- scores.value.length ? "下半场-" : "上半场-"
- }请连续射出6支箭`;
+ tips.value = `${scores.value.length ? "下半场-" : "上半场-"}请连续射6箭`;
halfTimeTip.value = false;
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
@@ -208,7 +204,7 @@ onUnmounted(() => {
>
-
+
{
/>
-
+
diff --git a/src/pages/practise-one.vue b/src/pages/practise-one.vue
index a8e5b7b..c729fca 100644
--- a/src/pages/practise-one.vue
+++ b/src/pages/practise-one.vue
@@ -17,7 +17,6 @@ import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
-const { updateUser } = store;
const start = ref(false);
const scores = ref([]);
const total = 12;
diff --git a/src/pages/practise-two.vue b/src/pages/practise-two.vue
index 25058c1..5c700cd 100644
--- a/src/pages/practise-two.vue
+++ b/src/pages/practise-two.vue
@@ -17,7 +17,6 @@ import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
-const { updateUser } = store;
const start = ref(false);
const scores = ref([]);
const total = 36;
@@ -57,6 +56,7 @@ async function onReceiveMessage(messages = []) {
practiseResult.value = {
...msg.practice,
arrows: JSON.parse(msg.practice.arrows),
+ lvl: msg.lvl,
};
generateCanvasImage(
"shareCanvas",
diff --git a/src/pages/rank-list.vue b/src/pages/rank-list.vue
index a3813b5..7dc60ba 100644
--- a/src/pages/rank-list.vue
+++ b/src/pages/rank-list.vue
@@ -10,31 +10,28 @@ const { getLvlName } = store;
const isIos = ref(true);
const selectedIndex = ref(0);
const currentList = ref([]);
-const myData = ref(null);
+const myData = ref({});
const addBg = ref("");
onMounted(async () => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
currentList.value = rankData.value.rank;
- myData.value = rankData.value.rank.find(
- (item) => item.userId === user.value.id
- );
+ myData.value = rankData.value.myRankPos;
});
const handleSelect = (index) => {
selectedIndex.value = index;
- myData.value = null;
if (index === 0) {
+ myData.value = rankData.value.myRankPos;
currentList.value = rankData.value.rank;
} else if (index === 2) {
currentList.value = rankData.value.ringRank;
+ myData.value = rankData.value.myRingRankPos;
} else {
+ myData.value = {};
currentList.value = [];
}
- myData.value = rankData.value.rank.find(
- (item) => item.userId === user.value.id
- );
};
const onScrollView = (e) => {
@@ -133,7 +130,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
{{ index + 1 }}
- {{ item.name }}
+ {{ item.name }}
{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场
@@ -153,24 +150,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
筹备中...
-
+
{{ myData.rank }}
{{ user.nickName }}
- {{ user.lvlName }},{{ myData.TotalGames }}场
+ {{ user.lvlName }},{{ rankData.TotalGames }}场
-
+ {{ myData.TenRings }}{{ rankData.myRankPos.TenRings }}次
-
+ {{ myData.totalScore }}{{ rankData.myRingRankPos.totalScore }}分
@@ -319,11 +316,13 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
border-radius: 20px;
margin: 10px;
font-size: 14px;
+ min-width: 15px;
+ text-align: center;
}
.my-rank-data > text:last-child {
position: relative;
margin-right: 10px;
- width: 56px;
+ width: 65px;
text-align: right;
}
.my-rank-data > .rank-item-content > text:first-child {
diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue
index 5379a83..374aa68 100644
--- a/src/pages/team-match.vue
+++ b/src/pages/team-match.vue
@@ -106,8 +106,8 @@ onLoad(async (options) => {
}
}
if (battleInfo.fireTime > 0) {
- console.log(`当前箭剩余${remain}秒`);
const remain = Date.now() / 1000 - battleInfo.fireTime;
+ console.log(`当前箭剩余${remain}秒`);
if (remain > 0 && remain <= 15) {
// 等渲染好再通知
setTimeout(() => {
@@ -342,9 +342,9 @@ onUnmounted(() => {
/>
-
+
diff --git a/src/store.js b/src/store.js
index ae5b6a5..de319a0 100644
--- a/src/store.js
+++ b/src/store.js
@@ -67,7 +67,7 @@ export default defineStore("store", {
return getLvlImage(rankLvl, this.config.randInfos);
},
updateRank(data = {}) {
- this.rankData = { rank: data.rank || [], ringRank: data.ringRank || [] };
+ this.rankData = { ...(data || {}) };
},
async updateUser(user = {}) {
this.user = { ...defaultUser, ...user };