();
+ user.Id = _userManager.UserId;
await user.UpdateExcludeAsync(new string[] {
nameof(SysUser.Account),
+ nameof(SysUser.SecurityLevel),
nameof(SysUser.Name),
nameof(SysUser.Password),
nameof(SysUser.AdminType),
@@ -301,9 +303,9 @@ namespace Ewide.Core.Service
///
///
[HttpPost("/sysUser/updateAvatar")]
- public async Task UpdateAvatar(UpdateUserInput input)
+ public async Task UpdateAvatar(UserInput input)
{
- var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == input.Id);
+ var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == _userManager.UserId);
// 调用文件上传
//sysFileInfoService.assertFile(input.Avatar);
user.Avatar = input.Avatar;
diff --git a/Api/Ewide.Web.Core/core.settings.json b/Api/Ewide.Web.Core/core.settings.json
index 035a2a2..d6ee02a 100644
--- a/Api/Ewide.Web.Core/core.settings.json
+++ b/Api/Ewide.Web.Core/core.settings.json
@@ -7,7 +7,8 @@
"sysFileInfo:download",
"sysFileInfo:preview",
"sysUser:updateInfo",
- "sysUser:updatePwd"
+ "sysUser:updatePwd",
+ "sysUser:updateAvatar"
]
}
}
\ No newline at end of file
diff --git a/Web/src/pages/system/account/setting/safety/index.vue b/Web/src/pages/system/account/setting/safety/index.vue
index 3fff7f8..7777377 100644
--- a/Web/src/pages/system/account/setting/safety/index.vue
+++ b/Web/src/pages/system/account/setting/safety/index.vue
@@ -3,11 +3,8 @@
@@ -78,9 +76,28 @@ export default {
},
computed: {
- safetyLevel() {
+ popSecurityLevel() {
// 计算帐号安全级别
- return '弱';
+ return (
+ Math.floor(((this.data.filter((p) => p.done).length - 1) * 3 + this.$root.global.info.securityLevel * 3) / 5) ||
+ 1
+ );
+ },
+ strokeColor() {
+ return [
+ {
+ from: '#e280bf',
+ to: '#e91010',
+ },
+ {
+ from: '#e9ce10',
+ to: '#ff974d',
+ },
+ {
+ from: '#108ee9',
+ to: '#87d068',
+ },
+ ][this.popSecurityLevel - 1];
},
},
@@ -92,7 +109,18 @@ export default {
title: '登录密码',
description:
'安全性高的密码可以使帐号更安全。建议您定期更换密码,设置一个包含字母,符号或数字中至少两项且长度超过6位的密码。',
- content: '当前密码强度:弱(不保存密码明文,需要在数据库以字段形式存储)',
+ extra: (
+
+ 当前密码强度:
+ {
+ [
+ 弱,
+ 中,
+ 强,
+ ][info.securityLevel - 1]
+ }
+
+ ),
done: true,
action: () => {
this.$refs['password-form'].onOpen({});