This commit is contained in:
xd 2024-05-16 16:34:43 +08:00
parent 17720a24bc
commit 447880ef21
1 changed files with 18 additions and 8 deletions

View File

@ -27,8 +27,8 @@
<el-dialog :title="switchAccountTitle" :visible.sync="switchAccountOpen" width="500px" append-to-body> <el-dialog :title="switchAccountTitle" :visible.sync="switchAccountOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" label-width="100px"> <el-form ref="form" :model="form":rules="rules" label-width="100px">
<el-form-item label="账号" prop="Name"> <el-form-item label="账号" prop="account">
<el-input v-model="form.account" placeholder="请输入账号" clearable/> <el-input v-model="form.account" placeholder="请输入账号" clearable/>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -85,7 +85,13 @@ export default {
switchAccountTitle: "", switchAccountTitle: "",
// //
switchAccountOpen: false, switchAccountOpen: false,
form: {} form: {},
//
rules: {
account: [
{required: true, message: "账号不能为空", trigger: "blur"}
]
}
} }
}, },
components: { components: {
@ -129,11 +135,15 @@ export default {
this.switchAccountOpen = true; this.switchAccountOpen = true;
}, },
switchAccountConfirm(account) { switchAccountConfirm(account) {
this.$refs["form"].validate(valid => {
if (valid) {
// OA-token // OA-token
getSwitchAccountToken(account).then(response => { getSwitchAccountToken(account).then(response => {
this.switchAccountOpen = false; this.switchAccountOpen = false;
window.open('http://localhost:3335/ssoLogin?loginid=' + account + '&token=' + response.token, '_self'); window.open('http://localhost:3335/ssoLogin?loginid=' + account + '&token=' + response.token, '_self');
}) })
}
})
}, },
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')