place.js 1006 B

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