Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tabulator-another-web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
tabulator-another-web
Commits
e7ecbb33
Commit
e7ecbb33
authored
Jul 27, 2025
by
xiaoye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
0f70c3c3
Pipeline
#39609
passed with stages
in 3 minutes and 6 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
17 deletions
+93
-17
src/pages/tabulator.vue
src/pages/tabulator.vue
+1
-1
src/pages/tournament.vue
src/pages/tournament.vue
+42
-4
src/script/match.ts
src/script/match.ts
+7
-5
src/script/participant.ts
src/script/participant.ts
+28
-1
src/script/post.ts
src/script/post.ts
+14
-2
src/script/tournament.ts
src/script/tournament.ts
+0
-2
src/script/type.ts
src/script/type.ts
+1
-2
No files found.
src/pages/tabulator.vue
View file @
e7ecbb33
...
...
@@ -122,7 +122,7 @@
v-for =
'(i, v) in search.result.tournaments'
:title =
'i.name'
:note =
'search.rule.note.get(i.rule)'
:rightText =
'`$
{i.createdAt.toLocaleDateString()}
\n${i.count}
`'
:rightText =
'`$
{i.createdAt.toLocaleDateString()}`'
:clickable = true
@click = 'page.show.tournament(i.id)'
>
</uni-list-item>
...
...
src/pages/tournament.vue
View file @
e7ecbb33
...
...
@@ -62,6 +62,17 @@
:max =
'participant.array.length'
></uni-number-box>
名
<uni-fav
:checked =
"searcher.p.chk"
:content-text =
"
{
contentDefault: '全部',
contentFav: '参与中'
}"
@click = 'searcher.p.btn()'
:star = 'false'
bgColor = 'white'
bgColorChecked = '#e6e6e6'
fgColorChecked = 'black'
/>
</div>
<div>
<view
...
...
@@ -100,7 +111,7 @@
<view
id =
'header'
>
<span>
{{
i
.
name
}}
</span>
<br>
<span
class =
'small'
>
{{
tournament
.
this
.
status
==
'
Ready
'
?
`${v + 1
}
`
:
(
i
.
score
?
i
.
score
.
rank
:
''
)
}}
<
/span
>
<span
class =
'small'
>
{{
v
+
1
}}
</span>
</view>
</
template
>
<
template
v-slot:footer
>
...
...
@@ -178,7 +189,7 @@
:current =
'participant.page'
v-model =
'participant.page'
pageSize =
20
:
total
=
'
searcher.participant ? participant.array.filter(i => searcher.filterParticipant(i)).length : participant.total
'
:total =
'
participant.array.filter(i => searcher.filterParticipant(i)).length
'
>
</uni-pagination>
</uni-card>
...
...
@@ -200,6 +211,17 @@
:disabled =
"tournament.this.status == 'Ready'"
></uni-number-box>
<span>
轮
</span>
<uni-fav
:checked =
"searcher.m.chk"
:content-text =
"{
contentDefault: '全部',
contentFav: '进行中'
}"
@
click =
'searcher.m.btn()'
:star =
'false'
bgColor =
'white'
bgColorChecked =
'#e6e6e6'
fgColorChecked =
'black'
/>
</div>
<div>
<view
class =
'button'
@
click =
'() => { match.round = 0; }'
>
全部轮次
</view>
...
...
@@ -475,7 +497,7 @@
}
,
copy
:
()
:
void
=>
{
if
(
!
tournament
.
this
)
return
;
let
string
=
`<--- ${tournament.this.name
}
- [${tournament.this.rule == 'SingleElimination' ? '淘汰赛' : '瑞士轮'
}
]${tournament.this.ruleSettings.rounds ? `
[
$
{
tournament
.
this
.
ruleSettings
.
rounds
}轮
]
` : ''
}
[${
tournament.this.count ?? 0
}
人] --->\n`
let
string
=
`<--- ${tournament.this.name
}
- [${tournament.this.rule == 'SingleElimination' ? '淘汰赛' : '瑞士轮'
}
]${tournament.this.ruleSettings.rounds ? `
[
$
{
tournament
.
this
.
ruleSettings
.
rounds
}轮
]
` : ''
}
[${
participant.array.length
}
人] --->\n`
for
(
let
round
=
1
;
round
<=
match
.
maxRound
;
round
++
)
{
if
(
match
.
round
>
0
&&
match
.
round
!=
round
)
continue
;
string
+=
`---------------------------------------------\n第[ ${round
}
]轮对决战况表\n---------------------------------------------\n`
...
...
@@ -652,7 +674,7 @@
}
,
copy
:
()
:
void
=>
{
if
(
!
tournament
.
this
)
return
;
let
string
=
`<--- ${tournament.this.name
}
- [${tournament.this.rule == 'SingleElimination' ? '淘汰赛' : '瑞士轮'
}
]${tournament.this.ruleSettings.rounds ? `
[
$
{
tournament
.
this
.
ruleSettings
.
rounds
}轮
]
` : ''
}
[${
tournament.this.count
?? 0
}
人] --->\n`
;
let
string
=
`<--- ${tournament.this.name
}
- [${tournament.this.rule == 'SingleElimination' ? '淘汰赛' : '瑞士轮'
}
]${tournament.this.ruleSettings.rounds ? `
[
$
{
tournament
.
this
.
ruleSettings
.
rounds
}轮
]
` : ''
}
[${
participant.array.length
?? 0
}
人] --->\n`
;
let
copyValue
=
participant
.
copyValue
;
if
(
copyValue
==
0
)
copyValue
=
participant
.
array
.
length
;
const
map
:
Map
<
number
,
string
>
=
new
Map
([
...
...
@@ -728,14 +750,30 @@
filterMatch
:
(
i
:
Match
)
:
boolean
=>
{
if
((
i
.
round
!=
match
.
round
&&
match
.
round
!=
0
)
||
(
i
.
status
==
'
Abandoned
'
&&
!
i
.
player1
.
name
||
!
i
.
player2
.
name
))
return
false
;
if
(
searcher
.
m
.
chk
&&
i
.
status
!=
'
Running
'
)
return
false
;
return
searcher
.
match
?
i
.
player1
.
name
.
toUpperCase
().
includes
(
searcher
.
match
.
toUpperCase
())
||
i
.
player2
.
name
.
toUpperCase
().
includes
(
searcher
.
match
.
toUpperCase
())
:
true
;
}
,
filterParticipant
:
(
i
:
Participant
)
:
boolean
=>
{
if
(
searcher
.
p
.
chk
&&
i
.
quit
)
return
false
;
return
searcher
.
participant
?
i
.
name
.
toUpperCase
().
includes
(
searcher
.
participant
.
toUpperCase
())
:
true
;
}
,
reset
:
()
:
void
=>
{
searcher
.
participant
=
''
;
searcher
.
match
=
''
;
}
,
p
:
{
chk
:
false
,
btn
:
()
:
void
=>
{
searcher
.
p
.
chk
=!
searcher
.
p
.
chk
;
}
}
,
m
:
{
chk
:
false
,
btn
:
()
:
void
=>
{
searcher
.
m
.
chk
=!
searcher
.
m
.
chk
;
}
}
}
);
...
...
src/script/match.ts
View file @
e7ecbb33
...
...
@@ -19,23 +19,25 @@ class Match {
winnerId
:
number
|
null
;
childMatchId
:
number
;
constructor
(
obj
:
MatchObject
)
{
constructor
(
obj
:
MatchObject
,
p
:
Array
<
Participant
>
)
{
this
.
id
=
obj
.
id
;
this
.
tournamentId
=
obj
.
tournamentId
;
this
.
round
=
obj
.
round
;
this
.
isThirdPlaceMatch
=
obj
.
isThirdPlaceMatch
;
this
.
status
=
obj
.
status
;
const
name1
=
obj
.
player1
?.
name
.
split
(
/
[\+\u
FF0B
]
/
)
??
[];
const
name1_str
=
p
.
find
(
i
=>
i
.
id
==
obj
.
player1Id
)?.
name
??
''
;
const
name1
=
name1_str
.
split
(
/
[\+\u
FF0B
]
/
)
??
[];
this
.
player1
=
{
id
:
obj
.
player1Id
,
name
:
(
name1
.
length
==
2
&&
!
Number
.
isNaN
(
name1
[
0
])
&&
name1
[
0
].
length
>
3
)
?
name1
[
1
]
:
obj
.
player1
?.
name
??
''
,
name
:
(
name1
.
length
==
2
&&
!
Number
.
isNaN
(
name1
[
0
])
&&
name1
[
0
].
length
>
3
)
?
name1
[
1
]
:
name1_str
,
qq
:
(
name1
.
length
==
2
&&
!
Number
.
isNaN
(
name1
[
0
])
&&
name1
[
0
].
length
>
3
)
?
name1
[
0
]
:
undefined
,
score
:
obj
.
player1Score
};
const
name2
=
obj
.
player2
?.
name
.
split
(
/
[\+\u
FF0B
]
/
)
??
[];
const
name2_str
=
p
.
find
(
i
=>
i
.
id
==
obj
.
player2Id
)?.
name
??
''
;
const
name2
=
name2_str
?.
split
(
/
[\+\u
FF0B
]
/
)
??
[];
this
.
player2
=
{
id
:
obj
.
player2Id
,
name
:
(
name2
.
length
==
2
&&
!
Number
.
isNaN
(
name2
[
0
])
&&
name2
[
0
].
length
>
3
)
?
name2
[
1
]
:
obj
.
player2
?.
name
??
''
,
name
:
(
name2
.
length
==
2
&&
!
Number
.
isNaN
(
name2
[
0
])
&&
name2
[
0
].
length
>
3
)
?
name2
[
1
]
:
name2_str
,
qq
:
(
name2
.
length
==
2
&&
!
Number
.
isNaN
(
name2
[
0
])
&&
name2
[
0
].
length
>
3
)
?
name2
[
0
]
:
undefined
,
score
:
obj
.
player2Score
};
...
...
src/script/participant.ts
View file @
e7ecbb33
import
{
Score
,
ParticipantObject
,
Deck
}
from
'
./type.ts
'
;
import
YGOProDeck
from
'
ygopro-deck-encode
'
;
import
{
Base64
}
from
'
js-base64
'
;
import
Match
from
'
./match.ts
'
;
import
Tournament
from
'
./tournament.ts
'
;
class
Participant
{
id
:
number
;
...
...
@@ -18,7 +20,6 @@ class Participant {
this
.
qq
=
(
name
.
length
==
2
&&
!
Number
.
isNaN
(
name
[
0
])
&&
name
[
0
].
length
>
3
)
?
name
[
0
]
:
undefined
;
this
.
tournamentId
=
obj
.
tournamentId
;
this
.
id
=
obj
.
id
;
this
.
score
=
obj
.
score
;
this
.
deckbuf
=
obj
.
deckbuf
??
''
;
this
.
quit
=
obj
.
quit
??
false
;
if
(
obj
.
deckbuf
)
...
...
@@ -43,6 +44,32 @@ class Participant {
const
data
=
this
.
deck
?.
toYdkString
()
??
''
;
return
new
Blob
([
data
],
{
type
:
'
text/plain
'
});
}
getScore
=
(
matches
:
Array
<
Match
>
,
t
:
Tournament
)
:
void
=>
{
const
m
=
{
win
:
matches
.
filter
(
i
=>
this
.
id
==
i
.
winnerId
).
length
,
draw
:
matches
.
filter
(
i
=>
(
this
.
id
==
i
.
player1
.
id
||
this
.
id
==
i
.
player2
.
id
)
&&
Number
.
isNaN
(
i
.
winnerId
)).
length
,
lose
:
matches
.
filter
(
i
=>
(
this
.
id
==
i
.
player1
.
id
||
this
.
id
==
i
.
player2
.
id
)
&&
!
Number
.
isNaN
(
i
.
winnerId
)
&&
i
.
winnerId
!=
this
.
id
).
length
,
bye
:
Math
.
max
(...
matches
.
filter
(
i
=>
i
.
status
==
'
Finished
'
||
i
.
status
==
'
Running
'
).
map
(
i
=>
i
.
round
))
-
matches
.
filter
(
i
=>
this
.
id
==
i
.
player1
.
id
||
this
.
id
==
i
.
player2
.
id
).
length
};
this
.
score
=
{
score
:
m
.
win
*
t
.
ruleSettings
.
winScore
+
m
.
draw
*
t
.
ruleSettings
.
drawScore
+
m
.
bye
*
t
.
ruleSettings
.
byeScore
,
win
:
m
.
win
,
draw
:
m
.
draw
,
bye
:
m
.
bye
,
lose
:
m
.
lose
}
}
getTieBreaker
=
(
participants
:
Array
<
Participant
>
,
matches
:
Array
<
Match
>
)
:
void
=>
{
let
tieBreaker
=
0
;
matches
.
filter
(
i
=>
this
.
id
==
i
.
player1
.
id
||
this
.
id
==
i
.
player2
.
id
).
forEach
(
i
=>
{
const
id
=
this
.
id
==
i
.
player1
.
id
?
i
.
player2
.
id
:
i
.
player1
.
id
;
const
p
=
participants
.
find
(
p
=>
p
.
id
==
id
)?.
score
.
score
??
0
;
tieBreaker
+=
p
;
});
this
.
score
.
tieBreaker
=
tieBreaker
;
}
}
export
default
Participant
;
src/script/post.ts
View file @
e7ecbb33
...
...
@@ -99,16 +99,28 @@ class TabulatorAPI {
'
x-user-token
'
:
token
}
});
const
tournament
=
new
Tournament
(
response
.
data
.
data
);
let
participants
:
Array
<
Participant
>
=
[];
let
matches
:
Array
<
Match
>
=
[];
response
.
data
.
data
.
participants
.
forEach
((
i
:
ParticipantObject
)
=>
{
participants
.
push
(
new
Participant
(
i
));
});
response
.
data
.
data
.
matches
.
forEach
((
i
:
MatchObject
)
=>
{
matches
.
push
(
new
Match
(
i
));
matches
.
push
(
new
Match
(
i
,
participants
));
});
participants
.
forEach
(
i
=>
{
i
.
getScore
(
matches
,
tournament
);
});
participants
.
forEach
(
i
=>
{
i
.
getTieBreaker
(
participants
,
matches
);
});
if
(
tournament
.
status
!=
'
Ready
'
)
{
participants
.
sort
((
a
,
b
)
=>
{
return
b
.
score
.
score
-
a
.
score
.
score
});
}
return
{
tournament
:
new
Tournament
(
response
.
data
.
data
)
,
tournament
:
tournament
,
participant
:
{
participants
:
participants
,
total
:
participants
.
length
...
...
src/script/tournament.ts
View file @
e7ecbb33
...
...
@@ -19,7 +19,6 @@ class Tournament {
creator
:
number
;
collaborators
:
Array
<
number
>
;
createdAt
:
Date
;
count
:
Number
;
constructor
(
obj
:
TournamentObject
)
{
this
.
name
=
obj
.
name
;
...
...
@@ -34,7 +33,6 @@ class Tournament {
this
.
status
=
obj
.
status
;
this
.
creator
=
obj
.
creator
;
this
.
createdAt
=
new
Date
(
obj
.
createdAt
);
this
.
count
=
obj
.
participants
.
length
;
if
(
Number
.
isNaN
(
this
.
ruleSettings
.
winScore
))
this
.
ruleSettings
.
winScore
=
3
;
if
(
Number
.
isNaN
(
this
.
ruleSettings
.
drawScore
))
this
.
ruleSettings
.
drawScore
=
1
;
if
(
Number
.
isNaN
(
this
.
ruleSettings
.
byeScore
))
this
.
ruleSettings
.
byeScore
=
3
;
...
...
src/script/type.ts
View file @
e7ecbb33
...
...
@@ -80,13 +80,12 @@ interface TournamentFindObject {
}
interface
Score
{
rank
:
number
;
score
:
number
;
win
:
number
;
draw
:
number
;
lose
:
number
;
bye
:
number
;
tieBreaker
:
number
;
tieBreaker
?
:
number
;
}
interface
ParticipantFindObject
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment