Commit 43c8d847 authored by xiaoye's avatar xiaoye

fix

parent 9ae485d8
Pipeline #37881 passed with stages
in 4 minutes and 49 seconds
...@@ -445,6 +445,7 @@ ...@@ -445,6 +445,7 @@
emitter.on(Const.tournamentReload, tournament.init); emitter.on(Const.tournamentReload, tournament.init);
// @ts-ignore // @ts-ignore
emitter.on(Const.updateRounds, tournament.updateRounds); emitter.on(Const.updateRounds, tournament.updateRounds);
// @ts-ignore
emitter.on(Const.createOff, creator.off); emitter.on(Const.createOff, creator.off);
window.addEventListener('hashchange', loading); window.addEventListener('hashchange', loading);
}); });
...@@ -462,6 +463,7 @@ ...@@ -462,6 +463,7 @@
emitter.off(Const.tournamentReload, tournament.init); emitter.off(Const.tournamentReload, tournament.init);
// @ts-ignore // @ts-ignore
emitter.off(Const.updateRounds, tournament.updateRounds); emitter.off(Const.updateRounds, tournament.updateRounds);
// @ts-ignore
emitter.off(Const.createOff, creator.off); emitter.off(Const.createOff, creator.off);
window.removeEventListener('hashchange', loading); window.removeEventListener('hashchange', loading);
}); });
......
...@@ -70,14 +70,13 @@ ...@@ -70,14 +70,13 @@
:is-full = 'true' :is-full = 'true'
:title = '`参与者:${participant.total}`' :title = '`参与者:${participant.total}`'
> >
<view id = 'round'> <view id = 'round' v-show = "tournament.this.status == 'Finished'">
<div> <div>
<uni-number-box <uni-number-box
v-model = 'participant.copyValue' v-model = 'participant.copyValue'
:min = '0' :min = '0'
:max = 'participant.array.length' :max = 'participant.array.length'
v-show = "tournament.this.status == 'Finished'"
></uni-number-box> ></uni-number-box>
</div> </div>
...@@ -85,7 +84,7 @@ ...@@ -85,7 +84,7 @@
<view <view
class = 'button' class = 'button'
@click = 'tournament.operatorChk(participant.copy)' @click = 'tournament.operatorChk(participant.copy)'
v-show = "tournament.this.status == 'Finished'"
> >
复制排名 复制排名
</view> </view>
...@@ -93,7 +92,6 @@ ...@@ -93,7 +92,6 @@
class = 'button' class = 'button'
id = 'newTournament' id = 'newTournament'
@click = 'tournament.operatorChk(tournament.new)' @click = 'tournament.operatorChk(tournament.new)'
v-show = "tournament.this.rule == 'Swiss' && tournament.this.status == 'Finished'"
> >
新建单淘赛 新建单淘赛
</view> </view>
......
...@@ -12,7 +12,7 @@ class Participant { ...@@ -12,7 +12,7 @@ class Participant {
deck : YGOProDeck | undefined; deck : YGOProDeck | undefined;
constructor(obj: ParticipantObject) { constructor(obj: ParticipantObject) {
this.name = new TextDecoder('utf-8').decode(new Uint8Array([...obj.name].map(c => c.charCodeAt(0)))); this.name = obj.name;
this.tournamentId = obj.tournamentId; this.tournamentId = obj.tournamentId;
this.id = obj.id; this.id = obj.id;
this.score = obj.score; this.score = obj.score;
......
...@@ -133,6 +133,7 @@ class TabulatorAPI { ...@@ -133,6 +133,7 @@ class TabulatorAPI {
data : Array<TournamentObject>; data : Array<TournamentObject>;
} }
}; };
console.log(token)
try { try {
response = await this.url.get(`/api/tournament`, { response = await this.url.get(`/api/tournament`, {
params : { params : {
...@@ -246,20 +247,23 @@ class TabulatorAPI { ...@@ -246,20 +247,23 @@ class TabulatorAPI {
}, },
UpdateYdk : async (token : string, id : number, res : UniApp.ChooseFileSuccessCallbackResult) : Promise<Boolean> => { UpdateYdk : async (token : string, id : number, res : UniApp.ChooseFileSuccessCallbackResult) : Promise<Boolean> => {
let response : { let response : {
data : string data : {
success : boolean
}
}; };
try { try {
// @ts-ignore let formData = new FormData();
const files : Array<UniApp.UploadFileOptionFiles> = res.tempFiles.map(file => ({ for (let i = 0; i < res.tempFilePaths.length; i++) {
name: 'files', let f = await fetch(res.tempFilePaths[i]);
uri: file.path, let blob = await f.blob();
type: file.type formData.append('files', blob, res.tempFiles[i].name.replace('.ydk', ''));
})); }
response = await UniApp.uploadFile( response = await this.url.post(`/api/tournament/${id}/upload-ydk`,formData, {
`${this.url.defaults.baseURL}/api/tournament/${id}/upload-ydk`, files, { 'x-user-token' : token } headers : {
) 'x-user-token' : token
const data = JSON.parse(response.data) }
return data.success; });
return response.data.success;
} }
catch(error) { catch(error) {
console.error(error); console.error(error);
......
...@@ -19,7 +19,7 @@ class UniappFuncs { ...@@ -19,7 +19,7 @@ class UniappFuncs {
return uni.uploadFile({ return uni.uploadFile({
url : url, url : url,
files : files, files : files,
header : header, header : header
}); });
} }
......
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