随笔 - 34  文章 - 0  评论 - 1  阅读 - 29681 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//队伍证书上传
   getFile() {
     var that = this;
     // //1 创建formData
     let formData = new FormData();
 
     // //2 添加数据,key可以重复。不会被覆盖。因此可以多文件上传。多文件都放在同一个formData对象中
     // formData.append('file', xx);
     // formData.append('file', xx);
     formData.append('id', that.consult_data.id);
     console.log(Array.from(that.$refs.more.files));
     Array.from(that.$refs.more.files).forEach((file) => {
       formData.append('certs', file);
     });
 
     // //3 发送请求, 注意请求头数据类型要用 'multipart/form-data'
     that.axios
       .post(`entryFormController/uploadCert.do`, formData, {
         'Content-Type': 'multipart/form-data;',
       })
       .then((res) => {
         if (res.data.code == 200) {
           that.loadList();
           that.$message.success('成功上传' + res.data.data + '个证书');
         } else if (res.data.code == 400) {
           that.$message.error(res.data.message);
         }
       });
   },
 
   //队员证书上传
   seeFile(index) {
     var that = this;
     // //1 创建formData
     let formData = new FormData();
     console.log(66666666666, that.listed);
     // //2 添加数据,key可以重复。不会被覆盖。因此可以多文件上传。多文件都放在同一个formData对象中
     formData.append('id', that.consult_data.users[index].id);
 
     formData.append('cert', that.$refs['rend' + index].files[0]);
 
     // //3 发送请求, 注意请求头数据类型要用 'multipart/form-data'
     that.axios
       .post(`entryFormController/uploadCert.do`, formData, {
         'Content-Type': 'multipart/form-data;',
       })
       .then((res) => {
         if (res.data.code == 200) {
           that.$message.success('操作成功');
           that.teamList(that.consult_data);
         }
         console.log(res);
       });
   },

 

posted on   前端学习/vue  阅读(182)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示