index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import request from '../utils/request.js';
  2. import requestWhite from '../utils/requestWhite.js';
  3. import Qs from 'qs';
  4. export function codeOperation(url) {
  5. // res="jp_team51_charge_id:A_11111"
  6. //http://localhost:8080/#/?jpcode=jp_team51_charge_id%3AA_111
  7. var res=url
  8. if(url.indexOf("#/?jpcode=")>-1){
  9. res=url.split("#/?jpcode=")[1]
  10. }
  11. if(res&&res.length>22){
  12. }else if(res == 'toLogin') {
  13. return '/pages/login/login'
  14. }else{
  15. return false
  16. }
  17. var str1 = res.slice(0,19);
  18. var str2 = res.slice(20,21);
  19. var id = res.slice(22);
  20. if(str1 == 'jp_team51_charge_id') {
  21. if(str2 == 'A') {
  22. return '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + id
  23. }
  24. if(str2 == 'B') {
  25. return '/pages/user/finance/rechargeRes?id=' + id
  26. }
  27. } else {
  28. return false;
  29. }
  30. }
  31. export function scanCode(res) {
  32. var url=codeOperation(res);
  33. if(url){
  34. uni.navigateTo({
  35. url:url
  36. })
  37. }else{
  38. uni.showToast({
  39. title: '请扫描充电桩上的二维码'
  40. })
  41. }
  42. }
  43. export function activityInfoList(data) {
  44. return requestWhite({
  45. method: 'post',
  46. data: data,
  47. url: '/mobile/activityInfo/activityInfoList'
  48. })
  49. }
  50. export function test(data) {
  51. return request({
  52. method: 'post',
  53. data: data,
  54. url: '/test/post'
  55. })
  56. }
  57. export function chargingData(data) {
  58. return request({
  59. method: 'post',
  60. data: data,
  61. url: '/mobile/charging/chargingData'
  62. })
  63. }
  64. export function marketingData(data) {
  65. return request({
  66. method: 'post',
  67. data: data,
  68. url: '/mobile/charging/marketingData'
  69. })
  70. }
  71. export function findChargeData(data) {
  72. return request({
  73. method: 'post',
  74. data: data,
  75. url: '/mobile/chargingCar/findChargeData'
  76. })
  77. }
  78. export function personalCenter(data) {
  79. return request({
  80. method: 'post',
  81. data: data,
  82. url: '/mobile/regUser/personalCenter'
  83. })
  84. }
  85. export function logout(data) {
  86. return request({
  87. method: 'get',
  88. data: data,
  89. url: '/mobile/regUser/logout'
  90. })
  91. }
  92. export function stopCharging(data) {
  93. return request({
  94. method: 'post',
  95. data: data,
  96. url: '/mobile/command/stopCharging'
  97. })
  98. }
  99. export function startCharging(data) {
  100. return request({
  101. method: 'post',
  102. data: data,
  103. url: '/mobile/command/startCharging'
  104. })
  105. }
  106. export function accountRecordData(data) {
  107. return request({
  108. method: 'post',
  109. data: data,
  110. url: '/mobile/accountRecord/accountRecordData'
  111. })
  112. }
  113. export function accountDetail(id) {
  114. return request({
  115. method: 'get',
  116. url: '/mobile/accountRecord/accountDetail?id='+id
  117. })
  118. }
  119. export function chargingRecordData(data) {
  120. return request({
  121. method: 'post',
  122. data: data,
  123. url: '/mobile/chargingCar/chargingRecordData'
  124. })
  125. }
  126. export function chargingDetail(id) {
  127. return request({
  128. method: 'get',
  129. url: '/mobile/chargingRecord/chargingDetail?id='+id
  130. })
  131. }
  132. export function passengerMessageNoReadNum(data) {
  133. return request({
  134. url: '/mobile/passengerApi/passengerMessageNoReadNum',
  135. data:data,
  136. method: 'post',
  137. })
  138. }
  139. export function chargingDeviceData(data) {
  140. return request({
  141. method: 'post',
  142. data: data,
  143. url: '/mobile/charging/chargingDeviceData'
  144. })
  145. }