other.js 556 B

123456789101112131415161718192021222324
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. import axios from 'axios';
  5. Vue.use(Vuex);
  6. const api = {
  7. calendar: `/api/train/common/findyear`,
  8. };
  9. const state = () => ({});
  10. const mutations = {};
  11. const actions = {
  12. async calendar({ commit }, { year } = {}) {
  13. const res = await this.$axios.$get(`${api.calendar}`, { year });
  14. if (res.errcode == '0') return res.data;
  15. else this.$message.error(res.reason || '万年历接口请求失败');
  16. },
  17. };
  18. export default {
  19. namespaced: true,
  20. state,
  21. mutations,
  22. actions,
  23. };