api.js 2.6 KB

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