diff --git a/components/MessagePopup/MessagePopup.vue b/components/MessagePopup/MessagePopup.vue index 46291b3..8f3a628 100644 --- a/components/MessagePopup/MessagePopup.vue +++ b/components/MessagePopup/MessagePopup.vue @@ -48,7 +48,7 @@ {{ buttonCancelText?buttonCancelText:'取消' }} diff --git a/components/MsgBox/MsgBox.vue b/components/MsgBox/MsgBox.vue new file mode 100644 index 0000000..77e99f1 --- /dev/null +++ b/components/MsgBox/MsgBox.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/config/index.js b/config/index.js index d239f4a..6ec3377 100644 --- a/config/index.js +++ b/config/index.js @@ -2,7 +2,7 @@ const config = { // 开发环境 development: { - BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000 + BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000 API_PREFIX: '', // MQTT 配置 MQTT_HOST: 'www.cnxhyc.com', diff --git a/pages.json b/pages.json index 8ee4097..9b578b8 100644 --- a/pages.json +++ b/pages.json @@ -414,6 +414,14 @@ { "navigationBarTitleText" : "录制语音" } + }, + { + "path" : "pages/common/addScan/ScanEquip", + "style" : + { + "navigationBarTitleText" : "扫码", + "navigationStyle": "custom" + } } diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue index eff28dd..824c995 100644 --- a/pages/100/HBY100.vue +++ b/pages/100/HBY100.vue @@ -736,7 +736,7 @@ for (let i = 0; i < header.length; i++) { dataView.setUint8(i, header[i]); } - console.log("curr=" + curr + "orderNo=", orderNo); + // console.log("curr=" + curr + "orderNo=", orderNo); dataView.setUint8(14, '0x' + orderNo.substring(0, 2)); dataView.setUint8(15, '0x' + orderNo.substring(2, 4)); @@ -764,7 +764,7 @@ }); } - console.log("发送成功," + curr + "/" + total); + // console.log("发送成功," + curr + "/" + total); this.Status.curr = curr; curr++; diff --git a/pages/6107/BJQ6107.vue b/pages/6107/BJQ6107.vue index d8995ed..ce0f426 100644 --- a/pages/6107/BJQ6107.vue +++ b/pages/6107/BJQ6107.vue @@ -976,7 +976,7 @@ buttonBgColor: "#BBE600" }, warn: { - icoUrl: '/static/images/6170/svg.png', + icoUrl: '/static/images/common/warning.png', borderColor: "#FFC84E", buttonBgColor: "#FFC84E", } diff --git a/pages/common/addScan/ScanEquip.vue b/pages/common/addScan/ScanEquip.vue new file mode 100644 index 0000000..dbfbe51 --- /dev/null +++ b/pages/common/addScan/ScanEquip.vue @@ -0,0 +1,396 @@ + + + + + \ No newline at end of file diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index c97172c..52b40f7 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -497,54 +497,57 @@ import BleReceive from '@/utils/BleReceive'; switch (item.action) { case 'scan': // 扫一扫 - uni.scanCode({ - autoDecodeCharset:true, - autoZoom:true, - barCodeInput:true, - success: (res) => { - console.log('条码内容:', res); - // 清除之前的数据 - this.previousScanResult = null; - // 处理新的扫码结果 - const cleanedResult = res.result.trim(); - console.log('扫码结果:', cleanedResult); - let url = - `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`; - try { - let json = JSON.parse(cleanedResult); - if ('imei' in json) { - url = - `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`; - } else if ('blue' in json || 'ble' in json) { - if(json.ble){ - json.blue=json.ble; - } - if(json.blue){ - if (!json.blue.includes(':')) { - json.blue = json.blue.replace( - /(.{2})/g, '$1:') - .slice(0, -1) - } - } - - url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`; - } - } catch (ex) { - - } - // 跳转并传递扫描结果 - uni.navigateTo({ - url: url - }); - }, - fail: (err) => { - console.log('扫码失败', err); - uni.showToast({ - title: '扫码失败', - icon: 'none' - }); - } + uni.navigateTo({ + url:'/pages/common/addScan/ScanEquip' }); + // uni.scanCode({ + // autoDecodeCharset:true, + // autoZoom:true, + // barCodeInput:true, + // success: (res) => { + // console.log('条码内容:', res); + // // 清除之前的数据 + // this.previousScanResult = null; + // // 处理新的扫码结果 + // const cleanedResult = res.result.trim(); + // console.log('扫码结果:', cleanedResult); + // let url = + // `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`; + // try { + // let json = JSON.parse(cleanedResult); + // if ('imei' in json) { + // url = + // `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`; + // } else if ('blue' in json || 'ble' in json) { + // if(json.ble){ + // json.blue=json.ble; + // } + // if(json.blue){ + // if (!json.blue.includes(':')) { + // json.blue = json.blue.replace( + // /(.{2})/g, '$1:') + // .slice(0, -1) + // } + // } + + // url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`; + // } + // } catch (ex) { + + // } + // // 跳转并传递扫描结果 + // uni.navigateTo({ + // url: url + // }); + // }, + // fail: (err) => { + // console.log('扫码失败', err); + // uni.showToast({ + // title: '扫码失败', + // icon: 'none' + // }); + // } + // }); break; case 'bluetooth': uni.navigateTo({ diff --git a/static/images/common/scan.png b/static/images/common/scan.png index 93e40fe..591d48f 100644 Binary files a/static/images/common/scan.png and b/static/images/common/scan.png differ diff --git a/static/images/common/warning.png b/static/images/common/warning.png new file mode 100644 index 0000000..fd4fce9 Binary files /dev/null and b/static/images/common/warning.png differ diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 49fcec1..8f35d96 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -784,18 +784,18 @@ class BleHelper { if (this.cfg.receivDataCallback.length > 0) { - // console.log("有人订阅消息") + console.log("有人订阅消息") this.cfg.receivDataCallback.forEach(( rec) => { - // console.log("有人订阅消息111", ) + console.log("有人订阅消息111", ) if (rec.callback) { try { - // console.log("正在处理订阅消息",rec); + console.log("正在处理订阅消息",rec); rec.callback(recData, f, rec.key, this.cfg .receivDataCallback ); - // console.log("处理订阅消息完毕"); + console.log("处理订阅消息完毕"); } catch (err) { console.error( "订阅消息出现异常", diff --git a/utils/MsgPops.js b/utils/MsgPops.js new file mode 100644 index 0000000..295ba05 --- /dev/null +++ b/utils/MsgPops.js @@ -0,0 +1,162 @@ +var MsgType = { + error: "error", + succ: "succ", + warn: "warn" +} +var time = null; +// 显示成功 +export const MsgSuccess = (msg, btnTxt, ev) => { + + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.succ); + + createClear(ev); + return option; +} +//显示失败 +export const MsgError = (msg, btnTxt, ev) => { + + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.error); + createClear(ev); + return option; +} +//显示警告 +export const MsgWarning = (msg, btnTxt, ev, isClear) => { + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.warn); + if (isClear === undefined || isClear) { + createClear(ev); + } + + return option; + + +} + + +// 隐藏loading +export const MsgClose = (options, ev) => { + + + if (!ev) { + + return; + } + if (!ev.$refs.msgPop) { + + return; + } + if (typeof(options) == 'string') { + options = { + key: options + } + } + ev.$refs.msgPop.closePop(options); + +} + + + +export const showPop = (options, ev, isClear) => { + + + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + let option = ev.$refs.msgPop.showPop(options); + + if (isClear === undefined || isClear) { + createClear(ev); + } + + return option; +} + +const createClear = (ev) => { + let cnt = getPops(ev); + if (cnt >= 5) { + clearTimeout(time); + time = setTimeout(() => { + let key = new Date().getTime(); + showPop({ + key: key, + message: "消息太多, 是否全部关闭", + iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + borderColor: "#e034344d", + buttonBgColor: "#E03434", + buttonText: '全部关闭', + buttonTextColor: '#232323de', + showCancel: true, + buttonCancelText: "取消", + cancelCallback: () => { + + MsgClose(key, ev); + }, + okCallback: function() { + + MsgClear(ev); + } + + }, ev, false); + }, 500); + + + } +} + +//获取当前弹窗数量 +export const getPops = (ev) => { + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + return ev.$refs.msgPop.getPops(); + +} + + +//清空所有弹窗 +export const MsgClear = (ev) => { + if (!ev) { + + return null; + } + if (!ev.$refs.msgPop) { + + return null; + } + return ev.$refs.msgPop.clearPops(); + +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index c56423a..1ac57fc 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,5 +1,5 @@ import config from '../config/index.js'; -export const env = 'development'; //production development //开发of线上 改这里就行 +export const env = 'production'; //production development //开发of线上 改这里就行 const BASE = config[env]; const request = (options) => { console.log("options" + JSON.stringify(options), BASE.BASE_URL)