|
@@ -23,9 +23,17 @@
|
|
|
<text class="gray">{{name}}</text>
|
|
<text class="gray">{{name}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="menuitem">
|
|
<view class="menuitem">
|
|
|
- <text>设备ID</text>
|
|
|
|
|
|
|
+ <text>设备编号</text>
|
|
|
<text class="gray device-id-text">{{deviceId}}</text>
|
|
<text class="gray device-id-text">{{deviceId}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="menuitem">
|
|
|
|
|
+ <text>设备型号</text>
|
|
|
|
|
+ <text class="gray">{{deviceModel || '未知'}}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="menuitem">
|
|
|
|
|
+ <text>序列号</text>
|
|
|
|
|
+ <text class="gray">{{serialNo || '未知'}}</text>
|
|
|
|
|
+ </view>
|
|
|
<view class="menuitem">
|
|
<view class="menuitem">
|
|
|
<text>信号强度</text>
|
|
<text>信号强度</text>
|
|
|
<view class="signal-value-wrap">
|
|
<view class="signal-value-wrap">
|
|
@@ -42,10 +50,20 @@
|
|
|
<text>固件版本</text>
|
|
<text>固件版本</text>
|
|
|
<text class="gray">{{firmwareVersion || '未获取'}}</text>
|
|
<text class="gray">{{firmwareVersion || '未获取'}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="menuitem lastItem">
|
|
|
|
|
|
|
+ <view class="menuitem">
|
|
|
<text>连接状态</text>
|
|
<text>连接状态</text>
|
|
|
<text class="gray">{{connected ? '已连接' : '未连接'}}</text>
|
|
<text class="gray">{{connected ? '已连接' : '未连接'}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="menuitem">
|
|
|
|
|
+ <text>在线状态</text>
|
|
|
|
|
+ <text class="gray">{{onlineStatus === 1 ? '在线' : '离线'}}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="menuitem lastItem menuitem-address">
|
|
|
|
|
+ <text>设备地址</text>
|
|
|
|
|
+ <view class="address-wrap">
|
|
|
|
|
+ <text class="gray address-text">{{address || '未设置'}}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
|
|
|
<text class="txt">设备操作</text>
|
|
<text class="txt">设备操作</text>
|
|
|
<view class="menuitem" @click="disconnectDevice" v-if="connected">
|
|
<view class="menuitem" @click="disconnectDevice" v-if="connected">
|
|
@@ -68,6 +86,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { useBleStore } from '@/stores/ble'
|
|
import { useBleStore } from '@/stores/ble'
|
|
|
import { BLE_STATE } from '@/utils/ble/constants.js'
|
|
import { BLE_STATE } from '@/utils/ble/constants.js'
|
|
|
|
|
+import { getDeviceDetail } from '@/utils/api/device.js'
|
|
|
import ayToast from '@/components/ay-toast/ay-toast.nvue'
|
|
import ayToast from '@/components/ay-toast/ay-toast.nvue'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -79,7 +98,13 @@ export default {
|
|
|
statusBarHeight: 44,
|
|
statusBarHeight: 44,
|
|
|
name: '',
|
|
name: '',
|
|
|
deviceId: '',
|
|
deviceId: '',
|
|
|
|
|
+ deviceCode: '',
|
|
|
|
|
+ deviceModel: '',
|
|
|
|
|
+ serialNo: '',
|
|
|
|
|
+ onlineStatus: 0,
|
|
|
|
|
+ address: '',
|
|
|
rssi: '',
|
|
rssi: '',
|
|
|
|
|
+ id:'',
|
|
|
connected: false,
|
|
connected: false,
|
|
|
connecting: false,
|
|
connecting: false,
|
|
|
firmwareVersion: '',
|
|
firmwareVersion: '',
|
|
@@ -113,6 +138,11 @@ export default {
|
|
|
this.name = decodeURIComponent(options.name || '')
|
|
this.name = decodeURIComponent(options.name || '')
|
|
|
this.deviceId = decodeURIComponent(options.deviceId || '')
|
|
this.deviceId = decodeURIComponent(options.deviceId || '')
|
|
|
this.rssi = decodeURIComponent(options.rssi || '')
|
|
this.rssi = decodeURIComponent(options.rssi || '')
|
|
|
|
|
+ this.id = decodeURIComponent(options.id || '')
|
|
|
|
|
+ // 获取设备详情
|
|
|
|
|
+ if (this.id) {
|
|
|
|
|
+ this.fetchDeviceDetail()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
async onShow() {
|
|
async onShow() {
|
|
|
const bleStore = useBleStore()
|
|
const bleStore = useBleStore()
|
|
@@ -158,6 +188,21 @@ export default {
|
|
|
this._cleanListeners()
|
|
this._cleanListeners()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ async fetchDeviceDetail() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getDeviceDetail(this.id)
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ this.name = res.deviceName || this.name
|
|
|
|
|
+ this.deviceModel = res.deviceModel || ''
|
|
|
|
|
+ this.serialNo = res.serialNo || ''
|
|
|
|
|
+ this.firmwareVersion = res.firmwareVersion || this.firmwareVersion
|
|
|
|
|
+ this.onlineStatus = res.onlineStatus || 0
|
|
|
|
|
+ this.address = res.address || ''
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log('获取设备详情失败', e)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
goBack() {
|
|
goBack() {
|
|
|
uni.navigateBack()
|
|
uni.navigateBack()
|
|
|
},
|
|
},
|
|
@@ -395,6 +440,25 @@ export default {
|
|
|
height: 40rpx;
|
|
height: 40rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.menuitem-address {
|
|
|
|
|
+ height: auto;
|
|
|
|
|
+ min-height: 104rpx;
|
|
|
|
|
+ padding-top: 24rpx;
|
|
|
|
|
+ padding-bottom: 24rpx;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.address-wrap {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ margin-left: 20rpx;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.address-text {
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #9BA5B7;
|
|
|
|
|
+ text-align: right;
|
|
|
|
|
+ lines: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.delbtn {
|
|
.delbtn {
|
|
|
width: 654rpx;
|
|
width: 654rpx;
|
|
|
height: 96rpx;
|
|
height: 96rpx;
|