Commit 973c9813 authored by lyong's avatar lyong

fix:增加温湿度检测

parent 7b7fc59a
<html>
<div class="screen" id="id_screen">
<!-- <div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;"> -->
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
<!-- </div> -->
<div style="left:100;top: 0;width: 280;height: 55; background-color: #FE8800;">
<text class="fontsize36" id="title_TEXT" style="color: rgb(255, 255, 255);left:0 ;top: 0; width: 280;height: 55;">TVOC</text>
</div>
<div style="left:0 ;top: 0; width: 100;height: 55;background-color: #f54335;">
<text class="fontsize36" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="color: #ffffff;left:0 ;top: 0; width: 100;height: 55;">失败</text>
</div>
<div id="id_yes" style="left:380 ;top: -480; width: 100;height: 55;background-color: #90c752;">
<text class="fontsize36" onpress="touchedScreen" onclick="touchedYesButton" style="color: #ffffff;left:0 ;top: 0; width: 100;height: 55;">通过</text>
</div>
<div style="left:0 ;top: 55; width: 480;height: 425;background-color: #FAFAFA;">
<!-- <text class="fontsize24" style="top: 10;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">VOC:</text> -->
<text class="fontsize24" style="top: 10;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">湿度:</text>
<text class="fontsize24" style="top: 45;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">温度:</text>
</div>
<div style="left:70 ;top: 55; width: 480;height: 425;background-color: #FAFAFA;">
<!-- <text class="fontsize24" style="top: 10;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">{{voc}}</text> -->
<text class="fontsize24" id="id_temp" style="top: 10;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">{{temp}}</text>
<text class="fontsize24" id="id_humidity" style="top: 45;left: 10;width: 480;color:rgb(0, 0, 0);text-align: left;">{{humidity}}</text>
</div>
<text class="fontsize16" style="top: 145;left: 10;width: 480;height: 70;color:#88ff00;text-align: left;">{{warn}}</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var packet_cmd = require("packet_cmd.js");
var _userdata = require("userdata.js");
var userData = _userdata.userData;
//var envTemp = require("environmentTemperature.js");
var sendValue = 0;
export default {
data: {
voc: 0,
temp: 0,
humidity: 0,
warn: "判断通过标准:温度大于0,湿度大于0,测试结果为通过,否则为失败"
//warn: "判断通过标准:voc大于0,温度大于0,湿度大于0,测试结果为通过,否则为失败"
},
onInit() {
},
readStringFromFile: function (filepath) {
var fs = require("@system.fs")
if (fs.exists(filepath)) {
var ret = fs.readFile(filepath, "r")
return ret
}
return undefined
},
readDataByFile: function () {
var temperaturePath = "../../../../../tmp/temperature";
var humidityPath = "../../../../../tmp/humidity";
var t;
var h;
// var tmp_t = readStringFromFile(dataObj.filename.temperature)DFF
var tmp_t = this.readStringFromFile(temperaturePath)
if (tmp_t != undefined) {
t = parseFloat(tmp_t) || -1
}
var tmp_h = this.readStringFromFile(humidityPath)
if (tmp_h != undefined) {
h = parseFloat(tmp_h) || -1
}
return { "t": t, "h": h }
},
naValueSet: function () {
this.temp = "NA"
this.humidity = "NA"
this.$setY("id_yes", -480);
this.$setTextColor("id_temp", "#ff0000");
this.$setTextColor("id_humidity", "#ff0000");
},
setValue: function (t, h) {
this.temp = t
this.humidity = h
this.$setY("id_yes", 0);
this.$setTextColor("id_temp", "#00ff00");
this.$setTextColor("id_humidity", "#00ff00");
},
InterValTime: function () {
var file = this.readDataByFile(); // 注意 this
var t = file.t;
var h = file.h;
if (t > 0 && h > 0) {
this.setValue(t, h);
}
else {
this.naValueSet();
}
},
onShow: function () {
//this.$setY("id_yes", -480);
this.InterValTime();
this.testTimer = this.$setInterval(this.InterValTime, 3000, [], this);
},
onHide: function () {
//console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
//console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
serialManager.close();
this.$clearInterval(this.testTimer);
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0;
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestUartComm);")
yesJumpPage.yesGoToNextPage("factoryTestUartComm");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
movePage: function (oldPage, newPage) {
//console.log(oldPage + "==========to==========" + newPage);
this.$hide(oldPage); // 跳转页面之前立即关掉toast
this.$setY(oldPage, -480); // hide
this.$show(newPage)
this.$setY(newPage, 0); // show
},
};
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
.fontsize20 {
font-size: 20;
text-align: center;
text-overflow: ellipsis;
color: #ffffff;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize36 {
text-align: center;
text-overflow: ellipsis;
font-size: 36;
color: #ffffff;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.fontsize24 {
height: 34;
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
.fontsize16 {
height: 34;
text-align: center;
text-overflow: ellipsis;
font-size: 16;
color: #ffffff;
background-color: transparent;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
#id_scanWifiList {
bottom: 20px;
right: 20px;
}
#id_startscanWifi {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.oneRow {
top: 15px;
}
.setBrightnessLineDivBg {
left: 78;
top: 33;
width: 324;
height: 24;
border-radius: 12px;
background-color: #4D4D4D;
}
.setBrightnessLineShowDiv {
left: 78;
top: 33;
width: 162;
height: 24;
border-radius: 12px;
background-color: rgb(32, 148, 240);
}
#setBrightnessSlider {
left: 78;
top: 30;
width: 324;
height: 32;
border-width: 0px;
border-radius: 3px;
border-color: gray;
/* background-color: #4D4D4D;
slider-indic-color: white; */
background-color: transparent;
slider-indic-color: transparent;
slider-knob-color: rgb(32, 148, 240);
slider-knob-height: 32;
}
</style>
\ No newline at end of file
......@@ -125,12 +125,21 @@
en: 1,
index: 8,
},
{
id: "id_factoryTestTvoc",
name: "温湿度测试",
startup: "factoryTestTvoc",
top: 190,
left: 20,
en: 1,
index: 9,
},
{
id: "id_factoryTestBurnIn",
name: "老化测试",
startup: "factoryTestBurnIn",
top: 190,
left: 20,
left: 130,
en: 1,
index: 0,
},
......@@ -141,7 +150,7 @@
top: 370,
left: 20,
en: 1,
index: 9,
index: 10,
},
{
id: "id_factoryTestClearAll",
......@@ -188,6 +197,7 @@
bright: 0,
licenseAuthor: 0,
rtc: 0,
tvoc: 0,
burnIn: 0,
systemCheck: 0,
clearAll: 0,
......@@ -203,7 +213,7 @@
const properties = [
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "rtc",
"uartComm", "bright", "licenseAuthor", "rtc","tvoc",
"burnIn", "systemCheck", "clearAll", "start"
];
......@@ -288,7 +298,7 @@
const properties = [
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "rtc",
"uartComm", "bright", "licenseAuthor", "rtc","tvoc",
"burnIn", "systemCheck", "clearAll", "start"
];
......@@ -379,6 +389,7 @@
{ index: 5, property: "bright" },
{ index: 6, property: "licenseAuthor" },
{ index: 7, property: "rtc" },
{ index: 7, property: "tvoc" },
{ index: 8, property: "burnIn" },
{ index: 9, property: "systemCheck" },
{ index: 10, property: "clearAll" },
......@@ -418,6 +429,7 @@
globalThis.factoryTest.bright = 0;
globalThis.factoryTest.licenseAuthor = 0;
globalThis.factoryTest.rtc = 0;
globalThis.factoryTest.tvoc = 0;
globalThis.factoryTest.burnIn = 0;
globalThis.factoryTest.systemCheck = 0;
globalThis.factoryTest.clearAll = 0;
......@@ -433,6 +445,7 @@
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
tvoc: globalThis.factoryTest.tvoc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
......@@ -458,6 +471,7 @@
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
tvoc: globalThis.factoryTest.tvoc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
......
{"color":0,"touch":0,"wifi":0,"sound":0,"uartComm":0,"bright":0,"licenseAuthor":0,"rtc": 0,"burnIn": 0,"systemCheck":0,"clearAll":0,"start":0}
\ No newline at end of file
{"color":0,"touch":0,"wifi":0,"sound":0,"uartComm":0,"bright":0,"licenseAuthor":0,"rtc": 0,"tvoc":0,"burnIn": 0,"systemCheck":0,"clearAll":0,"start":0}
\ No newline at end of file
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