| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import store from '@/utils/store';
- export default {
- state: {
- level: store.get('level') || {},
- category: store.get('category') || [],
- festival: store.get('festival') || []
- },
- actions: {
- // 等级
- getLevel({ commit }) {
- return this.$service.level.list().then(res => {
- commit('SET_LEVEL', res);
- return res;
- });
- },
- delLevel({ commit }) {
- commit('DEL_LEVEL');
- },
- // 分类
- getCategory({ commit }) {
- return this.$service.category.list().then(res => {
- commit('SET_CATEGORY', res);
- return res;
- });
- },
- delCategory({ commit }) {
- commit('DEL_CATEGORY');
- },
- // 节日
- getFestival({ commit }) {
- return this.$service.common.fest().then(res => {
- commit('SET_FESTIVAL', res);
- return res;
- });
- },
- delFestival({ commit }) {
- commit('DEL_FESTIVAL');
- }
- },
- mutations: {
- SET_LEVEL(state, val) {
- state.info = val;
- store.set('level', val);
- },
- DEL_LEVEL(state) {
- state.info = {};
- store.remove('level');
- },
- SET_CATEGORY(state, val) {
- state.info = val;
- store.set('category', val);
- },
- DEL_CATEGORY(state) {
- state.info = [];
- store.remove('category');
- },
- SET_FESTIVAL(state, val) {
- state.info = val;
- store.set('festival', val);
- },
- DEL_FESTIVAL(state) {
- state.info = [];
- store.remove('festival');
- }
- }
- };
|