user.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import http from '@/http/api.js'
  2. // 获取token
  3. const token = (tenantId, username, password, type) => {
  4. return http.request({
  5. url: '/blade-auth/oauth/token',
  6. method: 'POST',
  7. header: {
  8. 'Tenant-Id': tenantId
  9. },
  10. params: {
  11. tenantId,
  12. username,
  13. password,
  14. grant_type: "password",
  15. scope: "all",
  16. type:'account'
  17. }
  18. })
  19. }
  20. // 获取用户信息
  21. const userInfo = () => {
  22. return http.request({
  23. url: '/blade-user/info',
  24. method: 'GET',
  25. })
  26. }
  27. // 获取版本
  28. const getVersion = (params) => {
  29. return http.request({
  30. url: '/store-goods/appversion/getLatestVersion',
  31. method: 'GET',
  32. params
  33. })
  34. }
  35. // 授权获取token
  36. const empowerToken = (params) => {
  37. return http.request({
  38. url: '/blade-auth/oauth/token',
  39. method: 'POST',
  40. params: {
  41. ...params,
  42. grant_type: "password",
  43. scope: "all",
  44. type: 'account'
  45. }
  46. })
  47. }
  48. // 授权获取手机号
  49. const tokenTwo = (params) => {
  50. return http.request({
  51. url: '/blade-client/wechat/programLogin',
  52. method: 'get',
  53. params
  54. })
  55. }
  56. // 获取个人资料信息
  57. const user = (params) => {
  58. return http.request({
  59. url: '/blade-purchase-sales/appParts/personalInformation',
  60. method: 'get',
  61. params
  62. })
  63. }
  64. export default {
  65. token,
  66. userInfo,
  67. getVersion,
  68. empowerToken,
  69. tokenTwo,
  70. user
  71. }