mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
页眉文字+自动打开
This commit is contained in:
parent
bb7cc85792
commit
6aa352cc47
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title></title>
|
<title>瑞鞍星医疗科技</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vite",
|
"serve": "vite --open",
|
||||||
"build": "run-p type-check build-only",
|
"build": "run-p type-check build-only",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -65,6 +65,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { useLoginStore } from '@/stores/user-info-store'
|
import { useLoginStore } from '@/stores/user-info-store'
|
||||||
import { getHospitalsData } from '@/static-data/core'
|
import { getHospitalsData } from '@/static-data/core'
|
||||||
import userInfoForm from '@/components/user-info.vue'
|
import userInfoForm from '@/components/user-info.vue'
|
||||||
|
import {wsApi} from "@/axios/ws";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
@ -161,6 +162,15 @@ const userCommand = (e: string) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*wsApi.init("").then(() => {
|
||||||
|
wsApi.openListener(fn1);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function fn1(res:any) {
|
||||||
|
console.log(res);
|
||||||
|
}*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user