From 2110001f760813bd704b8447774a430d6cc950c0 Mon Sep 17 00:00:00 2001 From: AceDroidX <15519693+AceDroidX@users.noreply.github.com> Date: Sat, 5 Oct 2019 15:54:27 +0800 Subject: [PATCH 1/2] Update Cards.vue --- dash/src/components/Cards.vue | 75 +++++++++++------------------------ 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/dash/src/components/Cards.vue b/dash/src/components/Cards.vue index 165e810..a776de5 100644 --- a/dash/src/components/Cards.vue +++ b/dash/src/components/Cards.vue @@ -121,23 +121,14 @@ export default { ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] - 2; - while (newproduct <= 2073600) { - res[0] = res[0] - 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] - (res[1] % 4); - } - } else { - while (newproduct <= 2073600) { - res[0] = res[0] - 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] - (res[1] % 4); - } + } + while (newproduct <= 2073600) { + res[0] = res[0] - 4; + res[1] = Math.round(res[0] / ratio); + newproduct = res[0] * res[1]; + } + if (res[1] % 4 != 0) { + res[1] = res[1] - (res[1] % 4); } if (this.interlace == 1) { this.setcard("请输入宽度" + res[0] + "和高度" + res[1] + ",并按照码率B来处理,并按照手册文末问答2执行反交错操作", 3, 10000); @@ -173,23 +164,14 @@ export default { ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] + 2; - while (newproduct > 921600) { - res[0] = res[0] + 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] + (4 - (res[1] % 4)); - } - } else { - while (newproduct > 921600) { - res[0] = res[0] + 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] + (4 - (res[1] % 4)); - } + } + while (newproduct > 921600) { + res[0] = res[0] + 4; + res[1] = Math.round(res[0] / ratio); + newproduct = res[0] * res[1]; + } + if (res[1] % 4 != 0) { + res[1] = res[1] + (4 - (res[1] % 4)); } this.setcard("请输入宽度" + res[0] + "和高度" + res[1] + ",并按照码率B来处理", 3, 10000); return; @@ -200,23 +182,14 @@ export default { ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] + 2; - while (newproduct > 409920) { - res[0] = res[0] + 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] + (4 - (res[1] % 4)); - } - } else { - while (newproduct > 409920) { - res[0] = res[0] + 4; - res[1] = Math.round(res[0] / ratio); - newproduct = res[0] * res[1]; - } - if (res[1] % 4 != 0) { - res[1] = res[1] + (4 - (res[1] % 4)); - } + } + while (newproduct > 409920) { + res[0] = res[0] + 4; + res[1] = Math.round(res[0] / ratio); + newproduct = res[0] * res[1]; + } + if (res[1] % 4 != 0) { + res[1] = res[1] + (4 - (res[1] % 4)); } if (this.interlace == 1) { this.setcard("请输入宽度" + res[0] + "和高度" + res[1] + ",并按照码率A来处理,并按照手册文末问答2执行反交错操作", 3, 10000); From 80a5d10960b314dffcba5b482e6caaa08e874149 Mon Sep 17 00:00:00 2001 From: AceDroidX <15519693+AceDroidX@users.noreply.github.com> Date: Sat, 5 Oct 2019 22:17:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash/package.json | 6 ++++-- dash/src/components/Cards.vue | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/dash/package.json b/dash/package.json index 4629d2f..62e652a 100644 --- a/dash/package.json +++ b/dash/package.json @@ -34,7 +34,9 @@ "plugin:vue/essential", "eslint:recommended" ], - "rules": {}, + "rules": { + "no-console": "off" + }, "parserOptions": { "parser": "babel-eslint" } @@ -48,4 +50,4 @@ "> 1%", "last 2 versions" ] -} +} \ No newline at end of file diff --git a/dash/src/components/Cards.vue b/dash/src/components/Cards.vue index a776de5..3cd1313 100644 --- a/dash/src/components/Cards.vue +++ b/dash/src/components/Cards.vue @@ -58,6 +58,7 @@ export default { this.cardtext = text; this.switchbtn(btn); this.step = step; + console.log(step) }, switchbtn: function (mode) { if (mode == 1) { @@ -117,12 +118,12 @@ export default { } else { if (this.product > 2073600) { res = this.res; - newproduct = 0; + newproduct = res[0]*res[1]; ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] - 2; } - while (newproduct <= 2073600) { + while (newproduct > 2073600) { res[0] = res[0] - 4; res[1] = Math.round(res[0] / ratio); newproduct = res[0] * res[1]; @@ -160,15 +161,25 @@ export default { } if (this.hfps == 0 && this.interlace == 0) { res = this.res; - newproduct = 0; + newproduct = res[0]*res[1]; ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] + 2; } - while (newproduct > 921600) { + console.log('-----------') + console.log(res) + console.log(ratio) + console.log(newproduct) + console.log('-----------') + while (newproduct <= 921600) { res[0] = res[0] + 4; res[1] = Math.round(res[0] / ratio); newproduct = res[0] * res[1]; + console.log('-----------') + console.log(res) + console.log(ratio) + console.log(newproduct) + console.log('-----------') } if (res[1] % 4 != 0) { res[1] = res[1] + (4 - (res[1] % 4)); @@ -178,12 +189,12 @@ export default { } else { if (this.product <= 409920) { res = this.res; - newproduct = 0; + newproduct = res[0]*res[1]; ratio = res[0] / res[1]; if (res[0] % 4 != 0) { res[0] = res[0] + 2; } - while (newproduct > 409920) { + while (newproduct <= 409920) { res[0] = res[0] + 4; res[1] = Math.round(res[0] / ratio); newproduct = res[0] * res[1];