diff --git a/index.html b/index.html
index 6cb0bdd..f09437d 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
-
+ 瑞鞍星医疗科技
diff --git a/package.json b/package.json
index 64bfc92..e76120e 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
- "serve": "vite",
+ "serve": "vite --open",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
diff --git a/src/axios/ws.ts b/src/axios/ws.ts
new file mode 100644
index 0000000..07a0189
--- /dev/null
+++ b/src/axios/ws.ts
@@ -0,0 +1,46 @@
+let ws: WebSocket;
+
+function init(url: string | URL, protocols?: string | string[]) {
+ return new Promise(resolve => {
+ try {
+ ws = new WebSocket(url);
+ resolve(true)
+ } catch (e) {
+ console.log(e)
+ }
+ })
+}
+
+function close(code?: number, reason?: string) {
+ ws.close(code, reason)
+}
+
+function send(data: string | ArrayBufferLike | Blob | ArrayBufferView) {
+ ws.send(data)
+}
+
+function closeListener(cb: any) {
+ ws.onclose = cb
+}
+
+function openListener(cb: any) {
+ ws.onopen = cb
+}
+
+function errorListener(cb: any) {
+ ws.onerror = cb
+}
+
+function messageListener(cb: any) {
+ ws.onmessage = cb
+}
+
+export const wsApi= {
+ init,
+ close,
+ send,
+ closeListener,
+ openListener,
+ errorListener,
+ messageListener
+}
\ No newline at end of file
diff --git a/src/views/index.vue b/src/views/index.vue
index beaaa2b..ad13498 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -65,6 +65,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { useLoginStore } from '@/stores/user-info-store'
import { getHospitalsData } from '@/static-data/core'
import userInfoForm from '@/components/user-info.vue'
+import {wsApi} from "@/axios/ws";
const router = useRouter()
const route = useRoute()
@@ -161,6 +162,15 @@ const userCommand = (e: string) => {
break;
}
}
+
+/*wsApi.init("").then(() => {
+ wsApi.openListener(fn1);
+})
+
+
+function fn1(res:any) {
+ console.log(res);
+}*/