index.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import APP from '@/services';
  2. import { getLongTypeLoginID } from '@/services/bus/login';
  3. import { commonSearch_go } from '../index';
  4. import * as type from './interface';
  5. /**
  6. * 获取登录ID
  7. * @param username 可传入“登录账号”、“登录代码”和“手机号码”
  8. * @returns
  9. */
  10. export function GetLoginID(username: string): Promise<string> {
  11. return commonSearch_go('/User/GetLoginID', { username })
  12. }
  13. /**
  14. * 获取用户账号信息
  15. * @param username 用户ID
  16. * @returns
  17. */
  18. export function GetUserAccount(userID: number): Promise<type.GetUserAccount> {
  19. return commonSearch_go('/User/GetUserAccount', { userID })
  20. }
  21. /**
  22. * 账户登录后信息查询
  23. * @param loginID 登录账号
  24. * @returns
  25. */
  26. export function LoginQuery(): Promise<type.LoginQueryRsp> {
  27. const id = getLongTypeLoginID();
  28. return commonSearch_go('/User/LoginQuery', { loginID: Number(id) }).then(res => {
  29. const { externalExchanges,
  30. goodsgroups,
  31. loginAccount,
  32. markets,
  33. systemParams,
  34. userAccount,
  35. userInfo,
  36. username } = res;
  37. externalExchanges && APP.set('externalexchange', externalExchanges);
  38. goodsgroups && APP.set('goodsgroups', goodsgroups);
  39. loginAccount && APP.set('loginAccount', loginAccount);
  40. markets && APP.set('markets', markets);
  41. systemParams && APP.set('systemParams', systemParams);
  42. userAccount && APP.set('userAccount', userAccount);
  43. userInfo && APP.set('userInfo', userInfo);
  44. username && APP.set('username', username);
  45. console.log('LoginQuery', res);
  46. return res
  47. })
  48. }
  49. /**
  50. * 获取用户信息
  51. * @param loginID 登录账号
  52. * @returns
  53. */
  54. export function QueryUserInfo(userID: number, isDecrypt?: boolean): Promise<type.Userinfo> {
  55. const param = isDecrypt ? { isDecrypt, userID } : { userID }
  56. return commonSearch_go('/User/QueryUserInfo', param)
  57. }