tip: 该文只作为个人笔记,不解决技术问题,不发出技术反馈,当前不保证其技术含量,后续会一一解决修改
1)if语句多层级循环,if深层嵌套if ,且多层逻辑嵌套
主要解决办法就是反向思维去掉无用条件判断项
2)其次是正则,多用
3)然后是Vue中使用this.$options.methods时请求到的对象保存不到data中的数据,需要return出来,然后需要用个promise对象去接收
```
async uploadReportImage() {
this.fileList.forEach((item) => {
this.newFileList.push(item.content);
});
try {
const webResult = await initReview({
report_image_list: new Set(this.newFileList),
});
if (webResult.code === "Success") {
Toast.success("上传成功");
this.imageList = webResult.data.list;
this.reviewResult = this.$options.methods.reviewReportImage(
this.imageList
);
this.isReviewCompleted = true;
} else {
Toast.fail("上传失败");
}
} catch (err) {
Toast.fail("上传失败");
}
// 拿到响应结果,初始化
this.init();
},
// 审核
async reviewReportImage(image_list) {
try {
const webResult = await processReview({
image_list: image_list,
});
if (webResult.code === "Success") {
this.reviewResultList = webResult.data.list;
}
return this.reviewResultList;
} catch (err) {
console.log(err);
}
},
```
4)该问题目前还没有稍微好一点的解决方案,比如拿到后台的反馈数据的时候是一个对象,包含
check_type:String
is_high:Boolean
is_time:Boolean
info_id:Number
status:String
我需要知道当is_high属性为true时候的check_type的值,这个时候我只能写个if语句判断,外部写一个result值保存该res响应下的check_type,不知道有没有更简单的办法。
5)安装sass-loader的时候,以及less时,注意sassloader leseeloader版本,以及npm版本
6)用户提交报告需求,提交后条件识别不清,h5刷新页面,使用this.$router.push(0)
7)遇到了个图片路径是json拿到的url,图片会显示加载失败,但是该url是可以访问到的状态,修改Vue中index.html的h5头部。