lrf402788946 4 vuotta sitten
vanhempi
commit
95b1f68c8a
2 muutettua tiedostoa jossa 39 lisäystä ja 1 poistoa
  1. 38 0
      store/talented.js
  2. 1 1
      store/util.js

+ 38 - 0
store/talented.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/train/talented`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...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, ...data }) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 1 - 1
store/util.js

@@ -31,7 +31,7 @@ const actions = {
   async utilMethod({ commit }, payload) {
     const res = await this.$axios.$post(`${api.util}`, payload);
   },
-  async taskupload({ commit }, { file, uri }) {
+  async upload({ commit }, { file, uri }) {
     // const res = await this.$axios.$post(`${api.taskupload}`, payload, null, { 'Content-Type': 'multipart/form-data' });
     let param = new FormData(); //创建form对象
     param.append('file', file); //通过append向form对象添加数据