From 7cbdc00ae0d896613ea8b5b774571ee6fd806a25 Mon Sep 17 00:00:00 2001 From: liub Date: Thu, 5 Feb 2026 10:15:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E5=B0=81=E8=A3=85Msg?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=89=AB=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=AD=E8=BD=AC=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/MessagePopup/MessagePopup.vue | 2 +- components/MsgBox/MsgBox.vue | 187 +++++++++++ config/index.js | 2 +- pages.json | 8 + pages/100/HBY100.vue | 4 +- pages/6107/BJQ6107.vue | 2 +- pages/common/addScan/ScanEquip.vue | 396 +++++++++++++++++++++++ pages/common/index/index.vue | 97 +++--- static/images/common/scan.png | Bin 286 -> 2417 bytes static/images/common/warning.png | Bin 0 -> 1483 bytes utils/BleHelper.js | 8 +- utils/MsgPops.js | 162 ++++++++++ utils/request.js | 2 +- 13 files changed, 813 insertions(+), 57 deletions(-) create mode 100644 components/MsgBox/MsgBox.vue create mode 100644 pages/common/addScan/ScanEquip.vue create mode 100644 static/images/common/warning.png create mode 100644 utils/MsgPops.js 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 93e40fe1ba8d047947119561bdf68d5a12407b3b..591d48f4c7bbfec6f0b7468a0015a517773f380e 100644 GIT binary patch literal 2417 zcmeAS@N?(olHy`uVBq!ia0vp^2Y`4p2OE&QpCz2Zz`$wY>Eakt!T9z8;{+AYNh+Q~ z-K%Eqc6V_}OG^t21%h%A_3%uZI5T{(CF-&$J_J*Vo&=Km6HgkHG#aasTZ<=b7)C zc>dX{)&InQZQcDtw=+8af7QMA=dBQb<$bozFHxRv-E5#g;$K{U_h`FHUM-4u&wk%?vA4!7JoYOvOzs}d_q_A#*Y(eK zHu^`nKdvtSSTg&47ujwv0(;<<>>iT? z()W(Uf8HYiH1WUqBcQwgJApzcz60ol|J;Q@b@hrs)Bfup0lN8r>keSZ>>pJ;8XD9| z8~h(`s>%J{ar|2Qyof7nU-O?TSh+rUrD^!;S%F#G4X4U@Z9VpCWk~j_u#oLxfmZ^= zrd;jvI-QlOy4bC7rjd4$YOG^uk>k20t1pZ0To&W0RkSshldDX1<%&=r-xZU%0}8L1 zi0t-m|i4|jT-zx)uvm5{!fGa*} zJl=Qk)rng-8?R10%2(ojM6ATSTQ@>KP*==Bmm@*r8k+&jErzxY45y?vHYE0XMKG8O z91zIh>uF^0QfN@hmbsS1W}Lvo62NwZ=a}Hxs(xEbPMedyL-P#|M7z3*O9+G^0JQhhuhl?W^}!CkPW(>&~lUBY9I``kKwhUEv3`tGR|yw9cc?x;W8uk;5; znf@P*pU}|w#I<>clLM>O0;Yq&qUHUh11voUSZ35qKI&qyO5pqA@DNxSm3t;IgdJc| z`EPVYlu7FXv#bE9aMI)SIl$oK@JZh}M$y560jzzB0~6bs{X8G%fXb=&X>ldPv;b@U z@pbplbvb{|0n6=jNImpQwq|Qn^!*2H`(_P_dS)D z*5T;SP8@PNAMYY+?K*M!t7ka>u^QR`Z8QIP9hkm=HRsOm?Z@_*{1^Io9jyQJBY8&6 XHor@SO&u}7rWAvxtDnm{r-UW|6E0*x literal 286 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r63?ysp-_HY5`~f~8u0Z-f66kljmjM)FEeY}q zW|*nwTfE7l8Kh;Wr;B5V$MLt<&hj=J@USK@OD^b7W2m!YP+;@8^|ySLNAIeADnaYl z{<$mDRO6B3-m`L+GGBKaU+4Xnl8Tq6aSO!)zdT%3$fCPKOzXv=j>`vTzQ63~7i?6V zw_MZ6@M%T%1@DU;-MN1{d;K2wJm%iXAGED=qS>ND#iC)XRt>A3{=VY&?AAov9medM zS!>?@z3s-X@2br-{dJhstnF*K9Gh#O8=h&t8$8GNZr`<+D<|079eUn>&ua6^Y9=-@ WRlDNb@0fs|VDNPHb6Mw<&;$UgnR!$I diff --git a/static/images/common/warning.png b/static/images/common/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4fce98fbf24909039b718ef7e0c6e2c67eed3b GIT binary patch literal 1483 zcmV;+1vL7JP)V3(S77&i|UDd>+@PnA4)6KjNeH__7d6GSL!If6%RNU zNKc;)M6w}KBvw&lkswybuP5RVCju4K@--WXmXU~r;+9kt@A)a1xTq?HSw&AzPH`g< zIlz2!i;dLrn^$;iSQDsdxS75rI^?lKR3d?TX{)hY5$LXJF0gIl%tkeBBv8?7z7$mx z@wkPkSoYP6O?uPX0^N!8mgtbjEk?}{>FK&6ttHUB-(;@|L-{dCB?z9a)0Y(1ih1Q^ z?+HWsu}Ebh;Wqw4^7za5d<%RoKEmr^Z|wUxtw zV&nE(923=||B52f#m3Y=H7jbhK+}^OTqrJRv69iCM`CRSTOp;29^s8B%!t!bn=>J? z2ww{W72^h&8!D=~Tp-s;wOHz@poC0&gl^FCC%Fv8fKi~k=KPV+DO8a0{oli2X`Ea3 zgNLRgh%rGA(`$|n9?>9EsepwdWTChrbW6!JGYd35xxk%bZqdP01WKd=1nMKuTSC{o zqN306_b3s__O7*r1}ho;XGE6ggpN@&cGgD(_b3s_!<^5lXpRdIXiS#R37ta)t?04x z4TrndRT`{h2$YazkI+4ap13NIzd4_C%cwoXmqImv#2sMnG4w=}Ktlw&B=kec@|xpo zyYVlEV~0T?Urq52!>BD_u=)(vTS7k=7LD!&s35#s~ZZND~-$Nyj$nu=f4O)Fr zPbQ(1P$Q7zy~tJww7Lgdrdpt)S?iSOfw-V^fz&51>JJD?sT3&3>77jH0+ruIEvOYJ zha?j|*(0<|mjY?I;@y3zp_xFg4zOJc)bRh48VQu+WU6&0Q2o?e&{&`x&S)`ifZ3rN zfhL@}B77s-2~@0VSt9mM`Y9=3Rp?MeLb1a&M~c4bNKuBuT2YAfS!#}Z8uxCJHos|Fp002ovPDHLkV1oFWtAYRk literal 0 HcmV?d00001 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)