diff --git a/config/index.js b/config/index.js
index a655ae5..e977462 100644
--- a/config/index.js
+++ b/config/index.js
@@ -6,7 +6,7 @@ const config = {
API_PREFIX: '',
// MQTT 配置
MQTT_HOST: '47.120.79.150',
- MQTT_PORT: 8083,
+ MQTT_PORT: 9083,
MQTT_USERNAME: 'admin',
MQTT_PASSWORD: '#YtvpSfCNG'
},
@@ -16,7 +16,7 @@ const config = {
API_PREFIX: '',
// MQTT 配置
MQTT_HOST: '47.120.79.150',
- MQTT_PORT: 8083,
+ MQTT_PORT: 9083,
MQTT_USERNAME: 'admin',
MQTT_PASSWORD: '#YtvpSfCNG'
}
diff --git a/pages.json b/pages.json
index 945622f..0f32fea 100644
--- a/pages.json
+++ b/pages.json
@@ -1,197 +1,222 @@
{
- "pages": [
-
-
- {
- "path": "pages/common/login/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
-
-
-
-
- {
- "path": "pages/common/index/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/common/user/index",
- "style": {
- "navigationBarTitleText": "我的"
- }
- },
- {
- "path": "pages/common/scan/scan",
- "style": {
- "navigationBarTitleText": "扫描"
- }
- },
- {
- "path": "pages/common/qrcode/qrcode",
- "style": {
- "navigationBarTitleText": "扫描到的设备"
- }
- },
- {
- "path": "pages/common/send/index",
- "style": {
- "navigationBarTitleText": "发送信息"
- }
- },
- {
- "path": "pages/common/userAgreement/index",
- "style": {
- "navigationBarTitleText": "用户协议"
- }
- },
- {
- "path": "pages/common/privacyAgreement/index",
- "style": {
- "navigationBarTitleText": "隐私协议"
- }
- },
- {
- "path": "pages/common/aboutUs/index",
- "style": {
- "navigationBarTitleText": "关于我们"
- }
- },
- {
- "path": "pages/6170/deviceControl/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/common/operationVideo/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/common/addvideo/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- // 操作说明
- {
- "path": "pages/common/operatingInstruct/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- // 产品说明
- {
- "path": "pages/common/productDes/index",
- "style": {
- "navigationStyle": "custom"
- }
- },
- {
- "path" : "pages/common/addBLE/addEquip",
- "style" :
- {
- "navigationBarTitleText" : "添加设备"
- }
- },
- {
- "path" : "pages/common/addBLE/LinkBle",
- "style" :
- {
- "navigationBarTitleText" : "扫描到的设备"
- }
- },
- {
- "path" : "pages/6155/deviceDetail",
- "style" :
- {
- "navigationBarTitleText" : "HBY 6155"
- }
- },
- {
- "path" : "pages/6155/ImgCrop",
- "style" :
- {
- "navigationBarTitleText" : "图像裁剪",
- "navigationStyle": "custom",
- "fullscreen": true
- }
- },
- {
- "path" : "pages/650/HBY650",
- "style" :
- {
- "navigationBarTitleText" : "HBY650"
- }
- },
- {
- "path": "pages/common/map/index",
- "style": {
- "navigationBarTitleText": "地图"
- }
- },
- {
- "path": "pages/common/allType/index",
- "style": {
- "navigationBarTitleText": "所有类型"
- }
- },
- {
- "path": "pages/6170/allShare/index",
- "style": {
- "navigationBarTitleText": "所有分享"
- }
- },
-
- {
- "path": "pages/6170/share/index",
- "style": {
- "navigationBarTitleText": "分享"
- }
- },
- {
- "path": "pages/6170/shareDevices/index",
- "style": {
- "navigationBarTitleText": "分享设备"
- }
- },
- {
- "path": "pages/6170/shareManagement/index",
- "style": {
- "navigationBarTitleText": "分享管理"
- }
- }
-
-
- ],
- "tabBar": {
- "color": "#fff",
- "selectedColor": "#BBE600",
- "backgroundColor": "#202020",
- "list": [{
- "pagePath": "pages/common/index/index",
- "text": "我的设备",
- "iconPath": "/static/tabs/device.png",
- "selectedIconPath": "/static/tabs/device-HL.png"
- },
- {
- "pagePath": "pages/common/user/index",
- "text": "我的",
- "iconPath": "/static/tabs/my.png",
- "selectedIconPath": "/static/tabs/my-HL.png"
- }
- ]
- },
- "globalStyle": {
- "navigationBarTextStyle": "white",
- "navigationBarTitleText": "uni-app",
- "navigationBarBackgroundColor": "#121212",
- "backgroundColor": "#121212"
- },
- "uniIdRouter": {}
+ "pages": [
+ {
+ "path": "pages/common/login/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/index/index",
+ "style": {
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
+ }
+ },
+ {
+ "path": "pages/common/user/index",
+ "style": {
+ "navigationBarTitleText": "我的"
+ }
+ },
+ {
+ "path": "pages/common/scan/scan",
+ "style": {
+ "navigationBarTitleText": "扫描"
+ }
+ },
+ {
+ "path": "pages/common/qrcode/qrcode",
+ "style": {
+ "navigationBarTitleText": "扫描到的设备"
+ }
+ },
+ {
+ "path": "pages/common/send/index",
+ "style": {
+ "navigationBarTitleText": "发送信息",
+ "enablePullDownRefresh": true
+ }
+ },
+ {
+ "path": "pages/common/userAgreement/index",
+ "style": {
+ "navigationBarTitleText": "用户协议"
+ }
+ },
+ {
+ "path": "pages/common/privacyAgreement/index",
+ "style": {
+ "navigationBarTitleText": "隐私协议"
+ }
+ },
+ {
+ "path": "pages/common/aboutUs/index",
+ "style": {
+ "navigationBarTitleText": "关于我们"
+ }
+ },
+ {
+ "path": "pages/6170/deviceControl/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/6170/callPolice/index",
+ "style": {
+ "navigationBarTitleText": "报警"
+ }
+ },
+ {
+ "path": "pages/210/deviceControl/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/operationVideo/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/addvideo/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ // 操作说明
+ {
+ "path": "pages/common/operatingInstruct/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ // 产品说明
+ {
+ "path": "pages/common/productDes/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/addBLE/addEquip",
+ "style": {
+ "navigationBarTitleText": "添加设备"
+ }
+ },
+ {
+ "path": "pages/common/addBLE/LinkBle",
+ "style": {
+ "navigationBarTitleText": "扫描到的设备"
+ }
+ },
+ {
+ "path": "pages/6155/deviceDetail",
+ "style": {
+ "navigationBarTitleText": "HBY 6155"
+ }
+ },
+ {
+ "path": "pages/6155/ImgCrop",
+ "style": {
+ "navigationBarTitleText": "图像裁剪",
+ "navigationStyle": "custom",
+ "fullscreen": true
+ }
+ },
+ {
+ "path": "pages/650/HBY650",
+ "style": {
+ "navigationBarTitleText": "HBY650"
+ }
+ },
+ {
+ "path": "pages/common/map/index",
+ "style": {
+ "navigationBarTitleText": "地图"
+ }
+ },
+ {
+ "path": "pages/common/allType/index",
+ "style": {
+ "navigationBarTitleText": "所有类型"
+ }
+ },
+ {
+ "path": "pages/6170/allShare/index",
+ "style": {
+ "navigationBarTitleText": "所有分享"
+ }
+ },
+ {
+ "path": "pages/6170/share/index",
+ "style": {
+ "navigationBarTitleText": "分享"
+ }
+ },
+ {
+ "path": "pages/6170/shareDevices/index",
+ "style": {
+ "navigationBarTitleText": "分享设备"
+ }
+ },
+ {
+ "path": "pages/6170/shareManagement/index",
+ "style": {
+ "navigationBarTitleText": "分享管理"
+ }
+ },
+ {
+ "path": "pages/210/onlineDevice/index",
+ "style": {
+ "navigationBarTitleText": "联机设备"
+ }
+ },
+ {
+ "path": "pages/210/addDevice/index",
+ "style": {
+ "navigationBarTitleText": "添加联机设备"
+ }
+ },
+ {
+ "path": "pages/210/historyRecords/index",
+ "style": {
+ "navigationBarTitleText": "历史记录"
+ }
+ },
+ {
+ "path": "pages/210/call/index",
+ "style": {
+ "navigationBarTitleText": "呼叫"
+ }
+ }
+ ],
+ "tabBar": {
+ "color": "#fff",
+ "selectedColor": "#BBE600",
+ "backgroundColor": "#202020",
+ "list": [
+ {
+ "pagePath": "pages/common/index/index",
+ "text": "我的设备",
+ "iconPath": "/static/tabs/device.png",
+ "selectedIconPath": "/static/tabs/device-HL.png"
+ },
+ {
+ "pagePath": "pages/common/user/index",
+ "text": "我的",
+ "iconPath": "/static/tabs/my.png",
+ "selectedIconPath": "/static/tabs/my-HL.png"
+ }
+ ]
+ },
+ "globalStyle": {
+ "navigationBarTextStyle": "white",
+ "navigationBarTitleText": "uni-app",
+ "navigationBarBackgroundColor": "#121212",
+ "backgroundColor": "#121212"
+ },
+ "uniIdRouter": {}
}
\ No newline at end of file
diff --git a/pages/6170/allShare/index.vue b/pages/6170/allShare/index.vue
index bb6a4ef..cc0307e 100644
--- a/pages/6170/allShare/index.vue
+++ b/pages/6170/allShare/index.vue
@@ -249,14 +249,10 @@
},
onLoad() {
this.onIntall()
- // 绑定页面做了监听,新增成功,刷新页面
- uni.$on('refreshDeviceList', () => {
- this.onIntall()
- });
},
beforeDestroy() {
// 组件销毁前移除监听器
- uni.$off('refreshDeviceList');
+
},
}
diff --git a/pages/6170/callPolice/index.vue b/pages/6170/callPolice/index.vue
index 1b34bd6..99f4a2e 100644
--- a/pages/6170/callPolice/index.vue
+++ b/pages/6170/callPolice/index.vue
@@ -3,9 +3,10 @@
全选
-
+
-
+
@@ -15,13 +16,13 @@
- 设备:{{item.deviceName}}
+ 设备:{{ item.deviceName }}
- ID:{{item.deviceImei}}
- 在线
+ ID:{{ item.deviceImei }}
+ 在线
- 离线
- 电量:{{item.battery || '0'}}%
+ 离线
+ 电量:{{ item.battery || '0' }}%
@@ -46,368 +47,448 @@
\ No newline at end of file
diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue
index 6fe0ff0..8ed74fe 100644
--- a/pages/6170/deviceControl/index.vue
+++ b/pages/6170/deviceControl/index.vue
@@ -269,311 +269,336 @@
\ No newline at end of file
diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue
index 34806e3..5d35263 100644
--- a/pages/common/send/index.vue
+++ b/pages/common/send/index.vue
@@ -2,9 +2,9 @@
-
+
-
+
@@ -14,15 +14,13 @@
- 设备:{{item.deviceName}}
+ 设备:{{ item.deviceName }}
- ID:{{item.deviceImei}}
- 在线
+ ID:{{ item.deviceImei }}
+ 在线
- 离线
- 电量:{{item.battery || '0'}}%
+ 离线
+ 电量:{{ item.battery || '0' }}%
@@ -32,14 +30,15 @@
编辑信息
+ v-model="messageToSend" :maxlength="20" />
-
+
-
+
@@ -49,12 +48,16 @@
deviceInfo,
} from '@/api/common/index.js'
import {
- deviceSendMessage
+ deviceSendMessage,
+ deviceRealTimeStatus //设备状态
} from '@/api/6170/deviceControl.js'
+ import {
+ generateShortId
+ } from '@/utils/function.js';
export default {
- components: {
- CustomPopup
- },
+ components: {
+ CustomPopup
+ },
data() {
return {
deviceList: [],
@@ -62,10 +65,55 @@
showPopupFlag: false,
popupTitle: '',
popupMessage: '信息发送成功!',
- popupConfirmText: '确认'
+ popupConfirmText: '确认',
+ isSending: false,
+ sendInfo: {}
}
},
methods: {
+ onPullDownRefresh() {
+ // 执行下拉刷新时的操作,比如重新获取数据
+ this.getData();
+ },
+ /**
+ * 获取设备状态(带自动轮询)
+ * @param {number} val - 功能模式
+ * @param {string} batchId - 批次ID
+ * @param {number} [interval=1000] - 轮询间隔(毫秒)
+ */
+ async getdeviceSTatus(val, batchId, interval = 800) {
+ const checkStatus = async () => {
+ try {
+ const data = {
+ functionMode: val,
+ batchId: batchId,
+ typeName: this.sendInfo.typeName,
+ deviceImei: this.sendInfo.deviceImei
+ };
+ const res = await deviceRealTimeStatus(data);
+ if (res.code !== 200) {
+ throw new Error(res.msg || '请求失败');
+ }
+ switch (res.data.functionAccess) {
+ case 'OK':
+ return res; // 成功完成
+ case 'ACTIVE':
+ await new Promise(r => setTimeout(r, interval));
+ return checkStatus(); // 继续轮询
+ case 'FAILED':
+ throw new Error('设备操作失败');
+ case 'TIMEOUT':
+ throw new Error('设备响应超时');
+ default:
+ throw new Error('未知状态');
+ }
+ } catch (error) {
+ throw error;
+ }
+ };
+ return checkStatus();
+ },
+
toggleSelect(index) {
this.deviceList[index].checked = !this.deviceList[index].checked
this.$forceUpdate()
@@ -75,7 +123,7 @@
this.loading = true;
let data = {
pageNum: 1,
- pageSize: 20,
+ pageSize: 50,
deviceType: deviceType
}
deviceInfo(data).then((res) => {
@@ -93,9 +141,12 @@
});
},
// 发送文本消息
- sendTextMessage() {
+ async sendTextMessage() {
+ // 防重复提交
+ if (this.isSending) return;
const selectedDevices = this.deviceList.filter(item => item.checked)
const deviceIds = selectedDevices.map(item => item.id);
+ const deviceImeiList = selectedDevices.map(item => item.deviceImei);
if (selectedDevices.length === 0) {
uni.showToast({
title: '请选择一个设备',
@@ -105,25 +156,53 @@
}
if (!this.messageToSend) {
uni.showToast({
- title: '请输入要发送的内容',
+ title: '请输入要发送的文字',
icon: 'none'
});
return;
}
- let data = {
- sendMsg: this.messageToSend,
- deviceIds: deviceIds
- }
- deviceSendMessage(data).then((res) => {
- if (res.code == 200) {
- this.showPopupFlag = true
- } else {
+ this.isSending = true;
+ let loadingShown = false;
+ try {
+ uni.showLoading({
+ title: '发送中...',
+ mask: true
+ });
+ loadingShown = true;
+ // 2. 准备请求数据
+ const batchId = generateShortId();
+ const data = {
+ sendMsg: this.messageToSend,
+ deviceIds: deviceIds,
+ batchId: batchId,
+ typeName: this.sendInfo.typeName,
+ batchId: batchId,
+ deviceImeiList: deviceImeiList
+ };
+ // 3.人员信息
+ const registerRes = await deviceSendMessage(data);
+ if (registerRes.code !== 200) {
uni.showToast({
- title: res.msg,
+ title: registerRes.msg,
icon: 'none'
- });
+ })
+ return
}
- })
+ // 4. 获取设备状态
+ const statusRes = await this.getdeviceSTatus(2, batchId);
+ if (statusRes.data.functionAccess === 'OK') {
+ // 5. 显示成功弹窗
+ this.showPopupFlag = true
+ }
+ } catch (error) {
+ uni.showToast({
+ title: error.message,
+ icon: 'none'
+ });
+ } finally {
+ uni.hideLoading();
+ this.isSending = false;
+ }
},
onPopupConfirm() {
this.showPopupFlag = false
@@ -137,7 +216,8 @@
// 监听 'deviceSend' 事件,获取传过来的数据
eventChannel.on('deviceSend', (data) => {
console.log('Received detail data:', data);
- this.getData(data.data)
+ this.getData(data.data.id)
+ this.sendInfo = data.data
});
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
eventChannel.emit('ack', {})
@@ -342,4 +422,14 @@
border-radius: 50rpx;
width: 90%;
}
+ .checkbox.disabled {
+ opacity: 0.5;
+ background-color: rgba(255, 255, 255, 0.1) !important;
+ border-color: rgba(255, 255, 255, 0.2) !important;
+ pointer-events: none; /* 阻止点击事件 */
+ }
+ /* 可选:离线设备的卡片整体置灰 */
+ .device-card[data-offline="true"] {
+ opacity: 0.6;
+ }
\ No newline at end of file
diff --git a/pages/common/user/index.vue b/pages/common/user/index.vue
index d3dfa59..1ff2974 100644
--- a/pages/common/user/index.vue
+++ b/pages/common/user/index.vue
@@ -6,7 +6,7 @@
- 富源晟科技
+ 武汉研创
ID:123456
diff --git a/utils/request.js b/utils/request.js
index a5f55e2..b113555 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -1,5 +1,5 @@
import config from '../config/index.js';
-const env = 'development'; //production development //开发of线上 改这里就行
+const env = 'production'; //production development //开发of线上 改这里就行
const BASE = config[env];
const request = (options) => {
console.log("options"+JSON.stringify(options),BASE.BASE_URL)
@@ -20,7 +20,7 @@ const request = (options) => {
method: options.method || 'GET',
data: options.method !== 'GET' ? options.data : {},
header: options.header || {},
- timeout: 10000,
+ timeout: 30000,
success: (res) => {
resolve(res.data);
},