guhongwei há 4 anos atrás
pai
commit
74d48966e0
2 ficheiros alterados com 45 adições e 0 exclusões
  1. 2 0
      src/store/index.js
  2. 43 0
      src/store/market/util.js

+ 2 - 0
src/store/index.js

@@ -52,6 +52,7 @@ import liveTechnicalNews from './live/liveTechnicalNews';
 import survey from './market/survey';
 // e专利
 import patent from './market/patent';
+import util from './market/util';
 
 Vue.use(Vuex);
 
@@ -108,5 +109,6 @@ export default new Vuex.Store({
     survey,
     // e专利
     patent,
+    util,
   },
 });

+ 43 - 0
src/store/market/util.js

@@ -0,0 +1,43 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  utilInfo: `/api/market/util`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.utilInfo}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.utilInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.utilInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.utilInfo}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.utilInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};