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
12538fbd
Commit
12538fbd
authored
Oct 23, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use deckform for deckprint
parent
7d23fb2b
Pipeline
#41218
passed with stages
in 1 minute and 31 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
176 additions
and
160 deletions
+176
-160
src/components/Deckprint.vue
src/components/Deckprint.vue
+176
-160
No files found.
src/components/Deckprint.vue
View file @
12538fbd
...
@@ -20,18 +20,23 @@
...
@@ -20,18 +20,23 @@
<el-input
v-model=
"form.event"
placeholder=
"请输入Event"
auto-complete=
"off"
width=
"10px"
></el-input>
<el-input
v-model=
"form.event"
placeholder=
"请输入Event"
auto-complete=
"off"
width=
"10px"
></el-input>
</el-form-item>
</el-form-item>
<!-- 改成 lastInitial -->
<el-form-item
label=
"参赛ID"
:label-width=
"formLabelWidth"
>
<el-form-item
label=
"参赛ID"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"form.
gameid"
placeholder=
"请输入gameid
"
auto-complete=
"off"
width=
"10px"
></el-input>
<el-input
v-model=
"form.
lastInitial"
placeholder=
"请输入 lastInitial
"
auto-complete=
"off"
width=
"10px"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"日期"
:label-width=
"formLabelWidth"
>
<el-form-item
label=
"日期"
:label-width=
"formLabelWidth"
>
<el-date-picker
v-model=
"form.date"
type=
"date"
placeholder=
"选择日期"
format=
"yyyy 年 MM 月 dd 日"
value-format=
"yyyy-MM-dd"
>
<el-date-picker
v-model=
"form.date"
type=
"date"
placeholder=
"选择日期"
format=
"yyyy 年 MM 月 dd 日"
value-format=
"yyyy-MM-dd"
>
</el-date-picker>
</el-date-picker>
<!--<el-input v-model="form.date" placeholder="请输入" auto-complete="off" width="10px"></el-input>-->
</el-form-item>
</el-form-item>
<!-- 模板选择:仅隐藏 UI,保留控件(v-show=false) -->
<el-form-item
label=
"模版选择"
:label-width=
"formLabelWidth"
>
<el-form-item
label=
"模版选择"
:label-width=
"formLabelWidth"
v-show=
"false"
>
<el-select
v-model=
"value"
placeholder=
"请选择"
>
<el-select
v-model=
"value"
placeholder=
"请选择"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-option>
...
@@ -39,15 +44,18 @@
...
@@ -39,15 +44,18 @@
</el-form-item>
</el-form-item>
<el-form-item
label=
"ydk文件"
:label-width=
"formLabelWidth"
>
<el-form-item
label=
"ydk文件"
:label-width=
"formLabelWidth"
>
<el-upload
class=
"upload-demo"
:action=
"uploadUrl"
:on-change=
"handleChange"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
<!-- 只选择文件,不走旧的自动上传。保留 before/after 钩子最小侵入 -->
<el-upload
class=
"upload-demo"
:on-change=
"handleChange"
:auto-upload=
"false"
:file-list=
"fileList3"
>
:file-list=
"fileList3"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<el-button
size=
"small"
type=
"primary"
>
选择文件
</el-button>
<div
slot=
"tip"
class=
"el-upload__tip"
>
上传卡组文件,大小不能超过3KB
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
上传卡组文件,大小不能超过3KB
</div>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
<el-form-item
label=
"备选项"
:label-width=
"formLabelWidth"
>
<el-form-item
label=
"备选项"
:label-width=
"formLabelWidth"
>
<!--<el-checkbox v-model="checked">是否生成图片</el-checkbox>-->
<el-checkbox
v-model=
"checked2"
>
是否打印(会帮您调用打印程序)
</el-checkbox>
<el-checkbox
v-model=
"checked2"
>
是否打印(会帮您调用打印程序)
</el-checkbox>
</el-form-item>
</el-form-item>
...
@@ -62,28 +70,23 @@
...
@@ -62,28 +70,23 @@
</template>
</template>
<
script
>
<
script
>
import
querystring
from
'
querystring
'
;
// 移除失效 API 的使用(最小改动:删除 import API 并清空相关字段的用途)
import
crypto
from
'
crypto
'
;
import
querystring
from
'
querystring
'
;
import
API
from
'
../api
'
import
crypto
from
'
crypto
'
;
import
{
mapGetters
}
from
'
vuex
'
import
{
mapGetters
}
from
'
vuex
'
import
moment
from
'
moment
'
import
moment
from
'
moment
'
import
tb_language
from
'
./tb_lang.js
'
import
tb_language
from
'
./tb_lang.js
'
import
Footads
from
'
./Footads
'
import
Footads
from
'
./Footads
'
export
default
{
export
default
{
components
:
{
components
:
{
Footads
},
Footads
},
data
()
{
data
()
{
return
{
return
{
fileList3
:
[],
fileList3
:
[],
options
:
[{
options
:
[
value
:
'
1
'
,
{
value
:
'
1
'
,
label
:
'
默认
'
},
label
:
'
默认
'
{
value
:
'
2
'
,
label
:
'
KONAMI
'
}
},
{
],
value
:
'
2
'
,
label
:
'
KONAMI
'
}],
value
:
'
1
'
,
value
:
'
1
'
,
isIE
:
false
,
isIE
:
false
,
...
@@ -92,20 +95,19 @@
...
@@ -92,20 +95,19 @@
name
:
''
,
name
:
''
,
event
:
''
,
event
:
''
,
date
:
''
,
date
:
''
,
gameid
:
''
,
// gameid -> lastInitial
lastInitial
:
''
,
},
},
formLabelWidth
:
'
80px
'
,
formLabelWidth
:
'
80px
'
,
isNew
:
true
,
isNew
:
true
,
isClick
:
false
,
isClick
:
false
,
todayCount
:
0
,
todayCount
:
0
,
uploadUrl
:
API
.
uploadUrl
,
// 旧的 uploadUrl / imageUrl / downloadPath 废弃
imageUrl
:
""
,
imageUrl
:
""
,
downloadPath
:
""
,
downloadPath
:
""
,
demo_title
:
""
,
demo_title
:
""
,
demo_url
:
""
,
demo_url
:
""
,
demo1
:
[],
demo1
:
[],
// checked: false,
checked2
:
false
,
checked2
:
false
,
demo2
:
[]
demo2
:
[]
}
}
...
@@ -115,7 +117,6 @@
...
@@ -115,7 +117,6 @@
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
(
"
.el-upload__input
"
).
hide
()
$
(
"
.el-upload__input
"
).
hide
()
},
100
)
},
100
)
this
.
isIE
=
this
.
isIEMethod
();
this
.
isIE
=
this
.
isIEMethod
();
},
},
...
@@ -131,29 +132,30 @@
...
@@ -131,29 +132,30 @@
this
.
fileList3
=
fileList
.
slice
(
-
1
);
this
.
fileList3
=
fileList
.
slice
(
-
1
);
},
},
// 保留但不再使用旧上传回调
handleAvatarSuccess
(
res
,
file
)
{
handleAvatarSuccess
(
res
,
file
)
{
this
.
downloadPath
=
file
.
response
.
path
// 不再使用旧下载路径
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
},
},
// 选择文件阶段可选校验:保持原逻辑最小复用(现在不自动上传,所以在提交时再严格校验)
beforeAvatarUpload
(
file
)
{
beforeAvatarUpload
(
file
)
{
var
type
=
/
\.[^\.]
+/
.
exec
(
file
.
name
);
var
type
=
/
\.[^\.]
+/
.
exec
(
file
.
name
);
const
isJPG
=
type
[
0
]
===
'
.ydk
'
;
const
isYDK
=
type
&&
type
[
0
]
===
'
.ydk
'
;
const
isLt2M
=
file
.
size
/
1024
<
3
;
const
isLt3KB
=
file
.
size
/
1024
<
3
;
if
(
!
isJPG
)
{
if
(
!
isYDK
)
{
this
.
$message
.
error
(
'
上传文件只能是 ydk 格式!
'
);
this
.
$message
.
error
(
'
上传文件只能是 ydk 格式!
'
);
return
false
return
false
}
}
if
(
!
isLt2M
)
{
if
(
!
isLt3KB
)
{
this
.
$message
.
error
(
'
上传文件大小不能超过 3KB!
'
);
this
.
$message
.
error
(
'
上传文件大小不能超过 3KB!
'
);
return
false
return
false
}
}
return
true
;
return
true
;
},
},
download
:
function
()
{
// 旧下载方法废弃
window
.
location
.
href
=
API
.
getDownloadUrl
(
this
.
downloadPath
)
download
:
function
()
{},
},
isIEMethod
:
function
(
ver
)
{
isIEMethod
:
function
(
ver
)
{
var
b
=
document
.
createElement
(
'
b
'
)
var
b
=
document
.
createElement
(
'
b
'
)
...
@@ -161,74 +163,88 @@
...
@@ -161,74 +163,88 @@
return
b
.
getElementsByTagName
(
'
i
'
).
length
===
1
return
b
.
getElementsByTagName
(
'
i
'
).
length
===
1
},
},
onSubmit
:
function
()
{
// 改为直传 /api/fill
// if (!this.form.name || !this.form.name.trim()) {
async
onSubmit
()
{
// this.$notify({
// 取出表单字段
// title: '警告',
const
{
name
,
event
,
date
,
lastInitial
}
=
this
.
form
;
// message: '请输入姓名!',
// type: 'error'
// })
// return;
// }
// if (!this.form.event || !this.form.event.trim()) {
// this.$notify({
// title: '警告',
// message: '请输入event!',
// type: 'error'
// })
// return;
// }
var
date
;
if
(
this
.
form
.
date
)
{
date
=
moment
(
this
.
form
.
date
).
format
(
'
YYMMDD
'
)
}
if
(
!
this
.
downloadPath
||
!
this
.
downloadPath
.
trim
())
{
// 文件检查
if
(
!
this
.
fileList3
.
length
||
!
this
.
fileList3
[
0
].
raw
)
{
this
.
$notify
({
this
.
$notify
({
title
:
'
警告
'
,
title
:
'
警告
'
,
message
:
'
请上传ydk
文件!
'
,
message
:
'
请先选择 ydk
文件!
'
,
type
:
'
error
'
type
:
'
error
'
})
});
return
;
return
;
}
}
const
file
=
this
.
fileList3
[
0
].
raw
;
var
opt
=
{
name
:
this
.
form
.
name
,
// 轻量校验(沿用原限制)
event
:
this
.
form
.
event
,
const
ok
=
this
.
beforeAvatarUpload
(
file
);
gameid
:
this
.
form
.
gameid
,
if
(
!
ok
)
return
;
date
:
date
,
id
:
this
.
downloadPath
.
slice
(
7
),
// === 全局 Loading 遮罩 ===
// img: this.checked,
const
loading
=
this
.
$loading
({
print
:
this
.
checked2
,
lock
:
true
,
text
:
'
正在生成...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.3)
'
});
try
{
const
qs
=
new
URLSearchParams
({
name
:
name
||
''
,
event
:
event
||
''
,
date
:
date
||
''
,
lastInitial
:
lastInitial
||
''
}).
toString
();
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
file
);
// multipart/form-data
const
resp
=
await
fetch
(
`https://deckform.yuzurisa.com:444/api/fill?
${
qs
}
`
,
{
method
:
'
POST
'
,
body
:
formData
});
if
(
!
resp
.
ok
)
{
let
errText
=
'
生成失败
'
;
try
{
const
ct
=
resp
.
headers
.
get
(
'
content-type
'
)
||
''
;
if
(
ct
.
includes
(
'
application/json
'
))
{
const
j
=
await
resp
.
json
();
errText
=
(
j
&&
j
.
message
)
||
errText
;
}
else
{
errText
=
await
resp
.
text
();
}
}
catch
(
e
)
{}
this
.
$notify
({
title
:
'
错误
'
,
message
:
errText
,
type
:
'
error
'
});
return
;
}
}
const
blob
=
await
resp
.
blob
();
const
url
=
URL
.
createObjectURL
(
blob
);
const
win
=
window
.
open
(
url
,
"
_blank
"
);
// var baseUrl = "http://localhost:8081"
if
(
this
.
checked2
&&
win
)
{
var
baseUrl
=
"
https://mycard.world/ygopro/arena
"
setTimeout
(()
=>
{
try
{
win
.
focus
();
win
.
print
();
}
catch
(
e
)
{}
var
template
=
"
deck
"
},
800
);
if
(
this
.
value
===
"
1
"
)
{
template
=
"
deck
"
}
}
if
(
this
.
value
===
"
2
"
)
{
}
catch
(
e
)
{
template
=
"
konami
"
this
.
$notify
({
title
:
'
错误
'
,
message
:
'
网络异常或服务器错误
'
,
type
:
'
error
'
});
}
finally
{
loading
.
close
();
}
}
var
request
=
querystring
.
stringify
(
opt
);
var
url
=
`
${
baseUrl
}
/
${
template
}
.html?
${
request
}
`
;
window
.
open
(
url
,
"
_blank
"
);
},
},
},
},
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
</
style
>
</
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