mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
页眉文字+自动打开
This commit is contained in:
parent
bb7cc85792
commit
6aa352cc47
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title></title>
|
||||
<title>瑞鞍星医疗科技</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 { 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);
|
||||
}*/
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
Loading…
Reference in New Issue
Block a user