Commit e1e59099 authored by lyong's avatar lyong

fix:优化Tp测试局部测试

parent 88ed78b6
......@@ -14,46 +14,11 @@
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var point_div = undefined;
var point_div_list = undefined;
var FirstStartupFlag = 1;
export default {
data: {
flagBash: [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 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],
],
flagBash: Array(15).fill().map(() => Array(15).fill(0)),
flagBashStd: Array(15).fill().map(() => Array(15).fill(0)),
appItem: [
{ 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" },
......@@ -105,63 +70,51 @@
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 () {
for (x = 0; x < 15; x++) {
for (y = 0; y < 15; y++) {
for (var x = 0; x < 15; x++) { // ← 加 var
for (var y = 0; y < 15; y++) { // ← 加 var
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引入
pointInit: function () {
var getPointTopDiv = document.getElementById('id_pointDiv');
////console.log("getPointTopDiv:" + getPointTopDiv);
var parent = document.getElementById('id_pointDiv');
if (!parent) return;
if (!getPointTopDiv)
return
if (!point_div) {
point_div = document.createElement('div', {
if (this.point_div_list && this.point_div) {
this.point_div.removeChild(this.point_div_list);
this.point_div_list = null;
}
if (!this.point_div) {
this.point_div = document.createElement('div', {
top: 0,
left: 0,
width: 480,
height: 480,
}, getPointTopDiv)
}
if (point_div_list) {
point_div.removeChild(point_div_list)
return;
}, parent)
}
point_div_list = document.createElement('div', {
this.point_div_list = document.createElement('div', {
top: 0,
left: 0,
width: 480,
height: 480,
}, point_div)
}, this.point_div)
},
drawPointEvent: function (x, y) {
document.createElement('div', {
top: y,
......@@ -169,7 +122,7 @@
width: 4,
height: 4,
"background-color": "#ff0000",
}, point_div_list)
}, this.point_div_list)
},
drawChanlePointEvent: function (x, y) {
document.createElement('div', {
......@@ -178,38 +131,41 @@
width: 4,
height: 4,
"background-color": "#ff0000",
}, point_div_list)
}, this.point_div_list)
},
resetDrawDiv: function () {
// if (point_div_list) {
point_div.removeChild(point_div_list)
// return;
//}
point_div_list = document.createElement('div', {
top: 0,
left: 0,
width: 480,
height: 480,
}, point_div)
if (this.point_div && this.point_div_list) {
this.point_div.removeChild(this.point_div_list);
}
if (!this.point_div) return; // 节点还没创建就退出
this.point_div_list = document.createElement('div', {
top: 0, left: 0, width: 480, height: 480
}, this.point_div);
},
onInit: function () {
this.point_div = null;
this.point_div_list = null;
},
onShow: function () {
////console.log(this.$uri + "===========factoryTestTouch onShow=============");
////console.log("FirstStartupFlag:" + FirstStartupFlag);
if (FirstStartupFlag == 1) {
this.timerSet();
this.pointInit();
}
this.dataInit();
// this.$enableMouseMoveEvent(true);
this.resetArrays();
this.notRender();
this.buttonReset();
this.timerSet();
this.pointInit(); // 先建好 DOM
this.resetDrawDiv(); // 再清一次子画布
},
buttonReset: function () {
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 () {
FirstStartupFlag = 0;
var x = 0;
var y = 0;
var divheight = 32;
......@@ -231,13 +187,29 @@
},
onHide: function () {
////console.log(this.$uri + "===========factoryTestTouch onHide=============");
this.clearTimer();
this.exitEvent();
this.exit();
},
onQuit: function () {
////console.log(this.$uri + "===========factoryTestTouch onQuit=============");
this.exit();
},
exit: function () {
this.clearTimer();
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 ***************/
timerSet: function () {
......@@ -406,18 +378,27 @@
},
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");
////console.log("=====yesJumpPage.yesGoToNextPage(factoryTestTouch);")
yesJumpPage.yesGoToNextPage("factoryTestTouch");
},
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({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 3);
this.exit();
router.push({
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