1
0
forked from dyf/APP

018A初步完成

This commit is contained in:
liub
2026-04-14 15:19:05 +08:00
parent d82ae6445e
commit 01ff9c7a05
43 changed files with 2626 additions and 892 deletions

View File

@ -218,31 +218,31 @@ export default {
value: "1",
label: "灯光模式",
checked: false,
type: ['6170', '670','102','6155','650','7305','6075']
type: ['6170', '670', '102', '6155', '650', '7305', '6075']
},
{
value: "2",
label: "激光模式",
checked: false,
type: ['6170','6075']
type: ['6170', '6075']
},
{
value: "3",
label: "开机画面",
checked: false,
type: ['210', '6170', '670','6155','650','7305','6075']
type: ['210', '6170', '670', '6155', '650', '7305', '6075']
},
{
value: "4",
label: "人员信息登记",
checked: false,
type: ['210', '6170', '670','6155','650','7305','6075']
type: ['210', '6170', '670', '6155', '650', '7305', '6075']
},
{
value: "5",
label: "发送信息",
checked: false,
type: ['210', '6170', '670','6075']
type: ['210', '6170', '670', '6075']
},
{
value: "6",
@ -253,12 +253,12 @@ export default {
value: "41",
label: "静电探测",
checked: false,
type: ['670','650']
type: ['670', '650']
}, {
value: "42",
label: "SOS",
checked: false,
type: ['670','4877','6075']
type: ['670', '4877', '6075']
},
{
value: "43",
@ -266,25 +266,25 @@ export default {
checked: false,
type: ['210']
},
{
{
value: "44",
label: "报警声音",
checked: false,
type: ['210']
},
{
{
value: "45",
label: "自动报警",
checked: false,
type: ['210']
},
{
{
value: "46",
label: "手动报警",
checked: false,
type: ['210','102','6170']
type: ['210', '102', '6170']
},
{
{
value: "47",
label: "报警时长",
checked: false,
@ -302,28 +302,28 @@ export default {
checked: false,
type: ['102']
},
{
value: "50",
label: "报警模式",
checked: false,
type: ['100','100J']
type: ['100', '100J']
},
{
value: "51",
label: "警示灯",
checked: false,
type: ['100','100J']
type: ['100', '100J']
},
{
value: "52",
label: "语音管理",
checked: false,
type: ['100','100J']
type: ['100', '100J']
},
{
value: "53",
label: "箭头模式",
@ -340,7 +340,7 @@ export default {
value: "55",
label: "修改信道",
checked: false,
type: ['4877','102']
type: ['4877', '102']
},
{
value: "56",
@ -400,10 +400,10 @@ export default {
},
//将相对路径的文件移动到_downloads文件夹中
moveFileToDownloads(tempFilePath) {
return new Promise((resolve, reject) => {
if(!tempFilePath){
if (!tempFilePath) {
console.log("无文件需要移动");
resolve(tempFilePath);
return;
@ -452,20 +452,21 @@ export default {
});
},
getOSAndUpload(){
let os=uni.getSystemInfoSync().platform;
let url=''
if(os==='ios'){
url='https://apps.apple.com/cn/app/星汉物联/id6752555460'
getOSAndUpload() {
let os = uni.getSystemInfoSync().platform;
let url = ''
if (os === 'ios') {
url = 'https://apps.apple.com/cn/app/星汉物联/id6752555460'
} else if (os === 'android') {
url = 'https://www.pgyer.com/xhwl';
}
else if(os==='android'){
url='https://www.pgyer.com/xhwl';
}
return {os:os,url:url};
return {
os: os,
url: url
};
},
//将点阵数据转换成RGB565
convertToRGB565(pixels, type) {
if (!type) {
@ -478,15 +479,106 @@ export default {
let g = pixels[i + 1];
let b = pixels[i + 2];
let a = pixels[i + 3];
if (type == 'bgr') {
result[index++] = ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
} else {
result[index++] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}
}
return result;
},
formatTime(value, unit = 'minute') {
// 边界处理空值、0或负数
if (!value || value <= 0) return '0秒';
// 将所有单位统一转换为分钟和总秒数
let minutes;
let totalSeconds;
switch (unit) {
case 'second': // 秒
minutes = value / 60;
totalSeconds = value;
break;
case 'minute': // 分钟(默认)
minutes = value;
totalSeconds = value * 60;
break;
case 'hour': // 小时
minutes = value * 60;
totalSeconds = value * 3600;
break;
case 'day': // 天
minutes = value * 24 * 60;
totalSeconds = value * 86400;
break;
default:
minutes = value;
totalSeconds = value * 60;
}
// 定义时间单位(分钟)
const units = [
{ label: '年', minutes: 365 * 24 * 60 },
{ label: '月', minutes: 30 * 24 * 60 }, // 按30天简化计算
{ label: '天', minutes: 24 * 60 },
{ label: '小时', minutes: 60 },
{ label: '分', minutes: 1 }
];
let remaining = minutes;
const parts = [];
for (const unitObj of units) {
const val = Math.floor(remaining / unitObj.minutes);
if (val > 0) {
parts.push(`${val}${unitObj.label}`);
remaining %= unitObj.minutes;
}
}
// 处理剩余的秒数remaining 现在是小于1分钟的分钟数
if (remaining > 0) {
const seconds = Math.round(remaining * 60);
if (seconds > 0) {
parts.push(`${seconds}`);
}
}
// 如果没有任何部分,返回总秒数
if (parts.length === 0) {
return `${Math.floor(totalSeconds)}`;
}
return parts.join('');
},
regeo(lon, lat) {
return new Promise((resolve, reject) => {
let url =
'https://restapi.amap.com/v3/geocode/regeo?key=ca3af8a20d628897020893892bda5ae4&location=' +
lon + ',' + lat;
request({
url: url,
method: 'GET',
isAuthen: false
}).then(res => {
if (res) {
if (res.infocode == '10000' && res.info == 'OK') {
resolve(res);
return;
}
}
reject(res);
}).catch(ex => {
reject(ex);
});
});
}
}