Commit 5b77ab4b authored by xiaoye's avatar xiaoye

fix

parent b4db05ce
...@@ -447,12 +447,12 @@ ...@@ -447,12 +447,12 @@
total : 0, total : 0,
tournaments : [] as Array<Tournament> tournaments : [] as Array<Tournament>
}, },
on : async () : Promise<void> => { on : async (Data : TournamentFindObject = search.info) : Promise<void> => {
page.drawer = false; page.drawer = false;
if (search.result.total > 0) { if (search.result.total > 0) {
search.result.total = 0; search.result.total = 0;
} }
const result = await Tabulator.Tournament.FindALL(Mycard.token, search.info); const result = await Tabulator.Tournament.FindALL(Mycard.token, Data);
search.result.total = result.total; search.result.total = result.total;
search.result.tournaments = result.tournaments; search.result.tournaments = result.tournaments;
}, },
...@@ -598,7 +598,15 @@ ...@@ -598,7 +598,15 @@
if (page.tournament) if (page.tournament)
page.show.menu(); page.show.menu();
create.clear(); create.clear();
await search.on(); await search.on({
pageCount : 1,
id : 0,
creator : Mycard.id >= 0 ? Mycard.id : 0,
name : '',
rule : '',
visibility : '',
status : ''
} as TournamentFindObject);
} }
}, },
remove : (v : number) : void => { remove : (v : number) : void => {
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ class Match { ...@@ -11,7 +11,7 @@ class Match {
player2Score : number; player2Score : number;
player1Id : number; player1Id : number;
player2Id : number; player2Id : number;
winnerId : number; winnerId : number | null;
childMatchId : number; childMatchId : number;
constructor(obj : MatchObject) { constructor(obj : MatchObject) {
...@@ -24,7 +24,7 @@ class Match { ...@@ -24,7 +24,7 @@ class Match {
this.player2Id = obj.player2Id; this.player2Id = obj.player2Id;
this.player1Score = obj.player1Score; this.player1Score = obj.player1Score;
this.player2Score = obj.player2Score; this.player2Score = obj.player2Score;
this.winnerId = obj.winnerId; this.winnerId = obj.winnerId as number | null;
this.childMatchId = obj.childMatchId; this.childMatchId = obj.childMatchId;
} }
......
...@@ -20,7 +20,8 @@ import { ...@@ -20,7 +20,8 @@ import {
AllTournament, AllTournament,
AllParticipant, AllParticipant,
AllMatch, AllMatch,
UserObject UserObject,
TournamentAParticipant
} from './type.ts' } from './type.ts'
class TabulatorAPI { class TabulatorAPI {
...@@ -76,7 +77,7 @@ class TabulatorAPI { ...@@ -76,7 +77,7 @@ class TabulatorAPI {
return false; return false;
} }
}, },
Find : async (token : string, id : number) : Promise<Tournament | undefined> => { Find : async (token : string, id : number) : Promise<TournamentAParticipant> => {
let response : { let response : {
data : { data : {
data : TournamentObject; data : TournamentObject;
...@@ -88,11 +89,27 @@ class TabulatorAPI { ...@@ -88,11 +89,27 @@ class TabulatorAPI {
'x-user-token' : token 'x-user-token' : token
} }
}); });
return new Tournament(response.data.data); let participants : Array<Participant> = [];
response.data.data.participants.forEach((i : ParticipantObject) => {
participants.push(new Participant(i));
});
return {
tournament : new Tournament(response.data.data),
participant : {
participants : participants,
total : participants.length
}
};
} }
catch(error) { catch(error) {
console.error(error); console.error(error);
return undefined; return {
tournament : undefined,
participant : {
participants : [],
total : 0
}
};
} }
}, },
FindALL : async (token : string, obj : TournamentFindObject = {}) : Promise<AllTournament> => { FindALL : async (token : string, obj : TournamentFindObject = {}) : Promise<AllTournament> => {
...@@ -153,7 +170,6 @@ class TabulatorAPI { ...@@ -153,7 +170,6 @@ class TabulatorAPI {
'x-user-token' : token 'x-user-token' : token
} }
}); });
console.log(response)
return response.data.success; return response.data.success;
} }
catch(error) { catch(error) {
...@@ -173,7 +189,6 @@ class TabulatorAPI { ...@@ -173,7 +189,6 @@ class TabulatorAPI {
'x-user-token' : token 'x-user-token' : token
} }
}); });
console.log(response)
return response.data.success; return response.data.success;
} }
catch(error) { catch(error) {
...@@ -193,7 +208,6 @@ class TabulatorAPI { ...@@ -193,7 +208,6 @@ class TabulatorAPI {
'x-user-token' : token 'x-user-token' : token
} }
}); });
console.log(response)
return response.data.success; return response.data.success;
} }
catch(error) { catch(error) {
...@@ -213,7 +227,6 @@ class TabulatorAPI { ...@@ -213,7 +227,6 @@ class TabulatorAPI {
'x-user-token' : token 'x-user-token' : token
} }
}); });
console.log(response)
return response.data.success; return response.data.success;
} }
catch(error) { catch(error) {
......
...@@ -22,7 +22,7 @@ interface MatchFindObject { ...@@ -22,7 +22,7 @@ interface MatchFindObject {
interface MatchUpdateObject { interface MatchUpdateObject {
player1Score : number; player1Score : number;
player2Score : number; player2Score : number;
winnerId : number; winnerId : number | null | undefined;
} }
interface MatchObject extends MatchUpdateObject { interface MatchObject extends MatchUpdateObject {
...@@ -142,10 +142,16 @@ interface AllTournament extends All { ...@@ -142,10 +142,16 @@ interface AllTournament extends All {
interface AllParticipant extends All { interface AllParticipant extends All {
participants : Array<Participant>; participants : Array<Participant>;
} }
interface AllMatch extends All { interface AllMatch extends All {
matchs : Array<Match>; matchs : Array<Match>;
} }
interface TournamentAParticipant {
tournament : Tournament | undefined;
participant : AllParticipant
}
interface UserObject { interface UserObject {
avatar : string avatar : string
id : 777668 id : 777668
...@@ -171,5 +177,6 @@ export { ...@@ -171,5 +177,6 @@ export {
AllParticipant, AllParticipant,
AllMatch, AllMatch,
ruleSettings, ruleSettings,
UserObject UserObject,
TournamentAParticipant
} }
\ No newline at end of file
...@@ -17,37 +17,40 @@ ...@@ -17,37 +17,40 @@
} }
} }
#body {
position: relative;
width: 80%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 1fr;
justify-content: center;
transition: all 0.3s ease;
#left {
justify-self: left;
}
#center {
justify-self: center;
}
#right {
justify-self: right;
}
}
:deep(.uni-list-item) { :deep(.uni-list-item) {
.small {
margin-top: 6rpx;
color: #999;
font-size: 12px;
overflow: hidden;
}
#header { #header {
min-width: 30%; min-width: 30%;
.rank {
margin-top: 6rpx;
color: #999;
font-size: 12px;
overflow: hidden;
}
} }
#body { #body {
position: relative;
width: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 1fr;
justify-content: center;
transition: all 0.3s ease;
#left {
justify-self: left;
}
#center {
justify-self: center;
}
#right {
justify-self: right;
}
&:hover { &:hover {
cursor: pointer; cursor: pointer;
scale: (1.05); scale: (1.05);
} }
} }
#footer { #footer {
.button { .button {
...@@ -63,10 +66,41 @@ ...@@ -63,10 +66,41 @@
} }
.match { .match {
border: 1px solid gray;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
top : var(--top); top : var(--top);
left : 100%; // left : 100%;
width: 100%;
background-color: white;
display: grid;
justify-content: center;
justify-items: center;
.button {
border: 1px solid #409eff;
display: flex;
justify-content: center;
width: 80%;
&:hover {
background-color: #e6e6e6;
cursor: pointer;
}
}
#score {
display: flex;
justify-content: center;
justify-items: center;
column-gap: 10%;
margin: 3%;
}
}
:deep(#matchList) {
#footer {
width: 20%;
display: flex;
flex-direction: row-reverse;
}
} }
} }
} }
\ No newline at end of file
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