api.js 2.0 KB

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