login.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import request from '@/utils/request'
  2. import upload from '@/utils/upload'
  3. // 登录方法
  4. export function login(username, password, code, uuid) {
  5. const data = {
  6. username,
  7. password,
  8. code,
  9. uuid
  10. }
  11. return request({
  12. 'url': '/login',
  13. headers: {
  14. isToken: false
  15. },
  16. 'method': 'post',
  17. 'data': data
  18. })
  19. }
  20. // 获取用户详细信息
  21. export function getInfo() {
  22. return request({
  23. 'url': '/getInfo',
  24. 'method': 'get'
  25. })
  26. }
  27. // 退出方法
  28. export function logout() {
  29. return request({
  30. 'url': '/logout',
  31. 'method': 'post'
  32. })
  33. }
  34. // 获取验证码
  35. export function getCodeImg() {
  36. return request({
  37. 'url': '/captchaImage',
  38. headers: {
  39. isToken: false
  40. },
  41. method: 'get',
  42. timeout: 20000
  43. })
  44. }
  45. // 用户注册
  46. export function uploadRegister(data) {
  47. return upload({
  48. 'url': '/registerMobile',
  49. headers: {
  50. isToken: false
  51. },
  52. method: 'post',
  53. formData : data.formdata,
  54. name: data.name,
  55. filePath: data.file
  56. })
  57. }
  58. //获取手机号
  59. export function getPhone(data) {
  60. return request({
  61. url: '/registerMobile/getPhone',
  62. method: 'get',
  63. data: data
  64. })
  65. }
  66. //校验注册信息
  67. export function checkReg(phone) {
  68. return request({
  69. url: '/registerMobile/check/'+phone,
  70. method: 'get',
  71. })
  72. }