Commit a66acb08 authored by ganjingcun's avatar ganjingcun

deck print bug fix

parent 148640bd
......@@ -4,16 +4,32 @@
<template>
<el-alert title="上传ydk文件和填写必要的信息之后,卡组表格即可自动生成" type="success">
</el-alert>
<hr>
<el-alert v-if="isIE" title="您的浏览器不支持卡表打印功能。
卡表打印功能支持谷歌、Safari、火狐以及手机默认浏览器。" type="error">
</el-alert>
</template>
<hr>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="姓名" :label-width="formLabelWidth">
<el-input v-model="form.name" placeholder="请输入标题姓名" auto-complete="off" width="10px"></el-input>
</el-form-item>
<el-form-item label="Event" :label-width="formLabelWidth">
<el-form-item label="Event" :label-width="formLabelWidth">
<el-input v-model="form.event" placeholder="请输入Event" auto-complete="off" width="10px"></el-input>
</el-form-item>
<el-form-item label="参赛ID" :label-width="formLabelWidth">
<el-input v-model="form.gameid" placeholder="请输入gameid" auto-complete="off" width="10px"></el-input>
</el-form-item>
<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>
<!--<el-input v-model="form.date" placeholder="请输入" auto-complete="off" width="10px"></el-input>-->
</el-form-item>
<el-form-item label="ydk文件" :label-width="formLabelWidth">
<el-upload class="upload-demo" :action="uploadUrl" :on-change="handleChange" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"
:file-list="fileList3">
......@@ -43,9 +59,14 @@
return {
fileList3: [],
isIE: false,
form: {
name: '',
event: '',
date: '',
gameid: '',
},
formLabelWidth: '80px',
isNew: true,
......@@ -65,6 +86,8 @@
setTimeout(function () {
$(".el-upload__input").hide()
}, 100)
this.isIE = this.isIEMethod();
},
computed: {
......@@ -103,23 +126,35 @@
window.location.href = API.getDownloadUrl(this.downloadPath)
},
onSubmit: function () {
if (!this.form.name || !this.form.name.trim()) {
this.$notify({
title: '警告',
message: '请输入姓名!',
type: 'error'
})
return;
}
isIEMethod: function (ver) {
var b = document.createElement('b')
b.innerHTML = '<!--[if IE ' + ver + ']><i></i><![endif]-->'
return b.getElementsByTagName('i').length === 1
},
if (!this.form.event || !this.form.event.trim()) {
this.$notify({
title: '警告',
message: '请输入event!',
type: 'error'
})
return;
onSubmit: function () {
// if (!this.form.name || !this.form.name.trim()) {
// this.$notify({
// title: '警告',
// 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()) {
......@@ -130,13 +165,17 @@
})
return;
}
var opt = {
var opt = {
name: this.form.name,
event: this.form.event,
gameid: this.form.gameid,
date: date,
id: this.downloadPath.slice(7)
}
var request = querystring.stringify(opt);
// var baseUrl = "http://localhost:̃8081"
// var baseUrl = "http://localhost:8081"
var baseUrl = "https://mycard.moe/ygopro/arena"
var url = `${baseUrl}/konami.html?${request}`;
......
......@@ -10,7 +10,7 @@ module.exports = {
download: '下载',
profile: '个人信息',
account: '用户中心',
deckprint: '打印',
deckprint: '打印',
signout: '退出',
signin: '登录 | 注册',
qc: '查询条件',
......
......@@ -834,54 +834,54 @@
<!--card game id-->
<div class="c x1f y49 w1d h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[0]}}</div>
</div>
<div class="c x21 y49 w1d h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[1]}}</div>
</div>
<div class="c x22 y49 w1e h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[2]}}</div>
</div>
<div class="c xa y49 w1d h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[3]}}</div>
</div>
<div class="c xb y49 w1d h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[4]}}</div>
</div>
<div class="c xc y49 w1e h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[5]}}</div>
</div>
<div class="c x23 y49 w1e h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[6]}}</div>
</div>
<div class="c x24 y49 w1d h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[7]}}</div>
</div>
<div class="c xe y49 w1e h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[8]}}</div>
</div>
<div class="c xf y49 w1e h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.gameid[9]}}</div>
</div>
<!--date-->
<div class="c x10 y4b w1f h18">
<div class="t m0 x20 h17 y4c ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4c ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[0]}}</div>
</div>
<div class="c x25 y4d w1f h19">
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[1]}}</div>
</div>
<div class="c x26 y4f w1f h16">
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4a ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[2]}}</div>
</div>
<div class="c x27 y50 w1f h19">
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[3]}}</div>
</div>
<div class="c x28 y4d w1f h19">
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4e ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[4]}}</div>
</div>
<div class="c x29 y4b w20 h18">
<div class="t m0 x20 h17 y4c ff7 fs5 fc0 sc0 ls1 ws0"></div>
<div class="t m0 x20 h17 y4c ff7 fs5 fc0 sc0 ls1 ws0">{{deck.date[5]}}</div>
</div>
<!--total-->
......@@ -897,6 +897,7 @@
</div>
<div class="pi" data-data='{"ctm":[1.000000,0.000000,0.000000,1.000000,0.000000,0.000000]}'></div>
</div>
<!--<div style="position: absolute;width:50px;height: 50px;right:200px; bottom:100px;background-color: red;"></div>-->
</div>
<div class="loading-indicator">
......@@ -923,6 +924,21 @@
if (id) {
this.deck.name = getParameterByName('name');
this.deck.event = getParameterByName('event');
var gameid = getParameterByName('gameid');
if (gameid) {
var gameid_arr = gameid.split('');
for (var i = 0; i < gameid_arr.length; i++) {
this.deck.gameid[i] = gameid_arr[i];
}
}
var date = getParameterByName('date');
if (date) {
this.deck.date = date.split('')
}
// var URL = "http://localhost:3000/api"
var URL = "https://api.mycard.moe/ygopro/arena"
var params = {
......@@ -986,8 +1002,8 @@
deck: {
name: "Joe xx xx 3",
event: "",
gameID: "0500270878",
date: "",
gameid: ["", "", "", "", "", "", "", "", "", ""],
date: ["", "", "", "", "", ""],
monsterTotal: 0,
spellTotal: 0,
trapTotal: 0,
......@@ -1102,10 +1118,10 @@
this.deck.monsterTotal = this.deck.monster.reduce(function (a, b) {
let x = a.num;
let y = b.num;
if (isNaN(a.num)) {
if (isNaN(a.num) || a.num === "") {
x = 0
}
if (isNaN(b.num)) {
if (isNaN(b.num) || b.num === "") {
y = 0
}
return { num: x + y }
......@@ -1114,10 +1130,10 @@
this.deck.spellTotal = this.deck.spells.reduce(function (a, b) {
let x = a.num;
let y = b.num;
if (isNaN(a.num)) {
if (isNaN(a.num) || a.num === "") {
x = 0
}
if (isNaN(b.num)) {
if (isNaN(b.num) || b.num === "") {
y = 0
}
return { num: x + y }
......@@ -1126,10 +1142,10 @@
this.deck.trapTotal = this.deck.traps.reduce(function (a, b) {
let x = a.num;
let y = b.num;
if (isNaN(a.num)) {
if (isNaN(a.num) || a.num === "") {
x = 0
}
if (isNaN(b.num)) {
if (isNaN(b.num) || b.num === "") {
y = 0
}
return { num: x + y }
......@@ -1138,10 +1154,10 @@
this.deck.extraTotal = this.deck.extra.reduce(function (a, b) {
let x = a.num;
let y = b.num;
if (isNaN(a.num)) {
if (isNaN(a.num) || a.num === "") {
x = 0
}
if (isNaN(b.num)) {
if (isNaN(b.num) || b.num === "") {
y = 0
}
return { num: x + y }
......@@ -1150,10 +1166,10 @@
this.deck.sideTotal = this.deck.side.reduce(function (a, b) {
let x = a.num;
let y = b.num;
if (isNaN(a.num)) {
if (isNaN(a.num) || a.num === "") {
x = 0
}
if (isNaN(b.num)) {
if (isNaN(b.num) || b.num === "") {
y = 0
}
return { num: x + y }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment