跳到主要内容

Account 账户信息

Account

YHP系统的当前用户账号, 用户可以使用此对象来进行对自己的基本信息的查询与修改。 也可以用来修改自己账户密码。

成员函数:

init(service: Service, namespace?: object)

用户账号的初始化方法,需要传入对应的iniut服务实例

参数:
参数名称参数类型描述
serviceService

对应的iniut服务实例

namespaceobject

对应的namespace,这是保留参数,可以不传

profile() → {Promise}

获取账户对应的用户描述,包括first name, last name等

updateProfile(profiles: any) → {Promise}

更新用户描述,包括first name, last name等。此方法为全量更新,所以请注意保留未变更的值

参数:
参数名称参数类型描述
profilesany

updateAttribute(attributeName: string, value: any) → {Promise}

更新用户属性的方法

参数:
参数名称参数类型描述
attributeNamestring

属性名称

valueany

新的属性值

getAttribute(attributeName: string) → {Promise}

获取单个用户属性,需要传入一个属性名称

参数:
参数名称参数类型描述
attributeNamestring

updatePassword(pwd: NewPassword) → {Promise}

更改账户密码,需要传入一个新的密码

参数:
参数名称参数类型描述
pwdNewPassword
示例:
account.updatePassword({
     currentPassword,
     newPassword,
     newPasswordConfirmation,
}).then(() => {})