浏览代码

Merge branch 'master' of http://git.cc-lotus.info/live/common

guhongwei 3 年之前
父节点
当前提交
d395060835
共有 2 个文件被更改,包括 39 次插入0 次删除
  1. 1 0
      src/store/adminLogin.js
  2. 38 0
      src/store/patent/report.js

+ 1 - 0
src/store/adminLogin.js

@@ -40,6 +40,7 @@ const actions = {
       localStorage.setItem('token', res.data);
       user = jwt.decode(res.data);
       commit('setUser', user, { root: true });
+      res.user = user;
     }
     return res;
   },

+ 38 - 0
src/store/patent/report.js

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