Commit b032a553 authored by xiaoye's avatar xiaoye

减少不必要的请求

parent f53fde14
Pipeline #39012 passed with stages
in 3 minutes and 7 seconds
...@@ -29,27 +29,27 @@ ...@@ -29,27 +29,27 @@
</view> </view>
<br> <br>
<view v-show = 'operatorChk()'> <view v-show = 'operatorChk()'>
<view class = 'button click' @click = 'emit.on()'> <view class = 'button' @click = 'emit.on()'>
<span>{{ `切换状态:${status.text.get(tournament.this.status)}` }}</span> <span>{{ `切换状态:${status.text.get(tournament.this.status)}` }}</span>
<uni-icons type = 'circle-filled' :color = 'status.color.get(tournament.this.status)'></uni-icons> <uni-icons type = 'circle-filled' :color = 'status.color.get(tournament.this.status)'></uni-icons>
</view> </view>
<view class = 'button click' @click = 'emit.reset()'> <view class = 'button' @click = 'emit.reset()'>
<span>重置比赛</span> <span>重置比赛</span>
<uni-icons type = 'loop'></uni-icons> <uni-icons type = 'loop'></uni-icons>
</view> </view>
<view class = 'button click' @click = 'emit.shuffle()'> <view class = 'button' @click = 'emit.shuffle()'>
<span>打乱选手</span> <span>打乱选手</span>
<uni-icons type = 'auth'></uni-icons> <uni-icons type = 'auth'></uni-icons>
</view> </view>
<view class = 'button click' @click = 'emit.upload()'> <view class = 'button' @click = 'emit.upload()'>
<span>上传选手</span> <span>上传选手</span>
<uni-icons type = 'cloud-upload'></uni-icons> <uni-icons type = 'cloud-upload'></uni-icons>
</view> </view>
<view class = 'button click' @click = 'emit.empty()'> <view class = 'button' @click = 'emit.empty()'>
<span>清空选手</span> <span>清空选手</span>
<uni-icons type = 'spinner-cycle' color = 'red'></uni-icons> <uni-icons type = 'spinner-cycle' color = 'red'></uni-icons>
</view> </view>
<view class = 'button click' @click = 'emit.del()'> <view class = 'button' @click = 'emit.del()'>
<span>删除比赛</span> <span>删除比赛</span>
<uni-icons type = 'trash' color = 'red'></uni-icons> <uni-icons type = 'trash' color = 'red'></uni-icons>
</view> </view>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</uni-forms> </uni-forms>
</template> </template>
<template v-slot:footer> <template v-slot:footer>
<view id = 'footer'> <view id = 'footer'>
<view <view
class = 'button' class = 'button'
:style = "{ '--color' : '#409eff' }" :style = "{ '--color' : '#409eff' }"
......
...@@ -458,15 +458,16 @@ ...@@ -458,15 +458,16 @@
let del_list : Array<Participant> = []; let del_list : Array<Participant> = [];
// @ts-ignore // @ts-ignore
res.tempFiles.forEach(i => { res.tempFiles.forEach(i => {
const name = i.name.replace(/\.[^/.]+$/, ""); const fileName = i.name.replace(/\.[^/.]+$/, "");
const p = participant.array.filter(p => p.baseName == name || p.name == name); const name = fileName.split(/[\+\uFF0B]/);
const p = participant.array.filter(p => p.name == ((name.length == 2 && !Number.isNaN(name[0]) && name[0].length > 3) ? name[1] : fileName));
del_list.push(...p); del_list.push(...p);
}); });
// @ts-ignore // @ts-ignore
if (await Tabulator.Tournament.UpdateYdk(Mycard.token, tournament.this.id, res)) { if (await Tabulator.Tournament.UpdateYdk(Mycard.token, tournament.this.id, res)) {
for (const i of del_list) for (const i of del_list)
await participant.del(i); await Tabulator.Participant.Delete(Mycard.token, i.id);
await tournament.search(); await tournament.search();
} }
}; };
......
...@@ -5,7 +5,6 @@ import { Base64 } from 'js-base64'; ...@@ -5,7 +5,6 @@ import { Base64 } from 'js-base64';
class Participant { class Participant {
id : number; id : number;
name : string; name : string;
baseName : string;
qq : string | undefined; qq : string | undefined;
quit : boolean; quit : boolean;
tournamentId : number; tournamentId : number;
...@@ -16,7 +15,6 @@ class Participant { ...@@ -16,7 +15,6 @@ class Participant {
constructor(obj: ParticipantObject) { constructor(obj: ParticipantObject) {
const name = obj.name.split(/[\+\uFF0B]/); const name = obj.name.split(/[\+\uFF0B]/);
this.name = (name.length == 2 && !Number.isNaN(name[0]) && name[0].length > 3) ? name[1] : obj.name; this.name = (name.length == 2 && !Number.isNaN(name[0]) && name[0].length > 3) ? name[1] : obj.name;
this.baseName = obj.name;
this.qq = (name.length == 2 && !Number.isNaN(name[0]) && name[0].length > 3) ? name[0] : undefined; this.qq = (name.length == 2 && !Number.isNaN(name[0]) && name[0].length > 3) ? name[0] : undefined;
this.tournamentId = obj.tournamentId; this.tournamentId = obj.tournamentId;
this.id = obj.id; this.id = obj.id;
......
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