diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 664f710..6fe0ff0 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -19,19 +19,19 @@ - {{deviceInfo.batteryPercentage}}% + :style="{ color: deviceInfo.batteryPercentage < 20 ? '#FF0000' : '' }"> + {{ deviceInfo.batteryPercentage }}% 电量 - + - {{deviceInfo.batteryRemainingTime || '0'}}分钟 + {{ deviceInfo.batteryRemainingTime || '0' }}分钟 续航时间 @@ -44,11 +44,11 @@ IMEI号 - {{deviceInfo.deviceImei}} + {{ deviceInfo.deviceImei }} 设备状态 - {{deviceInfo.onlineStatus===0?'离线':'在线'}} + {{ deviceInfo.onlineStatus === 0 ? '离线' : '在线' }} 定位信息 @@ -60,14 +60,12 @@ - {{deviceInfo.address}} + {{ deviceInfo.address }} - - - + 设备强制报警中 灯光亮度 {{ sliderValue }}% - - @@ -107,7 +103,7 @@ 激光模式 - {{currentlaserMode}} + {{ currentlaserMode }} @@ -133,7 +129,7 @@ - + 单位: 发送信息 - + - + @@ -195,9 +190,9 @@ {{ popupTitle }} - + - {{item.text}} + {{ item.text }} @@ -270,1324 +265,1494 @@ icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false" @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" /> - - - - \ No newline at end of file diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 8c6b498..70ac5da 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -31,7 +31,7 @@ + :style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }"> @@ -54,7 +54,8 @@ 报警中 + v-if="item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1"> + 报警中 已连接 未连接 @@ -144,6 +145,10 @@ deviceReName } from '@/api/common/index.js' export default { + onPullDownRefresh() { + // 执行下拉刷新时的操作,比如重新获取数据 + this.onIntall(); + }, data() { return { navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight, @@ -313,16 +318,18 @@ this.showTooltip = false; // 关闭弹窗 switch (item.action) { case 'scan': - // uni.navigateTo({ - // url: '/pages/common/scan/scan' - // }); // 扫一扫 uni.scanCode({ success: (res) => { - console.log('条码内容:' + res.result); + console.log('条码内容:', res); + // 清除之前的数据 + this.previousScanResult = null; + // 处理新的扫码结果 + const cleanedResult = res.result.trim(); + console.log('扫码结果:', cleanedResult); // 跳转并传递扫描结果 uni.navigateTo({ - url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(res.result)}` + url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}` }); }, fail: (err) => { @@ -438,7 +445,7 @@ }, success: (res) => { res.eventChannel.emit('devicePolice', { - data: deviceType + data: currentTab }); } }) @@ -455,7 +462,8 @@ }, success: (res) => { res.eventChannel.emit('deviceSend', { - data: deviceType + //data: deviceType, + data: currentTab }); } }) @@ -475,72 +483,33 @@ } }) }, + // 列表跳转 handleFile(item) { - // communicationMode 0是4G 1是蓝牙,考虑多个4g设备 - console.log("item=",item); - if (item.typeName == 'BJQ6170') { - uni.navigateTo({ - url: "/pages/6170/deviceControl/index", - events: { - ack: function(data) {} - }, - success: (res) => { - // 页面跳转成功后的回调函数 - res.eventChannel.emit('deviceControl', { - data: item, - apiType: 'listA' // 自定义标识,详情哪里根据这个参数不同信息 - }); - } - }) - } else if (item.typeName == 'HBY210') { - const currentTab = this.tabs[this.activeTab]; - const deviceType = currentTab.id || ''; - uni.navigateTo({ - url: "/pages/210/deviceControl/index", - events: { - ack: function(data) {} - }, - success: (res) => { - // 页面跳转成功后的回调函数 - res.eventChannel.emit('deviceControl', { - data: item, - deviceType: deviceType, - apiType: 'listA' // 自定义标识 - }); - } - }) - } - else if (item.typeName == '6155') { - uni.navigateTo({ - url: "/pages/6155/deviceDetail", - events: { - ack: function(data) {} - }, - success: (res) => { - res.eventChannel.emit('deviceControl', { - data: item - }); - } - }) - } - else if (item.typeName == '650') { - uni.navigateTo({ - url: "/pages/650/HBY650", - events: { - ack: function(data) {} - }, - success: (res) => { - res.eventChannel.emit('deviceControl', { - data: item - }); - } - }) - } + let url = item.detailPageUrl; + uni.navigateTo({ + url: url, + events: { + ack: function(data) {} + }, + success: (res) => { + // 页面跳转成功后的回调函数 + res.eventChannel.emit('detailData', { + data: item, + deviceType: this.tabs[this.activeTab].id || '', + apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息 + }); + } + }) }, onIntall() { this.page = 1; this.finished = false; - this.getData(this.deviceType); // 重新加载第一页数据 + const deviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id; + this.getData(deviceType); // 重新加载第一页数据 + setTimeout(() => { + // 停止下拉刷新动画 + uni.stopPullDownRefresh(); + }, 800); }, updateDeviceStatus(data) { this.deviceList = this.deviceList diff --git a/utils/request.js b/utils/request.js index e02cdb0..a5f55e2 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,9 +1,12 @@ -const BASE_URL = 'http://192.168.110.169:8000'; +import config from '../config/index.js'; +const env = 'development'; //production development //开发of线上 改这里就行 +const BASE = config[env]; const request = (options) => { - console.log("options"+JSON.stringify(options)) + console.log("options"+JSON.stringify(options),BASE.BASE_URL) return new Promise((resolve, reject) => { // 处理GET请求参数 - let url = BASE_URL + options.url; + let url = BASE.BASE_URL + options.url; + console.log("url"+url) if (options.method === 'GET' && options.data) { // 使用qs序列化参数 const params = Object.keys(options.data) @@ -19,11 +22,9 @@ const request = (options) => { header: options.header || {}, timeout: 10000, success: (res) => { - console.log("请求成功",res); resolve(res.data); }, fail: (err) => { - console.log("请求失败",err); reject(err); } }; @@ -43,7 +44,7 @@ const request = (options) => { }); }; // 导出基础URL以便其他地方使用 -export const baseURL = BASE_URL +export const baseURL = BASE.BASE_URL export const getToken = () => uni.getStorageSync('token') // 获取token的方法 export const clientid =() => uni.getStorageSync('clientID'); export default request; \ No newline at end of file