细节完善
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -20,7 +20,9 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
onMounted(() => {
|
||||
if (props.lvl > user.value.lvl) {
|
||||
updateUser({ ...user.value, lvl: props.lvl });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -52,11 +52,7 @@ onLoad(async (options) => {
|
||||
}"
|
||||
class="player-bg"
|
||||
/>
|
||||
<Avatar
|
||||
:src="player.avatar"
|
||||
:size="40"
|
||||
:rank="showRank ? index + 1 : 0"
|
||||
/>
|
||||
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" :size="40" />
|
||||
<text>{{ player.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -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(() => {
|
||||
>
|
||||
<view class="container">
|
||||
<block v-if="battleId">
|
||||
<BattleHeader :players="players" />
|
||||
<BattleHeader v-if="!start" :players="players" />
|
||||
<TestDistance v-if="!start" :guide="false" />
|
||||
<ShootProgress
|
||||
v-if="start"
|
||||
@@ -260,9 +256,9 @@ onUnmounted(() => {
|
||||
/>
|
||||
</block>
|
||||
</view>
|
||||
<view :style="{ marginBottom: '20px' }">
|
||||
<!-- <view :style="{ marginBottom: '20px' }">
|
||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||
</view>
|
||||
</view> -->
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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次数", "本周十环次数"];
|
||||
<view v-if="index > 2" class="view-crown">{{ index + 1 }}</view>
|
||||
<Avatar :src="item.avatar" />
|
||||
<view class="rank-item-content">
|
||||
<text>{{ item.name }}</text>
|
||||
<text class="truncate">{{ item.name }}</text>
|
||||
<text
|
||||
>{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场</text
|
||||
>
|
||||
@@ -153,24 +150,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
||||
<text>筹备中...</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="my-rank-data" v-if="myData">
|
||||
<view class="my-rank-data" v-if="myData.userId">
|
||||
<image src="../static/modal-content-bg.png" mode="widthFix" />
|
||||
<text>{{ myData.rank }}</text>
|
||||
<Avatar :src="user.avatar" />
|
||||
<view class="rank-item-content">
|
||||
<text class="truncate">{{ user.nickName }}</text>
|
||||
<text>{{ user.lvlName }},{{ myData.TotalGames }}场</text>
|
||||
<text>{{ user.lvlName }},{{ rankData.TotalGames }}场</text>
|
||||
</view>
|
||||
<text class="rank-item-integral" v-if="selectedIndex === 2"
|
||||
><text
|
||||
<text class="rank-item-integral" v-if="selectedIndex === 2">
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ myData.TenRings }}</text
|
||||
>{{ rankData.myRankPos.TenRings }}</text
|
||||
>次</text
|
||||
>
|
||||
<text class="rank-item-integral" v-else
|
||||
><text
|
||||
<text class="rank-item-integral" v-else>
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ myData.totalScore }}</text
|
||||
>{{ rankData.myRingRankPos.totalScore }}</text
|
||||
>分</text
|
||||
>
|
||||
</view>
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(() => {
|
||||
/>
|
||||
</block>
|
||||
</view>
|
||||
<view :style="{ marginBottom: '20px' }">
|
||||
<!-- <view :style="{ marginBottom: '20px' }">
|
||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||
</view>
|
||||
</view> -->
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user