index.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. import http from '@/utils/http';
  2. import DictCache from '@/utils/dict';
  3. import { stringify } from 'qs';
  4. /**
  5. * 忘记密码
  6. * page func
  7. * parameter: { }
  8. * @param parameter
  9. * @returns {*}
  10. */
  11. export function forgetPwd(parameter) {
  12. return http({
  13. url: '/ignores/forget-pwd',
  14. method: 'put',
  15. data: parameter
  16. });
  17. }
  18. /**
  19. * 获取图片验证码
  20. */
  21. export function getCode(data) {
  22. return http({
  23. url: '/service/sms/sendSms',
  24. method: 'POST',
  25. data
  26. });
  27. }
  28. /**
  29. * 获取用户详情,包括权限
  30. */
  31. export function getUserInfo() {
  32. return http({
  33. url: '/upms/users/info',
  34. method: 'get'
  35. });
  36. }
  37. /**
  38. * 获取用户详情
  39. */
  40. export function getUserInfoModel() {
  41. return http({
  42. url: '/upms/users/info/model',
  43. method: 'get'
  44. });
  45. }
  46. /**
  47. * 退出登录
  48. */
  49. export function userLogout() {
  50. return http({
  51. url: '/upms/users/logout',
  52. method: 'delete'
  53. });
  54. }
  55. /**
  56. * 获取数据词典
  57. */
  58. export function getDictData() {
  59. return http({
  60. url: '/upms/dicts/data',
  61. method: 'get'
  62. });
  63. }
  64. /**
  65. * 登录
  66. */
  67. export function mobileLogin(data) {
  68. return new Promise((resolve, reject) => {
  69. http({
  70. url: '/oauth/token',
  71. method: 'GET',
  72. data
  73. })
  74. .then(res => {
  75. // 存入用户信息
  76. // 获取用户信息
  77. // TODO future 没有做容错,完成再调试
  78. // 存入token
  79. uni.setStorage({
  80. key: 'accessToken',
  81. data: res.data.access_token,
  82. success: function () {
  83. // 获取词典
  84. getDictData().then(response => {
  85. uni.switchTab({ url: '/pages/tidings/tidings' });
  86. uni.setStorage({
  87. key: DictCache.BASE_DATA_CACHE,
  88. data: response.data,
  89. success: function () {}
  90. });
  91. });
  92. // 获取登录人信息 这一步可以不用,移动端可以在使用用户的时候再获取,这个方法是留着渲染动态路由的
  93. getUserInfo().then(response => {
  94. uni.setStorage({
  95. key: 'userInfo',
  96. data: response.data,
  97. success: function () {
  98. resolve(res);
  99. }
  100. });
  101. });
  102. }
  103. });
  104. })
  105. .catch(err => reject(err));
  106. });
  107. }
  108. /**
  109. * fetch single func
  110. * parameter: { }
  111. * @param parameter
  112. * @returns {*}
  113. */
  114. export function fetchSbInfoIgnores(parameter) {
  115. return http({
  116. url: '/ignores/sb/' + parameter.id,
  117. method: 'get',
  118. headers: {
  119. 'Content-Type': 'application/json;charset=UTF-8'
  120. }
  121. });
  122. }
  123. /**
  124. * 更新设备图片
  125. */
  126. export function updateSbInfoImagesIgnores (parameter) {
  127. return http({
  128. url: '/ignores/sb/images/' + parameter.id,
  129. method: 'PUT',
  130. data: parameter
  131. })
  132. }
  133. /**
  134. * 添加报修
  135. */
  136. export function addRepairApplicationFormIgnores (parameter) {
  137. return http({
  138. url: '/ignores/repair/add',
  139. method: 'POST',
  140. headers: {
  141. 'Accept': 'application/json',
  142. 'Content-Type': 'application/json;charset=UTF-8'
  143. },
  144. data: parameter
  145. })
  146. }
  147. /**
  148. * page func
  149. * parameter: { }
  150. * @param parameter
  151. * @returns {*}
  152. */
  153. export function getSbTaskIgnores (parameter) {
  154. return http({
  155. url: '/ignores/sb/task2/' + parameter.id,
  156. method: 'get',
  157. headers: {
  158. 'Content-Type': 'application/json;charset=UTF-8'
  159. }
  160. })
  161. }
  162. // /**
  163. // * page func
  164. // * parameter: { }
  165. // * @param parameter
  166. // * @returns {*}
  167. // */
  168. // export function getSbTaskIgnores (parameter) {
  169. // return http({
  170. // url: '/ignores/sb/task/' + parameter.id,
  171. // method: 'get',
  172. // headers: {
  173. // 'Content-Type': 'application/json;charset=UTF-8'
  174. // }
  175. // })
  176. // }
  177. export function getCheckJobPageIgnores (parameter) {
  178. return http({
  179. url: '/ignores/check/sb/jobs/page?' + stringify(parameter),
  180. method: 'get',
  181. headers: {
  182. 'Content-Type': 'application/json;charset=UTF-8'
  183. }
  184. })
  185. }
  186. export function fetchCheckJobIgnores (parameter) {
  187. return http({
  188. url: '/ignores/check/jobs/' + parameter.id,
  189. method: 'get',
  190. headers: {
  191. 'Content-Type': 'application/json;charset=UTF-8'
  192. }
  193. })
  194. }
  195. export function executeJobIgnores (parameter) {
  196. return http({
  197. url: '/ignores/check/jobs/execute',
  198. method: 'PUT',
  199. data: parameter
  200. })
  201. }
  202. export function finishJobIgnores (parameter) {
  203. return http({
  204. url: '/ignores/check/jobs/finish',
  205. method: 'PUT',
  206. data: parameter
  207. })
  208. }
  209. /**
  210. * 添加设备状态变更记录
  211. */
  212. export function addSbStatusLogIgnores (parameter) {
  213. return http({
  214. url: '/ignores/sb/status-logs',
  215. method: 'POST',
  216. headers: {
  217. 'Accept': 'application/json',
  218. 'Content-Type': 'application/json;charset=UTF-8'
  219. },
  220. data: parameter
  221. })
  222. }
  223. export function getCheckJobDetail (parameter) {
  224. return http({
  225. url: '/check/jobs/getCheckJobVO/detail?' + stringify(parameter),
  226. method: 'get',
  227. headers: {
  228. 'Content-Type': 'application/json;charset=UTF-8'
  229. }
  230. })
  231. }
  232. export function getCheckJob (parameter) {
  233. return http({
  234. url: '/check/jobs/getCheckJobVO?' + stringify(parameter),
  235. method: 'get',
  236. headers: {
  237. 'Content-Type': 'application/json;charset=UTF-8'
  238. }
  239. })
  240. }