market.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = { newsInfo: `/api/market/product` };
  6. const state = () => ({});
  7. const mutations = {};
  8. const actions = {
  9. async query({ commit }, { skip = 0, limit, ...info } = {}) {
  10. const res = await this.$axios.$get(`${api.newsInfo}`, { skip, limit, ...info });
  11. return res;
  12. },
  13. async newquery({ commit }, { skip = 0, limit, ...info } = {}) {
  14. const res = await this.$axios.$get(`${api.newsInfo}/newquery`, { skip, limit, ...info });
  15. return res;
  16. },
  17. async newfetch({ commit }, { skip = 0, limit, ...info } = {}) {
  18. const res = await this.$axios.$get(`${api.newsInfo}/newfetch`, { skip, limit, ...info });
  19. return res;
  20. },
  21. async create({ commit }, payload) {
  22. const res = await this.$axios.$post(`${api.newsInfo}`, payload);
  23. return res;
  24. },
  25. async fetch({ commit }, payload) {
  26. const res = await this.$axios.$get(`${api.newsInfo}/${payload}`);
  27. return res;
  28. },
  29. async update({ commit }, { id, ...data }) {
  30. const res = await this.$axios.$post(`${api.newsInfo}/update/${id}`, data);
  31. return res;
  32. },
  33. async delete({ commit }, payload) {
  34. const res = await this.$axios.$delete(`${api.newsInfo}/${payload}`);
  35. return res;
  36. },
  37. };
  38. export default { namespaced: true, state, mutations, actions };