Commit faf8744b authored by xiaoye's avatar xiaoye

fix

parent 60fa8bc0
This diff is collapsed.
......@@ -127,7 +127,6 @@
</uni-list-item>
<uni-list-item
v-for = '(i, v) in match.array'
v-show = 'participant.array.findIndex(p => p.id == i.player1Id) >= 0'
:clickable = true
>
<template v-slot:header>
......@@ -181,7 +180,7 @@
tournamentReload
} from '../script/const.ts'
import Mycard from '../script/mycard.ts';
import { AllParticipant, AllMatch, TournamentUpdateObject } from '../script/type.ts'
import { AllParticipant, AllMatch, TournamentCreateObject } from '../script/type.ts'
let tournament = reactive({
this : undefined as undefined | Tournament,
......@@ -241,7 +240,7 @@
if (!res.confirm) return;
// @ts-ignore
if (await Tabulator.Tournament.Delete(Mycard.token, tournament.this.id))
page.reload();
page.clear();
}
});
},
......@@ -290,7 +289,7 @@
participant.total = participants.total;
}
},
update : async (Data : TournamentUpdateObject) : Promise<void> => {
update : async (Data : TournamentCreateObject) : Promise<void> => {
// @ts-ignore
if (await Tabulator.Tournament.Update(Mycard.token, tournament.this.id, Data))
page.reload();
......@@ -317,7 +316,7 @@
const participants : AllParticipant = await Tabulator.Participant.FindALL(Mycard.token, {tournamentId : t.id});
participant.array = participants.participants;
participant.total = participants.total;
const matchs = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : t.id});
const matchs = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : t.id, statusIn : 'Running,Finished'});
match.array = matchs.matchs;
match.total = matchs.total;
},
......@@ -336,7 +335,7 @@
participant.array = participants.participants;
participant.total = participants.total;
// @ts-ignore
const matchs : AllMatch = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id});
const matchs : AllMatch = await Tabulator.Match.FindALL(Mycard.token, {tournamentId : tournament.this.id, statusIn : 'Running,Finished'});
match.array = matchs.matchs;
match.total = matchs.total;
emitter.emit(tournamentReload, tournament.this)
......
......@@ -6,7 +6,6 @@ import ApiKey from '../script/apikey.ts';
import {
TournamentObject,
TournamentCreateObject,
TournamentUpdateObject,
TournamentFindObject,
MatchObject,
MatchUpdateObject,
......@@ -48,6 +47,11 @@ class TabulatorAPI {
return response.data.data.id;
}
catch(error) {
uni.showModal({
title : '创建失败',
content : error.message,
showCancel : false
})
console.error(error);
return -1;
}
......@@ -136,7 +140,7 @@ class TabulatorAPI {
};
}
},
Update : async (token : string, id : number, Data : TournamentUpdateObject) : Promise<boolean> => {
Update : async (token : string, id : number, Data : TournamentCreateObject) : Promise<boolean> => {
let response : {
data : {
success : boolean;
......@@ -400,7 +404,8 @@ class TabulatorAPI {
player2Id : obj.player2Id,
player2Score : obj.player2Score,
winnerId : obj.winnerId,
childMatchId : obj.childMatchId
childMatchId : obj.childMatchId,
statusIn : obj.statusIn
},
headers : {
'x-user-token' : token
......
......@@ -16,6 +16,7 @@ interface MatchFindObject {
player2Score ?: number;
winnerId ?: number;
childMatchId ?: number;
statusIn ?: string
}
interface MatchUpdateObject {
......@@ -40,13 +41,6 @@ interface MatchObject extends MatchUpdateObject {
parentMatches ?: MatchObject;
}
interface TournamentUpdateObject {
name : string;
description : string;
visibility : string;
collaborators : Array<number>;
}
interface ruleSettings {
rounds : number;
winScore : number;
......@@ -55,7 +49,11 @@ interface ruleSettings {
hasThirdPlaceMatch : boolean;
}
interface TournamentCreateObject extends TournamentUpdateObject {
interface TournamentCreateObject {
name : string;
description : string;
visibility : string;
collaborators : Array<number>;
rule : string;
ruleSettings : ruleSettings;
}
......@@ -152,7 +150,6 @@ export {
Score,
TournamentObject,
TournamentCreateObject,
TournamentUpdateObject,
TournamentFindObject,
MatchObject,
MatchUpdateObject,
......
......@@ -52,6 +52,7 @@
justify-items: center;
align-items: center;
&:hover {
background-color: #e6e6e6;
cursor: pointer;
}
}
......
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