掉接口封装的参数控制台 有值 network 里丢失问题

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
解决方案
把以前的代码

 let images=  []
                 this.formInline.fileList.forEach((item,index)=>{
                   this.BlobToBase64(item.raw).then(res => {
                         images.push({
                           fileName: item.name,
                            docType: item.formTypeCode,
                            imageNo: this.formInline.fileList.length + index + 1 + "",
                             msg: res.split(";base64,")[1]
                        });
                    })
                     if (index+1==this.formInline.fileList.length) {
                        query.imageList=images
                     }
                 });
                 console.log('准备发起',{query});
                    const res = await startPolicyInvestigate(query)
                         console.log('保单调查发起',res);
                        if (res.success) {
                            this.$message.success('发起成功')
                            this.clearFN()
                            this.showserveypage=false
                        }

改成这个格式promise.all 方法使用

// 使用Promise.all等待所有图片转换完成
                    const imagePromises = this.formInline.fileList.map((item, index) => {
                        return this.BlobToBase64(item.raw).then(res => {
                            return {
                                fileName: item.name,
                                docType: item.formTypeCode,
                                imageNo: this.formInline.fileList.length + index + 1 + "",
                                msg: res.split(";base64,")[1]
                            };
                        })
                    });
                    // 等待所有图片转换完成后再继续
                    Promise.all(imagePromises).then(images => {
                        query.imageList = images;
                        
                        console.log('准备发起', {query});
                        
                        // 在Promise.all的then中调用接口
                        startPolicyInvestigate(query).then(res => {
                            console.log('保单调查发起', res);
                            if (res.success) {
                                this.$message.success('发起成功')
                                this.clearFN()
                                this.showserveypage = false
                            }
                        }).catch(error => {
                            console.error('发起失败', error);
                        });
                    }).catch(error => {
                        console.error('图片转换失败', error);
                    });
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值