Browse Source

添加接口

306132416@qq.com 4 years ago
parent
commit
b01943879c
2 changed files with 37 additions and 12 deletions
  1. 1 1
      src/request/api.js
  2. 36 11
      src/views/data/InforList.vue

+ 1 - 1
src/request/api.js

@@ -4,7 +4,7 @@ axios.defaults.baseURL = 'http://192.168.2.122:8080';
 //axios.defaults.baseURL = '/api';
 axios.defaults.timeout = 5000;
 // axios.defaults.headers.common['token'] = token
-axios.defaults.headers.post['Content-Type'] = 'multipart/form-data';//配置请求头
+//axios.defaults.headers.post['Content-Type'] = 'multipart/form-data';//配置请求头
 
 // 请求拦截器
 axios.interceptors.request.use((config) => {

+ 36 - 11
src/views/data/InforList.vue

@@ -59,7 +59,7 @@
                   <span
                     v-for="(operationObj, i) in operation"
                     :key="i"
-                    @click="operationObj.function(index)"
+                    @click="operationObj.function(obj)"
                     >{{ operationObj.name }}
                   </span>
                 </td>
@@ -121,8 +121,8 @@ export default {
       initialPage: this.detailVisible,
       tableHeaderD: [
         "资料名称",
-        "时间类型",
-        "传播类型",
+        "素材时间",
+        "经销商范围",
         "上传时间",
         "下载状态",
         "反馈状态",
@@ -131,9 +131,16 @@ export default {
       operation: [
         {
           name: "下载",
-          function: () => {
+          function: (obj) => {
             //this.download();
-            this.downloadPost();
+            let config = {
+              url:'/dealerDownload',
+              data:{
+                informationId:obj.id,
+                agentId:obj.agentId
+              }
+            };
+            this.downloadPost(config);
           },
         },
         /*    {
@@ -156,7 +163,7 @@ export default {
       currentPage: 1,
       tableData: [
         {
-          name: "北京博瑞",
+          informationName: "北京博瑞",
           time: "2021/04",
           spread: "传播类型1",
           uploadTime: "",
@@ -164,7 +171,7 @@ export default {
           feedback: "未反馈",
         },
         {
-          name: "雷克萨斯纯电动SUV",
+          informationName: "雷克萨斯纯电动SUV",
           time: "2021/04",
           spread: "传播类型1",
           uploadTime: "",
@@ -172,7 +179,7 @@ export default {
           feedback: "未反馈",
         },
         {
-          name: "续航可达400公里",
+          informationName: "续航可达400公里",
           time: "2021/04",
           spread: "传播类型1",
           uploadTime: "",
@@ -251,10 +258,10 @@ export default {
           url: config.url,
           method: "post",
           data: config.data,
-          responseType: "blob",
         })
           .then((res) => {
-            // resolve(res);
+            console.log(res)
+            resolve(res);
             let link = document.createElement("a");
             link.href = window.URL.createObjectURL(new Blob([res.data]));
             link.target = "_blank";
@@ -269,8 +276,26 @@ export default {
           });
       });
     },
+    //获取资料列表
+    getDataList: function () {
+        this.$http({
+          url:'/firmsUploadListByAgent',
+          method: "post",
+          data: {},
+        }).then((res) => {
+           console.log(res);
+           if(res.data.code === 200){
+             this.tableData = res.data.data;
+           }
+        })
+      .catch((err) => {
+           console.log(err);
+     });
+    },
+  },
+  mounted() {
+      this.getDataList()
   },
-  mounted() {},
 };
 </script>