ticket.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. tickets: '/api/jobs/tickets',
  7. ticketsinfo: '/api/jobs/tickets/{id}',
  8. };
  9. export const state = () => ({});
  10. export const mutations = {};
  11. export const actions = {
  12. // 入场券接口
  13. async ticketsOperation({ state }, { type, data }) {
  14. let result;
  15. let { skip, limit } = data;
  16. if (type === 'add') {
  17. let { query, body } = data;
  18. result = await this.$axios.$post(api.tickets, body, {}, query);
  19. }
  20. if (type === 'list') {
  21. let { schid, fairid, studid } = data;
  22. result = await this.$axios.$get(api.tickets, {}, { schid: schid, fairid: fairid, studid: studid, skip: skip, limit: limit });
  23. }
  24. if (type === 'search') {
  25. let { id } = data;
  26. result = await this.$axios.$get(api.ticketsinfo, { id: id });
  27. }
  28. if (type === 'update') {
  29. let { info, id } = data;
  30. result = await this.$axios.$post(api.ticketsinfo, info, { id: id });
  31. }
  32. if (type === 'delete') {
  33. let { id } = data;
  34. result = await this.$axios.$delete(api.ticketsinfo, {}, { id: id });
  35. }
  36. return result;
  37. },
  38. };