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 {
Footads
},
created
:
function
()
{
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
;
var
u
=
navigator
.
userAgent
;
...
...
@@ -246,41 +245,39 @@ export default {
},
},
methods
:
{
period
(){
// 计算禁卡表发布时间间隔
const
today
=
new
Date
();
const
year
=
today
.
getFullYear
();
const
dates
=
[
new
Date
(
year
,
0
,
1
),
new
Date
(
year
,
3
,
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
));
if
(
today
>=
date
&&
diff
>=
0
&&
diff
<
min
)
{
return
diff
;
}
return
min
;
},
Infinity
);
// 根据select设定对应天数
const
periodMap
=
{
day
:
1
,
week
:
7
,
halfmonth
:
15
,
month
:
30
,
season
:
season
};
var
selectedType
=
$
(
"
#type
"
).
val
();
return
periodMap
[
selectedType
]
||
1
;
},
// period() {
// const today = new Date();
// const year = today.getFullYear();
// const dates = [
// new Date(year, 0, 1),
// new Date(year, 3, 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));
// if (today >= date && diff >= 0 && diff
<
min
)
{
// return diff;
// }
// return min;
// }, Infinity);
// // 根据select设定对应天数
// const periodMap = {
// day: 1,
// week: 7,
// halfmonth: 15,
// month: 30,
// season: season
// };
// var selectedType = $("#type").val();
// return periodMap[selectedType] || 1;
// },
navClick
(
data
)
{
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Cards.vue---------------------%c:238', 'background:#f034c6', 'background:#14f1a4',
// data)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
[
data
])
},
init
:
function
(
lang
)
{
if
(
lang
===
"
cn
"
)
{
...
...
@@ -298,13 +295,10 @@ export default {
}
else
{
this
.
isActive
=
false
;
}
var
self
=
this
;
this
.
getCount
().
then
(
function
(
count
)
{
self
.
totalDeck
=
count
;
// 设置totalDeck的值
// 在获取到count后调用init2
function
renderPage
()
{
if
(
monsterTable
)
{
monsterTable
.
clear
();
monsterTable
.
destroy
();
...
...
@@ -325,9 +319,11 @@ export default {
sideTable
.
clear
();
sideTable
.
destroy
();
}
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
final_source
=
server
+
"
-
"
+
source
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/single/type
'
,
{
type
:
$
(
"
#type
"
).
val
(),
lang
:
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
,
...
...
@@ -339,21 +335,21 @@ export default {
var
trap
=
data
.
trap
;
var
side
=
data
.
side
;
var
ex
=
data
.
ex
;
monsterTable
=
renderTable
(
"
#monster
"
,
monster
)
spellTable
=
renderTable
(
"
#spell
"
,
spell
)
trapTable
=
renderTable
(
"
#trap
"
,
trap
)
exTable
=
renderTable
(
"
#ex
"
,
ex
)
sideTable
=
renderTable
(
"
#side
"
,
side
)
// console.log(data)
monsterTable
=
renderTable
(
"
#monster
"
,
monster
);
spellTable
=
renderTable
(
"
#spell
"
,
spell
);
trapTable
=
renderTable
(
"
#trap
"
,
trap
);
exTable
=
renderTable
(
"
#ex
"
,
ex
);
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
'
;
if
(
lang
===
"
cn
"
)
{
if
(
deckTable
)
{
deckTable
.
clear
();
deckTable
.
destroy
();
}
$
.
get
(
'
https://sapi.moecube.com:444/ygopro/analytics/deck/type
'
,
{
type
:
$
(
"
#type
"
).
val
(),
source
:
final_source
...
...
@@ -361,6 +357,7 @@ export default {
var
obj
=
data
;
if
(
typeof
obj
===
'
string
'
)
obj
=
JSON
.
parse
(
data
);
var
rank
=
1
;
var
processData
=
obj
.
map
(
function
(
x
)
{
var
tagStr
=
[];
...
...
@@ -370,18 +367,13 @@ export default {
var
short_tagName
=
tagName
.
replace
(
deckName
+
"
-
"
,
""
);
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之间
return
[
rank
++
,
x
.
name
,
x
.
count
,
PickRate
,
tagStr
.
join
(
"
,
"
)];
});
deckTable
=
$
(
"
#deck
"
).
DataTable
({
data
:
processData
,
pageLength
:
25
,
...
...
@@ -390,21 +382,11 @@ export default {
],
ordering
:
true
,
columns
:
[
{
title
:
tb_language
[
lang
].
rank
},
{
title
:
tb_language
[
lang
].
deck
},
{
title
:
tb_language
[
lang
].
count
},
{
title
:
tb_language
[
lang
].
PickRate
},
{
title
:
tb_language
[
lang
].
topTags
},
{
title
:
tb_language
[
lang
].
rank
},
{
title
:
tb_language
[
lang
].
deck
},
{
title
:
tb_language
[
lang
].
count
},
{
title
:
tb_language
[
lang
].
PickRate
},
{
title
:
tb_language
[
lang
].
topTags
},
],
columnDefs
:
[
{
...
...
@@ -416,7 +398,6 @@ export default {
],
language
:
tb_language
[
lang
]
});
});
}
}
...
...
@@ -427,9 +408,10 @@ export default {
var
langIndex
=
(
lang
===
'
en
'
?
'
en-US
'
:
'
zh-CN
'
);
var
rank
=
1
;
var
processData
=
tableData
.
map
(
function
(
d
)
{
var
period
=
self
.
period
();
var
PickRate
=
(
parseInt
(
d
.
putone
)
+
parseInt
(
d
.
puttwo
)
+
parseInt
(
d
.
putthree
))
/
self
.
totalDeck
/
period
;
//
var period = self.period();
var
PickRate
=
(
parseInt
(
d
.
putone
)
+
parseInt
(
d
.
puttwo
)
+
parseInt
(
d
.
putthree
))
/
self
.
totalDeck
;
PickRate
=
(
0
<
PickRate
&&
PickRate
<
1
)
?
(
PickRate
*
100
).
toFixed
(
2
)
+
"
%
"
:
"
-
"
;
// 使用率出现-是数据算出来不在0-1之间
return
[
rank
++
,
d
.
name
?
d
.
name
[
langIndex
]
:
"
未知卡片
"
,
...
...
@@ -441,74 +423,65 @@ export default {
d
.
id
];
});
var
table
=
$
(
tableID
).
DataTable
({
data
:
processData
,
pageLength
:
50
,
order
:
[
[
2
,
"
desc
"
]
order
:
[[
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
,
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
},
columnDefs
:
[
{
title
:
tb_language
[
lang
].
put2
render
:
function
(
data
,
type
,
row
)
{
return
"
<a href='https://www.ourocg.cn/search/
"
+
row
[
6
]
+
"
'>
"
+
data
+
"
</a>
"
;
},
{
title
:
tb_language
[
lang
].
put3
targets
:
1
},
],
"
columnDefs
"
:
[{
"
render
"
:
function
(
data
,
type
,
row
)
{
return
"
<a href='https://www.ourocg.cn/search/
"
+
row
[
6
]
+
"
'>
"
+
data
+
"
</a>
"
;
},
"
targets
"
:
1
},],
"
language
"
:
tb_language
[
lang
]
language
:
tb_language
[
lang
]
});
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
.
Deck
)
$
(
"
.input-sm
"
).
attr
(
"
placeholder
"
,
placeholder
.
Deck
);
return
table
;
}
renderPage
();
$
(
"
#search
"
).
click
(
function
()
{
renderPage
();
return
false
;
})
});
},
onChange
:
function
()
{
$
(
"
#search
"
).
trigger
(
'
click
'
)
this
.
getCount
()
var
self
=
this
;
this
.
getCount
().
then
(
function
()
{
self
.
init2
();
});
},
getCount
:
function
()
{
var
server
=
$
(
"
#server
"
).
val
()
||
"
mycard
"
var
source
=
$
(
"
#source
"
).
val
()
||
"
athletic
"
var
opt
=
{
type
:
$
(
"
#type
"
).
val
()
||
"
day
"
,
source
:
server
+
"
-
"
+
source
}
};
var
self
=
this
;
return
API
.
getCount
(
opt
).
then
((
res
)
=>
{
if
(
isNaN
(
res
.
data
))
{
return
0
;
}
else
{
this
.
totalDeck
=
res
.
data
;
this
.
$forceUpdate
();
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