细节完善
This commit is contained in:
@@ -7,6 +7,10 @@ import BowData from "@/components/BowData.vue";
|
|||||||
import UserUpgrade from "@/components/UserUpgrade.vue";
|
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||||
import { wxShare } from "@/util";
|
import { wxShare } from "@/util";
|
||||||
import { directionAdjusts } from "@/constants";
|
import { directionAdjusts } from "@/constants";
|
||||||
|
import useStore from "@/store";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
const store = useStore();
|
||||||
|
const { user } = storeToRefs(store);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
onClose: {
|
onClose: {
|
||||||
type: Function,
|
type: Function,
|
||||||
@@ -42,7 +46,7 @@ const closePanel = () => {
|
|||||||
}, 300);
|
}, 300);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.result.lvl) {
|
if (props.result.lvl > user.value.lvl) {
|
||||||
showUpgrade.value = true;
|
showUpgrade.value = true;
|
||||||
}
|
}
|
||||||
if (props.result.arrows) {
|
if (props.result.arrows) {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (props.lvl > user.value.lvl) {
|
||||||
updateUser({ ...user.value, lvl: props.lvl });
|
updateUser({ ...user.value, lvl: props.lvl });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ onLoad(async (options) => {
|
|||||||
});
|
});
|
||||||
tips.value = `${
|
tips.value = `${
|
||||||
scores.value.length ? "下半场-" : "上半场-"
|
scores.value.length ? "下半场-" : "上半场-"
|
||||||
}请连续射出6支箭`;
|
}请连续射6箭`;
|
||||||
const remain = Date.now() / 1000 - battleInfo.startTime;
|
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||||
console.log(`当前局剩余${remain}秒`);
|
console.log(`当前局剩余${remain}秒`);
|
||||||
if (remain <= 90) {
|
if (remain <= 90) {
|
||||||
@@ -352,7 +352,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
timerSeq.value = 0;
|
timerSeq.value = 0;
|
||||||
tips.value = `${
|
tips.value = `${
|
||||||
scores.value.length ? "下半场-" : "上半场-"
|
scores.value.length ? "下半场-" : "上半场-"
|
||||||
}请连续射出6支箭`;
|
}请连续射6箭`;
|
||||||
total.value = 90;
|
total.value = 90;
|
||||||
halfTimeTip.value = false;
|
halfTimeTip.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import useStore from "@/store";
|
|||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user } = storeToRefs(store);
|
const { user } = storeToRefs(store);
|
||||||
const { updateUser } = store;
|
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const step = ref(0);
|
const step = ref(0);
|
||||||
const total = 12;
|
const total = 12;
|
||||||
@@ -80,6 +79,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
practiseResult.value = {
|
practiseResult.value = {
|
||||||
...msg.practice,
|
...msg.practice,
|
||||||
arrows: JSON.parse(msg.practice.arrows),
|
arrows: JSON.parse(msg.practice.arrows),
|
||||||
|
lvl: msg.lvl,
|
||||||
};
|
};
|
||||||
generateCanvasImage(
|
generateCanvasImage(
|
||||||
"shareCanvas",
|
"shareCanvas",
|
||||||
|
|||||||
@@ -8,12 +8,7 @@ import SModal from "@/components/SModal.vue";
|
|||||||
import Signin from "@/components/Signin.vue";
|
import Signin from "@/components/Signin.vue";
|
||||||
import BubbleTip from "@/components/BubbleTip.vue";
|
import BubbleTip from "@/components/BubbleTip.vue";
|
||||||
import BackToGame from "@/components/BackToGame.vue";
|
import BackToGame from "@/components/BackToGame.vue";
|
||||||
import {
|
import { getAppConfig, getHomeData, getMyDevicesAPI } from "@/apis";
|
||||||
getAppConfig,
|
|
||||||
getHomeData,
|
|
||||||
getMyDevicesAPI,
|
|
||||||
getRankListAPI,
|
|
||||||
} from "@/apis";
|
|
||||||
import { topThreeColors } from "@/constants";
|
import { topThreeColors } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
@@ -64,9 +59,8 @@ onMounted(async () => {
|
|||||||
const config = await getAppConfig();
|
const config = await getAppConfig();
|
||||||
updateConfig(config);
|
updateConfig(config);
|
||||||
console.log("全局配置:", config);
|
console.log("全局配置:", config);
|
||||||
const rankList = await getRankListAPI();
|
|
||||||
updateRank(rankList);
|
|
||||||
const result = await getHomeData();
|
const result = await getHomeData();
|
||||||
|
updateRank(result);
|
||||||
console.log("首页数据:", result);
|
console.log("首页数据:", result);
|
||||||
if (result.user) {
|
if (result.user) {
|
||||||
updateUser(result.user);
|
updateUser(result.user);
|
||||||
|
|||||||
@@ -52,11 +52,7 @@ onLoad(async (options) => {
|
|||||||
}"
|
}"
|
||||||
class="player-bg"
|
class="player-bg"
|
||||||
/>
|
/>
|
||||||
<Avatar
|
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" :size="40" />
|
||||||
:src="player.avatar"
|
|
||||||
:size="40"
|
|
||||||
:rank="showRank ? index + 1 : 0"
|
|
||||||
/>
|
|
||||||
<text>{{ player.name }}</text>
|
<text>{{ player.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ onLoad(async (options) => {
|
|||||||
scores.value = p.arrows;
|
scores.value = p.arrows;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tips.value = `${
|
tips.value = `${scores.value.length ? "下半场-" : "上半场-"}请连续射6箭`;
|
||||||
scores.value.length ? "下半场-" : "上半场-"
|
|
||||||
}请连续射出6支箭`;
|
|
||||||
const remain = Date.now() / 1000 - battleInfo.startTime;
|
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||||
console.log(`当前局剩余${remain}秒`);
|
console.log(`当前局剩余${remain}秒`);
|
||||||
if (remain <= 90) {
|
if (remain <= 90) {
|
||||||
@@ -137,9 +135,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
startCount.value = true;
|
startCount.value = true;
|
||||||
seq.value += 1;
|
seq.value += 1;
|
||||||
timerSeq.value = 0;
|
timerSeq.value = 0;
|
||||||
tips.value = `${
|
tips.value = `${scores.value.length ? "下半场-" : "上半场-"}请连续射6箭`;
|
||||||
scores.value.length ? "下半场-" : "上半场-"
|
|
||||||
}请连续射出6支箭`;
|
|
||||||
halfTimeTip.value = false;
|
halfTimeTip.value = false;
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||||
@@ -208,7 +204,7 @@ onUnmounted(() => {
|
|||||||
>
|
>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<block v-if="battleId">
|
<block v-if="battleId">
|
||||||
<BattleHeader :players="players" />
|
<BattleHeader v-if="!start" :players="players" />
|
||||||
<TestDistance v-if="!start" :guide="false" />
|
<TestDistance v-if="!start" :guide="false" />
|
||||||
<ShootProgress
|
<ShootProgress
|
||||||
v-if="start"
|
v-if="start"
|
||||||
@@ -260,9 +256,9 @@ onUnmounted(() => {
|
|||||||
/>
|
/>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view :style="{ marginBottom: '20px' }">
|
<!-- <view :style="{ marginBottom: '20px' }">
|
||||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||||
</view>
|
</view> -->
|
||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import useStore from "@/store";
|
|||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user } = storeToRefs(store);
|
const { user } = storeToRefs(store);
|
||||||
const { updateUser } = store;
|
|
||||||
const start = ref(false);
|
const start = ref(false);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const total = 12;
|
const total = 12;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import useStore from "@/store";
|
|||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user } = storeToRefs(store);
|
const { user } = storeToRefs(store);
|
||||||
const { updateUser } = store;
|
|
||||||
const start = ref(false);
|
const start = ref(false);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const total = 36;
|
const total = 36;
|
||||||
@@ -57,6 +56,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
practiseResult.value = {
|
practiseResult.value = {
|
||||||
...msg.practice,
|
...msg.practice,
|
||||||
arrows: JSON.parse(msg.practice.arrows),
|
arrows: JSON.parse(msg.practice.arrows),
|
||||||
|
lvl: msg.lvl,
|
||||||
};
|
};
|
||||||
generateCanvasImage(
|
generateCanvasImage(
|
||||||
"shareCanvas",
|
"shareCanvas",
|
||||||
|
|||||||
@@ -10,31 +10,28 @@ const { getLvlName } = store;
|
|||||||
const isIos = ref(true);
|
const isIos = ref(true);
|
||||||
const selectedIndex = ref(0);
|
const selectedIndex = ref(0);
|
||||||
const currentList = ref([]);
|
const currentList = ref([]);
|
||||||
const myData = ref(null);
|
const myData = ref({});
|
||||||
const addBg = ref("");
|
const addBg = ref("");
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const deviceInfo = uni.getDeviceInfo();
|
const deviceInfo = uni.getDeviceInfo();
|
||||||
isIos.value = deviceInfo.osName === "ios";
|
isIos.value = deviceInfo.osName === "ios";
|
||||||
currentList.value = rankData.value.rank;
|
currentList.value = rankData.value.rank;
|
||||||
myData.value = rankData.value.rank.find(
|
myData.value = rankData.value.myRankPos;
|
||||||
(item) => item.userId === user.value.id
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSelect = (index) => {
|
const handleSelect = (index) => {
|
||||||
selectedIndex.value = index;
|
selectedIndex.value = index;
|
||||||
myData.value = null;
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
|
myData.value = rankData.value.myRankPos;
|
||||||
currentList.value = rankData.value.rank;
|
currentList.value = rankData.value.rank;
|
||||||
} else if (index === 2) {
|
} else if (index === 2) {
|
||||||
currentList.value = rankData.value.ringRank;
|
currentList.value = rankData.value.ringRank;
|
||||||
|
myData.value = rankData.value.myRingRankPos;
|
||||||
} else {
|
} else {
|
||||||
|
myData.value = {};
|
||||||
currentList.value = [];
|
currentList.value = [];
|
||||||
}
|
}
|
||||||
myData.value = rankData.value.rank.find(
|
|
||||||
(item) => item.userId === user.value.id
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onScrollView = (e) => {
|
const onScrollView = (e) => {
|
||||||
@@ -133,7 +130,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
|||||||
<view v-if="index > 2" class="view-crown">{{ index + 1 }}</view>
|
<view v-if="index > 2" class="view-crown">{{ index + 1 }}</view>
|
||||||
<Avatar :src="item.avatar" />
|
<Avatar :src="item.avatar" />
|
||||||
<view class="rank-item-content">
|
<view class="rank-item-content">
|
||||||
<text>{{ item.name }}</text>
|
<text class="truncate">{{ item.name }}</text>
|
||||||
<text
|
<text
|
||||||
>{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场</text
|
>{{ getLvlName(item.totalScore) }},{{ item.TotalGames }}场</text
|
||||||
>
|
>
|
||||||
@@ -153,24 +150,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
|||||||
<text>筹备中...</text>
|
<text>筹备中...</text>
|
||||||
</view>
|
</view>
|
||||||
</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" />
|
<image src="../static/modal-content-bg.png" mode="widthFix" />
|
||||||
<text>{{ myData.rank }}</text>
|
<text>{{ myData.rank }}</text>
|
||||||
<Avatar :src="user.avatar" />
|
<Avatar :src="user.avatar" />
|
||||||
<view class="rank-item-content">
|
<view class="rank-item-content">
|
||||||
<text class="truncate">{{ user.nickName }}</text>
|
<text class="truncate">{{ user.nickName }}</text>
|
||||||
<text>{{ user.lvlName }},{{ myData.TotalGames }}场</text>
|
<text>{{ user.lvlName }},{{ rankData.TotalGames }}场</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="rank-item-integral" v-if="selectedIndex === 2"
|
<text class="rank-item-integral" v-if="selectedIndex === 2">
|
||||||
><text
|
<text
|
||||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||||
>{{ myData.TenRings }}</text
|
>{{ rankData.myRankPos.TenRings }}</text
|
||||||
>次</text
|
>次</text
|
||||||
>
|
>
|
||||||
<text class="rank-item-integral" v-else
|
<text class="rank-item-integral" v-else>
|
||||||
><text
|
<text
|
||||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||||
>{{ myData.totalScore }}</text
|
>{{ rankData.myRingRankPos.totalScore }}</text
|
||||||
>分</text
|
>分</text
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
@@ -319,11 +316,13 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
|||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
min-width: 15px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.my-rank-data > text:last-child {
|
.my-rank-data > text:last-child {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
width: 56px;
|
width: 65px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.my-rank-data > .rank-item-content > text:first-child {
|
.my-rank-data > .rank-item-content > text:first-child {
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ onLoad(async (options) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (battleInfo.fireTime > 0) {
|
if (battleInfo.fireTime > 0) {
|
||||||
console.log(`当前箭剩余${remain}秒`);
|
|
||||||
const remain = Date.now() / 1000 - battleInfo.fireTime;
|
const remain = Date.now() / 1000 - battleInfo.fireTime;
|
||||||
|
console.log(`当前箭剩余${remain}秒`);
|
||||||
if (remain > 0 && remain <= 15) {
|
if (remain > 0 && remain <= 15) {
|
||||||
// 等渲染好再通知
|
// 等渲染好再通知
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -342,9 +342,9 @@ onUnmounted(() => {
|
|||||||
/>
|
/>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view :style="{ marginBottom: '20px' }">
|
<!-- <view :style="{ marginBottom: '20px' }">
|
||||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||||
</view>
|
</view> -->
|
||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default defineStore("store", {
|
|||||||
return getLvlImage(rankLvl, this.config.randInfos);
|
return getLvlImage(rankLvl, this.config.randInfos);
|
||||||
},
|
},
|
||||||
updateRank(data = {}) {
|
updateRank(data = {}) {
|
||||||
this.rankData = { rank: data.rank || [], ringRank: data.ringRank || [] };
|
this.rankData = { ...(data || {}) };
|
||||||
},
|
},
|
||||||
async updateUser(user = {}) {
|
async updateUser(user = {}) {
|
||||||
this.user = { ...defaultUser, ...user };
|
this.user = { ...defaultUser, ...user };
|
||||||
|
|||||||
Reference in New Issue
Block a user