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
abbb0b48
Commit
abbb0b48
authored
Jul 14, 2023
by
铃兰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
6a65cbdf
Pipeline
#22682
passed with stages
in 2 minutes and 45 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
446 additions
and
473 deletions
+446
-473
src/components/Cards.vue
src/components/Cards.vue
+446
-473
No files found.
src/components/Cards.vue
View file @
abbb0b48
...
@@ -202,7 +202,6 @@ export default {
...
@@ -202,7 +202,6 @@ export default {
Footads
Footads
},
},
created
:
function
()
{
created
:
function
()
{
var
regex_match
=
var
regex_match
=
/
(
nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s
[
cg
]
h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220
)
/i
;
/
(
nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s
[
cg
]
h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220
)
/i
;
var
u
=
navigator
.
userAgent
;
var
u
=
navigator
.
userAgent
;
...
@@ -246,41 +245,39 @@ export default {
...
@@ -246,41 +245,39 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
period
(){
// 计算禁卡表发布时间间隔
// 计算禁卡表发布时间间隔
const
today
=
new
Date
();
// period() {
const
year
=
today
.
getFullYear
();
// const today = new Date();
const
dates
=
[
// const year = today.getFullYear();
new
Date
(
year
,
0
,
1
),
// const dates = [
new
Date
(
year
,
3
,
1
),
// new Date(year, 0, 1),
new
Date
(
year
,
6
,
1
),
// new Date(year, 3, 1),
new
Date
(
year
,
9
,
1
),
// new Date(year, 6, 1),
];
// new Date(year, 9, 1),
const
season
=
dates
.
reduce
((
min
,
date
)
=>
{
// ];
const
diff
=
Math
.
floor
((
today
-
date
)
/
(
1000
*
60
*
60
*
24
));
// const season = dates.reduce((min, date) => {
if
(
today
>=
date
&&
diff
>=
0
&&
diff
<
min
)
{
// const diff = Math.floor((today - date) / (1000 * 60 * 60 * 24));
return
diff
;
// if (today >= date && diff >= 0 && diff
<
min
)
{
}
// return diff;
return
min
;
// }
},
Infinity
);
// return min;
// 根据select设定对应天数
// }, Infinity);
const
periodMap
=
{
// // 根据select设定对应天数
day
:
1
,
// const periodMap = {
week
:
7
,
// day: 1,
halfmonth
:
15
,
// week: 7,
month
:
30
,
// halfmonth: 15,
season
:
season
// month: 30,
};
// season: season
var
selectedType
=
$
(
"
#type
"
).
val
();
// };
return
periodMap
[
selectedType
]
||
1
;
// var selectedType = $("#type").val();
},
// return periodMap[selectedType] || 1;
// },
navClick
(
data
)
{
navClick
(
data
)
{
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Cards.vue---------------------%c:238', 'background:#f034c6', 'background:#14f1a4',
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Cards.vue---------------------%c:238', 'background:#f034c6', 'background:#14f1a4',
// data)
// data)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
[
data
])
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
[
data
])
},
},
init
:
function
(
lang
)
{
init
:
function
(
lang
)
{
if
(
lang
===
"
cn
"
)
{
if
(
lang
===
"
cn
"
)
{
...
@@ -298,13 +295,10 @@ export default {
...
@@ -298,13 +295,10 @@ export default {
}
else
{
}
else
{
this
.
isActive
=
false
;
this
.
isActive
=
false
;
}
}
var
self
=
this
;
var
self
=
this
;
this
.
getCount
().
then
(
function
(
count
)
{
self
.
totalDeck
=
count
;
// 设置totalDeck的值
// 在获取到count后调用init2
function
renderPage
()
{
function
renderPage
()
{
if
(
monsterTable
)
{
if
(
monsterTable
)
{
monsterTable
.
clear
();
monsterTable
.
clear
();
monsterTable
.
destroy
();
monsterTable
.
destroy
();
...
@@ -325,9 +319,11 @@ export default {
...
@@ -325,9 +319,11 @@ export default {
sideTable
.
clear
();
sideTable
.
clear
();
sideTable
.
destroy
();
sideTable
.
destroy
();
}
}
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
final_source
=
server
+
"
-
"
+
source
var
final_source
=
server
+
"
-
"
+
source
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/single/type
'
,
{
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/single/type
'
,
{
type
:
$
(
"
#type
"
).
val
(),
type
:
$
(
"
#type
"
).
val
(),
lang
:
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
,
lang
:
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
,
...
@@ -339,21 +335,21 @@ export default {
...
@@ -339,21 +335,21 @@ export default {
var
trap
=
data
.
trap
;
var
trap
=
data
.
trap
;
var
side
=
data
.
side
;
var
side
=
data
.
side
;
var
ex
=
data
.
ex
;
var
ex
=
data
.
ex
;
monsterTable
=
renderTable
(
"
#monster
"
,
monster
)
spellTable
=
renderTable
(
"
#spell
"
,
spell
)
monsterTable
=
renderTable
(
"
#monster
"
,
monster
);
trapTable
=
renderTable
(
"
#trap
"
,
trap
)
spellTable
=
renderTable
(
"
#spell
"
,
spell
);
exTable
=
renderTable
(
"
#ex
"
,
ex
)
trapTable
=
renderTable
(
"
#trap
"
,
trap
);
sideTable
=
renderTable
(
"
#side
"
,
side
)
exTable
=
renderTable
(
"
#ex
"
,
ex
);
// console.log(data)
sideTable
=
renderTable
(
"
#side
"
,
side
);
});
});
//卡组api https://sapi.moecube.com:444/ygopro/analytics/deck/type?type=day&source=mycard-entertain
//只显示中文
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
if
(
lang
===
"
cn
"
)
{
if
(
lang
===
"
cn
"
)
{
if
(
deckTable
)
{
if
(
deckTable
)
{
deckTable
.
clear
();
deckTable
.
clear
();
deckTable
.
destroy
();
deckTable
.
destroy
();
}
}
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/deck/type
'
,
{
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/deck/type
'
,
{
type
:
$
(
"
#type
"
).
val
(),
type
:
$
(
"
#type
"
).
val
(),
source
:
final_source
source
:
final_source
...
@@ -361,6 +357,7 @@ export default {
...
@@ -361,6 +357,7 @@ export default {
var
obj
=
data
;
var
obj
=
data
;
if
(
typeof
obj
===
'
string
'
)
if
(
typeof
obj
===
'
string
'
)
obj
=
JSON
.
parse
(
data
);
obj
=
JSON
.
parse
(
data
);
var
rank
=
1
;
var
rank
=
1
;
var
processData
=
obj
.
map
(
function
(
x
)
{
var
processData
=
obj
.
map
(
function
(
x
)
{
var
tagStr
=
[];
var
tagStr
=
[];
...
@@ -370,18 +367,13 @@ export default {
...
@@ -370,18 +367,13 @@ export default {
var
short_tagName
=
tagName
.
replace
(
deckName
+
"
-
"
,
""
);
var
short_tagName
=
tagName
.
replace
(
deckName
+
"
-
"
,
""
);
tagStr
.
push
(
short_tagName
)
tagStr
.
push
(
short_tagName
)
}
}
var
PickRate
=
(
0
<
(
x
.
count
/
(
self
.
totalDeck
))
&&
(
x
.
count
/
(
self
.
totalDeck
))
<
1
)
?
((
x
.
count
/
(
self
.
totalDeck
)
*
100
)).
toFixed
(
2
)
+
"
%
"
:
"
-
"
;
var
period
=
self
.
period
();
var
PickRate
=
(
0
<
(
x
.
count
/
(
self
.
totalDeck
*
period
))
&&
(
x
.
count
/
(
self
.
totalDeck
*
period
))
<
1
)
?
((
x
.
count
/
(
self
.
totalDeck
*
period
)
*
100
)).
toFixed
(
2
)
+
"
%
"
:
"
-
"
;
// 出现-是数据算出来不在0-1之间
// 出现-是数据算出来不在0-1之间
return
[
rank
++
,
x
.
name
,
x
.
count
,
PickRate
,
tagStr
.
join
(
"
,
"
)];
return
[
rank
++
,
x
.
name
,
x
.
count
,
PickRate
,
tagStr
.
join
(
"
,
"
)];
});
});
deckTable
=
$
(
"
#deck
"
).
DataTable
({
deckTable
=
$
(
"
#deck
"
).
DataTable
({
data
:
processData
,
data
:
processData
,
pageLength
:
25
,
pageLength
:
25
,
...
@@ -390,21 +382,11 @@ export default {
...
@@ -390,21 +382,11 @@ export default {
],
],
ordering
:
true
,
ordering
:
true
,
columns
:
[
columns
:
[
{
{
title
:
tb_language
[
lang
].
rank
},
title
:
tb_language
[
lang
].
rank
{
title
:
tb_language
[
lang
].
deck
},
},
{
title
:
tb_language
[
lang
].
count
},
{
{
title
:
tb_language
[
lang
].
PickRate
},
title
:
tb_language
[
lang
].
deck
{
title
:
tb_language
[
lang
].
topTags
},
},
{
title
:
tb_language
[
lang
].
count
},
{
title
:
tb_language
[
lang
].
PickRate
},
{
title
:
tb_language
[
lang
].
topTags
},
],
],
columnDefs
:
[
columnDefs
:
[
{
{
...
@@ -416,7 +398,6 @@ export default {
...
@@ -416,7 +398,6 @@ export default {
],
],
language
:
tb_language
[
lang
]
language
:
tb_language
[
lang
]
});
});
});
});
}
}
}
}
...
@@ -427,9 +408,10 @@ export default {
...
@@ -427,9 +408,10 @@ export default {
var
langIndex
=
(
lang
===
'
en
'
?
'
en-US
'
:
'
zh-CN
'
);
var
langIndex
=
(
lang
===
'
en
'
?
'
en-US
'
:
'
zh-CN
'
);
var
rank
=
1
;
var
rank
=
1
;
var
processData
=
tableData
.
map
(
function
(
d
)
{
var
processData
=
tableData
.
map
(
function
(
d
)
{
var
period
=
self
.
period
();
//
var period = self.period();
var
PickRate
=
(
parseInt
(
d
.
putone
)
+
parseInt
(
d
.
puttwo
)
+
parseInt
(
d
.
putthree
))
/
self
.
totalDeck
/
period
;
var
PickRate
=
(
parseInt
(
d
.
putone
)
+
parseInt
(
d
.
puttwo
)
+
parseInt
(
d
.
putthree
))
/
self
.
totalDeck
;
PickRate
=
(
0
<
PickRate
&&
PickRate
<
1
)
?
(
PickRate
*
100
).
toFixed
(
2
)
+
"
%
"
:
"
-
"
;
PickRate
=
(
0
<
PickRate
&&
PickRate
<
1
)
?
(
PickRate
*
100
).
toFixed
(
2
)
+
"
%
"
:
"
-
"
;
// 使用率出现-是数据算出来不在0-1之间
// 使用率出现-是数据算出来不在0-1之间
return
[
return
[
rank
++
,
d
.
name
?
d
.
name
[
langIndex
]
:
"
未知卡片
"
,
rank
++
,
d
.
name
?
d
.
name
[
langIndex
]
:
"
未知卡片
"
,
...
@@ -441,74 +423,65 @@ export default {
...
@@ -441,74 +423,65 @@ export default {
d
.
id
d
.
id
];
];
});
});
var
table
=
$
(
tableID
).
DataTable
({
var
table
=
$
(
tableID
).
DataTable
({
data
:
processData
,
data
:
processData
,
pageLength
:
50
,
pageLength
:
50
,
order
:
[
order
:
[[
2
,
"
desc
"
]],
[
2
,
"
desc
"
]
ordering
:
true
,
columns
:
[
{
title
:
tb_language
[
lang
].
rank
},
{
title
:
tb_language
[
lang
].
cardName
},
{
title
:
tb_language
[
lang
].
used
},
{
title
:
tb_language
[
lang
].
PickRate
},
{
title
:
tb_language
[
lang
].
put1
},
{
title
:
tb_language
[
lang
].
put2
},
{
title
:
tb_language
[
lang
].
put3
},
],
],
"
ordering
"
:
true
,
columnDefs
:
[
columns
:
[{
title
:
tb_language
[
lang
].
rank
},
{
title
:
tb_language
[
lang
].
cardName
},
{
title
:
tb_language
[
lang
].
used
},
{
title
:
tb_language
[
lang
].
PickRate
},
{
title
:
tb_language
[
lang
].
put1
},
{
{
title
:
tb_language
[
lang
].
put2
render
:
function
(
data
,
type
,
row
)
{
return
"
<a href='https://www.ourocg.cn/search/
"
+
row
[
6
]
+
"
'>
"
+
data
+
"
</a>
"
;
},
},
{
targets
:
1
title
:
tb_language
[
lang
].
put3
},
},
],
],
"
columnDefs
"
:
[{
language
:
tb_language
[
lang
]
"
render
"
:
function
(
data
,
type
,
row
)
{
return
"
<a href='https://www.ourocg.cn/search/
"
+
row
[
6
]
+
"
'>
"
+
data
+
"
</a>
"
;
},
"
targets
"
:
1
},],
"
language
"
:
tb_language
[
lang
]
});
});
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
.
Deck
)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
.
Deck
);
return
table
;
return
table
;
}
}
renderPage
();
renderPage
();
$
(
"
#search
"
).
click
(
function
()
{
$
(
"
#search
"
).
click
(
function
()
{
renderPage
();
renderPage
();
return
false
;
return
false
;
})
});
});
},
},
onChange
:
function
()
{
onChange
:
function
()
{
$
(
"
#search
"
).
trigger
(
'
click
'
)
var
self
=
this
;
this
.
getCount
()
this
.
getCount
().
then
(
function
()
{
self
.
init2
();
});
},
},
getCount
:
function
()
{
getCount
:
function
()
{
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
opt
=
{
var
opt
=
{
type
:
$
(
"
#type
"
).
val
()
||
"
day
"
,
type
:
$
(
"
#type
"
).
val
()
||
"
day
"
,
source
:
server
+
"
-
"
+
source
source
:
server
+
"
-
"
+
source
}
};
var
self
=
this
;
return
API
.
getCount
(
opt
).
then
((
res
)
=>
{
return
API
.
getCount
(
opt
).
then
((
res
)
=>
{
if
(
isNaN
(
res
.
data
))
{
if
(
isNaN
(
res
.
data
))
{
return
0
;
return
0
;
}
else
{
}
else
{
this
.
totalDeck
=
res
.
data
;
this
.
totalDeck
=
res
.
data
;
this
.
$forceUpdate
();
return
res
.
data
;
return
res
.
data
;
}
}
});
});
...
...
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