getApiRes.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import axios from 'axios';
  2. import global from '../Global.js'
  3. headapi = process.env.NODE_ENV === 'development' ? '/api/' : 'http://video.beswell.com:85/';
  4. console.log(process.env.NODE_ENV)
  5. console.log(headapi)
  6. // 基础方法进行封装
  7. function getApiBasic(url, postdata) {
  8. return axios.post(url, postdata).then(function (data) {
  9. let json = data.data;
  10. return json
  11. }, function (response) {
  12. console.info(response);
  13. })
  14. }
  15. // 调用的api改写成方法
  16. export function worldDetail(postdata) {
  17. let url = headapi + 'worldDetail';
  18. return getApiBasic(url, postdata);
  19. }
  20. export function editbasicinfo(postdata) {
  21. let url = headapi + 'editbasicinfo';
  22. return getApiBasic(url, postdata);
  23. }
  24. export function modPwd(postdata) {
  25. let url = headapi + 'modPwd';
  26. return getApiBasic(url, postdata);
  27. }
  28. export function logout(postdata) {
  29. let url = headapi + 'logout';
  30. return getApiBasic(url, postdata);
  31. }
  32. // 调用的api改写成方法
  33. export function testTable(postdata) {
  34. let url = headapi + 'v1/Auth/testTable';
  35. return getApiBasic(url, postdata);
  36. }
  37. export function testSelect(postdata) {
  38. let url = headapi + 'testSelect';
  39. return getApiBasic(url, postdata);
  40. }
  41. export function testPic(postdata) {
  42. let url = headapi + 'testPic';
  43. return getApiBasic(url, postdata);
  44. }
  45. // 正式接口
  46. // 获取验证图片
  47. export function GenVerifyPic(postdata) {
  48. let url = headapi + 'v1/Auth/GenVerifyPic';
  49. return getApiBasic(url, postdata);
  50. }
  51. // 手机获取验证码
  52. export function GetPhoneVFCode(postdata) {
  53. let url = headapi + 'v1/Auth/GetPhoneVFCode';
  54. return getApiBasic(url, postdata);
  55. }
  56. // 用户手机验证码登陆
  57. export function PhoneSignIn(postdata) {
  58. let url = headapi + 'v1/Auth/PhoneSignIn';
  59. return getApiBasic(url, postdata);
  60. }
  61. // 查询用户自身信息
  62. export function UserSelfQuery(postdata) {
  63. let url = headapi + 'v1/User/UserSelfQuery';
  64. return getApiBasic(url, postdata);
  65. }
  66. // 查询用户是否正在上课接口
  67. export function GetDuInfoAndUserInfoByUserMd5(postdata) {
  68. let url = headapi + 'v1/User/GetDuInfoAndUserInfoByUserMd5';
  69. return getApiBasic(url, postdata);
  70. }
  71. // 心率带信息查询和更新
  72. export function HrSensorsUpdate(postdata) {
  73. let url = headapi + 'v1/HrSensors/HrSensorsUpdate';
  74. return getApiBasic(url, postdata);
  75. }
  76. // App心率数据上报
  77. export function AddAppHeartRate(postdata) {
  78. let url = headapi + 'v1/HrSensors/AddAppHeartRate';
  79. return getApiBasic(url, postdata);
  80. }