升级逻辑完善
This commit is contained in:
@@ -3,13 +3,13 @@ import { ref, onMounted } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||
import { getGameAPI, getHomeData } from "@/apis";
|
||||
import { getGameAPI } from "@/apis";
|
||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
const { updateUser, getLvlName } = store;
|
||||
const { getLvlName } = store;
|
||||
|
||||
const ifWin = ref(false);
|
||||
const data = ref({});
|
||||
@@ -44,6 +44,9 @@ function exit() {
|
||||
onMounted(async () => {
|
||||
const battleInfo = uni.getStorageSync("last-battle");
|
||||
console.log("----battleInfo", battleInfo);
|
||||
if (battleInfo.lvl > user.value.lvl) {
|
||||
showUpgrade.value = true;
|
||||
}
|
||||
data.value = battleInfo;
|
||||
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
|
||||
rank.value =
|
||||
@@ -52,8 +55,6 @@ onMounted(async () => {
|
||||
totalPoints.value = mine.totalScore;
|
||||
ifWin.value = battleInfo.mode === 1 && mine.team === battleInfo.winner;
|
||||
}
|
||||
const result = await getHomeData();
|
||||
if (result.user) updateUser(result.user);
|
||||
});
|
||||
|
||||
const checkBowData = () => {
|
||||
|
||||
Reference in New Issue
Block a user