api.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {
  2. HTTP
  3. } from './Http.js'
  4. class ApiModel extends HTTP {
  5. devicevaluecheck(data) {
  6. data.accesstoken = wx.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 = wx.getStorageSync('userMsg').token;
  42. return this.request({
  43. url: "/index",
  44. data,
  45. loading
  46. })
  47. }
  48. /* 无状态 */
  49. base(data, loading = true) {
  50. return this.request({
  51. url: "/index",
  52. data,
  53. loading
  54. })
  55. }
  56. /* 退出登录 */
  57. logout() {
  58. let data = {
  59. accesstoken: wx.getStorageSync('userMsg').token
  60. }
  61. return this.request({
  62. url: "/index/logout",
  63. data
  64. })
  65. }
  66. /* 获取地区code */
  67. getLocationCode() {
  68. return this.request({
  69. url: "/index/getforward?url=" + encodeURIComponent("http://www.nmc.cn/rest/position"),
  70. data: {},
  71. method: "GET",
  72. header: {
  73. "Access-Control-Allow-Origin": "*"
  74. }
  75. })
  76. }
  77. }
  78. export {
  79. ApiModel
  80. }