userManage

userManage

userManage.getToken() ⇒ string

获取登录用户的token

Kind: static method of userManage
Returns: string - 用户的token
Example

return this.$store.getters.im.userManage.getToken();
return this.$store.getters.im.userManage.getToken();
return this.$store.getters.im.userManage.getToken();
token: this.$store.state.im.userManage.getToken()
return this.im.userManage.getToken();
return this.$store.getters.im.userManage.getToken();
return this.im.userManage.getToken();
return this.$store.getters.im.userManage.getToken();

userManage.getUid() ⇒ number

获取登录用户的uid

Kind: static method of userManage
Returns: number - 用户ID
Example

const uid = this.$store.getters.im.userManage.getUid();
if (uid + '' === message.uid + '') {
  this.requireMessage();
}
const toUid = toNumber(message.to);
const pid = this.getSid;
const uid = this.$store.getters.im.userManage.getUid();
if (toUid === pid) {
  if (uid + '' !== message.from + '') {
    this.$store.getters.im.groupManage.readGroupMessage(this.getSid);
  }
  this.requireMessage();
  if (message.ext && !message.isHistory) {
    let ext = {};
    try {
      ext = JSON.parse(message.ext);
    } catch (ex) {
      //
    }
    if (ext && ext.ai && ext.ai.stream && !ext.ai.finish) {
      this.calculateScroll(message);
    } else {
      this.scroll();
    }
  } else {
    this.scroll();
  }
}
const uid = this.$store.getters.im.userManage.getUid();
return this.getAdminList.filter((x) => x.user_id === uid).length > 0 || this.getGroupInfo.member_modify;
const uid = this.$store.getters.im.userManage.getUid();
return this.getGroupInfo.owner_id === uid;
res.avatar = this.$store.getters.im.sysManage.getImage({
  avatar: res.avatar,
  type: 'group'
});
this.groupInfo = res;
const uid = this.$store.getters.im.userManage.getUid();
const user = this.getMemberList.find((x) => x.user_id === uid);
this.cardName = (user && (user.display_name || user.name)) || '';
if (!this.cardName) {
  this.$store.getters.im.groupManage
    .asyncGetMemberDisplayName({
      group_id: newSid,
      user_list: [uid]
    })
    .then((res) => {
      if (!res || !res.length) {
        return;
      }
      res.forEach((item) => {
        this.cardName = item.display_name;
      });
    });
}
const uid = this.$store.getters.im.userManage.getUid();
return this.getAdminList.filter((x) => x.user_id === uid).length > 0;
return x.user_id != this.im.userManage.getUid();
if (x.user_id != that.im.userManage.getUid()) {
  return x.display_name.indexOf(str) >= 0;
}

userManage.getAppid() ⇒ string

获取appid

Kind: static method of userManage
Returns: string - APP ID
Example

let hide = true;
let hide_member_info = this.getGroupInfo.hide_member_info;
let app_hide_member_info = false;
const uid = this.im.userManage.getUid();
let appConfig = this.im.sysManage.getAppConfig(this.im.userManage.getAppid());
if (appConfig) {
  app_hide_member_info = appConfig.hide_member_info;
}
if (app_hide_member_info) {
  if (!hide_member_info) {
    hide = false;
  }
} else {
  hide = false;
}

return hide;
let hide = true;
let hide_member_info = this.getGroupInfo.hide_member_info;
let app_hide_member_info = false;
const uid = this.im.userManage.getUid();
let appConfig = this.im.sysManage.getAppConfig(this.im.userManage.getAppid());
if (appConfig) {
  app_hide_member_info = appConfig.hide_member_info;
}
if (app_hide_member_info) {
  if (!hide_member_info) {
    hide = false;
  }
} else {
  hide = false;
}

