session.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import axios from '../http'
  2. export default {
  3. /**
  4. * 返回会话列表
  5. * @param {Object} data
  6. */
  7. sessionList (callback) {
  8. return axios.request2({
  9. url: 'session/list',
  10. method: 'get',
  11. needLogin: true,
  12. callback
  13. })
  14. },
  15. /**
  16. * 设置已读
  17. * @param {Object} data
  18. */
  19. setRead (data) {
  20. return axios.request({
  21. url: 'session/setRead',
  22. method: 'post',
  23. needLogin: true,
  24. data
  25. })
  26. },
  27. /**
  28. * 静音
  29. * @param {Object} data
  30. */
  31. setMute (data) {
  32. return axios.request({
  33. url: 'session/mute',
  34. method: 'post',
  35. needLogin: true,
  36. data
  37. })
  38. },
  39. /**
  40. * 取消静音
  41. * @param {Object} data
  42. */
  43. cancelMute (data) {
  44. return axios.request({
  45. url: 'session/unMute',
  46. method: 'post',
  47. needLogin: true,
  48. data
  49. })
  50. },
  51. /**
  52. * 置顶
  53. * @param {Object} data
  54. */
  55. setPin (data) {
  56. return axios.request({
  57. url: 'session/pin',
  58. method: 'post',
  59. needLogin: true,
  60. data
  61. })
  62. },
  63. /**
  64. * 取消置顶
  65. * @param {Object} data
  66. */
  67. cancelPin (data) {
  68. return axios.request({
  69. url: 'session/unPin',
  70. method: 'post',
  71. needLogin: true,
  72. data
  73. })
  74. },
  75. /**
  76. * 删除会话
  77. * @param {Object} data
  78. */
  79. deleteSession (data) {
  80. return axios.request({
  81. url: 'session/delete',
  82. method: 'post',
  83. needLogin: true,
  84. data
  85. })
  86. },
  87. /**
  88. * 文件上传
  89. * @param {Object} data
  90. */
  91. fileUpload (data) {
  92. return axios.request({
  93. url: 'session/uploadFile',
  94. method: 'post',
  95. headers: {
  96. 'Content-Type': 'multipart/form-data'
  97. },
  98. needLogin: true,
  99. data
  100. })
  101. },
  102. /**
  103. * 迷你版未读数量
  104. * @param {Object} data
  105. */
  106. getMiniUnRead (data) {
  107. return axios.request({
  108. url: 'session/miniUnRead ',
  109. method: 'post',
  110. needLogin: true,
  111. data
  112. })
  113. }
  114. }