diff --git a/App.vue b/App.vue index 7988fae..5f1c716 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,7 @@ import upgrade from '@/utils/update.js'; // 延迟断开蓝牙:选择文件/录音等会触发 onHide,8 秒内返回则不断开 - const BLE_DISCONNECT_DELAY = 8000; + const BLE_DISCONNECT_DELAY = 30000; let _bleDisconnectTimer = null; export default { @@ -74,6 +74,9 @@ initOS(); } + + let system=uni.getSystemInfoSync(); + console.log("system=",system); // #endif }, onShow: function() { diff --git a/components/MsgBox/MsgBox.vue b/components/MsgBox/MsgBox.vue index 8cefd65..41f8d0c 100644 --- a/components/MsgBox/MsgBox.vue +++ b/components/MsgBox/MsgBox.vue @@ -130,12 +130,12 @@ return json; }, - //弹出预定好的三种弹窗 + //弹出预定好的四种弹窗 showMsg(msg, btnTxt, type, okCallback) { let cfg = { error: { - icoUrl: '/static/images/6155/DeviceDetail/uploadErr.png', + icoUrl: '/static/images/common/uploadErr.png', borderColor: "#e034344d", buttonBgColor: "#E03434" }, @@ -148,6 +148,10 @@ icoUrl: '/static/images/common/warning.png', borderColor: "#FFC84E", buttonBgColor: "#FFC84E", + }, + info:{ + borderColor: "#BBE600", + buttonBgColor: "#BBE600" } } diff --git a/components/ProParams/ProParams.vue b/components/ProParams/ProParams.vue new file mode 100644 index 0000000..11742ea --- /dev/null +++ b/components/ProParams/ProParams.vue @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/components/TextToHex/TextToHexV1.vue b/components/TextToHex/TextToHexV1.vue index d3237ad..36612d1 100644 --- a/components/TextToHex/TextToHexV1.vue +++ b/components/TextToHex/TextToHexV1.vue @@ -124,9 +124,10 @@ */ async drawAndGetPixels() { // 第一次调用时先预热画布(解决APP重新打开后第一次获取数据不完整的问题) - await this.warmupCanvas(); + // await this.warmupCanvas(); let convertCharToMatrix=function(imageData) { + debugger; // console.log("imgData=",imageData) let matrix = []; @@ -166,6 +167,7 @@ } let drawTxt=async (textLine)=> { + debugger; let result = {}; let ctx = this.ctx; @@ -226,7 +228,7 @@ let arr = []; // 循环处理每行文本 for (let i = 0; i < this.validTxts.length; i++) { - +debugger; let linePixls = []; let item = this.validTxts[i]; diff --git a/pages.json b/pages.json index 64d3058..9289587 100644 --- a/pages.json +++ b/pages.json @@ -429,7 +429,7 @@ { "path": "pages/common/addDevice/addBle", "style": { - "navigationBarTitleText": "蓝牙添加设备" + "navigationStyle": "custom" } }, { @@ -446,6 +446,19 @@ "navigationStyle": "custom", "fullscreen": true } + }, + { + "path" : "pages/008A/HBY008A", + "style" : + { + "navigationStyle": "custom" + } + }, + { + "path": "pages/100Y/HBY100Y", + "style": { + "navigationBarTitleText": "" + } } ], diff --git a/pages/008A/HBY008A.vue b/pages/008A/HBY008A.vue new file mode 100644 index 0000000..a6b2dd8 --- /dev/null +++ b/pages/008A/HBY008A.vue @@ -0,0 +1,1213 @@ + + + + + \ No newline at end of file diff --git a/pages/018A/HBY018A.vue b/pages/018A/HBY018A.vue index 36fa6c6..2c38b37 100644 --- a/pages/018A/HBY018A.vue +++ b/pages/018A/HBY018A.vue @@ -7,16 +7,17 @@ - + {{formData.sta_PowerPercent}}% 电量 - + - {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} + + {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} 设备状态 @@ -54,7 +55,7 @@ + @click="sosSetting(dic.sta_LightType[4],4)"> {{formData.sta_LedType==='led_alarm'?'报警中':'声光报警'}} 解除 @@ -72,7 +73,7 @@ @@ -92,47 +93,12 @@ - - - - - - - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - - - - - - - - + - + @@ -144,7 +110,15 @@ showLoading, hideLoading, updateLoading - } from '@/utils/loading.js' + } from '@/utils/loading.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' import request, { baseURL } from '@/utils/request.js' @@ -167,26 +141,7 @@ curr: 0, total: 0, pageHide: false, - Pop: { - showPop: false, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '您确定要这样做吗?', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '设备名称', - modelValue: '', - visibleClose: false, - okCallback: null, - buttonCancelText: '', - showCancel: false, - }, + usrToggle: false, }, @@ -340,7 +295,10 @@ these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.formData.sta_IntrusTime = 0; these.formData.sta_sosadd = ""; these.setBleFormData(); @@ -362,7 +320,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -401,7 +362,7 @@ these.setBleFormData(); }).catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,'',these); }); }, @@ -443,7 +404,7 @@ these.setBleFormData(); resolve(); }).catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,'',these); reject(ex); }); }); @@ -451,9 +412,9 @@ } if (item.key == 'led_alarm') { - this.showPop({ + showPop({ message: '确定开启声光报警?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -462,12 +423,12 @@ buttonText: "开启", showCancel: true, buttonCancelText: '取消' - }); + },these); } else { if (this.formData.sta_LedType == 'led_alarm') { - this.showPop({ + showPop({ message: '确定解除声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -482,7 +443,7 @@ showCancel: true, buttonCancelText: '取消' - }); + },these); } else { task(item.key); } @@ -559,7 +520,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -620,7 +582,7 @@ if (msg.length > 0) { - this.showMsg(msg.join(',')); + MsgError(msg.join(','),'',these); } these.setBleFormData(); @@ -655,9 +617,9 @@ }, showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -683,121 +645,16 @@ } }) } - }); - }, - - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); + },these); }, - closePop: function() { - this.Status.Pop.showPop = false; - if (this.Status.Pop.cancelCallback) { - this.Status.Pop.cancelCallback(); - } - }, - HidePop: function() { - if (this.Status.Pop.clickEvt == 'SendUsr') { - - } - - - this.Status.Pop.showPop = false; - if (this.Status.Pop.okCallback) { - this.Status.Pop.okCallback(); - } - }, - showPop: function(option) { - // hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } - - let keys = Object.keys(def); - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - this.Status.Pop[key] = option[key]; - } - } - - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, - showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; - let borderColor = "#e034344d"; - let buttonBgColor = "#E03434"; - if (isSucc) { - icoUrl = '/static/images/common/success.png'; - borderColor = "#BBE600"; - buttonBgColor = "#BBE600"; - } - this.showPop({ - message: msg, - iconUrl: icoUrl, - borderColor: borderColor, - buttonBgColor: buttonBgColor, - buttonText: '确定', - okCallback: null - }); - } + + + + } } @@ -1162,47 +1019,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue index 6b11d7e..2e11bab 100644 --- a/pages/100/HBY100.vue +++ b/pages/100/HBY100.vue @@ -10,7 +10,7 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -28,14 +28,14 @@ - + {{formData.sta_battery}}% 电量 - + {{formData.sta_system?dic.sta_system[formData.sta_system]:"" }} 设备状态 @@ -62,9 +62,9 @@ {{getbleStatu}} + 设备状态 + {{formData.sta_system?dic.sta_system[formData.sta_system]:"" }} + --> @@ -96,9 +96,10 @@ + v-for="item,index in dic.sta_VoiceType" :class="{'active':formData.sta_VoiceType===item.key, + 'displayNone' :!Status.usrToggle && index> + 3 + }"> {{item.name}} @@ -121,12 +122,12 @@ + :class="{'active':formData.sta_VoiceType==='8'}"> + src="/static/images/common/play.png" mode="aspectFit"> + src="/static/images/common/pauseActive.png" mode="aspectFit"> 播放语音 @@ -163,9 +164,9 @@ }" v-on:click.stop="lightTypeSet(item,index)"> + src="/static/images/100/light.png" mode="aspectFit"> + src="/static/images/100/lightActive.png" mode="aspectFit"> @@ -193,8 +194,8 @@ + activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde" + @change="onBrightnessChanged" @changing="onBrightnessChanging" class="custom-slider" /> @@ -205,8 +206,8 @@ + activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde" + @change="onFreqChanged" @changing="onFreqChanging" class="custom-slider" /> @@ -217,8 +218,8 @@ + activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde" + @change="onVolumeChanged" @changing="onVolumeChanging" class="custom-slider" /> @@ -228,45 +229,11 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + - - - - - + + @@ -279,7 +246,15 @@ showLoading, hideLoading, updateLoading - } from '@/utils/loading.js' + } from '@/utils/loading.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js'; import request, { baseURL } from '@/utils/request.js'; @@ -311,26 +286,7 @@ curr: 0, total: 0, pageHide: false, - Pop: { - showPop: false, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '您确定要这样做吗?', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '设备名称', - modelValue: '', - visibleClose: false, - okCallback: null, - buttonCancelText: '', - showCancel: false, - }, + BottomMenu: { show: false, showHeader: true, @@ -475,9 +431,9 @@ sta_system: { "0": '关机', - "1": '仅充电', - "2": '开机未充电', - "3": '开机且充电', + "1": '充电中',//仅充电 + "2": '未充电',//开机未充电 + "3": '充电中',//开机且充电 "": "" } @@ -520,7 +476,7 @@ this.$watch("formData.sta_battery", (newVal, oldVal) => { if (newVal <= 20 && this.formData.sta_system == 2) { - this.showMsg("设备电量低"); + MsgError("设备电量低",'',these); } }); @@ -582,6 +538,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); these.setBleFormData(); @@ -602,7 +559,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -656,14 +616,14 @@ audioManager() { if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } uni.navigateTo({ @@ -846,7 +806,7 @@ text: "握手成功,等待设备响应" }); }).catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,'',these); }); }, @@ -991,14 +951,14 @@ onFreqChanging(e){ if (!this.permissions.includes('51') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } let f = this.getDevice(); @@ -1043,14 +1003,14 @@ onFreqChanging(e){ if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -1083,14 +1043,14 @@ onFreqChanging(e){ this.formData.sta_VoiceType = val; these.setBleFormData(); }).catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,'',these); }); }, showUnWarn(val) { - this.showPop({ + showPop({ message: '确定解除声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -1102,20 +1062,20 @@ onFreqChanging(e){ showCancel: true, buttonCancelText: '取消' - }); + },these); }, sosSetting(item, isOk) { if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -1164,7 +1124,7 @@ onFreqChanging(e){ }) .catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,'',these); }); } @@ -1173,16 +1133,16 @@ onFreqChanging(e){ this.showUnWarn(0); } else { - this.showPop({ + showPop({ message: '确定开启强制报警?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: task, buttonText: "开启", showCancel: true, buttonCancelText: '取消' - }); + },these); } @@ -1371,6 +1331,7 @@ onFreqChanging(e){ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -1393,9 +1354,9 @@ onFreqChanging(e){ }, showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -1421,124 +1382,15 @@ onFreqChanging(e){ } }) } - }); + },these); }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + - closePop: function() { - this.Status.Pop.showPop = false; - - if (this.Status.Pop.cancelCallback) { - this.Status.Pop.cancelCallback(); - } - }, - HidePop: function() { - if (this.Status.Pop.clickEvt == 'SendUsr') { - - } - - - this.Status.Pop.showPop = false; - if (this.Status.Pop.okCallback) { - this.Status.Pop.okCallback(); - } - }, - showPop: function(option) { - // hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } - - let keys = Object.keys(def); - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - this.Status.Pop[key] = option[key]; - } - } - - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, - showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; - let borderColor = "#e034344d"; - let buttonBgColor = "#E03434"; - if (isSucc) { - icoUrl = '/static/images/common/success.png'; - borderColor = "#BBE600"; - buttonBgColor = "#BBE600"; - } - this.showPop({ - message: msg, - iconUrl: icoUrl, - borderColor: borderColor, - buttonBgColor: buttonBgColor, - buttonText: '确定', - okCallback: null - }); - }, - btnClick() { - - } + + } } @@ -1903,46 +1755,7 @@ onFreqChanging(e){ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index c21712f..ec3ff87 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -11,7 +11,7 @@ - + {{ deviceInfo.batteryPercentage }}% @@ -20,7 +20,7 @@ - + {{ Math.floor((Number(deviceInfo.batteryRemainingTime) || 0) / 60) }}小时 @@ -190,36 +190,9 @@ backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="onVolumeChanging" @changing="onVolumeChanging" class="custom-slider" /> - - 产品信息 - - - - - 产品参数 - - - - - 操作说明 - - - - - 操作视频 - - - - - + + @@ -231,7 +204,15 @@ showLoading, hideLoading, updateLoading - } from '@/utils/loading.js' + } from '@/utils/loading.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js'; import request, { baseURL } from '@/utils/request.js'; @@ -1460,29 +1441,7 @@ }, showBleUnConnect() {}, - proParam: function() { - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.deviceInfo.deviceId, - success(ev) {} - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.deviceInfo.deviceId, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.deviceInfo.deviceId, - success(ev) { - - } - }); - }, - + closePop: function() { this.Status.Pop.showPop = false; @@ -1547,6 +1506,7 @@ option.buttonBgColor = '#BBE600'; } these.Status.Pop.showPop = true; + showPop(option,this); }, btnClick() { @@ -1920,44 +1880,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { padding: 0px; diff --git a/pages/100J/audioManager/AudioList.vue b/pages/100J/audioManager/AudioList.vue index 83bc0e0..b42b353 100644 --- a/pages/100J/audioManager/AudioList.vue +++ b/pages/100J/audioManager/AudioList.vue @@ -698,7 +698,7 @@ these.Status.Pop.showPop = true; }, showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { diff --git a/pages/100J/audioManager/Recording.vue b/pages/100J/audioManager/Recording.vue index 3f59151..4640f90 100644 --- a/pages/100J/audioManager/Recording.vue +++ b/pages/100J/audioManager/Recording.vue @@ -1146,7 +1146,7 @@ if (okCallback === undefined) { okCallback = null; } - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { diff --git a/pages/100Y/HBY100Y.vue b/pages/100Y/HBY100Y.vue new file mode 100644 index 0000000..cf619a7 --- /dev/null +++ b/pages/100Y/HBY100Y.vue @@ -0,0 +1,1213 @@ + + + + + \ No newline at end of file diff --git a/pages/102/HBY102.vue b/pages/102/HBY102.vue index d7c368e..113d0ed 100644 --- a/pages/102/HBY102.vue +++ b/pages/102/HBY102.vue @@ -10,7 +10,7 @@ + v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -28,16 +28,17 @@ - + {{formData.sta_PowerPercent}}% 电量 - + - {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} + + {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} 设备状态 @@ -60,7 +61,7 @@ 蓝牙状态 - {{getbleStatu}} + {{getbleStatu}} 信道:{{formData.sta_Channel}} @@ -79,7 +80,7 @@ + @click="sosSetting(dic.sta_LightType[6],6)"> {{formData.sta_LedType==='led_alarm'?'报警中':'强制报警'}} 解除 @@ -97,7 +98,7 @@ @@ -125,7 +126,7 @@ {return v.group!=='sta_LedType'})" :class="{'active':formData[item.group]===item.key, 'marginLeft':index%2===1, 'displayNone':!item.show }" v-on:click.stop="actionSett(item,index)"> @@ -147,41 +148,19 @@ - - - - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - - - - + + :borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor" + :buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor" + :iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText" + @buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle" + v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText" + :showCancel="Status.Pop.showCancel" @cancelPop="closePop" :showSlot="Status.Pop.showSlot"> 修改信道 + placeholder-class="popup-prompt-input-placeHolder" v-model="formData.ins_Channel" /> @@ -194,6 +173,7 @@ + @@ -211,6 +191,14 @@ } from '@/utils/request.js' import Common from '@/utils/Common.js' + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' const pagePath = "/pages/102/HBY102"; var ble = null; @@ -502,6 +490,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); these.formData.sta_IntrusTime = 0; these.formData.sta_sosadd = ""; @@ -524,9 +513,12 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } - + this.getWarns(); // this.getLinkedCnt(); }, computed: { @@ -596,14 +588,14 @@ if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -673,7 +665,7 @@ } let warnKey = "102_" + these.device.id + "_warning"; - let linkKey = "102_" + these.device.id + "_linked"; + // let linkKey = "102_" + these.device.id + "_linked"; let p1 = new Promise((succ, err) => { uni.getStorage({ key: warnKey, @@ -690,33 +682,33 @@ }); }); - let p2 = new Promise((succ, err) => { - uni.getStorage({ - key: linkKey, - success(res) { - console.error("获取到联机数据", res); - let data = res.data; - let fs = data.filter(v => { - return !v.read - }); - console.error("未读联机数据", fs); - succ(fs); - }, - fail(ex) { - err(null); - } - }); - }); + // let p2 = new Promise((succ, err) => { + // uni.getStorage({ + // key: linkKey, + // success(res) { + // console.error("获取到联机数据", res); + // let data = res.data; + // let fs = data.filter(v => { + // return !v.read + // }); + // console.error("未读联机数据", fs); + // succ(fs); + // }, + // fail(ex) { + // err(null); + // } + // }); + // }); - Promise.allSettled([p1, p2]).then(results => { + Promise.allSettled([p1]).then(results => { let fs = []; if (results[0].status == 'fulfilled') { fs = fs.concat(results[0].value); } - if (results[1].status == 'fulfilled') { - fs = fs.concat(results[1].value); - } + // if (results[1].status == 'fulfilled') { + // fs = fs.concat(results[1].value); + // } console.error("获取到未读消息", fs); these.$set(these.Status.navbar.icons[0], "math", fs.length); }); @@ -772,14 +764,14 @@ if (!this.permissions.includes(item.permission) && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -840,9 +832,9 @@ if (val === 'E49_on') { - this.showPop({ + showPop({ message: '确定开启联机模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -852,7 +844,7 @@ showCancel: true, buttonCancelText: '取消' - }); + },these); } else { task(); } @@ -922,9 +914,9 @@ } if (val == 'status_off') { - this.showPop({ + showPop({ message: '确定关闭物体感应功能?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -934,7 +926,7 @@ showCancel: true, buttonCancelText: '取消' - }); + },these); } else { task(); } @@ -945,17 +937,16 @@ sosSetting(item, isOk) { - if (!this.permissions.includes('46') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -993,7 +984,7 @@ these.setBleFormData(); resolve(); }).catch(ex => { - this.showMsg(ex.msg); + MsgError(ex.msg,null,these); reject(ex); }); }); @@ -1001,9 +992,9 @@ } if (item.key == 'led_alarm') { - this.showPop({ + showPop({ message: '确定开启强制报警?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -1012,12 +1003,12 @@ buttonText: "开启", showCancel: true, buttonCancelText: '取消' - }); + },these); } else { if (this.formData.sta_LedType == 'led_alarm') { - this.showPop({ + showPop({ message: '确定解除声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: () => { @@ -1032,9 +1023,10 @@ showCancel: true, buttonCancelText: '取消' - }); + },these); } else { - task(item.key); + let newval=this.formData.sta_LedType===item.key?'led_off':item.key; + task(newval); } } @@ -1155,7 +1147,7 @@ this.Status.BottomMenu.activeIndex = active; let msg = []; - if (json.sta_PowerPercent <= 20 && (json.sta_charge === 0 || json.sta_charge === '0')) { + if (json.sta_PowerPercent <= 20 && json.sta_PowerPercent!=this.formData.sta_PowerPercent && (json.sta_charge === 0 || json.sta_charge === '0')) { msg.push("设备电量低"); } @@ -1201,7 +1193,7 @@ name: deviceName }); } - this.showMsg(msg.join(',')); + MsgError(msg.join(','),'',these); }); return; // clearInterval(instrusionTime); @@ -1221,7 +1213,7 @@ // this.formData.sta_IntrusTime = 0; } if (msg.length > 0) { - this.showMsg(msg.join(',')); + MsgError(msg.join(','),'',these); } @@ -1345,6 +1337,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -1366,9 +1359,9 @@ }, showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -1394,121 +1387,80 @@ } }) } - }); + },these); }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - - - + closePop: function() { - this.Status.Pop.showPop = false; + this.Status.Pop.showPop = false; - if (this.Status.Pop.cancelCallback) { - this.Status.Pop.cancelCallback(); - } - }, - HidePop: function() { - if (this.Status.Pop.clickEvt == 'SendUsr') { + if (this.Status.Pop.cancelCallback) { + this.Status.Pop.cancelCallback(); + } +}, +HidePop: function() { + if (this.Status.Pop.clickEvt == 'SendUsr') { - } + } - this.Status.Pop.showPop = false; - if (this.Status.Pop.okCallback) { - this.Status.Pop.okCallback(); - } - }, - showPop: function(option) { - // hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } + this.Status.Pop.showPop = false; + if (this.Status.Pop.okCallback) { + this.Status.Pop.okCallback(); + } +}, +showPop: function(option) { + hideLoading(this); + let def = { + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#BBE600', + textColor: '#ffffffde', + buttonBgColor: '#BBE600', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '确定', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: false, + okCallback: null, + showSlot: false, + buttonCancelText: '', + showCancel: false, + } - let keys = Object.keys(def); + let keys = Object.keys(def); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + if (key in option) { + continue; + } + this.Status.Pop[key] = def[key]; + } + if (option) { + keys = Object.keys(option); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; - this.Status.Pop[key] = option[key]; - } - } + this.Status.Pop[key] = option[key]; + } + } - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, - showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; - let borderColor = "#e034344d"; - let buttonBgColor = "#E03434"; - if (isSucc) { - icoUrl = '/static/images/common/success.png'; - borderColor = "#BBE600"; - buttonBgColor = "#BBE600"; - } - this.showPop({ - message: msg, - iconUrl: icoUrl, - borderColor: borderColor, - buttonBgColor: buttonBgColor, - buttonText: '确定', - okCallback: null - }); - } + if (!option.borderColor) { + option.borderColor = '#BBE600'; + option.buttonBgColor = '#BBE600'; + } + these.Status.Pop.showPop = true; +} + + + + } } @@ -1878,47 +1830,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; diff --git a/pages/210/HBY210.vue b/pages/210/HBY210.vue index 9e6f65f..9b725c6 100644 --- a/pages/210/HBY210.vue +++ b/pages/210/HBY210.vue @@ -18,14 +18,14 @@ - + {{deviceInfo.batteryPercentage}}% 电量 - + {{deviceInfo.batteryRemainingTime}}分钟 续航时间 @@ -127,23 +127,8 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + + @@ -780,25 +765,7 @@ }) } }, - // 操作说明 - operatingInst() { - uni.navigateTo({ - url: `/pages/common/operatingInstruct/index?id=${this.deviceID}` - }) - }, - // 产品参数 - productparams() { - uni.navigateTo({ - url: `/pages/common/productDes/index?id=${this.deviceID}` - }) - }, - // 操作视频 - operatingVideo() { - uni.navigateTo({ - url: `/pages/common/operationVideo/index?id=${this.deviceID}` - }) - }, // 发送人员信息 sendPersonnelInfo() { diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue index 9cd023d..71d7976 100644 --- a/pages/4877/BJQ4877.vue +++ b/pages/4877/BJQ4877.vue @@ -10,7 +10,7 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -26,19 +26,19 @@ - + {{formData.sta_PowerPercent}}% 电量 + + + {{formData.xuhang}} + 续航时间 + + --> @@ -72,17 +72,17 @@ + + + --> @@ -95,13 +95,13 @@ + :class="{active:formData.sta_SOSType===item.val,marginLeft:index%2==1}" + v-on:click.stop="sosSetting(item,index)"> + :src="item.img" mode="aspectFit"> + :src="item.activeImg" mode="aspectFit"> {{item['text']}} @@ -128,8 +128,8 @@ + :class="{active:item.id==formData.sta_GroupType,marginNoLeft:index%3===0}" + @click.stop="groupSetting(item,index)"> @@ -153,7 +153,7 @@ + :class="formData.sta_ArrowMode=='right_off'?'active':''"> @@ -164,13 +164,13 @@ 朝左 + :class="formData.sta_ArrowMode=='right_on'?'active':''"> + mode="aspectFit"> 朝右 @@ -185,7 +185,7 @@ + :class="formData.sta_ArrowType=='red_front'?'redactive':''"> 红色 @@ -194,7 +194,7 @@ + :class="formData.sta_ArrowType=='green_back'?'greenactive':''"> 绿色 @@ -217,7 +217,7 @@ + :class="formData.sta_ArrowType=='red_all'?'active':''"> @@ -228,13 +228,13 @@ 红色双向 + :class="formData.sta_ArrowType=='green_all'?'active':''"> + mode="aspectFit"> 绿色双向 @@ -243,45 +243,26 @@ - - - - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + + :borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor" + :buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor" + :iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText" + @buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle" + v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText" + :showCancel="Status.Pop.showCancel" @cancelPop="closePop" :showSlot="Status.Pop.showSlot"> 修改信道 + placeholder-class="popup-prompt-input-placeHolder" v-model="formData.sta_Channel" /> - + @@ -304,7 +285,14 @@ } from '@/api/4877/BJQ4877.js'; import MqTool from '@/utils/MqHelper.js' - + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' const pagePath = "/pages/4877/BJQ4877"; var ble = null; @@ -711,14 +699,14 @@ if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -749,7 +737,7 @@ cancelCallback: () => { this.Status.ShowEditChannel = false; } - }); + },these); }, onChannelChanging() { let regex = /^(0|([1-9]\d?)|1[01]\d|12[0-5])$/; @@ -792,14 +780,14 @@ if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -855,14 +843,14 @@ groupCheck() { if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } uni.navigateTo({ @@ -916,9 +904,9 @@ showUnWarn(val) { - // this.showPop({ + // showPop({ // message: '确定解除声光报警模式?', - // iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + // iconUrl: "/static/images/common/uploadErr.png", // borderColor: "#e034344d", // buttonBgColor: "#E03434", // okCallback: () => { @@ -938,14 +926,14 @@ if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -997,14 +985,14 @@ sosSetting(item, index) { if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } let f = this.getDevice(); @@ -1037,16 +1025,16 @@ let confirmTask = () => { - this.showPop({ + showPop({ message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: task, buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'), showCancel: true, buttonCancelText: '取消' - }); + },these); } if (item.val === 'sos') { confirmTask(); @@ -1258,9 +1246,9 @@ }, showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -1286,34 +1274,10 @@ } }) } - }); + },these); }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + @@ -1335,56 +1299,58 @@ this.Status.Pop.okCallback(); } }, - showPop: function(option) { - hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } + showPop: function (option) { + hideLoading(this); + let def = { + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#BBE600', + textColor: '#ffffffde', + buttonBgColor: '#BBE600', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '确定', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: false, + okCallback: null, + showSlot: false, + buttonCancelText: '', + showCancel: false, + } - let keys = Object.keys(def); + let keys = Object.keys(def); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + if (key in option) { + continue; + } + this.Status.Pop[key] = def[key]; + } + if (option) { + keys = Object.keys(option); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; - this.Status.Pop[key] = option[key]; - } - } + this.Status.Pop[key] = option[key]; + } + } - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, + if (!option.borderColor) { + option.borderColor = '#BBE600'; + option.buttonBgColor = '#BBE600'; + } + these.Status.Pop.showPop = true; + }, + + showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { @@ -1392,17 +1358,14 @@ borderColor = "#BBE600"; buttonBgColor = "#BBE600"; } - this.showPop({ + showPop({ message: msg, iconUrl: icoUrl, borderColor: borderColor, buttonBgColor: buttonBgColor, buttonText: '确定', okCallback: null - }); - }, - btnClick() { - + },this); } } } @@ -1768,46 +1731,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/4877/BJQ4877CheckColor.vue b/pages/4877/BJQ4877CheckColor.vue index c258f59..d1637b4 100644 --- a/pages/4877/BJQ4877CheckColor.vue +++ b/pages/4877/BJQ4877CheckColor.vue @@ -195,7 +195,7 @@ these.Status.Pop.showPop = true; }, showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { diff --git a/pages/4877/BJQ4877V1.vue b/pages/4877/BJQ4877V1.vue index 5e71f6e..894db34 100644 --- a/pages/4877/BJQ4877V1.vue +++ b/pages/4877/BJQ4877V1.vue @@ -7,14 +7,14 @@ - + {{formData.sta_PowerPercent}}% 电量 { @@ -562,7 +546,7 @@ import request, { baseURL } from '@/utils/request.js'; if (item.val === 'sos') { this.showPop({ message: '确定开启声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: task, @@ -760,7 +744,7 @@ import request, { baseURL } from '@/utils/request.js'; this.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -788,35 +772,7 @@ import request, { baseURL } from '@/utils/request.js'; } }); }, - - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - - - + closePop: function() { this.Status.Pop.showPop = false; @@ -884,7 +840,7 @@ import request, { baseURL } from '@/utils/request.js'; these.Status.Pop.showPop = true; }, showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { @@ -1268,46 +1224,7 @@ import request, { baseURL } from '@/utils/request.js'; text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/6075/BJQ6075.vue b/pages/6075/BJQ6075.vue index f609c34..5580e4c 100644 --- a/pages/6075/BJQ6075.vue +++ b/pages/6075/BJQ6075.vue @@ -18,14 +18,14 @@ - + {{deviceInfo.batteryPercentage}}% 电量 - + {{deviceInfo.batteryRemainingTime}}分钟 续航时间 diff --git a/pages/6075J/BJQ6075J.vue b/pages/6075J/BJQ6075J.vue index 6864f48..23e169c 100644 --- a/pages/6075J/BJQ6075J.vue +++ b/pages/6075J/BJQ6075J.vue @@ -23,29 +23,29 @@ - + {{formData.sta_PowerPercent}}% 电量 - + - {{battery}} + {{formData.sta_PowerTime}} 续航时间 - - {{formData.sta_ShakeBit==1?'设备疑似受到外力碰撞':'设备声光报警中'}}! + + {{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}! - - + + @@ -76,7 +76,10 @@ 设备状态 {{sta_system}} - + + 环境温度 + {{formData.sta_Heat}} + 定位信息 @@ -108,7 +111,7 @@ 海拔高度 - {{formData.sta_height}}m + {{formData.sta_Height}}m 相对高度 @@ -150,23 +153,23 @@ {{FuLight}} - + - - 激光模式 - + - - @@ -236,30 +239,14 @@ - - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + @@ -296,19 +283,19 @@ var eventChannel = null; var these = null; var ble = null; - var rec = null; + var recei = null; var mq = null; var pagePath = "pages/6075J/BJQ6075J"; var brightnessTimer = null; export default { components: { TextToHexV1 - }, + }, data() { return { Status: { - - + + pageHide: false, apiType: "listA", navbar: { @@ -325,7 +312,7 @@ height: 90 }, usrToggle: true, - + }, formData: { img: '/static/images/common/BJQ6075.png', @@ -334,7 +321,7 @@ sta_imei: "", //sta_imei sta_longitude: "", //经度 sta_latitude: "", //纬度 - address:'', + address: '', textLines: [], company: "湖北星汉文化", //单位 @@ -348,19 +335,20 @@ bleStatu: false, sta_LightGrade: "", //主灯档位 - sta_LightGrade: "", //副灯档位 - sta_ShakeBit: "1", //报警状态 + sta_Side_Light: "", //副灯档位 + sta_ShakeBit: 0, //报警状态 sta_4gSinal: "", //4G信号强度 sta_laser: "", //激光状态 sta_brightness: 100, //亮度 sta_SOSGrade: "1", //强制报警状态 - - showSosGrade:false, - showShakeBit:false, - sta_height:'',//海拔 - sta_releaHeight:'', - sta_BreakNews:'', - deviceId:'' + + + + sta_Height: '', //海拔 + sta_Heat: '', //温度 + sta_releaHeight: '', + sta_BreakNews: '', + deviceId: '' }, device: { id: "", @@ -412,12 +400,12 @@ staPowerPercent: null, staDetectResult: null }, - inteval:50 + inteval: 80 } }, computed: { getbleStatu() { - + if (this.formData.bleStatu === true) { return '已连接'; } @@ -449,20 +437,24 @@ } return state; }, - battery(){ - let hours = Math.floor(this.formData.sta_PowerTime / 60); - let remainingMinutes = this.formData.sta_PowerTime % 60; - - let xuhang = '0分'; - // 处理不同情况的显示 - if (hours === 0) { - xuhang = `${remainingMinutes}分`; - } else if (remainingMinutes === 0) { - xuhang = `${hours}小时`; - } else { - xuhang = `${hours}小时${remainingMinutes}分`; + + heatStyle() { + if (this.formData.sta_Heat < 0) { + return 'hanleng'; } - return xuhang; + if (this.formData.sta_Heat >= 0 && this.formData.sta_Heat <= 30) { + return 'green'; + } + if (this.formData.sta_Heat > 30 && this.formData.sta_Heat <= 40) { + return 're' + } + if (this.formData.sta_Heat > 40 && this.formData.sta_Heat <= 60) { + return 'yanRe' + } + if (this.formData.sta_Heat > 60) { + return 'kuRe' + } + return ''; } }, created() { @@ -486,15 +478,18 @@ }, onShow() { this.Status.pageHide = false; - - let f=this.getDevice(); - if(f){ - these.formData.bleStatu = 'connecting'; - ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { - console.log("连接成功") - these.formData.bleStatu = true; - }); - } + + let f = this.getDevice(); + if (f) { + these.formData.bleStatu = 'connecting'; + ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { + console.log("连接成功") + these.formData.bleStatu = true; + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; + } }, onHide: function() { this.Status.pageHide = true; @@ -506,10 +501,10 @@ this.initActionData(); this.initWatch(); - - rec = BleReceive.getBleReceive(); + + recei = BleReceive.getBleReceive(); ble = BleTool.getBleTool(); @@ -561,16 +556,19 @@ these.formData.bleStatu = 'connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; }); }, methods: { getDetail() { - + api.getDetail(this.device.id).then(res => { - + if (res && res.code == 200) { res = res.data; let json = res; @@ -586,53 +584,41 @@ this.formData.job = personnelInfo.position; this.formData.usrid = personnelInfo.code } - - - + this.formData.sta_PowerPercent = json.staPowerPercent - - - - - this.formData.sta_PowerTime = json.staPowerTime; - - - this.formData.sta_SOSGrade = json.staSOSGrade; - - } }); }, - initWatch(){ - this.$watch("formData.sta_SOSGrade", (newVal, oldVal) => { - console.log("报警状态发生变化"); - if (newVal == 1) { - this.formData.showSosGrade = true; + initWatch() { + + this.$watch("formData.sta_Heat", (newVal, oldVal) => { + if (newVal) { + if (newVal < -30) { + MsgError("危险:环境温度过低,当前温度" + newVal + ",请立即撤离", "确定"); + } + if (newVal >= 40 && newVal < 60) { + MsgWarning("注意:环境温度过高,当前温度" + newVal, "确定"); + } else if (newVal >= 60 && newVal < 80) { + MsgWarning("警告:环境温度过高,当前温度" + newVal + ",注意停留时间", "确定"); + } else if (newVal >= 80) { + MsgError("危险:环境温度过高,当前温度" + newVal + ",请立即撤离", "确定"); + } } }); - - this.$watch("formData.sta_ShakeBit", (newVal, oldVal) => { - console.log("碰撞状态发生变化"); - if (newVal != 0) { - this.formData.showShakeBit = true; + + this.$watch("formData.sta_BreakNews", (newVal, oldVal) => { + if (newVal) { + MsgSuccess("用户已确认收到紧急通知", "确定", these); + setTimeout(() => { + these.formData.sta_BreakNews = ""; + }, 10); } }); - - - - this.$watch("formData.sta_BreakNews",(newVal,oldVal)=>{ - if(newVal){ - MsgSuccess("用户已确认收到紧急通知","确定",these); - setTimeout(()=>{ - these.formData.sta_BreakNews=""; - },10); - } - }); - + this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => { console.log("电量发生变化"); - if (newVal <=20 && this.formData.sta_system===2 || this.formData.sta_system===0) { + if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) { //电量在20%及以及下,且是未充电状态提醒 showPop({ message: "设备电量低于20%,请充电", @@ -642,13 +628,13 @@ buttonTextColor: '#232323de', showCancel: false, showHeader: false, - visibleClose: true, + visibleClose: true, textColor: '#E03434', - iconUrl:'/static/images/common/path.png' - },this); + iconUrl: '/static/images/common/path.png' + }, this); } }); - + }, checkSendVideo() { @@ -778,7 +764,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "确定", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png" + iconUrl: "/static/images/common/uploadErr.png" }, these); reject(err); these.videoHexArray = null; @@ -868,7 +854,7 @@ if (arr[0].status == 'rejected') { showPop({ message: "设备准备未就绪", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -895,7 +881,7 @@ showPop({ message: "与服务器连接出现异常,请检查网络设置", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -906,7 +892,7 @@ hideLoading(these); showPop({ message: "出现异常," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -978,7 +964,7 @@ err = err.join(";"); showPop({ message: err, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -1004,43 +990,44 @@ } let f = this.getDevice(); - - + + var sendImagePackets = function(ReSendNo) { - + return new Promise((resolve, reject) => { - + // 总数据包数 let totalPackets = 52; let currentPacket = 1; - + if (ReSendNo) { totalPackets = ReSendNo; currentPacket = ReSendNo; } - + if (f) { // 发送单个数据包 const sendNextPacket = () => { if (currentPacket > totalPackets) { hideLoading(these); these.closeAction(); - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/common/success.png", }); - - setTimeout(()=>{ - ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f - .wirteCharactId); - },1000); - + + setTimeout(() => { + ble.sendString(f.deviceId, "transmit complete", f + .writeServiceId, f + .wirteCharactId); + }, 1000); + these.rgb565Data = null; resolve(); return; } - + // 计算当前包的数据 let packetSize = 250; // if (currentPacket <= 51) { @@ -1048,7 +1035,7 @@ // } else { // packetSize = 50; // 最后一个包100字节 // } - + // 创建数据包 const startIndex = (currentPacket - 1) * packetSize; const endIndex = Math.min(startIndex + packetSize, these.rgb565Data @@ -1062,47 +1049,37 @@ const bufferSize = 505; // 5 + packetData.length * 2; // 头部5字节 + 数据部分 const buffer = new ArrayBuffer(bufferSize); const dataView = new DataView(buffer); - + // 填充头部 dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(1, 0x02); // 帧类型:开机画面 dataView.setUint8(2, '0x' + currentPacket.toString(16).padStart(2, '0')); // 包序号 - - - if (packetData.length == 250) { - dataView.setUint8(3, 0x01); - dataView.setUint8(4, 0xF4); - } else { - dataView.setUint8(3, 0x00); - dataView.setUint8(4, 0x64); - } - + + + dataView.setUint16(3, packetData.length*2,false); // 包t长度 + // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序 } - - if (currentPacket > 51) { //第52包补FF - for (var i = 105; i < bufferSize; i++) { - dataView.setUint8(i, 0xFF); - } - } - - - + + + + + //发送数据包 ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10) .then(() => { - - + + updateLoading(these, { text: "正在发送:" + currentPacket + "/" + totalPackets }) currentPacket++; - + setTimeout(sendNextPacket, these.inteval); }).catch(err => { console.log("发送数据包失败了" + JSON.stringify(err)); @@ -1111,9 +1088,9 @@ return; } these.closeAction(); - these.showPop({ + showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1122,7 +1099,7 @@ reject(err); }); } - + if (ReSendNo) { sendNextPacket(ReSendNo); return; @@ -1131,12 +1108,12 @@ ble.sendString(f.deviceId, "picture transmit start", f.writeServiceId, f.wirteCharactId).then(() => { setTimeout(sendNextPacket, 120); - + }).catch((err) => { console.log("握手没有成功"); - these.showPop({ + showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1164,10 +1141,10 @@ these.rgb565Data = Common.convertToRGB565(data.piexls); - + setTimeout(function() { sendImagePackets().catch(() => { - + }); }, 0) @@ -1205,7 +1182,7 @@ ins_brightness: e.detail.value } - this.sendData(json, null, 'string').then(res=>{ + this.sendData(json, null, 'string').then(res => { this.setBleFormData(); }).catch(ex => { @@ -1220,18 +1197,18 @@ }, getLightMode(type) { let item = null; - let index = null; + let value = null; if (type === 'main') { - index = 0; + value = this.formData.sta_LightGrade; item = this.dic.actionSheets[0]; } else { - index = 1; + value = this.formData.sta_Side_Light; item = this.dic.actionSheets[1]; } let f = item.menuItems.find(v => { - if (v.value == this.dic.actionSheets[index].value) { + if (v.value == value) { return true; } }); @@ -1286,37 +1263,37 @@ item.menuItems = [{ text: '强光', icon: '/static/images/lightImg/qiang.png', - value: '1', + value: 1, key: 'ins_LightGrade' }, { text: '工作光', icon: '/static/images/lightImg/work.png', - value: '2', + value: 2, key: 'ins_LightGrade' }, { text: '节能光', icon: '/static/images/lightImg/jieN.png', - value: '3', + value: 3, key: 'ins_LightGrade' }, { text: '爆闪', icon: '/static/images/lightImg/shan.png', - value: '4', + value: 4, key: 'ins_LightGrade' }, { text: 'SOS', icon: '/static/images/lightImg/sos.png', - value: '5', + value: 5, key: 'ins_LightGrade' }, { text: '关闭', icon: '/static/images/lightImg/closeLight.png', - value: '6', + value: 6, key: 'ins_LightGrade' } ]; @@ -1329,31 +1306,31 @@ item1.menuItems = [{ text: '泛光', icon: '/static/images/lightImg/fan.png', - value: '2', + value: 2, key: 'ins_Side_Light' }, { text: '泛光爆闪', icon: '/static/images/lightImg/fan.png', - value: '3', + value: 3, key: 'ins_Side_Light' }, { text: '警示灯', icon: '/static/images/lightImg/warn.png', - value: '1', + value: 1, key: 'ins_Side_Light' }, { text: '警示灯/泛光', icon: '/static/images/lightImg/warn.png', - value: '4', + value: 4, key: 'ins_Side_Light' }, { text: '关闭', icon: '/static/images/lightImg/closeLight.png', - value: '5', + value: 5, key: 'ins_Side_Light' } ]; @@ -1418,13 +1395,16 @@ this.dic.actionSheets = [item, item1, item3]; }, SOSToggle() { + debugger; if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { MsgError('无操作权限', '确定', these); return; } let val = 1; - if (this.formData.sta_ShakeBit === 1) { + if (this.formData.sta_ShakeBit == 3) { + val = 0; + } else if (this.formData.sta_ShakeBit == 1) { val = 0; } @@ -1438,22 +1418,22 @@ console.error("出现错误", ex) }); } - let msg=val==1?'确定开启声光报警':'确定关闭声光报警'; - - showPop({ - message: msg, - iconUrl: "/static/images/670/sgActive.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - buttonText: '确定', - buttonTextColor: '#232323de', - showCancel: true, - buttonCancelText: '取消', - okCallback: send - }, these); - - - + let msg = val == 1 ? '确定开启声光报警' : '确定关闭声光报警'; + + showPop({ + message: msg, + iconUrl: "/static/images/670/sgActive.png", + borderColor: "#e034344d", + buttonBgColor: "#E03434", + buttonText: '确定', + buttonTextColor: '#232323de', + showCancel: true, + buttonCancelText: '取消', + okCallback: send + }, these); + + + }, laserToggle() { if (!this.permissions.includes('2') && this.Status.apiType !== 'listA') { @@ -1508,6 +1488,7 @@ let key = li.key.replace(/ins_/g, 'sta_'); this.formData[key] = li.value; this.setBleFormData(); + this.formData.sta_brightness = 100; }).catch((ex) => { console.error("出现错误", ex) }); @@ -1674,11 +1655,14 @@ }, 0); }, sendMsg() { + debugger; if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { MsgError('无操作权限', '确定', these); return; } + + this.formData.sendMsg.padStart(16, ' '); this.formData.textLines = [this.formData.sendMsg.slice(0, 8), this.formData.sendMsg.slice(8, 16)]; @@ -1907,11 +1891,13 @@ }, getDevice: function() { - console.log("LinkedList=", ble.data.LinkedList); - console.log("this.device=", this.device); + // console.log("LinkedList=", ble.data.LinkedList); + // console.log("this.device=", this.device); let f = ble.data.LinkedList.find((v) => { - if(v.macAddress == these.device.deviceMac){ - if(!this.formData.deviceId){this.formData.deviceId=v.deviceId}; + if (v.macAddress == these.device.deviceMac) { + if (!this.formData.deviceId) { + this.formData.deviceId = v.deviceId + }; return true; } }); @@ -1922,7 +1908,7 @@ showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -1987,10 +1973,17 @@ keys.forEach(key => { this.formData[key] = data[key]; }); + + this.$set(this.dic.actionSheets[0], 'value', this.formData.sta_LightGrade); + this.$set(this.dic.actionSheets[1], 'value', this.formData.sta_Side_Light); + this.setBleFormData(); }, - + setBleFormData() { + if (!ble) { + return; + } let f = ble.data.LinkedList.find((v) => { if (v.deviceId == these.formData.deviceId) { v.formData = these.formData; @@ -2071,18 +2064,46 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); }, 1000); }); + }, + bleStatuToggle() { + let f = this.getDevice(); + if (!f) { + this.showBleUnConnect(); + return; + } + if (this.formData.bleStatu === true) { + this.formData.bleStatu = 'dicconnect'; + ble.disconnectDevice(f.deviceId).finally(r => { + this.formData.bleStatu = false; + }); + return; + } + + if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') { + this.formData.bleStatu = 'connecting'; + ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { + these.formData.bleStatu = true; + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + }); + return; + } + + }, gotoMap() { let promise = lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude); promise.then(lnglat => { - + this.detailData.longitude = lnglat[0]; this.detailData.latitude = lnglat[1]; uni.navigateTo({ @@ -2097,20 +2118,9 @@ } }) }); + + }, - }, - proDetail: function(pgetpe) { - - - let url = '/pages/common/' + pgetpe + '/index?id=' + (this.device.id ? this.device.id : 0); - - uni.navigateTo({ - url: url, - fail(ex) { - console.error(ex); - } - }); - }, prevPage() { uni.navigateBack({ @@ -2515,47 +2525,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; @@ -2914,4 +2884,20 @@ text-indent: 10rpx; display: inline-block; } + + .hanleng { + color: #66CCFF; + } + + .re { + color: #FFB74D + } + + .yanRe { + color: #F57C00; + } + + .kuRe { + color: #B71C1C; + } \ No newline at end of file diff --git a/pages/6107/BJQ6107.vue b/pages/6107/BJQ6107.vue index 4735442..840d484 100644 --- a/pages/6107/BJQ6107.vue +++ b/pages/6107/BJQ6107.vue @@ -7,16 +7,17 @@ - + {{formData.sta_PowerPercent}}% 电量 - + - {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} + + {{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} 设备状态 @@ -74,12 +75,12 @@ + :class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}"> 强光 + :class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}"> 工作光 @@ -93,7 +94,7 @@ + mode="aspectFit"> @@ -114,9 +115,9 @@ + mode="aspectFit"> + src="/static/images/common/playingActive.png" mode="aspectFit"> {{formData.isPlay?'正在播放':'播放语音'}} @@ -183,36 +184,14 @@ - - - - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - - - - + + :borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor" + :buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message" + :buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt" + :promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)" + :buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" /> @@ -226,7 +205,7 @@ + color="#FFFFFFde"> @@ -239,8 +218,8 @@ + backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange" + @changing="volumechange" class="custom-slider" /> @@ -248,7 +227,7 @@ - + @@ -265,7 +244,16 @@ baseURL } from '@/utils/request.js' - import Common from '@/utils/Common.js' + import Common from '@/utils/Common.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' + const pagePath = "/pages/018A/HBY018A"; var ble = null; @@ -419,7 +407,10 @@ these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.setBleFormData(); @@ -439,7 +430,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -551,7 +545,7 @@ this.closePop(item); } if (msg) { - this.showPop({ + showPop({ key: Common.guid(), message: msg, iconUrl: "/static/images/common/playingActive.png", @@ -561,7 +555,7 @@ buttonText: '确定', buttonCancelText: '取消', showCancel: true - }); + },these); } else { exec(); } @@ -667,17 +661,17 @@ // },500) } - this.showPop({ + showPop({ key: key, message: msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: sosToggle, buttonText: '确定', buttonCancelText: '取消', showCancel: true - }); + },these); }, deviceRecovry(res) { @@ -742,7 +736,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -838,10 +833,10 @@ }, showBleUnConnect() { - this.showPop({ + showPop({ key: Common.guid(), message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -867,34 +862,10 @@ } }) } - }); + },these); }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + //关闭某个弹窗,并执行关闭的回调函数 @@ -918,63 +889,12 @@ } }, - //根据传入的配置,自定义一个弹窗 - showPop: function(option) { - let def = { - key: '', - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - cancelCallback: null - } - let json = {}; - let keys = Object.keys(def); - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - json[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - json[key] = option[key]; - } - } - - if (!json.borderColor) { - json.borderColor = '#BBE600'; - json.buttonBgColor = '#BBE600'; - } - json.showPop = true; - if (!('key' in json)) { - json.key = Common.guid(); - } - this.Msgboxs.push(json); - }, + showMsg(msg, type) { let cfg = { error: { - icoUrl: '/static/images/6155/DeviceDetail/uploadErr.png', + icoUrl: '/static/images/common/uploadErr.png', borderColor: "#e034344d", buttonBgColor: "#E03434" }, @@ -1008,7 +928,7 @@ buttonText: '确定', okCallback: this.closePop }; - this.showPop(options); + showPop(options,these); } } } @@ -1487,46 +1407,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/6155/BJQ6155.vue b/pages/6155/BJQ6155.vue index c4f0b0f..d0a89a1 100644 --- a/pages/6155/BJQ6155.vue +++ b/pages/6155/BJQ6155.vue @@ -10,7 +10,7 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -28,14 +28,14 @@ - + {{formData.battary}}% 电量 - + {{formData.xuhang}} 续航时间 @@ -74,8 +74,8 @@ + backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange" @changing="sliderChanging" + class="custom-slider" /> @@ -124,55 +124,33 @@ 发送 + :color="'#000000'" :fontSize="16" /> 单位: + placeholder-class="usrplace" /> 部门: + placeholder-class="usrplace" /> 姓名: + placeholder-class="usrplace" /> - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + - - + + @btnClick="btnClick"> @@ -182,6 +160,7 @@ + @@ -201,6 +180,14 @@ } from '@/utils/request.js'; var pagePath = "/pages/6155/BJQ6155"; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' var ble = null; var these = null; @@ -413,7 +400,10 @@ these.formData.bleStatu = 'connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.setBleFormData(); these.getDetail(); @@ -433,7 +423,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, onBackPress(e) { @@ -480,6 +473,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -640,7 +634,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + MsgError("连接错误:" + ex.msg, "确定", these); }).finally(() => { setTimeout(() => { hideLoading(these); @@ -698,42 +693,18 @@ if (this.formData.battary <= 20) { this.showPop({ message: "设备电量低", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); } }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + showBleUnConnect() { this.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -769,11 +740,11 @@ return; } let os = plus.os.name; + // 分包发送图片数据 var sendImagePackets = function(ReSendNo) { return new Promise((resolve, reject) => { - // 总数据包数 let totalPackets = os=='Android'?52:200; let currentPacket = 1; @@ -808,11 +779,7 @@ // 计算当前包的数据 let packetSize = os == 'Android' ? 250 : 64; - // if (currentPacket <= 51) { - // packetSize = 250; // 前51个包每个500字节 - // } else { - // packetSize = 50; // 最后一个包100字节 - // } + // 创建数据包 let startIndex = (currentPacket - 1) * packetSize; @@ -824,7 +791,7 @@ let packetData = these.rgb565Data.slice(startIndex, endIndex); // 构建数据包 - let bufferSize = os ==packetSize.length*2+5; // 5 + packetData.length * 2; // 头部5字节 + 数据部分 + let bufferSize = packetData.length * 2+5; // 头部5字节 + 数据部分 let buffer = new ArrayBuffer(bufferSize); let dataView = new DataView(buffer); @@ -833,12 +800,12 @@ dataView.setUint8(1, 0x02); // 帧类型:开机画面 dataView.setUint8(2, currentPacket); // 包序号 dataView.setUint16(3, packetData.length*2,false); - + // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序 } - + //发送数据包 ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(() => { @@ -860,7 +827,7 @@ these.Status.BottomMenu.show = false; these.showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -883,7 +850,7 @@ console.log("握手没有成功"); these.showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -911,8 +878,9 @@ console.log("data=", data); these.Status.BottomMenu.show = false; these.rgb565Data = Common.convertToRGB565(data.piexls); - +console.log("1111111111") setTimeout(function() { + console.log("1111111111") sendImagePackets().catch(() => { }); @@ -939,7 +907,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1072,7 +1040,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "确定", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png" + iconUrl: "/static/images/common/uploadErr.png" }); reject(err); these.videoHexArray = null; @@ -1162,7 +1130,7 @@ if (arr[0].status == 'rejected') { these.showPop({ message: "设备准备未就绪", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1189,7 +1157,7 @@ these.showPop({ message: "与服务器连接出现异常,请检查网络设置", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1200,7 +1168,7 @@ hideLoading(these); these.showPop({ message: "出现异常," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1273,7 +1241,7 @@ err = err.join(";"); these.showPop({ message: err, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1297,7 +1265,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1353,7 +1321,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1437,7 +1405,7 @@ }).catch((ex) => { these.showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1540,13 +1508,14 @@ option.buttonBgColor = '#BBE600'; } these.Status.Pop.showPop = true; + showPop(option, these); }, sendUsr() { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1585,7 +1554,7 @@ if (err) { this.showPop({ message: "单位、部门、姓名必须填写且最多8字", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1706,7 +1675,7 @@ hideLoading(these); these.showPop({ message: "发送失败: " + (err.msg || err.message), - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1723,7 +1692,7 @@ hideLoading(these); this.showPop({ message: "发送失败: " + (ex.msg || ex.message), - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1793,7 +1762,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -2217,47 +2186,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: "PingFang SC"; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index 0d33723..5071785 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -11,7 +11,7 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -29,14 +29,14 @@ - + {{formData.battary}}% 电量 - + {{formData.xuhang}} 续航时间 @@ -75,8 +75,8 @@ + backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange" + @changing="sliderChange" class="custom-slider" /> @@ -125,55 +125,33 @@ 发送 + :color="'#000000'" :fontSize="14" /> 单位: + placeholder-class="usrplace" /> 部门: + placeholder-class="usrplace" /> 姓名: + placeholder-class="usrplace" /> - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + - - + + @btnClick="btnClick"> @@ -183,6 +161,7 @@ + @@ -202,6 +181,14 @@ } from '@/utils/request.js'; var pagePath = "/pages/6155/deviceDetail"; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' var ble = null; var these = null; @@ -383,7 +370,10 @@ these.formData.bleStatu = 'connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + }); these.setBleFormData(); these.getDetail(); @@ -403,7 +393,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, onBackPress(e) { @@ -450,6 +443,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -621,7 +615,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -678,42 +673,18 @@ if (this.formData.battary <= 20) { this.showPop({ message: "设备电量低", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); } }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + showBleUnConnect() { this.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -913,7 +884,7 @@ these.Status.BottomMenu.show = false; these.showPop({ message: "发送数据包失败了" + err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -972,7 +943,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1285,7 +1256,7 @@ err = err.join(";"); these.showPop({ message: err, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1362,7 +1333,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1442,7 +1413,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1522,7 +1493,7 @@ }).catch((ex) => { these.showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1625,6 +1596,7 @@ option.buttonBgColor = '#BBE600'; } these.Status.Pop.showPop = true; + showPop(option,this); }, sendUsr() { @@ -1632,7 +1604,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1658,7 +1630,7 @@ if (err) { this.showPop({ message: "单位、部门、姓名必须填写且最多7字", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1756,7 +1728,7 @@ hideLoading(these); this.showPop({ message: "发送失败: " + (ex.msg || ex.message), - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1798,7 +1770,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -2192,46 +2164,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: "PingFang SC"; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 3552f41..04b3c39 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -16,7 +16,7 @@ - + @@ -29,7 +29,7 @@ - + {{ deviceInfo.batteryRemainingTime || '0' }}分钟 续航时间 @@ -54,7 +54,7 @@ 蓝牙状态 - + {{getbleStatu}} @@ -115,6 +115,17 @@ + + + + + + + {{itemInfo.alarmStatus==1?'解除报警':'强制报警'}} + + + + @@ -130,7 +141,7 @@ + :color="'#000000'" :fontSize="14" :returnType="10" /> 人员信息登记 @@ -175,23 +186,8 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + + @@ -273,9 +269,16 @@ - + + + + + @@ -405,7 +408,7 @@ Status: { pageHide: null }, - inteval: 120 + inteval: 200 } }, computed: { @@ -453,6 +456,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:"+ex.msg,"确定",these); }); return; } @@ -461,8 +465,7 @@ }, getDevice: function() { if (ble) { - console.log("LinkedList=", ble.data.LinkedList); - console.log("this.device=", this.itemInfo); + let f = ble.data.LinkedList.find((v) => { if (v.macAddress == this.itemInfo.deviceMac) { if (!this.formData.deviceId) { @@ -497,7 +500,7 @@ showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -566,6 +569,8 @@ updateLoading(these, { text: ex.msg }) + these.formData.bleStatu = 'err'; + MsgError("连接错误:"+ex.msg,"确定",these); }).finally(() => { setTimeout(() => { hideLoading(these); @@ -904,7 +909,7 @@ json.instruct[1] = parseInt(selectedItem.instructValue); ble.sendString(f.deviceId, json).then(res => { - console.log("ble send success") + console.log("ble send success",json); this.lightModeA = false; }).catch(ex => { console.error("ble send fail,mqsending....") @@ -926,6 +931,7 @@ }, + // 激光确认框提交 handleBtn() { @@ -1208,15 +1214,9 @@ dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(1, 0x02); // 帧类型:开机画面 dataView.setUint8(2, currentPacket); // 包序号 + dataView.setUint16(3, packetData.length*2,false); // 包t长度 - - if (packetData.length == 250) { - dataView.setUint8(3, 0x01); - dataView.setUint8(4, 0xF4); - } else { - dataView.setUint8(3, 0x00); - dataView.setUint8(4, 0x64); - } + // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { @@ -1254,7 +1254,7 @@ showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -1277,7 +1277,7 @@ console.log("握手没有成功"); showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }, these); @@ -1561,16 +1561,69 @@ // 强制报警() handlePolice() { this.popupType = 'cancel'; - this.popupMessage = '确认要解除所选设备的报警状态'; + this.popupMessage = '确认解除报警状态'; this.showPopupFlag = true; + // this.popupConfirmText=""; }, + OpenWarn(val){//开启/解除强制报警 + const topic = `B/${this.itemInfo.deviceImei}`; + let message={"instruct":[7,val,0,0,0,0]}; + message=JSON.stringify(message); + + let flag=this.mqttClient.publish(topic, message, { + qos: 1 + }); + if(flag){ + this.itemInfo.alarmStatus=val; + } + + this.showPopupFlag = false; + }, + warnToggle(){ + if(this.itemInfo.alarmStatus==1){ + this.popupType = 'cancel'; + this.popupMessage = '确认解除报警状态'; + + }else{ + this.popupType = 'openWarn'; + this.popupMessage = '确认开启报警状态'; + + } + this.showPopupFlag = true; + // this.popupConfirmText="开启"; + // let val=1; + // let msg="确认开启强制报警?"; + // if(this.itemInfo.alarmStatus==1){ + // val=0; + // msg="确认解除强制报警?"; + // } + + // let mqSend=()=>{ + // const topic = `B/${this.itemInfo.deviceImei}`; + // let message={"instruct":[7,val,0,0,0,0]}; + // message=JSON.stringify(message); + + // let flag=this.mqttClient.publish(topic, message, { + // qos: 1 + // }); + // if(flag){ + // this.itemInfo.alarmStatus=val; + // } + + // } + + + + }, + // 解除报警逻辑 async onPopupConfirmPolice() { if (this.deviceInfo.onlineStatus !== 1) { - uni.showToast({ - title: '设备已离线', - icon: 'none' - }); + // uni.showToast({ + // title: '设备已离线', + // icon: 'none' + // }); + this.OpenWarn(0);//走mq直发 return; } this.isPolling = true; // 标记开始轮询 @@ -1595,8 +1648,10 @@ title: registerRes.msg, icon: 'none' }) + return } + this.itemInfo.alarmStatus=0; // 4. 获取设备状态FunctionAccessBatchStatusRule 批量 let deviceImei = this.itemInfo.deviceImei let typeName = this.itemInfo.typeName @@ -1791,27 +1846,7 @@ } } }, - // 操作说明 - operatingInst() { - let id = this.computedDeviceId - uni.navigateTo({ - url: `/pages/common/operatingInstruct/index?id=${id}` - }) - }, - // 产品参数 - productparams() { - let id = this.computedDeviceId - uni.navigateTo({ - url: `/pages/common/productDes/index?id=${id}` - }) - }, - // 操作视频 - operatingVideo() { - let id = this.computedDeviceId - uni.navigateTo({ - url: `/pages/common/operationVideo/index?id=${id}` - }) - }, + // 发送mqtt查询设备信息 queryDeviceStatus() { if (this.mqttClient && this.mqttClient.isConnected()) { @@ -1956,6 +1991,9 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then( res => { these.formData.bleStatu = true; + }).catch(ex=>{ + these.formData.bleStatu = 'err'; + MsgError("连接错误:"+ex.msg,"确定",these); }); } } @@ -1976,6 +2014,8 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") this.formData.bleStatu = true; + }).catch(ex=>{ + MsgError("连接错误:"+ex.msg,"确定",these); }); } }, @@ -2210,6 +2250,11 @@ width: 47%; display: flex; text-align: center; + box-sizing: border-box; + border: 1rpx solid #00000000; + } + .mode-v1.active{ + border:1rpx solid #bbe600 !important; } .mode-v2 { diff --git a/pages/6331/BJQ6331.vue b/pages/6331/BJQ6331.vue index c372de2..ed179ee 100644 --- a/pages/6331/BJQ6331.vue +++ b/pages/6331/BJQ6331.vue @@ -6,14 +6,14 @@ - + {{formData.battary}}% 电量 - + {{formData.xuhang}} 续航时间 @@ -22,19 +22,19 @@ - + 设备名称 {{device.deviceName}} - Mac地址 - {{device.deviceMac}} - + Mac地址 + {{device.deviceMac}} + 蓝牙名称 {{device.bluetoothName}} - + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} @@ -45,34 +45,34 @@ 照明模式 亮度 + :class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度 + :class="formData.lightCurr=='shuxie'?'active':''"> + :src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'" + mode="aspectFit"> 书写 + :src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'" + mode="aspectFit"> 工作光 + :src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'" + mode="aspectFit"> 节能光 @@ -130,7 +130,7 @@ + v-on:click.stop="audioManage()"> @@ -153,31 +153,15 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + + :borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor" + :buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor" + :iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText" + @buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle" + v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot"> @@ -186,8 +170,8 @@ + backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange" + @changing="sliderChange" class="custom-slider" /> @@ -199,8 +183,8 @@ + backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange" + @changing="sliderChange" class="custom-slider" /> @@ -209,7 +193,7 @@ + @btnClick="btnClick"> @@ -221,7 +205,7 @@ - + @@ -236,7 +220,15 @@ } from '@/utils/loading.js' import request, { baseURL } from '@/utils/request.js'; - import usrApi from '@/api/670/HBY670.js' + import usrApi from '@/api/670/HBY670.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' const pagePath = "pages/6331/BJQ6331"; var ble = null; @@ -401,7 +393,10 @@ import request, { baseURL } from '@/utils/request.js'; these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.setBleFormData(); these.getDetail(); @@ -420,7 +415,10 @@ import request, { baseURL } from '@/utils/request.js'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -452,7 +450,7 @@ import request, { baseURL } from '@/utils/request.js'; let play = () => { alert('正在播放中'); } - this.showPop({ + showPop({ showPop: true, //是否显示弹窗 popType: 'custom', bgColor: '#383934bd', @@ -469,7 +467,7 @@ import request, { baseURL } from '@/utils/request.js'; modelValue: '', visibleClose: true, okCallback: play - }); + },these); }, audioManage() { //语音管理 uni.navigateTo({ @@ -594,12 +592,12 @@ import request, { baseURL } from '@/utils/request.js'; ble.sendHexs(f.deviceId, array, f.writeServiceId, f.wirteCharactId, 100).catch(ex => { - these.showPop({ + showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }); }, @@ -670,7 +668,8 @@ import request, { baseURL } from '@/utils/request.js'; }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -734,9 +733,9 @@ import request, { baseURL } from '@/utils/request.js'; showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -762,7 +761,7 @@ import request, { baseURL } from '@/utils/request.js'; } }) } - }); + },these); @@ -770,31 +769,7 @@ import request, { baseURL } from '@/utils/request.js'; }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + closePop: function() { this.Status.Pop.showPop = false; @@ -1186,46 +1161,7 @@ import request, { baseURL } from '@/utils/request.js'; text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue index 081ac7e..b39916f 100644 --- a/pages/650/HBY650.vue +++ b/pages/650/HBY650.vue @@ -10,31 +10,31 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} - + - + - + - + - + {{formData.battary}}% 电量 - + {{formData.xuhang}} 续航时间 @@ -78,19 +78,19 @@ + @click="MainModeSetting('smalllow','staticBattery')"> 前置 + @click="MainModeSetting('low','staticBattery')"> 低档 + @click="MainModeSetting('center','staticBattery')"> 中档 + @click="MainModeSetting('hight','staticBattery')"> 高档 @@ -98,9 +98,9 @@ + @click="MainModeSetting('close','staticBattery')"> + 关闭 + --> @@ -114,7 +114,7 @@ + v-on:click.stop="ShowUpload()"> @@ -159,35 +159,13 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - + - - + + @btnClick="btnClick"> @@ -198,6 +176,7 @@ + @@ -213,7 +192,15 @@ } from '@/utils/loading.js' import request, { baseURL } from '@/utils/request.js'; - import usrApi from '@/api/670/HBY670.js' + import usrApi from '@/api/670/HBY670.js'; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' const pagePath = "/pages/650/HBY650"; var ble = null; @@ -234,24 +221,7 @@ import request, { baseURL } from '@/utils/request.js'; }, pageHide: false, - Pop: { - showPop: false, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '您确定要这样做吗?', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '设备名称', - modelValue: '', - visibleClose: false, - okCallback: null - }, + BottomMenu: { show: false, showHeader: true, @@ -404,7 +374,10 @@ import request, { baseURL } from '@/utils/request.js'; these.formData.bleStatu='connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.setBleFormData(); console.error("222222"); these.getDetail(); @@ -425,7 +398,10 @@ import request, { baseURL } from '@/utils/request.js'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -466,6 +442,7 @@ import request, { baseURL } from '@/utils/request.js'; these.formData.bleStatu = true; }).catch(ex=>{ these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -569,7 +546,8 @@ import request, { baseURL } from '@/utils/request.js'; }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + MsgError("连接错误:" + ex.msg, "确定", these); }).finally(() => { setTimeout(() => { hideLoading(these); @@ -655,12 +633,12 @@ import request, { baseURL } from '@/utils/request.js'; } if (these.formData.iswarn) { - these.showPop({ + showPop({ message: "环境存在漏电电源", iconUrl: "/static/images/6155/DeviceDetail/warnning.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); } these.setBleFormData(); @@ -733,14 +711,14 @@ import request, { baseURL } from '@/utils/request.js'; if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -813,12 +791,12 @@ import request, { baseURL } from '@/utils/request.js'; console.log("发送成功了"); }).catch((ex) => { - these.showPop({ + showPop({ message: ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { @@ -838,9 +816,9 @@ import request, { baseURL } from '@/utils/request.js'; }, showBleUnConnect() { - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -866,49 +844,25 @@ import request, { baseURL } from '@/utils/request.js'; } }) } - }); + },these); }, LampToggle: function() { if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } this.formData.cMode = !this.formData.cMode; this.MainModeSetting(this.formData.cMode, "lamp"); }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + checkImgUpload: function(type, index) { console.log("123213213213"); let f = these.getDevice(); @@ -932,11 +886,11 @@ import request, { baseURL } from '@/utils/request.js'; if (currentPacket > totalPackets) { hideLoading(these); these.Status.BottomMenu.show = false; - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - }); + },these); if (!ReSendNo) { setTimeout(() => { these.HoldYouHand("transmit complete", 0, f @@ -975,17 +929,10 @@ import request, { baseURL } from '@/utils/request.js'; // 填充头部 dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(1, 0x02); // 帧类型:开机画面 - dataView.setUint8(2, '0x' + currentPacket.toString(16).padStart(2, - '0')); // 包序号 + dataView.setUint8(2, currentPacket); // 包序号 - if (packetData.length == 250) { - dataView.setUint8(3, 0x01); - dataView.setUint8(4, 0xF4); - } else { - dataView.setUint8(3, 0x00); - dataView.setUint8(4, 0x64); - } + dataView.setUint16(3, packetData.length*2,false); // 包t长度 // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { @@ -1012,23 +959,23 @@ import request, { baseURL } from '@/utils/request.js'; }) currentPacket++; - setTimeout(sendNextPacket, 0); + setTimeout(sendNextPacket, 80); }).catch(err => { console.log("发送数据包失败了" + JSON.stringify(err)); if (err.code == '10007') { - setTimeout(sendNextPacket, 0); + setTimeout(sendNextPacket, 500); return; } these.Status.BottomMenu.show = false; - these.showPop({ + showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); hideLoading(these); reject(err); }); @@ -1044,12 +991,12 @@ import request, { baseURL } from '@/utils/request.js'; sendNextPacket(); }).catch((err) => { console.log("握手没有成功"); - these.showPop({ + showPop({ message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); hideLoading(these); reject(err); }); @@ -1121,11 +1068,11 @@ import request, { baseURL } from '@/utils/request.js'; } these.Status.BottomMenu.show = false; hideLoading(these); - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" - }); + },these); @@ -1195,14 +1142,14 @@ import request, { baseURL } from '@/utils/request.js'; these.Status.BottomMenu.show = false; hideLoading(these); - these.showPop({ + showPop({ showPop: true, message: err.msg + ",发送失败了", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "确定", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png" - }); + iconUrl: "/static/images/common/uploadErr.png" + },these); reject(err); return; } @@ -1297,23 +1244,23 @@ import request, { baseURL } from '@/utils/request.js'; console.log("服务器未返回正确的数据"); - these.showPop({ + showPop({ message: "与服务器连接出现异常,请检查网络设置", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); } }).catch((ex) => { hideLoading(these); - these.showPop({ + showPop({ message: "出现异常," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }) } let f = these.getDevice(); @@ -1380,14 +1327,14 @@ import request, { baseURL } from '@/utils/request.js'; if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } //上传开机画面 @@ -1429,84 +1376,19 @@ import request, { baseURL } from '@/utils/request.js'; this.Status.BottomMenu.activeIndex = index; }, - closePop: function() { - this.Status.Pop.showPop = false; - - if (this.Status.Pop.cancelCallback) { - this.Status.Pop.cancelCallback(); - } - }, - HidePop: function() { - if (this.Status.Pop.clickEvt == 'SendUsr') { - - } - - - this.Status.Pop.showPop = false; - if (this.Status.Pop.okCallback) { - this.Status.Pop.okCallback(); - } - }, - showPop: function(option) { - hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } - - let keys = Object.keys(def); - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - this.Status.Pop[key] = option[key]; - } - } - - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, + sendUsr: function(ReSendNo) { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -1550,7 +1432,7 @@ import request, { baseURL } from '@/utils/request.js'; } - these.showPop({ + showPop({ showPop: true, //是否显示弹窗 popType: 'custom', bgColor: '#383934bd', @@ -1566,7 +1448,7 @@ import request, { baseURL } from '@/utils/request.js'; promptTitle: '', modelValue: '', visibleClose: true - }); + },these); these.setBleFormData(); @@ -1624,12 +1506,12 @@ import request, { baseURL } from '@/utils/request.js'; setTimeout(sendNextPacket, 0); }).catch(err => { - these.showPop({ + showPop({ message: "文字发送失败," + err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); }); @@ -1658,12 +1540,12 @@ import request, { baseURL } from '@/utils/request.js'; }).catch((ex) => { console.log("握手没有成功", ex); hideLoading(these); - these.showPop({ + showPop({ message: ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }); }, 0); @@ -2039,47 +1921,7 @@ import request, { baseURL } from '@/utils/request.js'; text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index 1187d22..a76b342 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -1,35 +1,37 @@ @@ -306,7 +295,14 @@ } from '@/utils/loading.js' import request, { baseURL } from '@/utils/request.js'; import lnglatConvert from '@/utils/wgs84_to_gcj02.js'; - + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' const pagePath = "/pages/670/HBY670"; var ble = null; var these = null; @@ -336,28 +332,28 @@ time: 0, inteval: null }, - Pop: { - showPop: false, //是否显示弹窗 + Pop: { + showPop: false, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#BBE600', + textColor: '#ffffffde', + buttonBgColor: '#BBE600', + buttonTextColor: '#232323DE', - iconUrl: '', - message: '您确定要这样做吗?', - buttonText: '确定', - showCancel: false, - buttonCancelText: '取消', - clickEvt: '', - visiblePrompt: false, - promptTitle: '设备名称', - modelValue: '', - visibleClose: false, - okCallback: null - }, + iconUrl: '', + message: '您确定要这样做吗?', + buttonText: '确定', + showCancel: false, + buttonCancelText: '取消', + clickEvt: '', + visiblePrompt: false, + promptTitle: '设备名称', + modelValue: '', + visibleClose: false, + okCallback: null + }, BottomMenu: { show: false, showHeader: true, @@ -490,8 +486,8 @@ recei = BleReceive.getBleReceive(); ble = BleTool.getBleTool(); this.$watch("formData.battary", (newVal, oldVal) => { - if (newVal <= 20 && this.formData.sta_system==2) { - this.showMsg("设备电量低"); + if (newVal <= 20 && this.formData.sta_system == 2) { + MsgError("设备电量低",'',these); } }); @@ -555,7 +551,10 @@ these.formData.bleStatu='connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; }); }, @@ -568,7 +567,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, onHide: function() { @@ -615,6 +617,7 @@ these.formData.bleStatu = true; }).catch(ex=>{ these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -693,7 +696,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -715,9 +719,9 @@ if (this.Status.bleLinkCnt > 3) { return; } - this.showPop({ + showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消" + (4 - this.Status.bleLinkCnt) + "次后不再提醒", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -747,7 +751,7 @@ } }) } - }); + },these); }, gotoMap() { let promise = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat); @@ -943,11 +947,11 @@ // } if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知 if(json.sta_BreakNews=='I get it'){ - these.showPop({ + showPop({ showPop: true, message: "用户已确认收到紧急通知", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" - }); + },these); } } @@ -1129,14 +1133,14 @@ msgs.push("设备静止报警中"); } if (msgs.length > 0) { - this.showPop({ + showPop({ message: msgs.join(";"), iconUrl: "/static/images/6155/DeviceDetail/warnning.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "确定", clickEvt: "staticWarn" - }); + },these); } @@ -1169,14 +1173,14 @@ lightSetting: function(type) { if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } if (this.formData.lightCurr == type) { @@ -1212,12 +1216,12 @@ console.log("4g发送成功"); }).catch((ex) => { console.log("ex=", ex); - these.showPop({ + showPop({ message: "通信异常,请检查手机或设备网络", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); @@ -1260,9 +1264,10 @@ CloseWarn: function(ispop) { //解除强制报警 let closeEvt = () => { - these.Status.Pop.showPop = false; + these.formData.qzwarn = false; + these.Status.staticWarn.inteval=null clearInterval(these.Status.staticWarn.inteval); let requestCloseSOS = () => { @@ -1276,12 +1281,12 @@ }).catch((ex) => { console.log("ex=", ex); - these.showPop({ + showPop({ message: "通信异常,请检查手机或设备网络", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); @@ -1341,7 +1346,7 @@ showHeader: true, headerTxt: "强制报警", message: message, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "解除报警", @@ -1352,20 +1357,20 @@ this.Status.Pop.okCallback = null; }, clickEvt: 'time' - }); + },these); }, sosSetting: function(type) { debugger; if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -1374,9 +1379,7 @@ type = "close"; } - showLoading(this, { - text: "请稍候..." - }); + let task = () => { let dic = { @@ -1432,12 +1435,12 @@ } }).catch((ex) => { console.log("ex=", ex); - these.showPop({ + showPop({ message: "通信异常,请检查手机或设备网络", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); @@ -1484,7 +1487,11 @@ } let OpenSOS = () => { + showLoading(this, { + text: "请稍候..." + }); let execSos = () => { + these.formData.qzwarn = true; //标记为强制报警了 these.Status.staticWarn.time = 180; @@ -1550,17 +1557,18 @@ } else if (type == 'sg') //强制报警 { - this.showPop({ + showPop({ message: '确定开启声光报警模式?', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: OpenSOS, buttonText: "开启" - }); + },these); return; } else if (type == 'close') { - + console.log("this.formData.SOS=",this.formData.SOS); + console.log("inteval=",this.Status.staticWarn.inteval); if (this.formData.SOS = 'sg' && this.Status.staticWarn.inteval) { //解除声光报警 this.CloseWarn(true); } else { @@ -1578,14 +1586,14 @@ GearSetting: function(type) { //档位设置 if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } if (this.formData.modeCurr == type) { @@ -1620,12 +1628,12 @@ console.log("4g发送成功"); }).catch((ex) => { console.log("ex=", ex) - these.showPop({ + showPop({ message: "通信异常,请检查手机或设备网络", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); @@ -1673,26 +1681,7 @@ setTimeout(task, 0); }, - proDetail: function(type) { - if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { - - this.showPop({ - message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - okCallback: null, - buttonText: "确定" - }) - return; - } - uni.navigateTo({ - url: '/pages/common/' + type + '/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + checkImgUpload: function(type, index) { console.log("123213213213"); @@ -1706,21 +1695,21 @@ deviceImei: these.device.deviceImei }).then((res) => { if (res.code == 200) { - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - }); + },these); resolve(); return; } else { - these.showPop({ + showPop({ message: res.errMsg ? res.errMsg : "未知的原因上传失败了", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); reject(res); } }).catch((ex) => { @@ -1752,11 +1741,11 @@ if (currentPacket > totalPackets) { hideLoading(these); these.Status.BottomMenu.show = false; - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - }); + },these); if (!ReSendNo) { setTimeout(() => { these.HoldYouHand("transmit complete", 0, f @@ -1799,13 +1788,7 @@ '0')); // 包序号 - if (packetData.length == 250) { - dataView.setUint8(3, 0x01); - dataView.setUint8(4, 0xF4); - } else { - dataView.setUint8(3, 0x00); - dataView.setUint8(4, 0x64); - } + dataView.setUint16(3, packetData.length*2,false); // 包t长度 // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { @@ -1832,11 +1815,11 @@ }); currentPacket++; - setTimeout(sendNextPacket, 0); + setTimeout(sendNextPacket, 80); }).catch(err => { console.log("发送数据包失败了" + JSON.stringify(err)); if (err.code == '10007') { - setTimeout(sendNextPacket, 0); + setTimeout(sendNextPacket, 500); return; } else { updateLoading(these, { @@ -1845,9 +1828,9 @@ sendImgByRequest().then(resolve).catch(reject); } // these.Status.BottomMenu.show = false; - // these.showPop({ + // showPop({ // message: err.msg, - // iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + // iconUrl: "/static/images/common/uploadErr.png", // borderColor: "#e034344d", // buttonBgColor: "#E03434", // }); @@ -1943,11 +1926,11 @@ } these.Status.BottomMenu.show = false; hideLoading(these); - these.showPop({ + showPop({ showPop: true, message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" - }); + },these); @@ -1995,7 +1978,7 @@ - let inteval = 30; + let inteval = 50; console.log("开始发送一段视频"); // ble.sendData(f.deviceId, buffer, f.writeServiceId, f .wirteCharactId, 10).then(() => { @@ -2019,14 +2002,14 @@ these.Status.BottomMenu.show = false; hideLoading(these); - these.showPop({ + showPop({ showPop: true, message: err.msg + ",发送失败了", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: "确定", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png" - }); + iconUrl: "/static/images/common/uploadErr.png" + },these); reject(err); return; } @@ -2123,23 +2106,23 @@ console.log("服务器未返回正确的数据", arr); - these.showPop({ + showPop({ message: "与服务器连接出现异常,请检查网络设置", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); } }).catch((ex) => { hideLoading(these); - these.showPop({ + showPop({ message: "出现异常," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }) } @@ -2205,14 +2188,14 @@ ShowUpload: function() { if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } //上传开机画面 @@ -2254,86 +2237,86 @@ this.Status.BottomMenu.activeIndex = index; }, - HidePop: function() { - if (this.Status.Pop.clickEvt == 'staticWarn') { - // this.Status.staticWarnTime=0; - // clearInterval(this.Status.staticWarn.inteval); - // this.formData.staticWarn=false; - } - if (this.Status.Pop.okCallback) { - console.log("执行点击按钮回调"); - this.Status.Pop.okCallback(); - } + HidePop: function () { + if (this.Status.Pop.clickEvt == 'staticWarn') { + // this.Status.staticWarnTime=0; + // clearInterval(this.Status.staticWarn.inteval); + // this.formData.staticWarn=false; + } + if (this.Status.Pop.okCallback) { + console.log("执行点击按钮回调"); + this.Status.Pop.okCallback(); + } - this.Status.Pop.showPop = false; - }, - closePop: function() { - this.Status.Pop.showPop = false; + this.Status.Pop.showPop = false; + }, + closePop: function () { + this.Status.Pop.showPop = false; - if (this.Status.Pop.cancelCallback) { - this.Status.Pop.cancelCallback(); - } - }, - showPop: function(option) { - hideLoading(this); - let def = { - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '', - message: '', - buttonText: '确定', - clickEvt: '', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: false, - okCallback: null, - showSlot: false, - buttonCancelText: '', - showCancel: false, - } + if (this.Status.Pop.cancelCallback) { + this.Status.Pop.cancelCallback(); + } + }, + showPop: function (option) { + hideLoading(this); + let def = { + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#BBE600', + textColor: '#ffffffde', + buttonBgColor: '#BBE600', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '确定', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: false, + okCallback: null, + showSlot: false, + buttonCancelText: '', + showCancel: false, + } - let keys = Object.keys(def); + let keys = Object.keys(def); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in option) { - continue; - } - this.Status.Pop[key] = def[key]; - } - if (option) { - keys = Object.keys(option); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + if (key in option) { + continue; + } + this.Status.Pop[key] = def[key]; + } + if (option) { + keys = Object.keys(option); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; - this.Status.Pop[key] = option[key]; - } - } + this.Status.Pop[key] = option[key]; + } + } - if (!option.borderColor) { - option.borderColor = '#BBE600'; - option.buttonBgColor = '#BBE600'; - } - these.Status.Pop.showPop = true; - }, + if (!option.borderColor) { + option.borderColor = '#BBE600'; + option.buttonBgColor = '#BBE600'; + } + these.Status.Pop.showPop = true; + }, sendUsr: function(ReSendNo) { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } @@ -2349,7 +2332,7 @@ code: this.formData.usrid }; api.sendUsr(json).then((res) => { - these.showPop({ + showPop({ showPop: true, //是否显示弹窗 popType: 'custom', bgColor: '#383934bd', @@ -2365,15 +2348,15 @@ promptTitle: '', modelValue: '', visibleClose: true - }); + },these); these.setBleFormData(); }).catch((ex) => { - these.showPop({ + showPop({ message: "文字发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); }).finally(() => { hideLoading(these); }); @@ -2421,7 +2404,7 @@ } - these.showPop({ + showPop({ showPop: true, //是否显示弹窗 popType: 'custom', bgColor: '#383934bd', @@ -2437,7 +2420,7 @@ promptTitle: '', modelValue: '', visibleClose: true - }); + },these); these.setBleFormData(); hideLoading(these); @@ -2528,9 +2511,9 @@ requestSend(); // console.log("握手没有成功", ex); // hideLoading(these); - // these.showPop({ + // showPop({ // message: ex.msg, - // iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + // iconUrl: "/static/images/common/uploadErr.png", // borderColor: "#e034344d", // buttonBgColor: "#E03434", // }); @@ -2544,14 +2527,14 @@ if (!this.permissions.includes('5') && this.Status.apiType !== 'listA') { - this.showPop({ + showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, buttonText: "确定" - }) + },these) return; } if (!this.formData.msgTxt) { @@ -2579,7 +2562,7 @@ }).then((res) => { console.log("res=", res) if (res.code == 200) { - these.showPop({ + showPop({ showPop: true, //是否显示弹窗 popType: 'custom', bgColor: '#383934bd', @@ -2595,7 +2578,7 @@ promptTitle: '', modelValue: '', visibleClose: true - }); + },these); // clearInterval(this.Status.msgOkIntval); @@ -2611,12 +2594,12 @@ } else { - these.showPop({ + showPop({ message: res.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - }); + },these); } }).finally(() => { hideLoading(this); @@ -3013,46 +2996,7 @@ text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: PingFang SC; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } + .slider-container { diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue index 0fe2112..a5f89ab 100644 --- a/pages/7305/BJQ7305.vue +++ b/pages/7305/BJQ7305.vue @@ -10,7 +10,7 @@ + @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons"> {{item.math>9?'9+':item.math}} @@ -26,14 +26,14 @@ - + {{formData.battary}}% 电量 - + {{formData.xuhang}} 续航时间 @@ -73,8 +73,8 @@ + backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange" + @changing="sliderChanging" class="custom-slider" /> @@ -89,14 +89,14 @@ + + + + + 辅灯模式 + 泛光模式 + + --> @@ -114,52 +114,28 @@ 发送 + :bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="13" /> 单位: - + 部门: - + 姓名: - + - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - - - - - - + + @btnClick="btnClick"> @@ -169,6 +145,7 @@ + @@ -183,7 +160,14 @@ } from '@/utils/loading.js' import BleReceive from '@/utils/BleReceive'; import Common from '@/utils/Common.js'; - + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgInfo + } from '@/utils/MsgPops.js' var ble = null; var these = null; var BrighInteval = null; @@ -363,7 +347,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; these.setBleFormData(); these.getDetail(); @@ -384,7 +371,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") these.formData.bleStatu = true; - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + });; } }, computed: { @@ -452,6 +442,7 @@ these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } @@ -560,7 +551,8 @@ }).catch(ex => { updateLoading(these, { text: ex.msg - }) + }); + these.formData.bleStatu = 'err'; }).finally(() => { setTimeout(() => { hideLoading(these); @@ -620,7 +612,7 @@ if ('battary' in json && this.formData.battary <= 20) { this.showPop({ message: "设备电量低", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -628,35 +620,11 @@ }, - proParam: function() { - - uni.navigateTo({ - url: '/pages/common/productDes/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handRemark: function() { - uni.navigateTo({ - url: '/pages/common/operatingInstruct/index?id=' + this.device.id, - success(ev) { - - } - }); - }, - handVideo: function() { - uni.navigateTo({ - url: '/pages/common/operationVideo/index?id=' + this.device.id, - success(ev) { - - } - }); - }, + showBleUnConnect() { this.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', @@ -766,7 +734,7 @@ these.Status.BottomMenu.show = false; these.showPop({ message: "发送数据包失败了: " + err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -931,7 +899,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -951,7 +919,7 @@ this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1081,7 +1049,7 @@ }).catch((ex) => { these.showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1177,13 +1145,14 @@ debugger; option.buttonBgColor = '#BBE600'; } these.Status.Pop.showPop = true; + showPop(option,this); }, sendUsr() { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1209,7 +1178,7 @@ debugger; if (err) { this.showPop({ message: "单位、部门、姓名必须填写且最多5字", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1360,7 +1329,7 @@ debugger; } else { this.showPop({ message: "出现异常发送失败", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1407,7 +1376,7 @@ debugger; this.showPop({ message: '无操作权限', - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: null, @@ -1439,7 +1408,7 @@ debugger; ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => { these.showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1488,7 +1457,7 @@ debugger; ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => { these.showPop({ message: "发送失败," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", }); @@ -1856,47 +1825,7 @@ debugger; text-align: left; } - .proinfo .itemcontent { - display: flex; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-content: center; - justify-content: space-evenly; - } - - .proinfo .item { - width: 180rpx; - height: 180rpx; - box-sizing: border-box; - padding: 40rpx; - border-radius: 16rpx; - background: rgba(26, 26, 26, 1); - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-content: center; - justify-content: center; - align-items: center; - } - - .proinfo .item .img { - width: 50rpx; - height: 50rpx; - - - } - - .proinfo .item .txt { - color: rgba(255, 255, 255, 0.6); - font-family: "PingFang SC"; - font-size: 24rpx; - font-weight: 400; - margin-top: 20rpx; - letter-spacing: 0.07px; - text-align: left; - } - + .slider-container { padding: 0px; diff --git a/pages/common/addBLE/LinkBle.vue b/pages/common/addBLE/LinkBle.vue index c882392..6d7de22 100644 --- a/pages/common/addBLE/LinkBle.vue +++ b/pages/common/addBLE/LinkBle.vue @@ -281,9 +281,9 @@ return; } //无效的设备回调 - let deviceInvalid = () => { - - these.$set(these.device, "deviceName", ""); + let deviceInvalid = () => { + these.$set(these.device, "deviceName", ""); + } clearTimeout(this.Statu.timeInteval); diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue index 3635f4c..18165c9 100644 --- a/pages/common/addBLE/addEquip.vue +++ b/pages/common/addBLE/addEquip.vue @@ -528,7 +528,7 @@ ble.StartSearch().then(result => { // console.log("开始搜索成功", result); - + these.Status.BottomMenu.show=false; }).catch(err => { console.error("开始搜索失败:", err); if (err.code === 10001) { @@ -580,6 +580,9 @@ ble.showBlueSetting(false); }, DeviceVerdict(deviceId) { //判断是否是目标设备 + if (these.Status.isPageHidden) { + return; + } console.log("deviceid=", deviceId); console.log("these.device=", these.device) if (these.device) { //从设备详情过来的,回设备详情去 @@ -616,6 +619,9 @@ } //找到目标设备的处理方法 let deviceOK = () => { + if (these.Status.isPageHidden) { + return; + } hideLoading(these); eventChannel.emit('BindOver', these.device); @@ -761,6 +767,9 @@ if (index == total) { console.log("连接了N次都没连上"); reject(ex); + updateLoading(this, { + text: ex.msg + }) return; } index++; @@ -777,6 +786,9 @@ execLink().then((res) => { console.log("res=", res); + if(this.Status.isPageHidden){ + return; + } linkCallback(res); }).catch(ex => { console.error("ex=", ex) diff --git a/pages/common/addDevice/addBle.vue b/pages/common/addDevice/addBle.vue index 0063bf4..d963791 100644 --- a/pages/common/addDevice/addBle.vue +++ b/pages/common/addDevice/addBle.vue @@ -1,6 +1,22 @@ @@ -98,19 +117,42 @@ hideLoading, updateLoading } from '@/utils/loading.js' - import common from '@/utils/Common.js' + import common from '@/utils/Common.js' const pagePath = "pages/common/addBLE/addEquip"; + import { + MsgSuccess, + MsgError, + MsgClose, + MsgWarning, + showPop, + MsgClear, + MsgInfo + } from '@/utils/MsgPops.js'; + import MQTT from '@/utils/MqHelper.js'; + var ble = null; var these = null; var eventChannel = null; var time = null; var time1 = null; - // var serv = null; + var mq = null; export default { data() { return { Status: { intval: null, + pcAuthori: false, + navbar: { + icons: [ + + { + src: '/static/images/common/scane.png' + } + ], + title: '添加设备', + showBack: true, + height: 90 + } }, search: '', groupid: '', @@ -120,7 +162,8 @@ EquipMents: [], //搜索出来的设备 devices: [], devicesCnt: 0, - privateNetUrl: '' + privateNetUrl: '', + scanKey: '' } }, @@ -137,18 +180,30 @@ }, onUnload() { - ble.StopSearch().then(res => { - console.log("停止搜索成功") - }).catch(ex => { - console.error("停止搜索成功", ex); - }); - ble.removeAllCallback(pagePath); - ble.disconnectDevice(); + if (ble) { + ble.StopSearch().then(res => { + console.log("停止搜索成功") + }).catch(ex => { + console.error("停止搜索成功", ex); + }); + ble.removeAllCallback(pagePath); + ble.disconnectDevice(); + } + + + if (mq) { + mq.disconnect(); + } }, onLoad() { + these = this; + + + mq = MQTT.getMqTool(); + mq.init(); this.groupid = common.DateFormat(new Date(), 'yyyy-MM-dd HH:mm:ss'); - these = this; + ble = bleTool.getBleTool(); // serv = serTool.serverInit(); @@ -356,12 +411,12 @@ if (!arr[i].name) { continue; } - - - arr[i].name=arr[i].name.replace(/\r\n/g, '').replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - - - + + + arr[i].name = arr[i].name.replace(/\r\n/g, '').replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,''); + + + let f = these.EquipMents.find(function(v, index) { if (v.deviceId == arr[i].deviceId) { these.$set(these.EquipMents[index], "RSSI", arr[i].RSSI); @@ -381,7 +436,7 @@ } } - + these.sendEquipToMq(); // console.log("equip=", these.EquipMents) }, pagePath); // console.log("addEquip") @@ -403,6 +458,7 @@ console.log("111111"); } if (f.imei) { + f.imei = f.imei.replace(/\u0000/g, ''); item = this.EquipMents.find((v, index) => { if (v.deviceId == f.deviceId) { v.imei = f.imei; @@ -474,7 +530,7 @@ let callback = () => { these.getTypeDeviceCnt().then(res => { - console.error("设备数量:",res); + console.error("设备数量:", res); these.devicesCnt = res; if (res > 0 && res <= 10000) { these.getAlltypeDevices().then(devs => { @@ -490,10 +546,37 @@ }); } - + callback(); + + }); + + + + + setTimeout(()=>{ + MsgInfo("如需要在PC上查看此数据,请复制链接后通过微信发送到PC,在PC端打开,然后点右上角扫码授权","复制链接",these,true,()=>{ + console.log("执行复制"); + uni.setClipboardData({ + data:'https://static-mp-5b7c35fc-f6fe-4100-a2e1-3669e4d4bfc9.next.bspapp.com/AppTools/views/index.html', + success(){ + uni.showToast({ + title:'已复制链接' + }); + + + plus.runtime.openURL('weixin://', (err) => { + MsgError("打开微信失败,请手动打开微信粘贴"); + }); + }, + fail(ex){ + console.error("无法复制",ex) + } + }); + }); + },500); }, onShow: function() { @@ -503,65 +586,87 @@ }, methods: { + prevPage() { + uni.navigateBack({ + + }); + }, + handleRightClick: function(s, e) { + + this.scan(); + }, + initWatch() { + this.$watch("devicesCnt", (newVal, oldVal) => { + const phone = uni.getStorageSync('phone'); + mq.sendData('pc/' + phone, JSON.stringify({ + devicesCnt: this.devicesCnt + }), false); + }); + + + + + + }, //获取某个类型下的所有设备 getAlltypeDevices() { return new Promise((succ, err) => { - - let json = { - "tenant_id": this.type.tenantId, - "deviceType": this.type.deviceTypeId - }; - - request({ - url: "/app/xinghan/device/getEquipAllByType", - method: 'POST', - data: json, - }).then(res=>{ - - if(res && res.code==200){ - - succ(res.data); - return; - } - err(res); - }).catch(ex=>{ - console.error("ex=",ex); - err(ex); - }); - + + let json = { + "tenant_id": this.type.tenantId, + "deviceType": this.type.deviceTypeId + }; + + request({ + url: "/app/xinghan/device/getEquipAllByType", + method: 'POST', + data: json, + }).then(res => { + + if (res && res.code == 200) { + + succ(res.data); + return; + } + err(res); + }).catch(ex => { + console.error("ex=", ex); + err(ex); + }); + }); }, //获取类型下的设备数量 getTypeDeviceCnt() { return new Promise((resolve, reject) => { - - - - - let json = { - "tenant_id": this.type.tenantId, - "deviceType": this.type.deviceTypeId - }; - console.error("json=",json); - - request({ - url: "/app/xinghan/device/getEquipCountByType", - method: 'POST', - data: json, - }).then(res=>{ - console.error("getEquipCountByType res.data=",res.data) - if(res && res.code==200){ - - resolve(res.data); - return; - } - reject(res); - }).catch(ex=>{ - console.error("ex=",ex); - reject(ex); - }); - - + + + + + let json = { + "tenant_id": this.type.tenantId, + "deviceType": this.type.deviceTypeId + }; + console.error("json=", json); + + request({ + url: "/app/xinghan/device/getEquipCountByType", + method: 'POST', + data: json, + }).then(res => { + console.error("getEquipCountByType res.data=", res.data) + if (res && res.code == 200) { + + resolve(res.data); + return; + } + reject(res); + }).catch(ex => { + console.error("ex=", ex); + reject(ex); + }); + + }); }, getDevice(item) { @@ -581,37 +686,40 @@ if (this.devicesCnt > 0) { if (this.devices && this.devices.length > 0) { let eqp = this.devices.find(v => { - let flag= v.bluetooth_name.replace(/\r\n/g, '').replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') == item.name; - + let flag = v.bluetooth_name.replace(/\r\n/g, '').replace( + /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') == item.name; + return flag; - + }); if (eqp) { - + these.$set(these.EquipMents[fIndex], "isUpload", true); these.$set(these.EquipMents[fIndex], "remark", "校验完成,设备已入库"); these.$set(these.EquipMents[fIndex], "macAddress", eqp.device_mac); - these.$set(these.EquipMents[fIndex], "device_name",eqp.device_name); - console.log("从缓存中找到了设备",eqp); + these.$set(these.EquipMents[fIndex], "device_name", eqp.device_name); + console.log("从缓存中找到了设备", eqp); resolve(eqp); return; } } - console.error("缓存中找不到此设备22222222",this.devices); + // console.error("缓存中找不到此设备22222222", this.devices); these.$set(these.EquipMents[fIndex], "remark", "校验完成,设备未入库"); reject(null); + + these.sendEquipToMq(); return; } - - - - let succCallback=(data)=>{ - if(data){ + + + + let succCallback = (data) => { + if (data) { these.$set(these.EquipMents[fIndex], "isUpload", true); these.$set(these.EquipMents[fIndex], "remark", @@ -620,77 +728,179 @@ data.device_mac); these.$set(these.EquipMents[fIndex], "imei", data .device_imei); - these.$set(these.EquipMents[fIndex], "device_name",data.device_name); - } - else{ - console.error("设备未入库111111",data) + these.$set(these.EquipMents[fIndex], "device_name", data.device_name); + } else { + console.error("设备未入库111111", data) these.$set(these.EquipMents[fIndex], "remark", "校验完成,设备未入库"); } - + these.sendEquipToMq(); } - - let errCallback=()=>{ + + let errCallback = () => { these.$set(these.EquipMents[fIndex], "remark", "校验出现异常"); + + these.sendEquipToMq(); } - - - - - let p2=new Promise((resolve,reject)=>{ + + + + + let p2 = new Promise((resolve, reject) => { let json = { "tenant_id": this.type.tenantId, "deviceType": this.type.deviceTypeId, "deviceName": item.name }; - + request({ - url:'/app/xinghan/device/GetDeviceByName', - data:json, + url: '/app/xinghan/device/GetDeviceByName', + data: json, method: 'POST' - }).then(res=>{ - if(res && res.code==200){ - - - resolve(res.data); - return; - - + }).then(res => { + if (res && res.code == 200) { + + + resolve(res.data); + return; + + } - + reject(res); - }).catch(ex=>{ + }).catch(ex => { reject(ex); }); }) - - Promise.any([p2]).then(res=>{ + + Promise.any([p2]).then(res => { succCallback(res); - }).catch(ex=>{ + + }).catch(ex => { errCallback(ex); + }).finally(() => { + }); }); }, + scan() { + uni.scanCode({ + success: (res) => { + console.log('条码内容:' + res.result); + + + let getUrlParams = (url) => { + var p = {}, + s = (url.indexOf('?') > -1 ? url.split('?')[1] : '').split('&'); + for (var i = 0; i < s.length; i++) { + if (!s[i]) continue; + var kv = s[i].split('='); + p[decodeURIComponent(kv[0])] = kv[1] ? decodeURIComponent(kv[1].replace( + /\+/g, ' ')) : ''; + } + return p; + } + + let json = getUrlParams(res.result); + if (!json.key) { + uni.showModal({ + title: '错误', + content: "无效的二维码" + }) + return; + } + this.scanKey = json.key; + let msg = { + scanResult: '已扫码', + scanCode: 200 + }; + mq.sendData('pc/' + json.key, JSON.stringify(msg), false); + uni.showModal({ + title: '授权申请', + content: 'pc端授权登陆', + confirmText: '同意', + cancelText: '拒绝', + showCancel: true, + success(res) { + if (res.confirm) { + these.pcAuthori(json); + return; + } + if (res.cancel) { + msg.scanResult = "用户拒绝授权"; + msg.scanCode = 500; + mq.sendData('pc/' + json.key, JSON.stringify(msg), false); + } + }, + + }) + + + + }, + fail: (err) => { + console.log('扫码失败', err); + uni.showToast({ + title: '扫码失败', + icon: 'none' + }); + } + }); + }, + pcAuthori() { //同意授权 + const token = 'Bearer ' + uni.getStorageSync('token'); + const clientid = uni.getStorageSync('clientID'); + const phone = uni.getStorageSync('phone'); + let msg = { + scanResult: '用户同意授权', + scanUsr: phone, + scanCode: 0, + Authorization: token, + clientid: clientid, + }; + console.log("同意授权", msg); + this.Status.pcAuthori = true; + mq.sendData('pc/' + this.scanKey, JSON.stringify(msg), false); + + these.sendEquipToMq(); + + + }, + sendEquipToMq() { + if (mq && this.scanKey) { + const phone = uni.getStorageSync('phone'); + setTimeout(() => { + mq.sendData('pc/' + phone, JSON.stringify({ + EquipMents: this.EquipMents + }), false); + }, 500); + } + }, ReSearch() { if (!ble) { return; } - + ble.disconnectDevice().finally(dis => { - + ble.StopSearch().finally(res => { - - this.EquipMents = []; + + setTimeout(()=>{ + this.EquipMents = []; this.PairEquip = []; ble.StartSearch().then(result => { - + }).catch(err => { console.error("err=", err); + MsgError("出现错误:" + err.msg, '', these); }); + },200); + }).catch(ex => { console.error("ex=", ex); + MsgError("出现错误:" + ex.msg, '', these); }); }); @@ -727,7 +937,7 @@ this.devices.push({ bluetooth_name: item.name, device_mac: item.macAddress, - device_name:item.name + device_name: item.name }); this.devicesCnt = this.devices.length; @@ -742,63 +952,31 @@ if (v.deviceId == item.deviceId) { this.$set(this.EquipMents[index], "isUpload", false); this.$set(this.EquipMents[index], "remark", res.msg); - - - this.devices.find((d,i)=>{ - if(d.device_mac==item.macAddress){ - - this.$set(this.EquipMents[index], "device_name", d.device_name); + + + this.devices.find((d, i) => { + if (d.device_mac == item.macAddress) { + + this.$set(this.EquipMents[index], "device_name", d + .device_name); return true; } }); - + return true; } return false; }); - + } - }) + }).catch(ex => {}).finally(() => { + these.sendEquipToMq(); + }); } time = setTimeout(exec, 100) }, - isItemLink: function(item, index, type) { - let src = '/static/images/BLEAdd/noLink.png'; - if (!item) { - - return src; - } - if (type == 'link') { - if (this.PairEquip && this.PairEquip.length) { - if (this.PairEquip.length > 0) { - let f = this.PairEquip.find(function(v) { - return v.deviceId == item.deviceId; - }); - if (f) { - src = '/static/images/BLEAdd/linked.png'; - } - } - - - } - } else if (type == 'mac') { - if (item.macAddress) { - src = '/static/images/BLEAdd/linked.png'; - } - } else if (type == 'imei') { - if (item.imei) { - src = '/static/images/BLEAdd/linked.png'; - } - } else if (type == 'upload') { - if (item.isUpload) { - src = '/static/images/BLEAdd/linked.png'; - } - } - - return src; - }, Link: function(item) { let exec = () => { @@ -848,6 +1026,9 @@ }).catch((ex) => { if (index == total) { console.log("连接了N次都没连上"); + updateLoading(this, { + text: ex.msg + }); reject(ex); return; } @@ -865,6 +1046,8 @@ execLink().then((res) => { linkCallback(res); + + these.sendEquipToMq(); }).catch(ex => { console.log("ex=", ex) uni.showModal({ @@ -1042,6 +1225,7 @@ width: 100%; height: calc(100% - 186rpx); overflow-y: scroll; + margin-top: 120rpx; } .list .item { @@ -1253,6 +1437,16 @@ animation: rotateClockwise 3s linear infinite; } + .topStatric { + width: 100%; + box-sizing: border-box; + padding: 30rpx; + position: fixed; + top: 0rpx; + z-index: 99; + background-color: #121212; + } + /* #ifdef H5 */ .topStatric { @@ -1274,17 +1468,13 @@ margin-top: 240rpx; } + .topStatric { + top: 90rpx + } + /* #endif */ - .topStatric { - width: 100%; - box-sizing: border-box; - padding: 30rpx; - position: fixed; - top: 0rpx; - z-index: 99; - background-color: #121212; - } + .uni-mt-5 { background-color: #000000; @@ -1293,4 +1483,22 @@ .uni-easyinput__content { background-color: #121212 !important; } + + .navbarRight .img { + width: 35rpx; + height: 35rpx; + margin-right: 20rpx; + } + + .uni-navbar--fixed { + top: 0rpx; + } + + /deep/ .uni-navbar--fixed { + top: 0px; + } + + /deep/ .uni-navbar__placeholder { + display: none !important; + } \ No newline at end of file diff --git a/pages/common/addScan/ScanEquip.vue b/pages/common/addScan/ScanEquip.vue index dc6bb27..ac99392 100644 --- a/pages/common/addScan/ScanEquip.vue +++ b/pages/common/addScan/ScanEquip.vue @@ -24,7 +24,7 @@ - + 对准二维码进行扫描 @@ -284,9 +284,10 @@ .btnOK { color: rgba(255, 255, 255, 0.6); font-family: 'PingFang SC'; - font-size: 30rpx; + font-size: 40rpx; font-weight: 400; letter-spacing: 5rpx; + margin-top: 20rpx; } .btnOK.active { diff --git a/pages/common/audioManager/AudioList.vue b/pages/common/audioManager/AudioList.vue index 1015b47..9f8267d 100644 --- a/pages/common/audioManager/AudioList.vue +++ b/pages/common/audioManager/AudioList.vue @@ -872,7 +872,7 @@ these.Status.Pop.showPop = true; }, showMsg(msg, isSucc) { - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { diff --git a/pages/common/audioManager/Recording.vue b/pages/common/audioManager/Recording.vue index d960fc5..1eeb44f 100644 --- a/pages/common/audioManager/Recording.vue +++ b/pages/common/audioManager/Recording.vue @@ -1206,7 +1206,7 @@ if (okCallback === undefined) { okCallback = null; } - let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png'; + let icoUrl = '/static/images/common/uploadErr.png'; let borderColor = "#e034344d"; let buttonBgColor = "#E03434"; if (isSucc) { diff --git a/pages/common/callPolice/index.vue b/pages/common/callPolice/index.vue index 920a09a..4df8bfc 100644 --- a/pages/common/callPolice/index.vue +++ b/pages/common/callPolice/index.vue @@ -363,7 +363,7 @@ } //统一通信协议方法 let CommonSend = () => { - let json=JSON.stringify({ins_ShakeBit:1}); + let json=JSON.stringify({ins_ShakeBit:isAlarming?1:0}); for (let i = 0; i < deviceImeiList.length; i++) { let imei = deviceImeiList[i]; mq.sendData("B/"+imei,json,false); diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 8b06b19..1fbee95 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -18,13 +18,10 @@ - + 报警 位置 - 发送信息 + 发送信息 -1 + ShowSendmessage() { + return this.dic.showMsgTypes.indexOf(this.activeTabInfo.typeName) > -1 }, - showMap(){ - return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName)>-1 + showMap() { + return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName) > -1 }, - showWarn(){ - return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName)>-1 + showWarn() { + return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName) > -1 } }, data() { @@ -254,10 +251,15 @@ deviceName: "", //重命名 activeTabInfo: '', dic: { - showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'],//需要发送消息的类型 - showMapTypes:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y'],//需要显示地图的类型 - showCallPolice:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y']//需要发送报警的类型 - } + showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'], //需要发送消息的类型 + showMapTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J', 'HBY008A', + 'HBY100-Y' + ], //需要显示地图的类型 + showCallPolice: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J', + 'HBY008A', 'HBY100-Y' + ] //需要发送报警的类型 + }, + isPageShow: true } }, methods: { @@ -299,8 +301,11 @@ this.updateBleStatu(); }, bleStateRecovery() { - console.log("蓝牙适配器恢复可用,重连断开的设备"); - if (ble && ble.linkAllDevices) ble.linkAllDevices(); + if (this.isPageShow) { + console.log("蓝牙适配器恢复可用,重连断开的设备"); + ble.linkAllDevices(); + } + }, bleBreak(res) { @@ -327,7 +332,7 @@ let f = null; if (ble.data && ble.data.LinkedList) { f = ble.data.LinkedList.find(v => { - if (!v) return false; + if (v.macAddress && v.device && v.device.id) { return v.device.id == this.deviceList[i].id; } @@ -738,8 +743,11 @@ .filter(Boolean); }, }, + onHide() { + this.isPageShow = false; + }, onShow() { - + this.isPageShow = true; if (ble) { //因为vue视图只能后退不能隐藏后再显示 //所以回到首页后将其他所有页面的订阅都删除 @@ -749,9 +757,6 @@ onLoad() { // console.error("首页加载"); - // 必须先初始化 ble:getTab/downCallback 会触发 updateBleStatu,否则会访问 null - ble = bleTool.getBleTool(); - recei = BleReceive.getBleReceive(); this.getTab() this.downCallback(); @@ -766,6 +771,8 @@ console.log('列表收到消息了么'); this.downCallback(); }); + ble = bleTool.getBleTool(); + recei = BleReceive.getBleReceive(); //蓝牙连接成功的回调 ble.addRecoveryCallback((res) => { // console.log("蓝牙连接成功的回调"); diff --git a/pages/common/user/index.vue b/pages/common/user/index.vue index 74d9807..a18efb8 100644 --- a/pages/common/user/index.vue +++ b/pages/common/user/index.vue @@ -77,6 +77,8 @@ import { Logout } from '@/api/common/login.js' + import bleTool from '@/utils/BleHelper.js'; + var ble=null; export default { data() { return { @@ -87,6 +89,7 @@ }, onLoad() { var these=this; + ble=bleTool.getBleTool(); uni.getSystemInfo({ success(res) { if(res.uniPlatform=='app'){ @@ -139,7 +142,12 @@ uni.showToast({ title: '退出成功', icon: 'success' - }) + }); + if(ble){ + ble.StopSearch().catch(ex => {}); + ble.disconnectDevice().catch(ex => {}); + } + uni.reLaunch({ url: '/pages/common/login/index' }); diff --git a/pages/common/user/logOff.vue b/pages/common/user/logOff.vue index 34ded02..628d251 100644 --- a/pages/common/user/logOff.vue +++ b/pages/common/user/logOff.vue @@ -2,7 +2,7 @@ - + 注销账号后账号将永久失效且不可恢复, diff --git a/static/images/6155/DeviceDetail/battry.png b/static/images/common/battry.png similarity index 100% rename from static/images/6155/DeviceDetail/battry.png rename to static/images/common/battry.png diff --git a/static/images/common/dl.png b/static/images/common/dl.png deleted file mode 100644 index 1e17edb..0000000 Binary files a/static/images/common/dl.png and /dev/null differ diff --git a/static/images/common/nz.png b/static/images/common/nz.png deleted file mode 100644 index 8b99e56..0000000 Binary files a/static/images/common/nz.png and /dev/null differ diff --git a/static/images/6155/DeviceDetail/time.png b/static/images/common/time.png similarity index 100% rename from static/images/6155/DeviceDetail/time.png rename to static/images/common/time.png diff --git a/static/images/6155/DeviceDetail/uploadErr.png b/static/images/common/uploadErr.png similarity index 100% rename from static/images/6155/DeviceDetail/uploadErr.png rename to static/images/common/uploadErr.png diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 6ac8be8..3d2b207 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -668,7 +668,7 @@ class BleHelper { BleReceive() { uni.onBLECharacteristicValueChange((receive) => { //订阅消息 - // console.log("收到订阅消息", receive); + console.log("收到订阅消息", receive); let f = this.data.LinkedList.find((v) => { return v.deviceId == receive.deviceId; }) @@ -909,7 +909,7 @@ class BleHelper { this.updateCache(); } - }, 500); + }, 100); }); @@ -1157,7 +1157,7 @@ class BleHelper { //停止搜索 StopSearch() { if (this.data.platform == 'web' || !this.data.discovering) { - console.error("web平台或当前没有搜索,直接返回"); + console.error("web平台或当前没有搜索,直接返回",this.data.discovering); return Promise.resolve(); } let p1 = new Promise((resolve, reject) => { diff --git a/utils/BleReceive.js b/utils/BleReceive.js index 6667509..a9175c7 100644 --- a/utils/BleReceive.js +++ b/utils/BleReceive.js @@ -14,7 +14,8 @@ class BleReceive { '/pages/100/HBY100': this.Receive_100.bind(this), '/pages/102/HBY102': this.Receive_102.bind(this), '/pages/6170/deviceControl/index':this.Receive_6170.bind(this), - '/pages/100J/HBY100-J': this.Receive_100J.bind(this) + '/pages/100J/HBY100-J': this.Receive_100J.bind(this), + '/pages/6075J/BJQ6075J':this.Receive_6075.bind(this) }; } @@ -910,7 +911,36 @@ Receive_6170(receive, f, path, recArr) { } + Receive_6075(receive,f,path,recArr){ + let receiveData = {}; + + try { + receiveData = JSON.parse(receive.str); + + let recCnt = recArr.find(v => { + return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl + .replace(/\//g, "").toLowerCase(); + }); + if (!recCnt) { + // if (receiveData.sta_PowerPercent <= 20) { + // uni.showModal({ + // title: "提示", + // content: "设备'" + f.device.deviceName + "'电量低", + // showCancel: false + // }); + // } + + + } + + } catch (error) { + receiveData = {}; + console.log("文本解析失败", error) + } + return receiveData; + + } } diff --git a/utils/Common.js b/utils/Common.js index acb048d..5c64780 100644 --- a/utils/Common.js +++ b/utils/Common.js @@ -282,7 +282,7 @@ export default { value: "46", label: "手动报警", checked: false, - type: ['210','102'] + type: ['210','102','6170'] }, { value: "47", diff --git a/utils/MsgPops.js b/utils/MsgPops.js index 295ba05..fd61c84 100644 --- a/utils/MsgPops.js +++ b/utils/MsgPops.js @@ -1,11 +1,12 @@ var MsgType = { error: "error", succ: "succ", - warn: "warn" + warn: "warn", + info:'info' } var time = null; // 显示成功 -export const MsgSuccess = (msg, btnTxt, ev) => { +export const MsgSuccess = (msg, btnTxt, ev,tapCallback) => { if (!ev) { @@ -15,13 +16,13 @@ export const MsgSuccess = (msg, btnTxt, ev) => { return null; } - let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.succ); + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.succ,tapCallback); createClear(ev); return option; } //显示失败 -export const MsgError = (msg, btnTxt, ev) => { +export const MsgError = (msg, btnTxt, ev,tapCallback) => { if (!ev) { @@ -32,12 +33,12 @@ export const MsgError = (msg, btnTxt, ev) => { return null; } - let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.error); + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.error,tapCallback); createClear(ev); return option; } //显示警告 -export const MsgWarning = (msg, btnTxt, ev, isClear) => { +export const MsgWarning = (msg, btnTxt, ev, isClear,tapCallback) => { if (!ev) { return null; @@ -46,7 +47,7 @@ export const MsgWarning = (msg, btnTxt, ev, isClear) => { return null; } - let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.warn); + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.warn,tapCallback); if (isClear === undefined || isClear) { createClear(ev); } @@ -55,7 +56,25 @@ export const MsgWarning = (msg, btnTxt, ev, isClear) => { } +//显示警告 +export const MsgInfo = (msg, btnTxt, ev, isClear,btnCallback) => { + if (!ev) { + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.info,btnCallback); + if (isClear === undefined || isClear) { + createClear(ev); + } + + return option; + + +} // 隐藏loading export const MsgClose = (options, ev) => { @@ -109,7 +128,7 @@ const createClear = (ev) => { showPop({ key: key, message: "消息太多, 是否全部关闭", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + iconUrl: "/static/images/common/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '全部关闭',