From 6d90fdfea3cf55a4d416c58c554710ba6162915a Mon Sep 17 00:00:00 2001 From: zhaoyz <11@11.com> Date: Mon, 25 Mar 2024 11:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C=20?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=A2=E9=98=85=E8=AE=BE=E7=BD=AE=E5=BF=83?= =?UTF-8?q?=E8=B7=B3=20=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=8C=BB=E9=99=A2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/acl/login.ts | 10 ++++- src/api/hospital.ts | 18 +++++++++ src/views/login/login.vue | 48 ++++++++++++++--------- src/views/remote-manage/remote-manage.vue | 5 ++- 4 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 src/api/hospital.ts diff --git a/src/api/acl/login.ts b/src/api/acl/login.ts index 1e8ec68..ed4dd63 100644 --- a/src/api/acl/login.ts +++ b/src/api/acl/login.ts @@ -4,6 +4,7 @@ import {HOST} from "@/utils/request"; import {ElMessage} from "element-plus"; const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded'; +const registerUrl = "/admin/register/user" export const login = (data: any) => { return new Promise(resolve => { @@ -36,4 +37,11 @@ export const login = (data: any) => { } }) }) -}; \ No newline at end of file +}; + +export const register = (data: any) => { + return new Promise(resolve => { + console.log(data) + resolve(true) + }) +} \ No newline at end of file diff --git a/src/api/hospital.ts b/src/api/hospital.ts new file mode 100644 index 0000000..8a104dc --- /dev/null +++ b/src/api/hospital.ts @@ -0,0 +1,18 @@ +import axios from "axios"; + +const getHospitalListUrl = "/api/admin/hospital/getHospitalList" +const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded' + +export const getHospitalList = () => { + return new Promise(resolve => { + axios.request({ + url: getHospitalListUrl, + method: 'post', + headers: { + 'Content-Type': FORM_CONTENT_TYPE, + }, + }).then(res => { + resolve(res.data); + }) + }) +} \ No newline at end of file diff --git a/src/views/login/login.vue b/src/views/login/login.vue index ff60821..6105bf2 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -79,8 +79,8 @@ - - + + { + hospitalApi.getHospitalList().then(data => { + console.log(data) + }); +}) const selectHospital = (e: string) => { // console.log(e) @@ -272,20 +280,22 @@ const selectHospital = (e: string) => { const register = async () => { await registerFormRef.value.validate((valid: any, fields: any) => { if (valid) { - ElMessageBox.confirm( - '注册成功,是否登录?', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'success', - draggable: true - } - ).then(() => { - loginParams.value.account = registerFormRef.value.account - loginParams.value.name = registerFormRef.value.name - currentHospital.value = registerFormRef.value.hospital - isShowRegister.value = false; - }).catch(() => { + loginApi.register({...registerParams.value, randomStr}).then(data => { + ElMessageBox.confirm( + '注册成功,是否登录?', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'success', + draggable: true + } + ).then(() => { + loginParams.value.account = registerFormRef.value.account + loginParams.value.name = registerFormRef.value.name + currentHospital.value = registerFormRef.value.hospital + isShowRegister.value = false; + }).catch(() => { + }) }) } else { // console.log('error submit!', fields) @@ -364,7 +374,7 @@ function getCaptchaCode() { } function refreshImg() { - const randomStr = v4() + randomStr = v4() captchaImgUrl.value = '/api/admin/code/textImage?randomStr=' + randomStr } diff --git a/src/views/remote-manage/remote-manage.vue b/src/views/remote-manage/remote-manage.vue index ca601af..4efd922 100644 --- a/src/views/remote-manage/remote-manage.vue +++ b/src/views/remote-manage/remote-manage.vue @@ -150,7 +150,10 @@ const surgeryClient = new Client({ brokerURL: 'ws://localhost:5173/socket.io/admin/rax/SurgeryData', connectHeaders: { token: Session.get('token') - } + }, + reconnectDelay: 5000, + heartbeatIncoming: 60000, + heartbeatOutgoing: 60000 }) surgeryClient.activate()