liveTechnicalNews.js 1.0 KB

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