Commit faf8744b authored by xiaoye's avatar xiaoye

fix

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