index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import axios from 'axios';
  2. import config from './config.js';
  3. axios.default.timeout = 5000;
  4. axios.defaults.headers.post['Content-Type'] = "application/json;charset=utf-8";
  5. const urls = config.urls;
  6. export default {
  7. getImgCode() {//获取图片验证码
  8. return axios.post(urls.getImgVerification, {})
  9. },
  10. vertifyImgCode(data) {//校验图片验证码
  11. return axios.post(
  12. urls.verifyImgVerification,
  13. {
  14. 'code': data.imgCode,
  15. 'imgId': data.imgId
  16. }
  17. )
  18. },
  19. loginMess(data) {
  20. return axios.post(urls.login,
  21. {
  22. 'username': data.username,
  23. 'password': data.password
  24. }
  25. )
  26. },
  27. checkTel(data){//注册
  28. return axios.post(urls.checkTel,{
  29. 'username':data
  30. })
  31. },
  32. checkForgetTel(data){//忘记密码
  33. return axios.post(urls.checkForgetTel,{
  34. 'username':data
  35. })
  36. },
  37. getMobileCode(data) {//获取短信验证码
  38. return axios.post(
  39. urls.getSmsWithRegister,
  40. {
  41. 'code': data.imgCode,
  42. 'imgId': data.imgId,
  43. 'mobile': data.mobile
  44. }
  45. )
  46. },
  47. vertifyMobileCode(data) {//验证短信验证码
  48. return axios.post(
  49. urls.verifySmsVerification,
  50. {
  51. 'code': data.imgCode,
  52. 'imgId': data.imgId,
  53. 'mobile': data.mobile,
  54. 'smsCode': data.smsCode
  55. }
  56. )
  57. },
  58. regidtry(data) {//注册
  59. return axios.post(
  60. urls.registry,
  61. {
  62. "code": data.code,
  63. "email": data.email,
  64. "gmtCreate": '',
  65. "gmtModified": '',
  66. "id": 0,
  67. "imgId": data.imgId,
  68. "isDeleted": '',
  69. "linkman": data.linkman,
  70. "modifier": '',
  71. "organization": data.organization,
  72. "password": data.password,
  73. "username": data.username
  74. }
  75. )
  76. },
  77. /**************************找回密码****************************/
  78. forgetPswGetMobileCode(data) {//忘记密码获取短信验证码
  79. return axios.post(
  80. urls.getSmsWithResetPassword,
  81. {
  82. 'code': data.imgCode,
  83. 'imgId': data.imgId,
  84. 'mobile': data.mobile
  85. }
  86. )
  87. },
  88. resetPsw(data) {
  89. return axios.post(
  90. urls.resetPassword,
  91. {
  92. 'password': data.password,
  93. 'username': data.username,
  94. 'diffPassword':data.diffPassword
  95. }
  96. )
  97. },
  98. getAccessdMenu() {
  99. return axios.post(urls.getAccessdMenu);
  100. },
  101. getUserEnumsData() {
  102. return axios.post(urls.getUserEnumsData);
  103. }
  104. }