user.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import http from '@/http/api.js'
  2. // 获取token
  3. const token = (uuid, phone, code) => {
  4. return http.request({
  5. url: '/blade-auth/oauth/token',
  6. method: 'POST',
  7. header: {
  8. 'Tenant-Id': '000000',
  9. },
  10. params: {
  11. 'Login-Type':4,
  12. 'Captcha-Key': uuid,
  13. 'Phone-Key':phone,
  14. 'Captcha-Code':code,
  15. grant_type: "phone",
  16. scope: "all",
  17. type:'phone'
  18. }
  19. })
  20. }
  21. // 获取手机号
  22. const programLogin = (params) => {
  23. return http.request({
  24. url: '/blade-auth/wechat/programLogin',
  25. method: 'GET',
  26. params
  27. })
  28. }
  29. // 获取验证码
  30. export function getPhoneVerifyCode(data){
  31. return http.request({
  32. url: '/blade-auth/verification/getPhoneVerifyCode',
  33. method: 'GET',
  34. data
  35. })
  36. }
  37. // 获取用户信息
  38. const userInfo = () => {
  39. return http.request({
  40. url: '/blade-user/info',
  41. method: 'GET',
  42. })
  43. }
  44. // 获取版本
  45. const getVersion = (params) => {
  46. return http.request({
  47. url: '/blade-user/appversion/getLatestVersion',
  48. method: 'GET',
  49. params
  50. })
  51. }
  52. // 门店是否禁用
  53. const isDisable = (data) => {
  54. return http.request({
  55. url: '/gubersail-shop-app/corpsDesc/whetherDisable',
  56. method: 'GET',
  57. data
  58. })
  59. }
  60. // 授权获取token
  61. const wechartToken = (params) => {
  62. return http.request({
  63. url: '/blade-auth/oauth/token',
  64. method: 'POST',
  65. params: {
  66. ...params,
  67. grant_type: "wechat",
  68. scope: "all",
  69. type: 'account'
  70. }
  71. })
  72. }
  73. export default {
  74. token,
  75. userInfo,
  76. getVersion,
  77. isDisable,
  78. programLogin,
  79. wechartToken
  80. }