Browse Source

设备类型统一获取

master
王梦远 2 weeks ago
parent
commit
cb466e41ff
  1. 3
      src/app.vue
  2. 4
      src/components/common/SoftKeyboard/index.vue
  3. 3
      src/components/home/HomeSetting.vue
  4. 3
      src/components/setting/Device.vue
  5. 7
      src/views/debug/index.vue

3
src/app.vue

@ -82,8 +82,7 @@ const startProgress = () => {
// 1-9% // 1-9%
const randomStep = Math.floor(Math.random() * 9 + 1) const randomStep = Math.floor(Math.random() * 9 + 1)
progress.value = Math.min(progress.value + randomStep, 100) progress.value = Math.min(progress.value + randomStep, 100)
const deviceInfo: Device.DeviceInfo = await initDeviceInfo()
if (deviceInfo.deviceType === deviceType.LargeSpaceDM_B) {
if (__DEVICE_TYPE__ === deviceType.LargeSpaceDM_B) {
await initData() // await initData() //
} }
else { else {

4
src/components/common/SoftKeyboard/index.vue

@ -41,7 +41,7 @@ onMounted(() => {
const isOpen = ref(false) const isOpen = ref(false)
watchEffect(() => { watchEffect(() => {
// EventListener // EventListener
if (deviceState.deviceInfo.deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B) { //
if (__DEVICE_TYPE__ !== deviceState.deviceTypeMap.LargeSpaceDM_B) { //
setTimeout(() => { setTimeout(() => {
isOpen.value = props.isVisible isOpen.value = props.isVisible
}, 100) }, 100)
@ -52,7 +52,7 @@ watchEffect(() => {
watch( watch(
() => props.isVisible, () => props.isVisible,
(newVal) => { (newVal) => {
if (deviceState.deviceInfo.deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B) {
if (__DEVICE_TYPE__ !== deviceState.deviceTypeMap.LargeSpaceDM_B) {
isOpen.value = newVal isOpen.value = newVal
} }
}, },

3
src/components/home/HomeSetting.vue

@ -58,8 +58,7 @@ watchEffect(() => {
* @description 初始化压力配置 * @description 初始化压力配置
*/ */
onMounted(async () => { onMounted(async () => {
const deviceInfo: Device.DeviceInfo = deviceStore.deviceInfo
if (deviceInfo.deviceType !== useDeviceStore().deviceTypeMap.LargeSpaceDM_B) {
if (__DEVICE_TYPE__ !== useDeviceStore().deviceTypeMap.LargeSpaceDM_B) {
await getPressureConfig() // await getPressureConfig() //
} }
}) })

3
src/components/setting/Device.vue

@ -18,6 +18,7 @@ const deviceInfo = ref(deviceStore.deviceInfo)
// const screenHeight = ref(height) // const screenHeight = ref(height)
const webVersion = computed(() => __APP_VERSION__) const webVersion = computed(() => __APP_VERSION__)
const deviceType = computed(() => __DEVICE_TYPE__)
</script> </script>
<template> <template>
@ -26,7 +27,7 @@ const webVersion = computed(() => __APP_VERSION__)
<div>设备ID{{ deviceInfo.deviceId }}</div> <div>设备ID{{ deviceInfo.deviceId }}</div>
</div> </div>
<div class="device-ul"> <div class="device-ul">
<div>设备类型{{ deviceInfo.deviceType }}</div>
<div>设备类型{{ deviceType }}</div>
</div> </div>
<div class="device-ul"> <div class="device-ul">
<div>IP地址{{ deviceInfo.ip }}</div> <div>IP地址{{ deviceInfo.ip }}</div>

7
src/views/debug/index.vue

@ -4,7 +4,7 @@ import { roundNumber } from 'libs/utils'
import { useDebugStore } from 'stores/debugStore' import { useDebugStore } from 'stores/debugStore'
import { useDeviceStore } from 'stores/deviceStore' import { useDeviceStore } from 'stores/deviceStore'
import { useHomeStore } from 'stores/homeStore' import { useHomeStore } from 'stores/homeStore'
import { ref, watchEffect } from 'vue'
import { computed, ref, watchEffect } from 'vue'
const homeStore = useHomeStore() const homeStore = useHomeStore()
const debugStore = useDebugStore() const debugStore = useDebugStore()
@ -164,6 +164,7 @@ const printerDoTest = () => {
} }
sendCmd(data) sendCmd(data)
} }
const deviceType = computed(() => __DEVICE_TYPE__)
</script> </script>
<template> <template>
@ -223,7 +224,7 @@ const printerDoTest = () => {
<div class="debug-lower"> <div class="debug-lower">
<section> <section>
<div> <div>
<div v-if="deviceState.deviceInfo.deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B" class="debug-left-lh">
<div v-if="deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B" class="debug-left-lh">
<div class="debug-label"> <div class="debug-label">
加液泵控制 加液泵控制
</div> </div>
@ -259,7 +260,7 @@ const printerDoTest = () => {
<bt-button button-text="关闭" @click="heatingDoClose" /> <bt-button button-text="关闭" @click="heatingDoClose" />
</div> </div>
</div> </div>
<div v-if="deviceState.deviceInfo.deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B" class="debug-left-lh">
<div v-if="deviceType !== deviceState.deviceTypeMap.LargeSpaceDM_B" class="debug-left-lh">
<div class="debug-label"> <div class="debug-label">
气密性阀门模式 气密性阀门模式
</div> </div>

Loading…
Cancel
Save