房间1v1流程完善
This commit is contained in:
@@ -9,20 +9,20 @@ import { ref } from "vue";
|
||||
const selectedIndex = ref(0);
|
||||
const matchPage = ref(1);
|
||||
const matchList = ref([]);
|
||||
const practiseList = ref([]);
|
||||
const battlePage = ref(1);
|
||||
const battleList = ref([]);
|
||||
const practiseList = ref([]);
|
||||
|
||||
const handleSelect = async (index) => {
|
||||
if (index === 0 && matchList.value.length === 0) {
|
||||
const result = await getBattleListAPI(matchPage.value, 2);
|
||||
matchList.value = result.list;
|
||||
matchList.value = result;
|
||||
matchPage.value += 1;
|
||||
}
|
||||
if (index === 1 && battleList.value.length === 0) {
|
||||
// const result = await getBattleListAPI(battlePage.value, 1);
|
||||
// battleList.value = result.list;
|
||||
// battlePage.value += 1;
|
||||
const result = await getBattleListAPI(battlePage.value, 1);
|
||||
battleList.value = result;
|
||||
battlePage.value += 1;
|
||||
}
|
||||
if (index === 2 && practiseList.value.length === 0) {
|
||||
const result = await getPractiseResultListAPI();
|
||||
@@ -107,7 +107,44 @@ onMounted(async () => {
|
||||
:style="{
|
||||
display: selectedIndex === 1 ? 'flex' : 'none',
|
||||
}"
|
||||
></view>
|
||||
>
|
||||
<view
|
||||
v-for="(item, index) in battleList"
|
||||
:key="index"
|
||||
@click="() => toMatchDetail(item.battleId)"
|
||||
>
|
||||
<view class="contest-header">
|
||||
<text>{{ item.name }}</text>
|
||||
<text>{{ item.createdAt }}</text>
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
<view v-if="item.mode === 1" class="contest-team">
|
||||
<view
|
||||
class="player"
|
||||
v-for="(p, index2) in item.players"
|
||||
:key="index2"
|
||||
>
|
||||
<Avatar frame :src="p.avatar" />
|
||||
<text>{{ p.name }}</text>
|
||||
<image
|
||||
v-if="index2 === 0"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.mode === 2" class="contest-multi">
|
||||
<view
|
||||
class="player"
|
||||
v-for="(p, index2) in item.players"
|
||||
:key="index2"
|
||||
>
|
||||
<Avatar :rank="index2 + 1" :src="p.avatar" />
|
||||
<text>{{ p.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
:style="{
|
||||
display: selectedIndex === 2 ? 'flex' : 'none',
|
||||
|
||||
Reference in New Issue
Block a user