| | |
| | | </Form> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { reactive, ref, unref, computed } from 'vue'; |
| | | import { reactive, ref, unref, computed, onMounted, onUnmounted } from 'vue'; |
| | | |
| | | import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'; |
| | | // import { |
| | |
| | | |
| | | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| | | |
| | | // const status = ref('Connecting...'); |
| | | // const message = ref(''); |
| | | |
| | | // let ws = null; |
| | | |
| | | // const connectWebSocket = () => { |
| | | // ws = new WebSocket('ws://192.168.124.9:7519'); |
| | | |
| | | // ws.onopen = () => { |
| | | // status.value = 'Connected'; |
| | | // // 发送初始消息或进行其他操作 |
| | | // ws.send('wsSubStrings 6c24aff98e274eeda74da0c57267f0b4_#_E:\\Data\\本原\\条码模板\\条码模板\\唯一ID.btw'); |
| | | // }; |
| | | |
| | | // ws.onmessage = (event) => { |
| | | // status.value = 'Received'; |
| | | // message.value = event.data; |
| | | // }; |
| | | |
| | | // ws.onerror = (error) => { |
| | | // status.value = 'Error'; |
| | | // console.error('WebSocket Error:', error); |
| | | // }; |
| | | |
| | | // ws.onclose = (event) => { |
| | | // status.value = 'Closed'; |
| | | // if (event.wasClean) { |
| | | // console.log( |
| | | // `WebSocket connection closed cleanly, code=${event.code} reason=${event.reason}`, |
| | | // ); |
| | | // } else { |
| | | // console.error('WebSocket connection died'); |
| | | // } |
| | | // }; |
| | | // }; |
| | | // onMounted(() => { |
| | | // connectWebSocket(); |
| | | // }); |
| | | |
| | | // onUnmounted(() => { |
| | | // if (ws) { |
| | | // ws.close(); |
| | | // } |
| | | // }); |
| | | |
| | | async function handleLogin() { |
| | | const data = await validForm(); |
| | | if (!data) return; |