lrf402788946 4 years ago
parent
commit
eb9fd56257
1 changed files with 11 additions and 0 deletions
  1. 11 0
      store/util.js

+ 11 - 0
store/util.js

@@ -10,6 +10,7 @@ const api = {
   findModel: model => `/api/train/common/findbymodel?modelname=${model}`,
   findByIds: model => `/api/train/common/findbyids/${model}`,
   util: `/api/train/util`,
+  taskupload: `/files/task/upload`,
 };
 const state = () => ({});
 const mutations = {};
@@ -30,6 +31,16 @@ const actions = {
   async utilMethod({ commit }, payload) {
     const res = await this.$axios.$post(`${api.util}`, payload);
   },
+  async taskupload({ commit }, payload) {
+    // const res = await this.$axios.$post(`${api.taskupload}`, payload, null, { 'Content-Type': 'multipart/form-data' });
+    let param = new FormData(); //创建form对象
+    param.append('file', payload); //通过append向form对象添加数据
+    const config = {
+      headers: { 'Content-Type': 'multipart/form-data' },
+    };
+    const res = await axios.post(`${api.taskupload}`, param, config);
+    return res;
+  },
 };
 export default {
   namespaced: true,