api.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. /* 老CRM登录 */
  26. OldLogin(data) {
  27. return this.getRequest({
  28. url: 'https://crm.meida.com/dmsService/rest/login' + data
  29. })
  30. }
  31. SSO(data) {
  32. return this.request({
  33. data,
  34. suffix: 'https://crm.meida.com:16691/yos/rest/sso/crm'
  35. })
  36. }
  37. /* 验证码登录 */
  38. plogin(data) {
  39. return this.request({
  40. url: "/index/login",
  41. data
  42. })
  43. }
  44. /* 获取验证码 */
  45. getpassword(data) {
  46. return this.request({
  47. url: "/index/getpassword",
  48. data
  49. })
  50. }
  51. /* 有状态通用 */
  52. basic(data, loading = true) {
  53. data.accesstoken = uni.getStorageSync('userMsg').token;
  54. return this.request({
  55. url: "/index",
  56. data,
  57. loading
  58. })
  59. }
  60. getClass(typename) {
  61. return this.basic({
  62. "classname": "sysmanage.develop.optiontype.optiontype",
  63. "method": "optiontypeselect",
  64. "content": {
  65. "typename": typename
  66. }
  67. })
  68. }
  69. /* 无状态 */
  70. base(data, loading = true) {
  71. return this.request({
  72. url: "/index",
  73. data,
  74. loading
  75. })
  76. }
  77. /* 退出登录 */
  78. logout() {
  79. let data = {
  80. accesstoken: uni.getStorageSync('userMsg').token
  81. }
  82. return this.request({
  83. url: "/index/logout",
  84. data
  85. })
  86. }
  87. /* 获取地区code */
  88. getLocationCode() {
  89. return this.request({
  90. url: "/index/getforward?url=" + encodeURIComponent("http://www.nmc.cn/rest/position"),
  91. data: {},
  92. method: "GET",
  93. header: {
  94. "Access-Control-Allow-Origin": "*"
  95. }
  96. })
  97. }
  98. }
  99. export {
  100. ApiModel
  101. }