Commit 104db06b authored by xiaoye's avatar xiaoye

fix

parent 1741020c
Pipeline #38230 passed with stages
in 2 minutes and 12 seconds
......@@ -38,9 +38,6 @@
<span>关闭</span>
<uni-icons type = 'close'></uni-icons>
</view>
</view>
<br>
<view class = 'button_list' >
<view class = 'button click' @click = 'tournament.operatorChk(tournament.on)'>
<span>{{ tournament.status.text.get(tournament.this.status) }}</span>
<uni-icons type = 'circle-filled' :color = 'tournament.status.color.get(tournament.this.status)'></uni-icons>
......@@ -57,6 +54,10 @@
<span>上传</span>
<uni-icons type = 'cloud-upload'></uni-icons>
</view>
<view class = 'button click' @click = 'tournament.operatorChk(tournament.empty)'>
<span>清空</span>
<uni-icons type = 'spinner-cycle' color = 'red'></uni-icons>
</view>
<view class = 'button click' @click = 'tournament.operatorChk(tournament.del)'>
<span>删除</span>
<uni-icons type = 'trash' color = 'red'></uni-icons>
......@@ -442,6 +443,17 @@
}
});
},
empty : () : void => {
uni.showModal({
title : '确认要清空比赛选手吗?',
success : async (res : UniApp.ShowModalRes) : Promise<void> => {
if (!res.confirm) return;
// @ts-ignore
if (await Tabulator.Tournament.Empty(Mycard.token, tournament.this.id))
page.reload();
}
});
},
shuffle : () : void => {
if (tournament.this?.status != 'Ready') return;
uni.showModal({
......
......@@ -95,6 +95,7 @@ class TabulatorAPI {
response.data.data.matches.forEach((i : MatchObject) => {
matches.push(new Match(i));
});
console.log(response)
return {
tournament : new Tournament(response.data.data),
participant : {
......@@ -269,6 +270,25 @@ class TabulatorAPI {
return false;
}
},
Empty : async (token : string, id : number) : Promise<Boolean> => {
let response : {
data : {
success : boolean;
}
};
try {
response = await this.url.post(`/api/tournament/${id}/clear-participants`, {
headers: {
'x-user-token' : token
}
});
return response.data.success;
}
catch(error) {
console.error(error);
return false;
}
},
Shuffle : async (token : string, id : number) : Promise<Boolean> => {
let response : {
data : {
......
......@@ -11,6 +11,8 @@
.button_list {
display: flex;
flex-wrap: wrap;
row-gap: 10px;
}
.button {
......
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