import APP from '@/services'; import { Arearole, Ermcp3RootUserAccount } from '../go/useInfo/interface'; /** * 获取用户账户类型 * @returns */ export function getUserAccountType(): number { return APP.get('userAccount').usertype } /** * 获取用户 */ export function getUserInfo() { return APP.get('userInfo') } /** * 获取用户名 * @returns */ export function getUserName() { const name = APP.get('loginAccount').accountname return name ? name : getUserInfo().customername } // 公司名 export function getCompanyName() { return getUserInfo().customername } /** * 获取用户id * 登录中也写了一个 获取用户id的方法,那个方法是在登录信息里面获取用户id,这个方法是在go服务修改登录请求方法,返回用户信息,后期有时间进行优化 */ export function getUsrId() { return getUserInfo().userid } /** * 获取所属机构id */ export function getAreaUserId(): number { return APP.get('userAccount').memberuserid } /** * 获取所属机构名称 */ export function getAreaUserName(): number { return APP.get('userAccount').memberusername } /** * 获取角色类型, 多个已逗号隔开 * 1:交易所 2:运营机构 3:营销中心 4:仓库机构 5:三方服务机构 6:自营会员 7:经纪会员 8:做市会员 9:产业会员 10:金融机构 11:商城店铺 12:子机构 13:报价商 14:积分服务商 15:供货商 16:圈内会员 17:物流机构 18:报价配置机构 19:场外期权做市商 20:组织机构 21:顶级机构 22:业务员 23:跟单员 24:交易员 */ export function getAoletype_string(): string { return APP.get('areaRoles').reduce((acc: string, cur: Arearole) => { return acc ? `${acc},${cur.roletype}` : `${cur.roletype}` }, '') } export function getRootUserInfo(): Ermcp3RootUserAccount | undefined { const temp = APP.get('RootUser'); return temp.length ? temp[0] : undefined }