mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
perf: 添加用户资料编辑功能
- 新增用户资料编辑对话框组件 - 添加后端更新用户资料接口 - 在用户信息页面添加编辑按钮 - 新增中英文翻译字段 - 实现头像上传和昵称修改功能
This commit is contained in:
@@ -32,4 +32,15 @@ export class MineController extends BaseController {
|
||||
await this.userService.changePassword(userId, body);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/updateProfile', { summary: Constants.per.authOnly })
|
||||
public async updateProfile(@Body(ALL) body: any) {
|
||||
const userId = this.getUserId();
|
||||
|
||||
await this.userService.updateProfile(userId, {
|
||||
avatar: body.avatar,
|
||||
nickName: body.nickName,
|
||||
});
|
||||
return this.ok({});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export const AdminRoleId = 1
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class UserService extends BaseService<UserEntity> {
|
||||
|
||||
@InjectEntityModel(UserEntity)
|
||||
repository: Repository<UserEntity>;
|
||||
@Inject()
|
||||
@@ -335,4 +336,14 @@ export class UserService extends BaseService<UserEntity> {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async updateProfile(userId: any, body: any) {
|
||||
|
||||
await this.update({
|
||||
id: userId,
|
||||
...body,
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user