From 10966267c6f2d0e33ce4fbe7b2c765c116f948d1 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Tue, 15 Aug 2023 11:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=94=AE=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 11 +++++++ package.json | 1 + src/components/LoginForm.vue | 35 +++++++++++++++++++++- src/components/Progress.vue | 9 ++++-- src/components/SimpleKeyboard.vue | 59 +++++++++++++++++++++++++++++++++++++ src/components/Test.vue | 33 +++++++++++---------- src/pages/Home.vue | 1 + src/pages/Login.vue | 35 +++++++++++++++++++++- src/store/modules/operator.js | 8 +++++ src/store/modules/websocket.js | 62 ++++++++++++++++++++++++++++++++------- src/utils/index.js | 0 yarn.lock | 5 ++++ 12 files changed, 228 insertions(+), 31 deletions(-) create mode 100644 src/components/SimpleKeyboard.vue create mode 100644 src/utils/index.js diff --git a/package-lock.json b/package-lock.json index 4045c1d..3b9be9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "echarts": "^5.4.3", "moment": "^2.29.4", "pinia": "^2.0.32", + "simple-keyboard": "^3.6.40", "vant": "^4.6.3", "vue": "^3.2.45", "vue-router": "^4.0.13" @@ -707,6 +708,11 @@ "node": ">=12.0.0" } }, + "node_modules/simple-keyboard": { + "version": "3.6.40", + "resolved": "https://registry.npmmirror.com/simple-keyboard/-/simple-keyboard-3.6.40.tgz", + "integrity": "sha512-4QmY9lpGhEIPeSUbUVnyLaYZBm9akR8z40c3ReSIij0h/oGaUxmVfcQIfG/Yvydym9m+PIWXdcquRv9fR+g/1w==" + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -1352,6 +1358,11 @@ "source-map-js": ">=0.6.2 <2.0.0" } }, + "simple-keyboard": { + "version": "3.6.40", + "resolved": "https://registry.npmmirror.com/simple-keyboard/-/simple-keyboard-3.6.40.tgz", + "integrity": "sha512-4QmY9lpGhEIPeSUbUVnyLaYZBm9akR8z40c3ReSIij0h/oGaUxmVfcQIfG/Yvydym9m+PIWXdcquRv9fR+g/1w==" + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/package.json b/package.json index ef7b6af..d915d6e 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "echarts": "^5.4.3", "moment": "^2.29.4", "pinia": "^2.0.32", + "simple-keyboard": "^3.6.40", "vant": "^4.6.3", "vue": "^3.2.45", "vue-router": "^4.0.13" diff --git a/src/components/LoginForm.vue b/src/components/LoginForm.vue index 8efa73e..65260f3 100644 --- a/src/components/LoginForm.vue +++ b/src/components/LoginForm.vue @@ -6,12 +6,14 @@ type="text" v-model="username" class="username" + @focus="handleFocus(1)" placeholder="请输入用户名" />
@@ -22,10 +24,32 @@ import Eye from '@/assets/img/login/eye.png' import Open from '@/assets/img/login/open.png' import { useWebSocketStore, useUserStore } from '@/store' -import { ref } from 'vue' +import { ref, watch } from 'vue' import { useRouter } from 'vue-router' import { loginJSON } from '@/mock/command' +const props = defineProps({ + handleShowKey: { + type: Function, + }, + handleHideKey: { + type: Function, + }, + clearInput: { + type: Function, + }, + input: { + type: String, + }, +}) + +const activeInput = ref(1) +const handleFocus = flag => { + props.handleShowKey() + props.clearInput() + activeInput.value = flag +} + const router = useRouter() const userStore = useUserStore() const webSocketStore = useWebSocketStore() @@ -37,8 +61,17 @@ const tip = ref('') const handleEye = () => { showPassword.value = !showPassword.value } +watch(() => { + // 需要有个逻辑判断 + if (activeInput.value == 1) { + username.value = props.input + } else { + password.value = props.input + } +}) const handleLogin = () => { + props.handleHideKey() if (username.value == '') { tip.value = '用户名不能为空' return diff --git a/src/components/Progress.vue b/src/components/Progress.vue index c0b1ea8..761b7b9 100644 --- a/src/components/Progress.vue +++ b/src/components/Progress.vue @@ -3,7 +3,7 @@
剩余时间
-

1000:00:00

+

{{ operatorStore.estimatedRemainingTimeS }}

import { useOperatorStore, useWebSocketStore } from '@/store' -import { stopDisinfectionJSON } from '@/mock/command' +import { stopDisinfectionJSON, getStateJSON } from '@/mock/command' +import { onMounted } from 'vue' const operatorStore = useOperatorStore() const webSocketStore = useWebSocketStore() @@ -63,6 +64,10 @@ const showDetail = () => { props.changeShowOperator(true) } +onMounted(() => { + webSocketStore.sendCommandMsg(getStateJSON) +}) + const pauseDisinfect = () => { if (operatorStore.disinfectStatus) { webSocketStore.sendCommandMsg(stopDisinfectionJSON) diff --git a/src/components/SimpleKeyboard.vue b/src/components/SimpleKeyboard.vue new file mode 100644 index 0000000..d7c874b --- /dev/null +++ b/src/components/SimpleKeyboard.vue @@ -0,0 +1,59 @@ + + + + + + diff --git a/src/components/Test.vue b/src/components/Test.vue index 681bca9..4882daf 100644 --- a/src/components/Test.vue +++ b/src/components/Test.vue @@ -2,7 +2,7 @@

加液蠕动泵

-

000/000

+

000 RPM

喷液蠕动泵

-

000/000

+

000 RPM

空压机

-

000/000

+

000 A

风机

-

000/000

+

000 RPM

水浸

-

000/000

+

有水

更新读取水浸状态

液位

-

000/000

+

000 kPa/100g

更新读取液位状态

仓内

-

温度 100 ℃

-

湿度 100 ℃

-

过氧化氢浓度 100 PPM

+

温度 {{ deviceStore.binTemperature }} ℃

+

湿度 {{ deviceStore.binHumidity }} ℃

+

过氧化氢浓度 {{ deviceStore.binHP }} PPM

环境1

-

温度 100 ℃

-

湿度 100 ℃

-

过氧化氢浓度 100 PPM

+

温度 {{ deviceStore.envirTemperature1 }} ℃

+

湿度 {{ deviceStore.envirHumidity1 }} ℃

+

过氧化氢浓度 {{ deviceStore.envirHP1 }} PPM

环境2

-

温度 100 ℃

-

湿度 100 ℃

-

过氧化氢浓度 100 PPM

+

温度 {{ deviceStore.envirTemperature2 }} ℃

+

湿度 {{ deviceStore.envirHumidity2 }} ℃

+

过氧化氢浓度 {{ deviceStore.envirHP2 }} PPM