Commit e1e59099 authored by lyong's avatar lyong

fix:优化Tp测试局部测试

parent 88ed78b6
...@@ -14,46 +14,11 @@ ...@@ -14,46 +14,11 @@
<script> <script>
var router = require("@system.router"); var router = require("@system.router");
var lvgl = require("@native.lvgl7"); var lvgl = require("@native.lvgl7");
var point_div = undefined;
var point_div_list = undefined;
var FirstStartupFlag = 1;
export default { export default {
data: { data: {
flagBash: [ flagBash: Array(15).fill().map(() => Array(15).fill(0)),
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], flagBashStd: Array(15).fill().map(() => Array(15).fill(0)),
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
flagBashStd: [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
appItem: [ appItem: [
{ id: "id_block0_0" }, { id: "id_block0_1" }, { id: "id_block0_2" }, { id: "id_block0_3" }, { id: "id_block0_4" }, { id: "id_block0_0" }, { id: "id_block0_1" }, { id: "id_block0_2" }, { id: "id_block0_3" }, { id: "id_block0_4" },
{ id: "id_block0_5" }, { id: "id_block0_6" }, { id: "id_block0_7" }, { id: "id_block0_8" }, { id: "id_block0_9" }, { id: "id_block0_5" }, { id: "id_block0_6" }, { id: "id_block0_7" }, { id: "id_block0_8" }, { id: "id_block0_9" },
...@@ -105,63 +70,51 @@ ...@@ -105,63 +70,51 @@
resetArrays: function (flagBash, flagBashStd) { resetArrays: function (flagBash, flagBashStd) {
flagBash = Array.from({ length: 15 }, () => Array(15).fill(0)); this.flagBash = Array.from({ length: 15 }, () => Array(15).fill(0));
flagBashStd = Array.from({ length: 15 }, () => Array(15).fill(0)); this.flagBashStd = Array.from({ length: 15 }, () => Array(15).fill(0));
}, },
notRender: function () { notRender: function () {
for (var x = 0; x < 15; x++) { // ← 加 var
for (x = 0; x < 15; x++) { for (var y = 0; y < 15; y++) { // ← 加 var
for (y = 0; y < 15; y++) {
var relId = "id_block" + x + "_" + y; var relId = "id_block" + x + "_" + y;
////console.log("relId :" + relId); this.$setBackgroundColor(relId, 0xFFFFFF);
this.$setBackgroundColor(relId, 0xFFFFFF)
}
} }
},
dataInit: function () {
if (globalThis.factoryTest.touch == 0) {
this.$setY("id_yes", -480);
// this.resetArrays();
// if (point_div_list) {
// point_div.removeChild(point_div_list)
// }
// this.notRender();
// this.$setY("id_ng", -480);
// this.$setY("id_back", -480);
} }
}, },
// var dom = require("dom.js"); app.js引入 // var dom = require("dom.js"); app.js引入
pointInit: function () { pointInit: function () {
var getPointTopDiv = document.getElementById('id_pointDiv'); var parent = document.getElementById('id_pointDiv');
////console.log("getPointTopDiv:" + getPointTopDiv); if (!parent) return;
if (this.point_div_list && this.point_div) {
this.point_div.removeChild(this.point_div_list);
this.point_div_list = null;
}
if (!getPointTopDiv) if (!this.point_div) {
return this.point_div = document.createElement('div', {
if (!point_div) {
point_div = document.createElement('div', {
top: 0, top: 0,
left: 0, left: 0,
width: 480, width: 480,
height: 480, height: 480,
}, getPointTopDiv) }, parent)
} }
if (point_div_list) {
point_div.removeChild(point_div_list) this.point_div_list = document.createElement('div', {
return;
}
point_div_list = document.createElement('div', {
top: 0, top: 0,
left: 0, left: 0,
width: 480, width: 480,
height: 480, height: 480,
}, point_div) }, this.point_div)
}, },
drawPointEvent: function (x, y) { drawPointEvent: function (x, y) {
document.createElement('div', { document.createElement('div', {
top: y, top: y,
...@@ -169,7 +122,7 @@ ...@@ -169,7 +122,7 @@
width: 4, width: 4,
height: 4, height: 4,
"background-color": "#ff0000", "background-color": "#ff0000",
}, point_div_list) }, this.point_div_list)
}, },
drawChanlePointEvent: function (x, y) { drawChanlePointEvent: function (x, y) {
document.createElement('div', { document.createElement('div', {
...@@ -178,38 +131,41 @@ ...@@ -178,38 +131,41 @@
width: 4, width: 4,
height: 4, height: 4,
"background-color": "#ff0000", "background-color": "#ff0000",
}, point_div_list) }, this.point_div_list)
}, },
resetDrawDiv: function () { resetDrawDiv: function () {
// if (point_div_list) { if (this.point_div && this.point_div_list) {
point_div.removeChild(point_div_list) this.point_div.removeChild(this.point_div_list);
// return; }
//} if (!this.point_div) return; // 节点还没创建就退出
point_div_list = document.createElement('div', { this.point_div_list = document.createElement('div', {
top: 0, top: 0, left: 0, width: 480, height: 480
left: 0, }, this.point_div);
width: 480,
height: 480,
}, point_div)
}, },
onInit: function () { onInit: function () {
this.point_div = null;
this.point_div_list = null;
}, },
onShow: function () { onShow: function () {
////console.log(this.$uri + "===========factoryTestTouch onShow============="); this.resetArrays();
////console.log("FirstStartupFlag:" + FirstStartupFlag); this.notRender();
if (FirstStartupFlag == 1) { this.buttonReset();
this.timerSet(); this.timerSet();
this.pointInit(); this.pointInit(); // 先建好 DOM
} this.resetDrawDiv(); // 再清一次子画布
this.dataInit(); },
buttonReset: function () {
// this.$enableMouseMoveEvent(true); this.$setY("id_yes", -480);
this.$setY("id_ng", 256);
this.$setY("id_back", 384);
},
resetArrays: function () {
this.flagBash = Array(15).fill().map(() => Array(15).fill(0));
this.flagBashStd = Array(15).fill().map(() => Array(15).fill(0));
}, },
exitEvent: function () { exitEvent: function () {
FirstStartupFlag = 0;
var x = 0; var x = 0;
var y = 0; var y = 0;
var divheight = 32; var divheight = 32;
...@@ -231,13 +187,29 @@ ...@@ -231,13 +187,29 @@
}, },
onHide: function () { onHide: function () {
////console.log(this.$uri + "===========factoryTestTouch onHide============="); ////console.log(this.$uri + "===========factoryTestTouch onHide=============");
this.clearTimer(); this.exit();
this.exitEvent();
}, },
onQuit: function () { onQuit: function () {
////console.log(this.$uri + "===========factoryTestTouch onQuit============="); ////console.log(this.$uri + "===========factoryTestTouch onQuit=============");
this.exit();
},
exit: function () {
this.clearTimer(); this.clearTimer();
this.exitEvent(); this.exitEvent();
this.cleanPointDom();
},
cleanPointDom: function () {
if (!this.point_div) return; // 已经清过
if (this.point_div_list) {
try { this.point_div.removeChild(this.point_div_list); } catch (e) { }
this.point_div_list = null;
}
var parent = this.point_div.parentNode;
if (parent) {
try { parent.removeChild(this.point_div); } catch (e) { }
}
this.point_div = null;
}, },
/*************** timer ***************/ /*************** timer ***************/
timerSet: function () { timerSet: function () {
...@@ -406,18 +378,27 @@ ...@@ -406,18 +378,27 @@
}, },
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 1; // globalThis.factoryTest.touch = 1;
var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 1);
this.exit();
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
////console.log("=====yesJumpPage.yesGoToNextPage(factoryTestTouch);") ////console.log("=====yesJumpPage.yesGoToNextPage(factoryTestTouch);")
yesJumpPage.yesGoToNextPage("factoryTestTouch"); yesJumpPage.yesGoToNextPage("factoryTestTouch");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 2; //globalThis.factoryTest.touch = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 2);
this.exit();
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 3);
this.exit();
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
......
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