Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena 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
Ygopro Arena Web
Commits
b5a9c8e6
Commit
b5a9c8e6
authored
Jul 28, 2023
by
铃兰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表格增加用户小头像
parent
abbb0b48
Pipeline
#22804
passed with stages
in 1 minute and 18 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
44 deletions
+88
-44
src/components/Ranking.vue
src/components/Ranking.vue
+88
-44
No files found.
src/components/Ranking.vue
View file @
b5a9c8e6
...
...
@@ -150,74 +150,108 @@
}
}
function
render
Exp
Table
(
tableData
)
{
function
render
Arena
Table
(
tableData
)
{
tableData
=
tableData
||
[];
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
var
rank
=
1
;
var
processData
=
tableData
.
map
(
function
(
d
)
{
return
[
rank
++
,
d
.
username
,
parseInt
(
d
.
exp
),
d
.
entertain_win
,
d
.
entertain_lose
];
var
processData
=
tableData
.
map
(
function
(
d
)
{
let
ratio
=
0
if
(
d
.
athletic_all
>
0
)
{
ratio
=
(
d
.
athletic_win
/
d
.
athletic_all
*
100
).
toFixed
(
2
)
}
var
iconSrc
=
'
https://sapi.moecube.com:444/avatar/avatar/
'
+
d
.
username
+
'
/100/pic.png
'
;
return
[
rank
++
,
iconSrc
,
String
(
d
.
username
),
parseInt
(
d
.
pt
),
d
.
athletic_win
,
d
.
athletic_lose
,
ratio
+
"
%
"
];
});
var
table
=
$
(
'
#exp_table
'
).
DataTable
({
var
table
=
$
(
'
#pt_table
'
).
DataTable
({
"
autoWidth
"
:
false
,
data
:
processData
,
pageLength
:
25
,
order
:
[
[
0
,
"
asc
"
]
],
"
ordering
"
:
true
,
columns
:
[{
title
:
tb_language
[
lang
].
rank
columns
:
[
{
title
:
tb_language
[
lang
].
rank
,
},
{
title
:
tb_language
[
lang
].
name
title
:
tb_language
[
lang
].
name
,
// Display icon + username in this column
render
:
function
(
data
,
type
,
row
)
{
var
iconSrcWithUsername
=
row
[
1
];
// 获取图像链接
var
username
=
row
[
2
];
// 获取用户名
return
'
<div style="display: flex; align-items: center;">
'
+
'
<img src="
'
+
iconSrcWithUsername
+
'
" style="width: 35px; height: 35px; margin-right: 3px;">
'
+
'
<a href="#/userinfo?username=
'
+
encodeURIComponent
(
username
)
+
'
">
'
+
username
+
'
</a>
'
+
'
</div>
'
;
},
},
{
title
:
tb_language
[
lang
].
exp
visible
:
false
,
// Hide the username column,
},
{
title
:
tb_language
[
lang
].
win
title
:
tb_language
[
lang
].
pt
,
},
{
title
:
tb_language
[
lang
].
lose
title
:
tb_language
[
lang
].
win
,
},
{
title
:
tb_language
[
lang
].
lose
,
},
{
title
:
tb_language
[
lang
].
wl
,
},
],
"
columnDefs
"
:
[{
"
render
"
:
function
(
data
,
type
,
row
)
{
"
render
"
:
function
(
data
,
type
,
row
)
{
return
"
<a href='#/userinfo?username=
"
+
encodeURIComponent
(
data
)
+
"
'>
"
+
data
+
"
</a>
"
;
},
"
targets
"
:
1
},
],
"
language
"
:
lang
===
'
en
'
?
tb_language
.
en
:
tb_language
.
cn
"
targets
"
:
2
},],
"
language
"
:
tb_language
[
lang
],
});
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
)
return
table
;
}
function
render
Arena
Table
(
tableData
)
{
function
render
Exp
Table
(
tableData
)
{
tableData
=
tableData
||
[];
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
var
rank
=
1
;
var
processData
=
tableData
.
map
(
function
(
d
)
{
let
ratio
=
0
if
(
d
.
athletic_all
>
0
)
{
ratio
=
(
d
.
athletic_win
/
d
.
athletic_all
*
100
).
toFixed
(
2
)
}
return
[
rank
++
,
d
.
username
,
parseInt
(
d
.
pt
),
d
.
athletic_win
,
d
.
athletic_lose
,
ratio
+
"
%
"
];
var
processData
=
tableData
.
map
(
function
(
d
)
{
var
iconSrc
=
'
https://sapi.moecube.com:444/avatar/avatar/
'
+
d
.
username
+
'
/100/pic.png
'
;
return
[
rank
++
,
iconSrc
,
String
(
d
.
username
),
parseInt
(
d
.
exp
),
d
.
entertain_win
,
d
.
entertain_lose
];
});
var
table
=
$
(
'
#pt_table
'
).
DataTable
({
var
table
=
$
(
'
#exp_table
'
).
DataTable
({
data
:
processData
,
pageLength
:
25
,
order
:
[
[
0
,
"
asc
"
]
],
order
:
[[
0
,
"
asc
"
]],
"
ordering
"
:
true
,
columns
:
[{
columns
:
[
{
title
:
tb_language
[
lang
].
rank
},
{
title
:
tb_language
[
lang
].
name
title
:
tb_language
[
lang
].
name
,
// Display icon + username in this column
render
:
function
(
data
,
type
,
row
)
{
var
iconSrcWithUsername
=
row
[
1
];
// 获取图像链接
var
username
=
row
[
2
];
// 获取用户名
return
'
<div style="display: flex; align-items: center;"><img src="
'
+
iconSrcWithUsername
+
'
" style="width: 35px; height: 35px; margin-right: 3px;"> <a href="#/userinfo?username=
'
+
encodeURIComponent
(
username
)
+
'
">
'
+
username
+
'
</a></div>
'
;
},
},
{
visible
:
false
,
// Hide the username column
},
{
title
:
tb_language
[
lang
].
pt
title
:
tb_language
[
lang
].
exp
},
{
title
:
tb_language
[
lang
].
win
...
...
@@ -225,19 +259,16 @@
{
title
:
tb_language
[
lang
].
lose
},
],
"
columnDefs
"
:
[
{
title
:
tb_language
[
lang
].
wl
"
targets
"
:
[
0
,
3
,
4
,
5
],
// Target other columns (exp, win, lose) to make them non-orderable
"
orderable
"
:
false
},
],
"
columnDefs
"
:
[{
"
render
"
:
function
(
data
,
type
,
row
)
{
return
"
<a href='#/userinfo?username=
"
+
encodeURIComponent
(
data
)
+
"
'>
"
+
data
+
"
</a>
"
;
},
"
targets
"
:
1
},
],
"
language
"
:
tb_language
[
lang
]
"
language
"
:
lang
===
'
en
'
?
tb_language
.
en
:
tb_language
.
cn
,
});
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
);
return
table
;
}
renderPage
();
...
...
@@ -271,3 +302,16 @@
width
:
250%
;
}
</
style
>
<
style
>
#pt_table
tr
td
:first-child
,
#pt_table
tr
th
:first-child
,
#exp_table
tr
td
:first-child
,
#exp_table
tr
th
:first-child
{
width
:
1%
;
white-space
:
nowrap
;
}
#pt_table
td
,
#pt_table
th
{
text-align
:
left
;
vertical-align
:
middle
}
#epx_table
td
,
#exp_table
th
{
text-align
:
left
;
vertical-align
:
middle
}
</
style
>
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