return hide;
let hide = true;
let hide_member_info = this.getGroupInfo.hide_member_info;
let app_hide_member_info = false;
let appConfig = this.im.sysManage.getAppConfig(this.im.userManage.getAppid());
if (appConfig) {
  app_hide_member_info = appConfig.hide_member_info;
}
if (app_hide_member_info) {
  if (!hide_member_info) {
    hide = false;
  }
} else {
  hide = false;
}
return hide;
const im = this.$store.getters.im;
let appConfig = im.sysManage.getAppConfig(im.userManage.getAppid());
if (appConfig) {
  if (appConfig.account_verification_type && appConfig.account_verification_type == 'enterprise') {
    this.verification_description += appConfig.account_verification_name;
  } else {
    this.verification_description += '个人开发者:' + appConfig.account_verification_name;
  }
  if (appConfig.account_verification_status) {
    switch (appConfig.account_verification_status) {
      case 'unverified':
        this.verification_status = '未认证';
        this.verification_img = '/image/unverified.png';
        break;
      case 'verified':
        this.verification_status = '已认证';
        this.verification_img = '/image/verifyed.png';
        break;
      case 'expired':
        this.verification_status = '认证失败';
        this.verification_img = '/image/verify_failed.png';
        break...

userManage.getConversationList() ⇒ Array.<ConversationItem>

获取最近会话列表

Kind: static method of userManage
Example

const { rootState } = context;
const convlist = rootState.im.userManage.getConversationList();
const allGroupMap = rootState.im.groupManage.getAllGroupDetail();
const allRosterMap = rootState.im.rosterManage.getAllRosterDetail() || {};
let totalUnreadCount = 0;
const convData = convlist.map((item, index) => {
  let name;
  const id = item.id;
  const content = item.content;
  const timestamp = item.timestamp;
  const hasAt = item.hasAt;
  // const img = allRosterMap[id] && allRosterMap[id].avatar;
  let avatar = ''; //(img && this.client.signatureUrl(img, { expires: 600, process: 'image/resize,w_50' })) || '/image/roster.png';
  const unreadCount = item.type == 'roster' ? rootState.im.rosterManage.getUnreadCount(id) : rootState.im.groupManage.getUnreadCount(id);
  const unread = unreadCount > 0 ? unreadCount : 0;
  totalUnreadCount += unread;
  if (item.type === 'roster') {
    //roster
    const sroster =...

userManage.getDeviceSN() ⇒ number

获取设备序号

Kind: static method of userManage
Returns: number - 设备序号
Example

userManage.asyncBindDeviceToken(param) ⇒ Promise.<boolean>

绑定推送设备

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
param object 绑定请求
param.device_sn number 设备序号
param.notifier_name string 证书名称,即在蓝莺IM控制台内上传证书时候设置的名称。
param.device_token string 推送设备Token

Example

userManage.asyncUnbindDeviceToken(param) ⇒ Promise.<boolean>

解绑推送设备

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
param object 解绑请求
param.deviceSn number 设备序号

Example

userManage.asyncRegister(opt) ⇒ Promise.<UserSettings>

用户注册

Kind: static method of userManage
Returns: Promise.<UserSettings> - 用户设置

Param Type Description
opt object 用户信息
opt.username string 用户名
opt.password string 密码

Example

userManage.asyncUpdateAvatar(params) ⇒ Promise.<boolean>

更新头像

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
params object 参数
params.avatar string 头像 url

Example

userManage.asyncUpdateNickName(params) ⇒ Promise.<boolean>

更新昵称

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
params object 参数
params.nick_name string 昵称

Example

if (!value) return;
im.userManage.asyncUpdateNickName({ nick_name: value }).then(() => {
  this.nick_name = value;
  this.$store.dispatch('header/actionGetHeaderProfile');
  alert('修改成功');
});

userManage.asyncUserChangePassword(params) ⇒ Promise.<boolean>

更新用户密码

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
params object 参数
params.old_password string 旧密码
params.new_password string 新密码

Example

userManage.asyncGetProfile() ⇒ Promise.<UserProfile>

获取用户profile

Kind: static method of userManage
Returns: Promise.<UserProfile> - 用户信息
Example

const { rootState } = context;
rootState.im.userManage.asyncGetProfile(true).then((profile) => {
  context.commit('changeHeaderUserProfile', profile);
});
headerRequestFlag.profile = true;
rootState.im.userManage.asyncGetProfile().then((profile) => {
  context.commit('changeHeaderUserProfile', profile);
  headerRequestFlag.profile = false;
});
const { rootState } = context;
rootState.im.userManage.asyncGetProfile(true).then((res) => {
  context.commit('setProfileInfo', res);
});

userManage.asyncUpdateProfile(params) ⇒ Promise.<boolean>

更新用户profile

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
params object
params.description string 描述信息
params.nick_name string 昵称
params.private_info string 私有信息,仅自己可见
params.public_info string 公开信息,好友和陌生人可见

Example

userManage.asyncGetSettings() ⇒ Promise.<UserSettings>

获取用户设置信息

Kind: static method of userManage
Returns: Promise.<UserSettings> - 用户信息
Example

const { rootState } = context;
rootState.im.userManage.asyncGetSettings().then((res) => {
  context.commit('setSettingInfo', res);
});

userManage.asyncUpdateSettings(settings) ⇒ Promise.<boolean>

修改用户设置

Kind: static method of userManage
Returns: Promise.<boolean> - 是否成功

Param Type Description
settings UserSettings 更新的设置

Example

const auth_mode = this.auth_mode === 1 ? 0 : 1;
const user_id = this.$store.state.im.userManage.getUid();
this.$store.state.im.userManage.asyncUpdateSettings({ auth_mode, user_id }).then(() => {
  this.auth_mode = auth_mode;
});
const group_confirm = !this.group_confirm;
const user_id = this.$store.state.im.userManage.getUid();
this.$store.state.im.userManage.asyncUpdateSettings({ group_confirm, user_id }).then(() => {
  this.group_confirm = group_confirm;
});

© 2019-2024 美信拓扑 | 官网 | 网站地图 该文件修订时间: 2024-12-07 06:49:06