文档管理中心
ASCF框架API参考API开放接口用户信息

用户信息

has.getUserProfile

has.getUserProfile(Object object)

获取用户信息。返回userInfo。

起始版本: 1.0.17

依赖关系: HarmonyOS SDK版本≥6.0.0(20)且ROM版本≥6.0.0

参数:

参数为Object对象,包括以下字段。

展开
参数 类型 必填 描述
success function 接口调用成功的回调函数。
fail function 接口调用失败的回调函数。
complete function 接口调用结束的回调函数(调用成功、失败都会执行)。

success返回值

展开
参数 类型 描述
userInfo UserInfo 用户信息对象。

示例:

收起
自动换行
深色代码主题
复制
  1. has.getUserProfile({
  2. success: (res) => {
  3. console.info('getUserProfile success', res);
  4. },
  5. fail: (err) => {
  6. console.error('getUserProfile fail', err);
  7. },
  8. complete: (res) => {
  9. console.info('getUserProfile complete', res);
  10. }
  11. });

UserInfo

用户信息对象。

起始版本: 1.0.17

展开
参数 类型 描述
nickName string 用户昵称。
avatarUrl string 用户头像图片的URL,若用户没有头像返回参数为undefined。
在 ASCF框架 中进行搜索
请输入您想要搜索的关键词