Commit e8af23d3 authored by xiaoye's avatar xiaoye

fix

parent 4b5369f9
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
> >
</uni-list-item> </uni-list-item>
<uni-list-item <uni-list-item
v-for = '(i, v) in participant.array' v-for = '(i, v) in participant.array.slice((participant.page - 1) * 20, participant.page * 20)'
:title = "`胜平负:${i.score.win + i.score.bye}-${i.score.draw}-${i.score.lose}`" :title = "i.score ? `胜平负:${i.score.win + i.score.bye}-${i.score.draw}-${i.score.lose}` : ''"
:note = '`小分:${i.score.score}`' :note = "i.score ? `小分:${i.score.score}` : ''"
:clickable = true :clickable = true
> >
<template v-slot:header> <template v-slot:header>
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
:title = '`比赛:${match.total}`' :title = '`比赛:${match.total}`'
> >
<view id = 'round'> <view id = 'round'>
<div>
<uni-number-box <uni-number-box
v-model = 'match.round' v-model = 'match.round'
...@@ -128,6 +129,8 @@ ...@@ -128,6 +129,8 @@
:disabled = "tournament.this.status == 'Ready'" :disabled = "tournament.this.status == 'Ready'"
></uni-number-box> ></uni-number-box>
</div>
<view class = 'button' @click = '() => { match.chk = true; match.page = 1; match.search(true); }'>全部轮次</view>
</view> </view>
<transition name = 'switch'> <transition name = 'switch'>
<uni-list> <uni-list>
...@@ -231,6 +234,7 @@ ...@@ -231,6 +234,7 @@
v-model = 'match.page' v-model = 'match.page'
pageSize = 20 pageSize = 20
:total = 'match.total' :total = 'match.total'
@change = 'match.search()'
> >
</uni-pagination> </uni-pagination>
</uni-card> </uni-card>
...@@ -334,6 +338,7 @@ ...@@ -334,6 +338,7 @@
page : 1, page : 1,
round : 1, round : 1,
maxRound : 2, maxRound : 2,
chk : false,
status : { status : {
color : new Map([ color : new Map([
['Running', 'rgb(84, 200, 17)'], ['Running', 'rgb(84, 200, 17)'],
...@@ -374,6 +379,12 @@ ...@@ -374,6 +379,12 @@
} }
}, },
chk : [] as Array<Array<number>> chk : [] as Array<Array<number>>
},
search : async (chk : boolean = match.chk) : Promise<void> => {
// @ts-ignore
const matchs = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id, statusIn : 'Running,Finished', pageCount : match.page, round : chk ? undefined : match.round});
match.array = matchs.matchs;
match.total = matchs.total;
} }
}); });
...@@ -386,7 +397,7 @@ ...@@ -386,7 +397,7 @@
// @ts-ignore // @ts-ignore
if (await Tabulator.Participant.Create(Mycard.token, { name : participant.name, tournamentId : tournament.this.id}, participant.array)) { if (await Tabulator.Participant.Create(Mycard.token, { name : participant.name, tournamentId : tournament.this.id}, participant.array)) {
participant.name = ''; participant.name = '';
page.reload(); await participant.search();
} }
}, },
del : async(v : number) : Promise<void> => { del : async(v : number) : Promise<void> => {
...@@ -410,6 +421,22 @@ ...@@ -410,6 +421,22 @@
// @ts-ignore // @ts-ignore
if (await Tabulator.Tournament.Update(Mycard.token, tournament.this.id, Data)) if (await Tabulator.Tournament.Update(Mycard.token, tournament.this.id, Data))
page.reload(); page.reload();
},
search : async () : Promise<boolean> => {
const url = window.location.pathname.match(/\/tournament\/([^\/]+)(?=\/|$)/);
// @ts-ignore
const id = url[1];
// @ts-ignore
const t : TournamentAParticipant = await Tabulator.Tournament.Find(Mycard.token, id);
if (t.tournament) {
tournament.this = t.tournament;
emitter.emit(tournamentReload, tournament.this)
const participants = t.participant;
participant.array = participants.participants;
participant.total = participants.total;
return true;
}
return false;
} }
}); });
...@@ -421,21 +448,11 @@ ...@@ -421,21 +448,11 @@
await (new Promise(resolve => setTimeout(resolve, 450))); await (new Promise(resolve => setTimeout(resolve, 450)));
window.location.replace(window.location.href.replace(window.location.pathname, '')) window.location.replace(window.location.href.replace(window.location.pathname, ''))
}, },
get : async (id : number) : Promise<void> => { get : async () : Promise<void> => {
const t : TournamentAParticipant = await Tabulator.Tournament.Find(Mycard.token, id); if (await participant.search())
if (t) { await match.search();
tournament.this = t.tournament; else
emitter.emit(tournamentReload, tournament.this)
const participants = t.participant;
participant.array = participants.participants;
participant.total = participants.total;
// @ts-ignore
const matchs = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id, statusIn : 'Running,Finished', round : match.round});
match.array = matchs.matchs;
match.total = matchs.total;
} else {
page.clear(); page.clear();
}
}, },
reload : async () : Promise<void> => { reload : async () : Promise<void> => {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
...@@ -445,20 +462,18 @@ ...@@ -445,20 +462,18 @@
}).exec(); }).exec();
page.loading = true; page.loading = true;
participant.name = ''; participant.name = '';
// @ts-ignore if (await participant.search()) {
const t : TournamentAParticipant = await Tabulator.Tournament.Find(Mycard.token, tournament.this.id); await match.search();
tournament.this = t.tournament;
const participants : AllParticipant = t.participant;
participant.array = participants.participants;
participant.total = participants.total;
// @ts-ignore
const matchs : AllMatch = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id, statusIn : 'Running,Finished', round : match.round});
match.array = matchs.matchs;
match.total = matchs.total;
emitter.emit(tournamentReload, tournament.this)
await (new Promise(resolve => setTimeout(resolve, 500))); await (new Promise(resolve => setTimeout(resolve, 500)));
page.loading = false; page.loading = false;
page.height = 0; page.height = 0;
} else
uni.showModal({
title : '刷新失败',
content : '请重试或检查网络设置',
showCancel : false
});
}, },
clickClear : (e) : void => { clickClear : (e) : void => {
let element = e.target; let element = e.target;
...@@ -474,7 +489,7 @@ ...@@ -474,7 +489,7 @@
onBeforeMount(() => { onBeforeMount(() => {
const url = window.location.pathname.match(/\/tournament\/([^\/]+)(?=\/|$)/); const url = window.location.pathname.match(/\/tournament\/([^\/]+)(?=\/|$)/);
url && !isNaN(parseInt(url[1])) ? page.get(parseInt(url[1])) : page.clear(); url && !isNaN(parseInt(url[1])) ? page.get() : page.clear();
document.addEventListener("click", page.clickClear); document.addEventListener("click", page.clickClear);
// @ts-ignore // @ts-ignore
emitter.on(updateTournament, participant.update); emitter.on(updateTournament, participant.update);
...@@ -487,10 +502,9 @@ ...@@ -487,10 +502,9 @@
}); });
watch(() => { return match.round; }, async () : Promise<void> => { watch(() => { return match.round; }, async () : Promise<void> => {
// @ts-ignore match.page = 1;
const matchs = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id, statusIn : 'Running,Finished', round : match.round}); match.chk = false;
match.array = matchs.matchs; await match.search();
match.total = matchs.total;
}); });
watch(() => { return match.array; }, () => { watch(() => { return match.array; }, () => {
......
...@@ -2,9 +2,16 @@ ...@@ -2,9 +2,16 @@
#PageTournament { #PageTournament {
#round { #round {
display: flex; display: flex;
column-gap: 10%;
div {
display: flex;
}
} }
.button_list { .button_list {
display: flex; display: flex;
}
.button { .button {
border: 1px solid #409eff; border: 1px solid #409eff;
display: flex; display: flex;
...@@ -15,7 +22,6 @@ ...@@ -15,7 +22,6 @@
background-color: #e6e6e6; background-color: #e6e6e6;
} }
} }
}
#body { #body {
position: relative; position: relative;
...@@ -55,6 +61,7 @@ ...@@ -55,6 +61,7 @@
#footer { #footer {
.button { .button {
border: 0.5px solid var(--color); border: 0.5px solid var(--color);
width: auto;
display: flex; display: flex;
justify-content: center; justify-content: center;
:hover { :hover {
...@@ -76,16 +83,6 @@ ...@@ -76,16 +83,6 @@
display: grid; display: grid;
justify-content: center; justify-content: center;
justify-items: center; justify-items: center;
.button {
border: 1px solid #409eff;
display: flex;
justify-content: center;
width: 80%;
&:hover {
background-color: #e6e6e6;
cursor: pointer;
}
}
#score { #score {
display: flex; display: flex;
justify-content: center; justify-content: center;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment