api.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // #ifndef MP-WEIXIN
  2. import {
  3. HTTP
  4. } from './Http.js'
  5. // #endif
  6. // #ifdef MP-WEIXIN
  7. import {
  8. HTTP
  9. } from './Http2.js'
  10. // #endif
  11. class ApiModel extends HTTP {
  12. devicevaluecheck(data) {
  13. data.accesstoken = uni.getStorageSync('WuserMsg').token || '';
  14. return this.request({
  15. url: "/simple/devicevaluecheck",
  16. data
  17. })
  18. }
  19. loginbywechat(data) {
  20. return this.request({
  21. url: "/index/loginbywechat",
  22. data
  23. })
  24. }
  25. /* 登录 */
  26. login(data) {
  27. return this.request({
  28. url: "/index/loginbyaccount",
  29. data
  30. })
  31. }
  32. /* 验证码登录 */
  33. plogin(data) {
  34. return this.request({
  35. url: "/index/login",
  36. data
  37. })
  38. }
  39. /* 获取验证码 */
  40. getpassword(data) {
  41. return this.request({
  42. url: "/index/getpassword",
  43. data
  44. })
  45. }
  46. /* 有状态通用 */
  47. basic(data, loading = true) {
  48. data.accesstoken = uni.getStorageSync('WuserMsg').token;
  49. return this.request({
  50. url: "/index",
  51. data,
  52. loading
  53. })
  54. }
  55. getClass(typename) {
  56. return this.basic({
  57. "classname": "sysmanage.develop.optiontype.optiontype",
  58. "method": "optiontypeselect",
  59. "content": {
  60. "typename": typename
  61. }
  62. })
  63. }
  64. /* 无状态 */
  65. base(data, loading = true) {
  66. return this.request({
  67. url: "/index",
  68. data,
  69. loading
  70. })
  71. }
  72. /* 退出登录 */
  73. logout() {
  74. let data = {
  75. accesstoken: uni.getStorageSync('WuserMsg').token
  76. }
  77. return this.request({
  78. url: "/index/logout",
  79. data
  80. })
  81. }
  82. /* 获取地区code */
  83. getLocationCode() {
  84. return this.request({
  85. url: "/index/getforward?url=" + encodeURIComponent("http://www.nmc.cn/rest/position"),
  86. data: {},
  87. method: "GET",
  88. header: {
  89. "Access-Control-Allow-Origin": "*"
  90. }
  91. })
  92. }
  93. }
  94. export {
  95. ApiModel
  96. }