antiFatigue.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // var nGenUrl = "http://121.201.66.101:9999";
  2. var nGenUrl = "https://hsws.enstation.com/ngen_war";
  3. // var fileUrl = "http://10.60.11.150:8085";
  4. var _headGen = {
  5. "Authorization": getCookie("nGenToken")
  6. };
  7. function checkGenToken(){
  8. let _opts = {
  9. url: nGenUrl + "/gps-web/h5/mnt/state?count&_t="+new Date().getTime(),
  10. type: "GET"
  11. }
  12. getAxios(_opts, {}, _headGen).then(function (res){
  13. if(res.status == -1){
  14. checkNuuid()
  15. }
  16. })
  17. }
  18. function checkNuuid(){
  19. let data = {};
  20. let _opts = {
  21. url: nGenUrl + "/gps-web/h5/blogin?&_t="+new Date().getTime(),
  22. type: "GET"
  23. }
  24. getAxios(_opts, data).then(function (res){
  25. if(res.result!=""){
  26. getNseId(res.result.uuid);
  27. }
  28. })
  29. }
  30. function getNseId(code){
  31. let data = {
  32. code: [{x: 135, y: 501, t: 28185}],
  33. codeId: code,
  34. h5login: true,
  35. loginLang: "zh_CN",
  36. loginType: "user",
  37. loginWay: "ie",
  38. password: "827ccb0eea8a706c4c34a16891f84e7b",
  39. plateColor: "1",
  40. smsCode: null,
  41. userId: "YZ"
  42. };
  43. let _opts= {
  44. url: nGenUrl + "/gps-web/h5/login?_t="+new Date().getTime(),
  45. type: "POST"
  46. }
  47. postAxios(_opts, data).then(function (res){
  48. if(res.result == "user due"){
  49. alert("系统异常,请联系管理员!");
  50. ajaxErr();
  51. }else if(res.result != ""){
  52. getNcTok(res.result.split("ok#")[1]);
  53. }
  54. })
  55. }
  56. function getNcTok(_NseId){
  57. let data = {};
  58. let _opts= {
  59. url: nGenUrl + "/gps-web/h5/alogin?sessionId="+_NseId+"&_t="+new Date().getTime(),
  60. type: "GET"
  61. }
  62. getAxios(_opts, data).then(function (res){
  63. if(res.result != ""){
  64. delCookie("nGenToken");
  65. setCookie("nGenToken", res.result.authorization);
  66. }
  67. })
  68. }
  69. function sendTxt(_data){
  70. let _opts= {
  71. url: nGenUrl + "/gps-web/h5/tmn/tmncmd?sendCarCmd&_t=" + new Date().getTime(),
  72. type: "POST"
  73. }
  74. _headGen['Content-Type'] = 'application/json;charset=utf-8';
  75. return postAxios(_opts, JSON.stringify(_data), _headGen);
  76. }
  77. function getAlarmById(_data){
  78. let _opts= {
  79. url: nGenUrl + "/gps-web/h5/query/rptalarm?detailsByCarId&_t=" + new Date().getTime(),
  80. type: "POST"
  81. }
  82. _headGen['Content-Type'] = 'application/json;charset=utf-8';
  83. return postAxios(_opts, JSON.stringify(_data), _headGen);
  84. }
  85. function getAlarmDetail(_data){
  86. let _opts= {
  87. url: nGenUrl + "/gps-web/h5/query/media?queryMedia&_t=" + new Date().getTime(),
  88. type: "POST"
  89. }
  90. _headGen['Content-Type'] = 'application/json;charset=utf-8';
  91. return postAxios(_opts, JSON.stringify(_data), _headGen);
  92. }
  93. function getAllAlarm(_time){
  94. let _opts = {
  95. url: nGenUrl + "/gps-web/h5/query/rptalarm?countByCarIds&_v=20230823110510&_t=" + new Date().getTime(),
  96. type: "POST"
  97. }
  98. let _data = JSON.stringify({
  99. "types": ["fd", "ya","cey","am","td","t3d"],
  100. "startTime": _time.replace(/\//g,"-")+" 00:00:00",
  101. "endTime": _time.replace(/\//g,"-")+" 23:59:59",
  102. "speedMin":null,
  103. "duration":null,
  104. "alarmSrcs":null,
  105. "states":null,
  106. "alarmLevels":[],
  107. "carIds": ["226940", "226941"]
  108. })
  109. _headGen['Content-Type'] = 'application/json;charset=utf-8';
  110. return postAxios(_opts, _data, _headGen);
  111. }