修改tmr蓝牙连接成功失败notice,修改收集页面上传成功不显示圈舍问题且过滤不是tmr的蓝牙,配置页面预留手动更新方法

This commit is contained in:
liuwu 2023-11-10 09:34:34 +08:00
parent 31cf133bbc
commit 61867b0f23
4 changed files with 40 additions and 13 deletions

View File

@ -175,8 +175,8 @@
}); });
} }
function handleClassClick(obj,batch,name){ function handleClassClick(obj,b,name){
batch = batch batch = b
mui.toast(name+'切换成功'); mui.toast(name+'切换成功');
var doms = document.getElementsByClassName('classes'); var doms = document.getElementsByClassName('classes');
if (doms.length > 0) { if (doms.length > 0) {
@ -294,8 +294,8 @@
} }
}, function (ret, err) { }, function (ret, err) {
if (ret){ if (ret){
cowshedName = '收集重量'
mui.toast(cowshedName+"上传成功"); mui.toast(cowshedName+"上传成功");
cowshedName = '收集重量'
} }
}) })
@ -457,8 +457,7 @@
ret.peripherals.forEach(function (p) { ret.peripherals.forEach(function (p) {
if (undefined !== p.name) { if (undefined !== p.name) {
console.log(p.name); console.log(p.name);
// if (p.name.indexOf("TMR_BLE") === -1){ if (p.name.indexOf("TMR_BLE") === -1){
if (p.name === -1){
return false return false
}else{ }else{
mui.toast("已扫描到" +p.name,{duration:3500,type:'div'}); mui.toast("已扫描到" +p.name,{duration:3500,type:'div'});
@ -548,7 +547,6 @@
document.getElementById('nextCowshed').setAttribute("class", 'btnc mui-btn-success flex dis'); document.getElementById('nextCowshed').setAttribute("class", 'btnc mui-btn-success flex dis');
connectTimes ++; connectTimes ++;
console.log('主机端连接失败'+connectTimes+' '+uuid) console.log('主机端连接失败'+connectTimes+' '+uuid)
// addNotice(sbId + '主机端连接失败'+connectTimes+'次 '+uuid);
wifiDom.innerHTML = '连接失败'; wifiDom.innerHTML = '连接失败';
api.hideProgress(); api.hideProgress();
setTimeout(function (){ setTimeout(function (){

View File

@ -133,7 +133,7 @@
</div> </div>
</div> </div>
<div class="mui-col-sm-6"> <div class="mui-col-sm-6">
<!-- <button class="flex1 mui-btn-inline mui-btn-info" style="font-size: large;color: seagreen !important;" onclick="downloadApp()">下载文件</button>-->
</div> </div>
</div> </div>
<div class="footer flex mui-row"> <div class="footer flex mui-row">
@ -195,6 +195,30 @@
} }
} }
function downloadApp(){
var mam = api.require('mam');
mam.checkUpdate(function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret))
}
})
// api.download({
// url: 'https://tmr.nxcyx.com/apk/TMRv2.0.5.apk',
// savePath: 'fs://TMRv2.0.6.apk',
// report: true,
// cache: true,
// allowResume: true
// }, function(ret, err) {
// console.log(JSON.stringify(ret))
// if (ret.state == 1) {
// //下载成功
// } else {
// console.log(JSON.stringify(err))
// }
// });
}
//返回主页 //返回主页
function handleBackMain() { function handleBackMain() {
api.closeWin(); api.closeWin();

View File

@ -131,6 +131,7 @@ function connect(param) {
wifiDom.innerHTML = '已连接'; wifiDom.innerHTML = '已连接';
connectTimes = 0; connectTimes = 0;
document.getElementById('text').innerHTML = '设备已连接'; document.getElementById('text').innerHTML = '设备已连接';
addNotice(1,'#02a7f0',sbId + '主机端连接成功'+uuid);
text = '设备已连接'; text = '设备已连接';
console.log('主机端连接成功') console.log('主机端连接成功')
ble.setMtu({ ble.setMtu({
@ -148,7 +149,9 @@ function connect(param) {
connetcedStatus = false connetcedStatus = false
connectTimes ++; connectTimes ++;
console.log('主机端连接失败'+connectTimes+' '+uuid) console.log('主机端连接失败'+connectTimes+' '+uuid)
addNotice(sbId + '主机端连接失败'+connectTimes+'次 '+uuid); if(connectTimes%50 === 0 || connectTimes === 1){
addNotice(4,'red',sbId + '主机端连接失败'+connectTimes+'次 '+uuid);
}
wifiDom.innerHTML = '连接失败'; wifiDom.innerHTML = '连接失败';
api.hideProgress(); api.hideProgress();
setTimeout(function (){ setTimeout(function (){

View File

@ -196,8 +196,8 @@ function submitData() {
}, 500); }, 500);
// },500) // },500)
} else if (err) { } else if (err) {
addNotice('submitData,' + err.msg); addNotice(4,'red','submitData,' + err.msg);
mui.alert("submitData:" + err.msg); mui.alert( err.msg);
} }
}); });
} }
@ -313,13 +313,15 @@ function uploadTotalWeight() {
/** /**
* 添加异常通知 * 添加异常通知
* @param type
* @param color
* @param {} describe * @param {} describe
*/ */
function addNotice(describe) { function addNotice(type,color,describe) {
var param = { var param = {
sourceCow: api.getPrefs({sync: true, key: 'sourceCow'}), sourceCow: api.getPrefs({sync: true, key: 'sourceCow'}),
type: 4, type: type?type:4,
color: 'red', color: color?color:'red',
time: currTimeFn(new Date()), time: currTimeFn(new Date()),
describe: describe describe: describe
}; };