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