Commit 5b77ab4b authored by xiaoye's avatar xiaoye

fix

parent b4db05ce
......@@ -447,12 +447,12 @@
total : 0,
tournaments : [] as Array<Tournament>
},
on : async () : Promise<void> => {
on : async (Data : TournamentFindObject = search.info) : Promise<void> => {
page.drawer = false;
if (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.tournaments = result.tournaments;
},
......@@ -598,7 +598,15 @@
if (page.tournament)
page.show.menu();
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 => {
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ class Match {
player2Score : number;
player1Id : number;
player2Id : number;
winnerId : number;
winnerId : number | null;
childMatchId : number;
constructor(obj : MatchObject) {
......@@ -24,7 +24,7 @@ class Match {
this.player2Id = obj.player2Id;
this.player1Score = obj.player1Score;
this.player2Score = obj.player2Score;
this.winnerId = obj.winnerId;
this.winnerId = obj.winnerId as number | null;
this.childMatchId = obj.childMatchId;
}
......
......@@ -20,7 +20,8 @@ import {
AllTournament,
AllParticipant,
AllMatch,
UserObject
UserObject,
TournamentAParticipant
} from './type.ts'
class TabulatorAPI {
......@@ -76,7 +77,7 @@ class TabulatorAPI {
return false;
}
},
Find : async (token : string, id : number) : Promise<Tournament | undefined> => {
Find : async (token : string, id : number) : Promise<TournamentAParticipant> => {
let response : {
data : {
data : TournamentObject;
......@@ -88,11 +89,27 @@ class TabulatorAPI {
'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) {
console.error(error);
return undefined;
return {
tournament : undefined,
participant : {
participants : [],
total : 0
}
};
}
},
FindALL : async (token : string, obj : TournamentFindObject = {}) : Promise<AllTournament> => {
......@@ -153,7 +170,6 @@ class TabulatorAPI {
'x-user-token' : token
}
});
console.log(response)
return response.data.success;
}
catch(error) {
......@@ -173,7 +189,6 @@ class TabulatorAPI {
'x-user-token' : token
}
});
console.log(response)
return response.data.success;
}
catch(error) {
......@@ -193,7 +208,6 @@ class TabulatorAPI {
'x-user-token' : token
}
});
console.log(response)
return response.data.success;
}
catch(error) {
......@@ -213,7 +227,6 @@ class TabulatorAPI {
'x-user-token' : token
}
});
console.log(response)
return response.data.success;
}
catch(error) {
......
......@@ -22,7 +22,7 @@ interface MatchFindObject {
interface MatchUpdateObject {
player1Score : number;
player2Score : number;
winnerId : number;
winnerId : number | null | undefined;
}
interface MatchObject extends MatchUpdateObject {
......@@ -142,10 +142,16 @@ interface AllTournament extends All {
interface AllParticipant extends All {
participants : Array<Participant>;
}
interface AllMatch extends All {
matchs : Array<Match>;
}
interface TournamentAParticipant {
tournament : Tournament | undefined;
participant : AllParticipant
}
interface UserObject {
avatar : string
id : 777668
......@@ -171,5 +177,6 @@ export {
AllParticipant,
AllMatch,
ruleSettings,
UserObject
UserObject,
TournamentAParticipant
}
\ No newline at end of file
......@@ -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) {
.small {
margin-top: 6rpx;
color: #999;
font-size: 12px;
overflow: hidden;
}
#header {
min-width: 30%;
.rank {
margin-top: 6rpx;
color: #999;
font-size: 12px;
overflow: hidden;
}
}
#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 {
cursor: pointer;
scale: (1.05);
}
scale: (1.05);
}
}
#footer {
.button {
......@@ -63,10 +66,41 @@
}
.match {
border: 1px solid gray;
position: absolute;
z-index: 1;
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