marketproduct.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. newsInfo: `/api/market/product`,
  7. };
  8. const state = () => ({});
  9. const mutations = {};
  10. const actions = {
  11. async query({ commit }, { skip = 0, limit, ...info } = {}) {
  12. const res = await this.$axios.$get(`${api.newsInfo}`, {
  13. skip,
  14. limit,
  15. ...info,
  16. });
  17. return res;
  18. },
  19. async newquery({ commit }, { skip = 0, limit, ...info } = {}) {
  20. const res = await this.$axios.$get(`${api.newsInfo}/newquery`, {
  21. skip,
  22. limit,
  23. ...info,
  24. });
  25. return res;
  26. },
  27. async comquery({ commit }, { skip = 0, limit, ...info } = {}) {
  28. const res = await this.$axios.$get(`${api.newsInfo}/allquery`, {
  29. skip,
  30. limit,
  31. ...info,
  32. });
  33. return res;
  34. },
  35. async newfetch({ commit }, { skip = 0, limit, ...info } = {}) {
  36. const res = await this.$axios.$get(`${api.newsInfo}/newfetch`, {
  37. skip,
  38. limit,
  39. ...info,
  40. });
  41. return res;
  42. },
  43. async create({ commit }, payload) {
  44. const res = await this.$axios.$post(`${api.newsInfo}`, payload);
  45. return res;
  46. },
  47. async fetch({ commit }, payload) {
  48. const res = await this.$axios.$get(`${api.newsInfo}/${payload}`);
  49. return res;
  50. },
  51. async update({ commit }, { id, ...data }) {
  52. const res = await this.$axios.$post(`${api.newsInfo}/update/${id}`, data);
  53. return res;
  54. },
  55. async delete({ commit }, payload) {
  56. const res = await this.$axios.$delete(`${api.newsInfo}/${payload}`);
  57. return res;
  58. },
  59. };
  60. export default {
  61. namespaced: true,
  62. state,
  63. mutations,
  64. actions,
  65. };