|
|
@@ -61,9 +61,15 @@
|
|
|
<el-dropdown @command="onUserDropClick">
|
|
|
<div class="ele-admin-header-avatar">
|
|
|
<el-avatar
|
|
|
- :src="loginUser && loginUser.avatarAddress ? loginUser.avatarAddress : ''"
|
|
|
+ :src="
|
|
|
+ loginUser && loginUser.avatarAddress
|
|
|
+ ? loginUser.avatarAddress
|
|
|
+ : ''
|
|
|
+ "
|
|
|
/>
|
|
|
- <span class="hidden-xs-only">{{ loginUser && loginUser.name ? loginUser.name : '' }}</span>
|
|
|
+ <span class="hidden-xs-only">{{
|
|
|
+ loginUser && loginUser.name ? loginUser.name : ''
|
|
|
+ }}</span>
|
|
|
<i class="el-icon-arrow-down"></i>
|
|
|
</div>
|
|
|
<template v-slot:dropdown>
|
|
|
@@ -131,8 +137,7 @@ export default {
|
|
|
roleId: '',
|
|
|
currentUser: { currentGroupId: '', currentRoleId: '' },
|
|
|
type: '',
|
|
|
- isFromExpiryConfirm: false,
|
|
|
- accountId: localStorage.getItem('accountId')
|
|
|
+ isFromExpiryConfirm: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -140,7 +145,13 @@ export default {
|
|
|
this.groupId = this.currentUser.currentGroupId;
|
|
|
this.roleId = this.currentUser.currentRoleId;
|
|
|
this.type = localStorage.getItem('singleUserInfo');
|
|
|
- this.checkPasswordExpiry();
|
|
|
+ const checkAccountIdExist = setInterval(() => {
|
|
|
+ const accountId = localStorage.getItem('accountId');
|
|
|
+ if (accountId !== null && accountId !== undefined) {
|
|
|
+ clearInterval(checkAccountIdExist);
|
|
|
+ this.checkPasswordExpiry(); // 有值后再校验
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
},
|
|
|
computed: {
|
|
|
loginUser() {
|
|
|
@@ -151,26 +162,26 @@ export default {
|
|
|
},
|
|
|
loginChangeRoleVOList() {
|
|
|
return this.$store.state.user?.info?.loginChangeGroupVOList.find(
|
|
|
- item => item.groupId === this.groupId
|
|
|
+ (item) => item.groupId === this.groupId
|
|
|
)?.loginChangeRoleVOList;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 密码有效期校验主逻辑:校验账号ID → 调用接口 → 弹窗交互 → 错误处理
|
|
|
async checkPasswordExpiry() {
|
|
|
- if (!this.accountId) {
|
|
|
+ const currentAccountId = localStorage.getItem('accountId');
|
|
|
+
|
|
|
+ if (currentAccountId === null || currentAccountId === undefined) {
|
|
|
+ console.log('当前 accountId:', currentAccountId);
|
|
|
Message.warning('账号ID缺失,无法校验密码有效期');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const isExpired = await getExpiryDate(this.accountId);
|
|
|
+ const isExpired = await getExpiryDate(currentAccountId);
|
|
|
if (!isExpired) {
|
|
|
await this.showExpiryConfirm();
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- const errorMsg = error?.response?.data?.message || '密码有效期校验失败,请稍后重试';
|
|
|
- Message.error(errorMsg);
|
|
|
console.error('密码有效期校验错误:', error);
|
|
|
}
|
|
|
},
|
|
|
@@ -188,7 +199,11 @@ export default {
|
|
|
};
|
|
|
|
|
|
try {
|
|
|
- await MessageBox.confirm(confirmConfig.message, confirmConfig.title, confirmConfig);
|
|
|
+ await MessageBox.confirm(
|
|
|
+ confirmConfig.message,
|
|
|
+ confirmConfig.title,
|
|
|
+ confirmConfig
|
|
|
+ );
|
|
|
this.isFromExpiryConfirm = true;
|
|
|
this.passwordVisible = true;
|
|
|
} catch {
|