Browse Source

fix:系统状态bug

master
guoapeng 5 months ago
parent
commit
f27fdc330a
  1. 1
      src/apis/system.ts
  2. 12
      src/components/home/Check/index.vue
  3. 5
      src/views/main/index.vue

1
src/apis/system.ts

@ -11,3 +11,4 @@ export const control = (params: any) => http.post('/function', params)
export const debugControl = (params: any) => http.post('/function/debug', params)
export const getDeviceStatus = () => http.get('/device-status/')
export const getDeviceSelfTest = () => http.get('/device_self_test/')

12
src/components/home/Check/index.vue

@ -1,4 +1,5 @@
<script setup lang="ts">
import { getDeviceSelfTest } from 'apis/system'
import FtDialog from 'components/common/FTDialog/index.vue'
import { FtMessage } from 'libs/message'
import { socket } from 'libs/socket'
@ -18,21 +19,14 @@ const okHandle = () => {
}, 300)
}
// const handleButtonClick = (callback: () => void) => {
// okLoading.value = true
// setTimeout(() => {
// okLoading.value = false
// FtMessage.success('')
// callback()
// }, 300)
// }
const list = ['x轴是否在原点', 'y轴是否在原点', 'z轴是否在原点']
onMounted(async () => {
let num = 0
await nextTick(() => {
buttonCloseRef.value.setLoading(true)
})
const res = await getDeviceSelfTest()
console.log(res)
const interval = async () => {
if (num < list.length) {

5
src/views/main/index.vue

@ -13,12 +13,13 @@ const systemStore = useSystemStore() // 使用 systemStore
const statusMessage = (data: any) => {
// systemStore systemStatus
systemStore.updateSystemStatus(data.data)
console.log(data)
systemStore.updateSystemStatus(data)
}
const sensorMessage = (data: any) => {
// systemStore systemInfo
systemStore.updateSystemSensor(data.data)
systemStore.updateSystemSensor(data)
}
socket.init(statusMessage, 'device_status_change')

Loading…
Cancel
Save