From 2be522977cee1036a90f482460b88caaaaf99554 Mon Sep 17 00:00:00 2001 From: liub Date: Tue, 10 Mar 2026 14:07:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=8A=A5=E8=AD=A6=E3=80=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=88=86=E4=BE=9B=E5=BA=94=E5=95=86=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 84 +- pages.json | 25 +- pages/6075/BJQ6075.vue | 2 +- pages/6075J/BJQ6075J.vue | 2 +- pages/6155/BJQ6155.vue | 2 +- pages/6155/ImgCrop.vue | 100 -- pages/6155/deviceDetail.vue | 2 +- pages/6170/deviceControl/index.vue | 2 +- pages/650/HBY650.vue | 2 +- pages/670/HBY670.vue | 2 +- pages/7305/BJQ7305.vue | 2 +- pages/common/ImgCrop/ImgCrop.vue | 100 ++ pages/{6170 => common}/callPolice/index.vue | 1079 ++++++++++--------- pages/common/index/index.vue | 94 +- pages/common/send/index.vue | 786 ++++++++------ 15 files changed, 1273 insertions(+), 1011 deletions(-) create mode 100644 pages/common/ImgCrop/ImgCrop.vue rename pages/{6170 => common}/callPolice/index.vue (71%) diff --git a/App.vue b/App.vue index faaf989..a21853c 100644 --- a/App.vue +++ b/App.vue @@ -30,43 +30,41 @@ //以上代码仅在开发时使用,否则会出现不可预知的问题。 // #ifdef APP|APP-PLUS - - bleTool.getBleTool(); - - var appid = plus.runtime.appid; - console.log('应用的 appid 为:' + appid); - + if (plus.runtime.isAgreePrivacy()) { + + + bleTool.getBleTool(); - uni.getPushClientId({ - success(res) { - console.log("推送信息:", res); - uni.setStorageSync('push_cid', res.cid); - }, - fail(err) { - console.error(err) + uni.getPushClientId({ + success(res) { + console.log("推送信息:", res); + uni.setStorageSync('push_cid', res.cid); + }, + fail(err) { + console.error(err) + } + }); + if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法 + uni.setAppBadgeNumber = plus.runtime.setBadgeNumber; } - }); - if(!uni.setAppBadgeNumber){//兼容鸿蒙的写法 - uni.setAppBadgeNumber=plus.runtime.setBadgeNumber; - } - uni.onPushMessage((res) => { - console.log("收到推送消息:", res); //监听推送消息 - if(res.type=='click'){ - //将App角标设置为0,清空app在消息中心的所有消息 - uni.setAppBadgeNumber(0); - plus.push.clear(); - return; - } - uni.createPushMessage({ - title: res.data.title, - content: res.data.content, - payload:res.data.payload + uni.onPushMessage((res) => { + console.log("收到推送消息:", res); //监听推送消息 + if (res.type == 'click') { + //将App角标设置为0,清空app在消息中心的所有消息 + uni.setAppBadgeNumber(0); + plus.push.clear(); + return; + } + uni.createPushMessage({ + title: res.data.title, + content: res.data.content, + payload: res.data.payload + }); + }); - }); - - + } // #endif }, @@ -74,18 +72,15 @@ console.log('App Show'); //将检查更新换到onshow,因为苹果用户喜欢一直挂着 - uni.getSystemInfo({ - success: function(res) { - if (res.uniPlatform == 'app') { - - let appid = plus.runtime.appid; - if (appid !== 'HBuilder') { - console.log("appid=", appid); - upgrade.checkAndUpdateWgt(); - } - } - } - }); + // #ifdef APP|APP-PLUS + + let appid = plus.runtime.appid; + console.log("appid=", appid); + + if (appid !== 'HBuilder') { + upgrade.checkAndUpdateWgt(); + } + // #endif }, onHide: function() { console.log('App Hide'); @@ -212,5 +207,4 @@ font-family: "PingFangBold"; src: url("~@/static/fonts/PingFangBold.ttf") format("opentype"); } - \ No newline at end of file diff --git a/pages.json b/pages.json index 8bc5df7..64d3058 100644 --- a/pages.json +++ b/pages.json @@ -52,8 +52,7 @@ { "path": "pages/common/send/index", "style": { - "navigationBarTitleText": "发送信息", - "enablePullDownRefresh": true + "navigationBarTitleText": "发送信息" } }, { @@ -102,10 +101,9 @@ } }, { - "path": "pages/6170/callPolice/index", + "path": "pages/common/callPolice/index", "style": { - "navigationBarTitleText": "报警", - "enablePullDownRefresh": true + "navigationBarTitleText": "报警" } }, @@ -160,14 +158,7 @@ "navigationStyle": "custom" } }, - { - "path": "pages/6155/ImgCrop", - "style": { - "navigationBarTitleText": "图像裁剪", - "navigationStyle": "custom", - "fullscreen": true - } - }, + { "path": "pages/6075/BJQ6075", "style": { @@ -447,6 +438,14 @@ { "navigationStyle": "custom" } + }, + { + "path": "pages/common/ImgCrop/ImgCrop", + "style": { + "navigationBarTitleText": "图像裁剪", + "navigationStyle": "custom", + "fullscreen": true + } } ], diff --git a/pages/6075/BJQ6075.vue b/pages/6075/BJQ6075.vue index a61429b..3e4d8dc 100644 --- a/pages/6075/BJQ6075.vue +++ b/pages/6075/BJQ6075.vue @@ -679,7 +679,7 @@ } let that = this; uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOverPath: function(data) { that.selectedImage = data.picPath; diff --git a/pages/6075J/BJQ6075J.vue b/pages/6075J/BJQ6075J.vue index 20b4efa..8115957 100644 --- a/pages/6075J/BJQ6075J.vue +++ b/pages/6075J/BJQ6075J.vue @@ -1145,7 +1145,7 @@ sourceType: ['album'], success: function(res) { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { diff --git a/pages/6155/BJQ6155.vue b/pages/6155/BJQ6155.vue index 8cc8ad8..72f80b0 100644 --- a/pages/6155/BJQ6155.vue +++ b/pages/6155/BJQ6155.vue @@ -909,7 +909,7 @@ sourceType: ['album'], success: function(res) { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { diff --git a/pages/6155/ImgCrop.vue b/pages/6155/ImgCrop.vue index c6209ea..e69de29 100644 --- a/pages/6155/ImgCrop.vue +++ b/pages/6155/ImgCrop.vue @@ -1,100 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index 714ed14..1170edb 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -926,7 +926,7 @@ sourceType: ['album'], success: function(res) { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 903511c..c18438c 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -979,7 +979,7 @@ } let that = this; uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { that.selectedImage = data.picPath; diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue index eadbee2..6742974 100644 --- a/pages/650/HBY650.vue +++ b/pages/650/HBY650.vue @@ -1051,7 +1051,7 @@ import request, { baseURL } from '@/utils/request.js'; var gotoCutImg = (imgPath) => { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { // console.log("我收到裁剪后的图片了,感谢老铁," + data) diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index feec97b..91addfe 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -1871,7 +1871,7 @@ var gotoCutImg = (imgPath) => { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { // console.log("我收到裁剪后的图片了,感谢老铁," + data) diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue index d7021ca..0daf510 100644 --- a/pages/7305/BJQ7305.vue +++ b/pages/7305/BJQ7305.vue @@ -783,7 +783,7 @@ sourceType: ['album'], success: function(res) { uni.navigateTo({ - url: "/pages/6155/ImgCrop", + url: "/pages/ImgCrop/ImgCrop", events: { ImgCutOver: function(data) { //将8位的二进制数组转换成16进制数据 diff --git a/pages/common/ImgCrop/ImgCrop.vue b/pages/common/ImgCrop/ImgCrop.vue new file mode 100644 index 0000000..0f68d84 --- /dev/null +++ b/pages/common/ImgCrop/ImgCrop.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/pages/6170/callPolice/index.vue b/pages/common/callPolice/index.vue similarity index 71% rename from pages/6170/callPolice/index.vue rename to pages/common/callPolice/index.vue index 0f3dec1..7a11efb 100644 --- a/pages/6170/callPolice/index.vue +++ b/pages/common/callPolice/index.vue @@ -1,497 +1,584 @@ - - - - - \ No newline at end of file diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 4c7b7b2..d384bde 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -18,13 +18,16 @@ - - - + 报警 + 位置 + 发送信息 + + + @@ -40,15 +43,15 @@ 设备:{{item.deviceName}} - ID:{{item.deviceImei}} + + ID:{{item.deviceImei}} ID:{{item.deviceMac}} - 在线 + 在线 - 离线 + 离线 电量:{{item.battery || '0'}}% @@ -74,7 +77,7 @@ 暂无数据 --> - + @@ -116,7 +119,7 @@ - + {{ item.text }} @@ -146,17 +149,34 @@ } from '@/api/common/index.js' import bleTool from '@/utils/BleHelper.js'; import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue' -import BleReceive from '@/utils/BleReceive'; + import BleReceive from '@/utils/BleReceive'; var pagePath = 'pages/common/index'; var ble = null; var timeout = null; - var recei=null; + var recei = null; export default { components: { MescrollUni }, - + computed:{ + showSendFlex(){ + // return this.activeTab && this.activeTab.id !== ''&& (this.activeTabInfo.communicationMode==0 || this.activeTabInfo.communicationMode==2); + if(this.showMap || this.ShowSendmessage || this.showWarn){ + return true; + } + return false; + }, + ShowSendmessage(){ + return this.dic.showMsgTypes.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 + } + }, data() { return { mescroll: null, @@ -187,8 +207,7 @@ import BleReceive from '@/utils/BleReceive'; navTitle: "我的设备", deleteShow: false, RenameModel: false, - menuItems: [ - { + menuItems: [{ text: '扫一扫添加', icon: '/static/images/common/scane.png', action: 'scan' @@ -233,7 +252,12 @@ import BleReceive from '@/utils/BleReceive'; deviceId: '', deviceName: "", //重命名 - activeTabInfo: '' + 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']//需要发送报警的类型 + } } }, methods: { @@ -254,7 +278,7 @@ import BleReceive from '@/utils/BleReceive'; // 下拉刷新 downCallback() { - + if (this.mescroll) { this.mescroll.resetUpScroll(false); this.mescroll.scrollTo(0, 0); @@ -266,7 +290,7 @@ import BleReceive from '@/utils/BleReceive'; // 上拉加载 upCallback() { - + this.getData(); }, @@ -387,7 +411,7 @@ import BleReceive from '@/utils/BleReceive'; if (res.code == 200) { //console.log("deviceTypeList=" + JSON.stringify(res.data)); this.tabs = [{ - id: '', + id: '', name: '全部设备', typeName: '全部设备' }, @@ -412,7 +436,7 @@ import BleReceive from '@/utils/BleReceive'; getData() { var task = () => { - + return new Promise((resolve, reject) => { let data = { pageNum: this.mescroll.num, @@ -496,9 +520,9 @@ import BleReceive from '@/utils/BleReceive'; case 'scan': // 扫一扫 uni.navigateTo({ - url:'/pages/common/addScan/ScanEquip' + url: '/pages/common/addScan/ScanEquip' }); - + break; case 'bluetooth': uni.navigateTo({ @@ -619,7 +643,7 @@ import BleReceive from '@/utils/BleReceive'; const deviceType = currentTab.id || ''; console.log(`跳转到发送信息页面\n当前设备类型: ${deviceType}\n设备类型名称: ${currentTab.typeName}`); uni.navigateTo({ - url: '/pages/6170/callPolice/index', + url: '/pages/common/callPolice/index', events: { ack: function(data) {} }, @@ -666,7 +690,7 @@ import BleReceive from '@/utils/BleReceive'; // 列表跳转 handleFile(item) { let url = item.detailPageUrl; - // url="/pages/6075/BJQ6075L"; + // url="/pages/6075/BJQ6075L"; // if(!url){ // url="/pages/6075/BJQ6075" // } @@ -715,7 +739,7 @@ import BleReceive from '@/utils/BleReceive'; }, }, onShow() { - + if (ble) { //因为vue视图只能后退不能隐藏后再显示 //所以回到首页后将其他所有页面的订阅都删除 @@ -723,12 +747,12 @@ import BleReceive from '@/utils/BleReceive'; } }, onLoad() { - + // console.error("首页加载"); this.getTab() this.downCallback(); - - + + // 绑定页面做了监听,新增成功,刷新页面 uni.$on('refreshDeviceList', () => { this.getTab() // 刷新数据 @@ -771,9 +795,9 @@ import BleReceive from '@/utils/BleReceive'; recei.ReceiveData(receive, device, path, recArr); this.updateBleStatu(); }, pagePath); - - let phone=uni.getStorageSync("phone"); - if(phone==='17671332251'){//先写死方便自己使用,后面按人员权限区分 + + let phone = uni.getStorageSync("phone"); + if (phone === '17671332251') { //先写死方便自己使用,后面按人员权限区分 this.menuItems.push({ text: '上报设备', icon: '/static/images/common/add.png', diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index f064c70..bd4d85c 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -1,11 +1,12 @@