index.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { commonSearch_go } from '../index'
  2. import * as type from './interface'
  3. import APP from '@/services';
  4. import { getLongTypeLoginID } from '@/services/bus/login';
  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. }