临时保存,控制设备启动需要英文名

master
blak-kong 2 years ago
parent 372579d234
commit 3350094fd6

@ -629,6 +629,11 @@ class Index extends Component<any, any> {
// return; // return;
} }
async goIot() {
go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
// return;
}
//连接完成时数据的回调 //连接完成时数据的回调
offlineChange = async (e) => { offlineChange = async (e) => {
console.log("offlineChange", e); console.log("offlineChange", e);
@ -918,6 +923,7 @@ class Index extends Component<any, any> {
<View className="txt"></View> <View className="txt"></View>
</View> </View>
</View> </View>
<View style="overflow-x: auto;"> <View style="overflow-x: auto;">
<View className="device_list flex"> <View className="device_list flex">
{instrumentList.map((item, index) => { {instrumentList.map((item, index) => {
@ -967,6 +973,10 @@ class Index extends Component<any, any> {
)} )}
</View> </View>
<View style="margin: 20px">
<View onClick={this.goIot}></View>
</View>
<View className="infobox3"> <View className="infobox3">
<Swiper <Swiper
autoplay={true} autoplay={true}

@ -8,9 +8,16 @@ interface Props {
ModeList: any; ModeList: any;
ModeType: string; // all visor cabin yimeish ModeType: string; // all visor cabin yimeish
ActiveModeItem: any; ActiveModeItem: any;
isShowNurse: boolean; // 是否已进入护理详情页
onEmit: Function; // 每次点击item回调事件和数据给父组件 onEmit: Function; // 每次点击item回调事件和数据给父组件
} }
function Index({ ModeList, ModeType, ActiveModeItem, onEmit }: Props) { function Index({
ModeList,
ModeType,
isShowNurse,
ActiveModeItem,
onEmit,
}: Props) {
let VisorList = ModeList.filter((item) => item.modeClass === 1); // 面罩模式 let VisorList = ModeList.filter((item) => item.modeClass === 1); // 面罩模式
let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式 let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式
let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后 let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后
@ -41,7 +48,7 @@ function Index({ ModeList, ModeType, ActiveModeItem, onEmit }: Props) {
return ( return (
<Block> <Block>
<View className="mode-list-main"> <View className="mode-list-main">
{ModeList.length > 0 && ModeType !== "all" && ( {ModeList.length > 0 && isShowNurse && (
<View className="change-all-mode-btn"> <View className="change-all-mode-btn">
<View className="title"></View> <View className="title"></View>
<Image <Image

@ -49,6 +49,33 @@
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
} }
} }
.msg-tips {
position: absolute;
top: 50%;
left: 0;
right: 0;
transform: translateY(-50%);
display: flex;
align-items: center;
max-width: 635rpx;
margin: auto;
padding: 15rpx 34rpx;
background-color: rgba(0, 0, 0, 0.5);
box-sizing: border-box;
border-radius: 30rpx;
.msg-tips-img {
width: 30rpx;
height: 30rpx;
margin-right: 17rpx;
}
.msg-tips-content {
flex: 1;
max-width: 530rpx;
font-size: 28rpx;
color: #fff;
word-break: break-word;
}
}
} }
.mode-box { .mode-box {
// background-color: #fff; // background-color: #fff;

File diff suppressed because it is too large Load Diff

@ -69,10 +69,10 @@ export const Ajax = (params) => {
} }
if (res.data.code === 500) { if (res.data.code === 500) {
let msg = let msg = "系统异常,请联系管理人员";
typeof res.data.msg == "string" // typeof res.data.msg == "string"
? res.data.msg // ? res.data.msg
: "系统异常,请联系管理人员"; // : "系统异常,请联系管理人员";
if (msg == "请不要操作太快哦") { if (msg == "请不要操作太快哦") {
reject(res); reject(res);
return false; return false;

@ -5,19 +5,23 @@
*/ */
const isVideo = (path) => { const isVideo = (path) => {
return /\.(mp4|avi|wmv|mpg|mpeg|mov|rm|ram|swf|flv)/.test(path); return /\.(mp4|avi|wmv|mpg|mpeg|mov|rm|ram|swf|flv)/.test(path);
} };
/** /**
* @description 图片预览 * @description 图片预览
* @param url data-url="{url}" * @param url data-url="{url}"
*/ */
const previewImage = ({currentTarget: {dataset: { url }}}) => { const previewImage = ({
currentTarget: {
dataset: { url },
},
}) => {
if (!url) return; if (!url) return;
if (url.indexOf('http') === -1 || url.indexOf('https') === -1) { if (url.indexOf("http") === -1 || url.indexOf("https") === -1) {
url = 'https://oss.flossom.com' + url; url = "https://oss.flossom.com" + url;
} }
wx.previewImage({ wx.previewImage({
urls: [url] urls: [url],
}) });
}; };
const formatTime = (date) => { const formatTime = (date) => {
const year = date.getFullYear(); const year = date.getFullYear();
@ -62,16 +66,19 @@ const filertext = (text) => {
*/ */
const formatRichText = (html) => { const formatRichText = (html) => {
let newContent = html.replace(/<img[^>]*>/gi, (match) => { let newContent = html.replace(/<img[^>]*>/gi, (match) => {
match = match.replace(/style="[^"]+"/gi, '') match = match.replace(/style="[^"]+"/gi, "");
return match; return match;
}); });
newContent = newContent.replace(/style="[^"]+"/gi, (match) => { newContent = newContent.replace(/style="[^"]+"/gi, (match) => {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%!important;') match = match.replace(/width:[^;]+;/gi, "max-width:100%!important;");
return match; return match;
}); });
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%!important;height:auto!important;display:block;margin-top:0;margin-bottom:0;"'); newContent = newContent.replace(
/\<img/gi,
'<img style="max-width:100%!important;height:auto!important;display:block;margin-top:0;margin-bottom:0;"'
);
return newContent; return newContent;
} };
const date = () => { const date = () => {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
@ -87,7 +94,7 @@ const date = () => {
}; };
const getdates = (date) => { const getdates = (date) => {
date = date.replace(/-/g, '/'); // 部分iphone new Date不兼容[2023-01-01]格式,需要转换 date = date.replace(/-/g, "/"); // 部分iphone new Date不兼容[2023-01-01]格式,需要转换
const year = new Date(date).getFullYear(); const year = new Date(date).getFullYear();
const month = new Date(date).getMonth() + 1; const month = new Date(date).getMonth() + 1;
const day = new Date(date).getDate(); const day = new Date(date).getDate();
@ -285,6 +292,7 @@ const ccrc8 = (str) => {
return (crc & 0xff).toString(16).padStart("2", 0); return (crc & 0xff).toString(16).padStart("2", 0);
}; };
/** 秒数转分秒,返回分秒 */
const s_to_hs = (s) => { const s_to_hs = (s) => {
//计算分钟 //计算分钟
//算法将秒数除以60然后下舍入既得到分钟数 //算法将秒数除以60然后下舍入既得到分钟数
@ -302,6 +310,7 @@ const s_to_hs = (s) => {
return h + ":" + s; return h + ":" + s;
}; };
/** 秒数转分钟,只返回分钟 */
const s_to_h = (s) => { const s_to_h = (s) => {
//计算分钟 //计算分钟
//算法将秒数除以60然后下舍入既得到分钟数 //算法将秒数除以60然后下舍入既得到分钟数
@ -319,6 +328,7 @@ const s_to_h = (s) => {
return h; return h;
}; };
/** 秒数转分钟,只返回秒数 */
const s_to_s = (s) => { const s_to_s = (s) => {
//计算分钟 //计算分钟
//算法将秒数除以60然后下舍入既得到分钟数 //算法将秒数除以60然后下舍入既得到分钟数
@ -336,13 +346,13 @@ const s_to_s = (s) => {
return s; return s;
}; };
// 分秒转换成秒 /** 分秒转秒数,返回秒数 */
const minSecToS = (minSecStr) => { const minSecToS = (minSecStr) => {
if (!minSecStr) return 0; if (!minSecStr) return 0;
let strArr = minSecStr.split(":"); let strArr = minSecStr.split(":");
console.info(strArr, 'strArr') console.info(strArr, "strArr");
return strArr.length ? parseInt(strArr[0]) * 60 + parseInt(strArr[1]) : 0; return strArr.length ? parseInt(strArr[0]) * 60 + parseInt(strArr[1]) : 0;
} };
// 将字符串转换成ArrayBufer // 将字符串转换成ArrayBufer
const string2buffer = (str) => { const string2buffer = (str) => {
@ -409,9 +419,16 @@ const getUpgradeData = (info) => {
.padStart("4", 0); .padStart("4", 0);
let baohaodiwei = num.substring(2, 4); let baohaodiwei = num.substring(2, 4);
let baohaogaowei = num.substring(0, 2); let baohaogaowei = num.substring(0, 2);
let data = `dbf0ab01F7${info.length_low.padStart('2',0)}${info.length_high.padStart('2',0)}${info.bao_low.padStart('2',0)}${ let data = `dbf0ab01F7${info.length_low.padStart(
info.bao_high.padStart('2',0) "2",
}${baohaodiwei.padStart('2',0)}${baohaogaowei.padStart('2',0)}${ 0
)}${info.length_high.padStart("2", 0)}${info.bao_low.padStart(
"2",
0
)}${info.bao_high.padStart("2", 0)}${baohaodiwei.padStart(
"2",
0
)}${baohaogaowei.padStart("2", 0)}${
index == arr.length - 1 index == arr.length - 1
? (arr[index].i.length / 2).toString(16).padStart("2", 0) ? (arr[index].i.length / 2).toString(16).padStart("2", 0)
: "F0" : "F0"
@ -500,13 +517,12 @@ const getimpedanceList = () => {
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
arr.push({ arr.push({
num: 0, num: 0,
time: `00:${String(i).padStart('2',0)}` time: `00:${String(i).padStart("2", 0)}`,
}) });
} }
return arr; return arr;
}; };
/** /**
* 处理上报数据转换成对象 * 处理上报数据转换成对象
*/ */
@ -521,14 +537,19 @@ const getreportData = (str) =>{
data.position = hex2int(str.substring(14, 16)); //档位 data.position = hex2int(str.substring(14, 16)); //档位
//TOREAD 当模式为水份模式 //TOREAD 当模式为水份模式
if (data.mode == 6) { if (data.mode == 6) {
data.waterLevel = hex2int(str.substring(16,18)) data.waterLevel = hex2int(str.substring(16, 18));
data.waterPercent = hex2int(str.substring(18,20)) data.waterPercent = hex2int(str.substring(18, 20));
//模式为水份测试时 档位1~3对应 0x01测试成功 0x02: 测试中 0x03: 测试错误 //模式为水份测试时 档位1~3对应 0x01测试成功 0x02: 测试中 0x03: 测试错误
const testResultMap = ['TEST_UNKNOW_STATUS','TEST_SUCCESS','TEST_PROCESSING','TEST_FAIL']; const testResultMap = [
data.testResult = testResultMap[data.position]||'TEST_UNKNOW_STATUS' "TEST_UNKNOW_STATUS",
"TEST_SUCCESS",
"TEST_PROCESSING",
"TEST_FAIL",
];
data.testResult = testResultMap[data.position] || "TEST_UNKNOW_STATUS";
} }
return data; return data;
} };
/** /**
* height 高位 * height 高位
@ -548,30 +569,30 @@ const getreportData = (str) =>{
const DYNAMIC_BONES_OFFSETS = (height, low) => { const DYNAMIC_BONES_OFFSETS = (height, low) => {
let total = Number(low) + Number(height) * 256; let total = Number(low) + Number(height) * 256;
if (total <= 200) { if (total <= 200) {
return 1 return 1;
} }
if (total <= 280) { if (total <= 280) {
return 2 return 2;
} }
if (total <= 360) { if (total <= 360) {
return 3 return 3;
} }
if (total <= 440) { if (total <= 440) {
return 4 return 4;
} }
if (total <= 520) { if (total <= 520) {
return 5 return 5;
} }
if (total <= 600) { if (total <= 600) {
return 6 return 6;
} }
if (total <= 700) { if (total <= 700) {
return 7 return 7;
} }
if (total >= 701) { if (total >= 701) {
return 8 return 8;
}
} }
};
const getTimeCode = () => { const getTimeCode = () => {
let year = new Date().getFullYear(); let year = new Date().getFullYear();
@ -580,10 +601,20 @@ const getTimeCode = () =>{
let hour = String(new Date().getHours()).padStart("2", 0); let hour = String(new Date().getHours()).padStart("2", 0);
let points = String(new Date().getMinutes()).padStart("2", 0); let points = String(new Date().getMinutes()).padStart("2", 0);
let seconds = String(new Date().getSeconds()).padStart("2", 0); let seconds = String(new Date().getSeconds()).padStart("2", 0);
let value = `dbf0a0010b${Number(String(year).substring(0, 2)).toString(16)}${Number(String(year).substring(2, 4)).toString(16)}${Number(month).toString(16).padStart("2", 0)}${Number(day).toString(16).padStart("2", 0)}${Number(hour).toString(16).padStart("2", 0)}${Number(points).toString(16).padStart("2", 0)}${Number(seconds).toString(16).padStart("2", 0)}00000000`; let value = `dbf0a0010b${Number(String(year).substring(0, 2)).toString(
16
)}${Number(String(year).substring(2, 4)).toString(16)}${Number(month)
.toString(16)
.padStart("2", 0)}${Number(day).toString(16).padStart("2", 0)}${Number(hour)
.toString(16)
.padStart("2", 0)}${Number(points).toString(16).padStart("2", 0)}${Number(
seconds
)
.toString(16)
.padStart("2", 0)}00000000`;
value = `${value}${ccrc8(value)}de`; value = `${value}${ccrc8(value)}de`;
return value; return value;
} };
/** /**
* @param currentVersionNo * @param currentVersionNo
* @param latestVersionNo * @param latestVersionNo
@ -593,15 +624,16 @@ const isNeedToUpdate = (currentVersionNo,latestVersionNo)=>{
if (!currentVersionNo || !latestVersionNo) return false; if (!currentVersionNo || !latestVersionNo) return false;
let needToUpdate = false; let needToUpdate = false;
//硬件版本号相同 //硬件版本号相同
let sameHardwareNo = latestVersionNo.substring(0, 2) == currentVersionNo.substring(0, 2); let sameHardwareNo =
latestVersionNo.substring(0, 2) == currentVersionNo.substring(0, 2);
//软件版本号当前版本比最新版的旧 //软件版本号当前版本比最新版的旧
let latestValue = parseInt(latestVersionNo.substring(2, 6), 16); let latestValue = parseInt(latestVersionNo.substring(2, 6), 16);
let currentValue = parseInt(currentVersionNo.substring(2, 6), 16); let currentValue = parseInt(currentVersionNo.substring(2, 6), 16);
let solftwareNoNeedToUpdate = latestValue > currentValue; let solftwareNoNeedToUpdate = latestValue > currentValue;
needToUpdate = sameHardwareNo && solftwareNoNeedToUpdate needToUpdate = sameHardwareNo && solftwareNoNeedToUpdate;
return needToUpdate return needToUpdate;
} };
/** /**
* @param compareVersion * @param compareVersion
@ -609,29 +641,29 @@ const isNeedToUpdate = (currentVersionNo,latestVersionNo)=>{
*/ */
const compareVersion = (version) => { const compareVersion = (version) => {
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
let SDKVersion = systemInfo.SDKVersion.split('.'); let SDKVersion = systemInfo.SDKVersion.split(".");
version = version.split('.'); version = version.split(".");
const len = Math.max(SDKVersion.length, version.length) const len = Math.max(SDKVersion.length, version.length);
while (SDKVersion.length < len) { while (SDKVersion.length < len) {
SDKVersion.push('0') SDKVersion.push("0");
} }
while (version.length < len) { while (version.length < len) {
version.push('0') version.push("0");
} }
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
const num1 = parseInt(SDKVersion[i]) const num1 = parseInt(SDKVersion[i]);
const num2 = parseInt(version[i]) const num2 = parseInt(version[i]);
if (num1 > num2) { if (num1 > num2) {
return 1 return 1;
} else if (num1 < num2) { } else if (num1 < num2) {
return -1 return -1;
}
} }
return 0
} }
return 0;
};
/** /**
* @param checkSameKey * @param checkSameKey
@ -646,7 +678,7 @@ const checkSameKey = (array1, array2, key)=>{
} }
} }
return false; return false;
} };
module.exports = { module.exports = {
isVideo, isVideo,
@ -682,5 +714,5 @@ module.exports = {
getTimeCode, //同步时间指令 getTimeCode, //同步时间指令
isNeedToUpdate, isNeedToUpdate,
compareVersion, compareVersion,
checkSameKey checkSameKey,
}; };

Loading…
Cancel
Save