123456789101112131415161718192021222324252627282930313233343536373839 |
- import Vue from 'vue';
- import Vuex from 'vuex';
- import _ from 'lodash';
- Vue.use(Vuex);
- const api = {
- tickets: '/api/jobs/tickets',
- ticketsinfo: '/api/jobs/tickets/{id}',
- };
- export const state = () => ({});
- export const mutations = {};
- export const actions = {
- // 入场券接口
- async ticketsOperation({ state }, { type, data }) {
- let result;
- let { skip, limit } = data;
- if (type === 'add') {
- let { query, body } = data;
- result = await this.$axios.$post(api.tickets, body, {}, query);
- }
- if (type === 'list') {
- let { schid, fairid, studid } = data;
- result = await this.$axios.$get(api.tickets, {}, { schid: schid, fairid: fairid, studid: studid, skip: skip, limit: limit });
- }
- if (type === 'search') {
- let { id } = data;
- result = await this.$axios.$get(api.ticketsinfo, { id: id });
- }
- if (type === 'update') {
- let { info, id } = data;
- result = await this.$axios.$post(api.ticketsinfo, info, { id: id });
- }
- if (type === 'delete') {
- let { id } = data;
- result = await this.$axios.$delete(api.ticketsinfo, {}, { id: id });
- }
- return result;
- },
- };
|