question-completion.js 1.1 KB

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