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() {