patentchat.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. patentchat: `/api/live/v0/patent/patentchat`,
  7. };
  8. const state = () => ({});
  9. const mutations = {};
  10. const actions = {
  11. // 用户查询列表
  12. async query({ commit }, { skip = 0, limit = 10, ...info } = {}) {
  13. const res = await this.$axios.$get(api.patentchat, { skip, limit, ...info });
  14. return res;
  15. },
  16. // 管理员查询好友列表
  17. async adminQuery({ commit }, { skip = 0, limit = 10, ...info } = {}) {
  18. const res = await this.$axios.$get(`${api.patentchat}/chatPerson`, { skip, limit, ...info });
  19. return res;
  20. },
  21. async adminChatQuery({ commit }, { skip = 0, limit = 10, ...info } = {}) {
  22. const res = await this.$axios.$get(`${api.patentchat}/chatRecord`, { skip, limit, ...info });
  23. return res;
  24. },
  25. async create({ commit }, payload) {
  26. const res = await this.$axios.$post(`${api.patentchat}`, payload);
  27. return res;
  28. },
  29. async fetch({ commit }, payload) {
  30. const res = await this.$axios.$get(`${api.patentchat}/${payload}`);
  31. return res;
  32. },
  33. async update({ commit }, { id, ...info } = {}) {
  34. const res = await this.$axios.$post(`${api.patentchat}/update/${id}`, { ...info });
  35. return res;
  36. },
  37. async delete({ commit }, payload) {
  38. const res = await this.$axios.$delete(`${api.patentchat}/${payload}`);
  39. return res;
  40. },
  41. };
  42. export default {
  43. namespaced: true,
  44. state,
  45. mutations,
  46. actions,
  47. };