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
60951143
Commit
60951143
authored
Jun 04, 2025
by
xiaoye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4286fbcd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
55 deletions
+60
-55
src/pages/tournament.vue
src/pages/tournament.vue
+38
-47
src/script/post.ts
src/script/post.ts
+16
-4
src/script/type.ts
src/script/type.ts
+6
-4
No files found.
src/pages/tournament.vue
View file @
60951143
...
...
@@ -162,13 +162,13 @@
第
<
uni
-
number
-
box
v
-
model
=
'
match.round
'
:
min
=
'
1
'
:
min
=
'
0
'
:
max
=
'
match.maxRound
'
:
disabled
=
"
tournament.this.status == 'Ready'
"
><
/uni-number-box
>
轮
<
/div
>
<
view
class
=
'
button
'
@
click
=
'
() => { match.
chk = true; match.page = 1; match.search(true)
;
}
'
>
全部轮次
<
/view
>
<
view
class
=
'
button
'
@
click
=
'
() => { match.
round = 0
;
}
'
>
全部轮次
<
/view
>
<
/view
>
<
transition
name
=
'
switch
'
>
<
uni
-
list
>
...
...
@@ -177,7 +177,9 @@
title
=
'
暂无比赛
'
>
<
/uni-list-item
>
<
view
v
-
for
=
'
(i, v) in match.array
'
>
<
view
v
-
for
=
'
(i, v) in (match.round == 0) ? match.array.slice((match.page - 1) * 20, match.page * 20) : match.array.filter(m => m.round == match.round).slice((match.page - 1) * 20, match.page * 20)
'
>
<
view
class
=
'
match
'
v
-
show
=
"
match.submit.page === i && (i.status == 'Running' || i.status == 'Finished')
"
...
...
@@ -205,7 +207,7 @@
<
/view
>
<
uni
-
list
-
item
:
clickable
=
true
@
click
=
'
match.submit.show(
v
)
'
@
click
=
'
match.submit.show(
i
)
'
id
=
'
matchList
'
>
<
template
v
-
slot
:
body
>
...
...
@@ -270,8 +272,7 @@
:
current
=
'
match.page
'
v
-
model
=
'
match.page
'
pageSize
=
20
:
total
=
'
match.total
'
@
change
=
'
match.search()
'
:
total
=
'
(match.round == 0) ? match.total : match.array.filter(m => m.round == match.round).length
'
>
<
/uni-pagination
>
<
/uni-card
>
...
...
@@ -282,7 +283,6 @@
<
/template
>
<
script
setup
lang
=
'
ts
'
>
import
{
ref
,
reactive
,
onMounted
,
onUnmounted
,
onBeforeMount
,
watch
}
from
'
vue
'
;
import
YGOProDeck
from
'
ygopro-deck-encode
'
;
import
emitter
from
'
../script/emitter.ts
'
import
UniApp
from
'
../script/uniapp.ts
'
;
import
{
Tabulator
,
User
}
from
'
../script/post.ts
'
;
...
...
@@ -291,7 +291,7 @@
import
Match
from
'
../script/match.ts
'
;
import
Const
from
'
../script/const.ts
'
import
Mycard
from
'
../script/mycard.ts
'
;
import
{
TournamentCreateObject
,
MatchUpdateObject
,
Tournament
AParticipan
t
,
ParticipantUpdateObject
}
from
'
../script/type.ts
'
import
{
TournamentCreateObject
,
MatchUpdateObject
,
Tournament
Ge
t
,
ParticipantUpdateObject
}
from
'
../script/type.ts
'
let
tournament
=
reactive
({
this
:
undefined
as
undefined
|
Tournament
,
status
:
{
...
...
@@ -306,6 +306,25 @@
[
'
Finished
'
,
'
darkgray
'
]
])
as
Map
<
string
,
string
>
,
}
,
search
:
async
()
:
Promise
<
boolean
>
=>
{
const
url
=
window
.
location
.
hash
.
match
(
/#
\/(
.*
?)(?:\?
|$
)
/
);
// @ts-ignore
const
id
=
url
[
1
];
// @ts-ignore
const
t
:
TournamentGet
=
await
Tabulator
.
Tournament
.
Find
(
Mycard
.
token
,
id
);
if
(
t
.
tournament
)
{
tournament
.
this
=
t
.
tournament
;
emitter
.
emit
(
Const
.
tournamentReload
,
tournament
.
this
)
const
participants
=
t
.
participant
;
participant
.
array
=
participants
.
participants
;
participant
.
total
=
participants
.
total
;
const
matches
=
t
.
match
;
match
.
array
=
matches
.
matches
;
match
.
total
=
matches
.
total
;
return
true
;
}
return
false
;
}
,
on
:
()
:
void
=>
{
switch
(
tournament
.
this
?.
status
)
{
case
'
Ready
'
:
...
...
@@ -367,7 +386,7 @@
if
(
!
res
.
confirm
)
return
;
// @ts-ignore
if
(
await
Tabulator
.
Tournament
.
Shuffle
(
Mycard
.
token
,
tournament
.
this
.
id
))
participa
nt
.
search
();
tourname
nt
.
search
();
}
}
);
}
,
...
...
@@ -394,7 +413,7 @@
if
(
await
Tabulator
.
Tournament
.
UpdateYdk
(
Mycard
.
token
,
tournament
.
this
.
id
,
res
))
{
for
(
const
i
of
del_list
)
await
participant
.
del
(
i
);
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
}
;
await
UniApp
.
selectFile
([
'
.ydk
'
,
'
.txt
'
],
f
);
...
...
@@ -407,7 +426,6 @@
page
:
1
,
round
:
1
,
maxRound
:
2
,
chk
:
false
,
status
:
{
color
:
new
Map
([
[
'
Running
'
,
'
rgb(84, 200, 17)
'
],
...
...
@@ -417,8 +435,8 @@
}
,
submit
:
{
page
:
undefined
as
Match
|
undefined
,
show
:
(
v
:
number
)
:
void
=>
{
match
.
submit
.
page
=
match
.
submit
.
page
==
match
.
array
[
v
]
?
undefined
:
match
.
array
[
v
]
;
show
:
(
i
:
Match
)
:
void
=>
{
match
.
submit
.
page
=
match
.
submit
.
page
==
=
i
?
undefined
:
i
;
if
(
!
match
.
submit
.
page
)
match
.
submit
.
chk
=
match
.
array
.
map
(
i
=>
[
i
.
player1Score
??
0
,
i
.
player2Score
??
0
]);
}
,
...
...
@@ -448,12 +466,6 @@
}
}
,
chk
:
[]
as
Array
<
Array
<
number
>>
}
,
search
:
async
(
chk
:
boolean
=
match
.
chk
)
:
Promise
<
void
>
=>
{
// @ts-ignore
const
matchs
=
await
Tabulator
.
Match
.
FindALL
(
Mycard
.
token
,
{
tournamentId
:
tournament
.
this
.
id
,
statusIn
:
'
Running,Finished
'
,
pageCount
:
match
.
page
,
round
:
chk
?
undefined
:
match
.
round
}
);
match
.
array
=
matchs
.
matchs
;
match
.
total
=
matchs
.
total
;
}
}
);
...
...
@@ -466,7 +478,7 @@
// @ts-ignore
if
(
await
Tabulator
.
Participant
.
Create
(
Mycard
.
token
,
{
name
:
participant
.
name
,
tournamentId
:
tournament
.
this
.
id
}
,
participant
.
array
))
{
participant
.
name
=
''
;
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
}
,
del
:
async
(
i
:
Participant
)
:
Promise
<
void
>
=>
{
...
...
@@ -482,29 +494,13 @@
}
// @ts-ignore
if
(
tournament
.
this
.
status
==
'
Ready
'
?
await
del
()
:
await
update
())
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
,
update
:
async
(
Data
:
TournamentCreateObject
)
:
Promise
<
void
>
=>
{
// @ts-ignore
if
(
await
Tabulator
.
Tournament
.
Update
(
Mycard
.
token
,
tournament
.
this
.
id
,
Data
))
page
.
reload
();
}
,
search
:
async
()
:
Promise
<
boolean
>
=>
{
const
url
=
window
.
location
.
hash
.
match
(
/#
\/(
.*
?)(?:\?
|$
)
/
);
// @ts-ignore
const
id
=
url
[
1
];
// @ts-ignore
const
t
:
TournamentAParticipant
=
await
Tabulator
.
Tournament
.
Find
(
Mycard
.
token
,
id
);
if
(
t
.
tournament
)
{
tournament
.
this
=
t
.
tournament
;
emitter
.
emit
(
Const
.
tournamentReload
,
tournament
.
this
)
const
participants
=
t
.
participant
;
participant
.
array
=
participants
.
participants
;
participant
.
total
=
participants
.
total
;
return
true
;
}
return
false
;
}
,
upload
:
async
(
i
:
Participant
)
:
Promise
<
void
>
=>
{
const
f
=
async
(
res
:
UniApp
.
ChooseFileSuccessCallbackResult
)
:
Promise
<
void
>
=>
{
if
(
res
.
tempFiles
[
0
].
size
<
Const
.
maxSize
)
{
...
...
@@ -513,7 +509,7 @@
name
:
i
.
name
,
deckbuf
:
i
.
deckbuf
}
as
ParticipantUpdateObject
))
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
}
;
await
UniApp
.
selectFile
([
'
.ydk
'
,
'
.txt
'
],
f
,
1
);
...
...
@@ -545,7 +541,7 @@
if
(
v1
-
v2
!=
1
)
{
// @ts-ignore
if
(
await
participant
.
move
.
change
(
participant
.
array
[
v1
].
id
,
v2
>=
1
?
participant
.
array
[
v2
-
1
].
id
:
0
)
&&
await
participant
.
move
.
change
(
participant
.
array
[
v2
].
id
,
v1
>=
1
?
participant
.
array
[
v1
-
1
].
id
:
0
))
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
else
{
const
v
=
v1
>
v2
?
v1
:
v2
;
await
participant
.
move
.
down
(
participant
.
array
[
v
-
1
].
id
,
participant
.
array
[
v
].
id
);
...
...
@@ -560,7 +556,7 @@
down
:
async
(
from
:
number
,
to
:
number
)
:
Promise
<
void
>
=>
{
// @ts-ignore
if
(
await
Tabulator
.
Tournament
.
Drag
(
Mycard
.
token
,
tournament
.
this
?.
id
,
from
,
to
))
await
participa
nt
.
search
();
await
tourname
nt
.
search
();
}
}
}
);
...
...
@@ -579,10 +575,8 @@
emitter
.
emit
(
Const
.
show
);
}
,
get
:
async
()
:
Promise
<
void
>
=>
{
if
(
await
participant
.
search
())
{
await
match
.
search
();
if
(
await
tournament
.
search
())
page
.
show
();
}
else
page
.
clear
(
true
);
}
,
...
...
@@ -594,8 +588,7 @@
}
).
exec
();
page
.
loading
=
true
;
participant
.
name
=
''
;
if
(
await
participant
.
search
())
{
await
match
.
search
();
if
(
await
tournament
.
search
())
{
await
(
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
500
)));
page
.
loading
=
false
;
page
.
height
=
0
;
...
...
@@ -644,8 +637,6 @@
watch
(()
=>
{
return
match
.
round
;
}
,
async
()
:
Promise
<
void
>
=>
{
match
.
page
=
1
;
match
.
chk
=
false
;
await
match
.
search
();
}
);
watch
(()
=>
{
return
match
.
array
;
}
,
async
()
:
Promise
<
void
>
=>
{
...
...
src/script/post.ts
View file @
60951143
...
...
@@ -22,7 +22,7 @@ import {
AllMatch
,
AllAPI
,
UserObject
,
Tournament
AParticipan
t
Tournament
Ge
t
}
from
'
./type.ts
'
import
UniApp
from
'
./uniapp.ts
'
;
...
...
@@ -79,7 +79,7 @@ class TabulatorAPI {
return
false
;
}
},
Find
:
async
(
token
:
string
,
id
:
number
)
:
Promise
<
Tournament
AParticipan
t
>
=>
{
Find
:
async
(
token
:
string
,
id
:
number
)
:
Promise
<
Tournament
Ge
t
>
=>
{
let
response
:
{
data
:
{
data
:
TournamentObject
;
...
...
@@ -92,14 +92,22 @@ class TabulatorAPI {
}
});
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
));
});
return
{
tournament
:
new
Tournament
(
response
.
data
.
data
),
participant
:
{
participants
:
participants
,
total
:
participants
.
length
},
match
:
{
matches
:
matches
,
total
:
matches
.
length
}
};
}
...
...
@@ -110,6 +118,10 @@ class TabulatorAPI {
participant
:
{
participants
:
[],
total
:
0
},
match
:
{
matches
:
[],
total
:
0
}
};
}
...
...
@@ -496,14 +508,14 @@ class TabulatorAPI {
})
return
{
total
:
response
.
data
.
total
,
matchs
:
matchs
match
e
s
:
matchs
};
}
catch
(
error
)
{
console
.
error
(
error
);
return
{
total
:
0
,
matchs
:
[]
match
e
s
:
[]
};
}
},
...
...
src/script/type.ts
View file @
60951143
...
...
@@ -64,6 +64,7 @@ interface TournamentObject extends TournamentCreateObject {
creator
:
number
;
createdAt
:
string
;
participants
:
Array
<
ParticipantObject
>
;
matches
:
Array
<
MatchObject
>
}
interface
TournamentFindObject
{
...
...
@@ -144,16 +145,17 @@ interface AllParticipant extends All {
}
interface
AllMatch
extends
All
{
matchs
:
Array
<
Match
>
;
match
e
s
:
Array
<
Match
>
;
}
interface
AllAPI
extends
All
{
api
:
Array
<
ApiKey
>
;
}
interface
Tournament
AParticipan
t
{
interface
Tournament
Ge
t
{
tournament
:
Tournament
|
undefined
;
participant
:
AllParticipant
participant
:
AllParticipant
,
match
:
AllMatch
}
interface
UserObject
{
...
...
@@ -189,6 +191,6 @@ export {
AllAPI
,
ruleSettings
,
UserObject
,
Tournament
AParticipan
t
,
Tournament
Ge
t
,
Deck
}
\ No newline at end of file
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