From 447880ef21295b8c1532aa2960d2fe4a3fadd191 Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Thu, 16 May 2024 16:34:43 +0800 Subject: [PATCH] '123' --- ruoyi-ui/src/layout/components/Navbar.vue | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 71c207c..fc81165 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -27,8 +27,8 @@ - - + + @@ -85,7 +85,13 @@ export default { switchAccountTitle: "", // 是否显示弹出层 switchAccountOpen: false, - form: {} + form: {}, + // 表单校验 + rules: { + account: [ + {required: true, message: "账号不能为空", trigger: "blur"} + ] + } } }, components: { @@ -128,11 +134,15 @@ export default { this.switchAccountTitle = "账号切换"; this.switchAccountOpen = true; }, - switchAccountConfirm(account){ - //获取 OA登录-token - getSwitchAccountToken(account).then(response => { - this.switchAccountOpen = false; - window.open('http://localhost:3335/ssoLogin?loginid='+account+'&token='+response.token, '_self'); + switchAccountConfirm(account) { + this.$refs["form"].validate(valid => { + if (valid) { + //获取 OA登录-token + getSwitchAccountToken(account).then(response => { + this.switchAccountOpen = false; + window.open('http://localhost:3335/ssoLogin?loginid=' + account + '&token=' + response.token, '_self'); + }) + } }) }, toggleSideBar() {