|
|
@@ -18,9 +18,17 @@
|
|
|
</div>
|
|
|
<p style="text-align: center">{{ imgText }}</p>
|
|
|
<div class="mask" v-if="progressFlag">
|
|
|
- <el-progress type="circle" :percentage="percentage"></el-progress>
|
|
|
+ <el-progress
|
|
|
+ type="circle"
|
|
|
+ :percentage="percentage"
|
|
|
+ :show-text="true"
|
|
|
+ :format="format"></el-progress>
|
|
|
</div>
|
|
|
- <imageAIVerifyErr v-if="imageAIVerifyFlag"></imageAIVerifyErr>
|
|
|
+ <imageAIVerifyErr
|
|
|
+ :imageAIVerifyFlag="imageAIVerifyFlag"
|
|
|
+ :imageAIVerifyData="imageAIVerifyData"
|
|
|
+ @confirmUpload="confirmUpload"
|
|
|
+ @uploadImg="uploadImg"></imageAIVerifyErr>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -29,10 +37,16 @@ import { ImagePreview } from 'vant';
|
|
|
import axios from 'axios';
|
|
|
import { uploadImagev } from '@/api/index';
|
|
|
import imageAIVerifyErr from './imageAIVerifyErr';
|
|
|
-
|
|
|
+import { mapState } from 'vuex';
|
|
|
+import store from '@/store';
|
|
|
export default {
|
|
|
name: 'uploadImg',
|
|
|
components: { imageAIVerifyErr },
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ shotsNum: (state) => state.otheStore.shotsNum,
|
|
|
+ }),
|
|
|
+ },
|
|
|
props: {
|
|
|
uploadid: {
|
|
|
type: String,
|
|
|
@@ -66,6 +80,7 @@ export default {
|
|
|
default: 1,
|
|
|
},
|
|
|
photoIdentifyType: {
|
|
|
+ // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
|
|
|
type: String,
|
|
|
default: '',
|
|
|
},
|
|
|
@@ -82,6 +97,7 @@ export default {
|
|
|
percentage: 0,
|
|
|
timeFlag: null,
|
|
|
imageAIVerifyFlag: false,
|
|
|
+ imageAIVerifyData: null, //图匠校验返回的数据
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -149,35 +165,30 @@ export default {
|
|
|
locationRemark: localStorage.getItem('locationRemark'),
|
|
|
deptName: localStorage.getItem('deptName'),
|
|
|
};
|
|
|
- var loind1 = that.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '上传中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
+ this.toastLoading(0, '上传中...', true);
|
|
|
// 需要图匠校验的添加参数和loading
|
|
|
if (this.photoIdentifyType) {
|
|
|
+ // store.dispatch('setShotsNum', this.shotsNum + 1);
|
|
|
form.photoIdentifyType = this.photoIdentifyType;
|
|
|
this.progress();
|
|
|
}
|
|
|
- // loading
|
|
|
uploadImagev(form).then((res) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
if (res.code == -1) {
|
|
|
// 图匠图片校验接口超时
|
|
|
- this.requestTimeOut();
|
|
|
+ this.requestTimeOut(res);
|
|
|
} else if (res.code == 200) {
|
|
|
// 图匠校验结果返回
|
|
|
if (this.photoIdentifyType) {
|
|
|
- this.imageAIVerifyFlag = true;
|
|
|
+ // 重置loaidng状态
|
|
|
this.resetProgress();
|
|
|
+ this.imageAIVerifyFlag = true;
|
|
|
+ this.imageAIVerifyData = res.data;
|
|
|
+ // 过滤校验数据
|
|
|
+ // this.filterResData(res);
|
|
|
} else {
|
|
|
// 正常流程
|
|
|
- let imgArr = [];
|
|
|
- res.data.forEach((item) => {
|
|
|
- imgArr.push(item.url);
|
|
|
- });
|
|
|
- loind1.clear();
|
|
|
- that.$toast('上传成功!');
|
|
|
- that.$emit('newimgarr', { fileUrl: imgArr.join(','), type: that.type });
|
|
|
+ this.normalFlow(res);
|
|
|
}
|
|
|
} else {
|
|
|
that.$toast('上传失败!');
|
|
|
@@ -193,15 +204,40 @@ export default {
|
|
|
this.percentage = this.percentage + 10;
|
|
|
}, 1000);
|
|
|
},
|
|
|
- requestTimeOut() {
|
|
|
+ format(percentage) {
|
|
|
+ return 'format';
|
|
|
+ },
|
|
|
+ requestTimeOut(res) {
|
|
|
this.resetProgress();
|
|
|
this.$dialog
|
|
|
.confirm({
|
|
|
title: '系统提示',
|
|
|
- message: '网络原因导致图像未被识别,暂时允许提交',
|
|
|
+ message: res.msg,
|
|
|
showCancelButton: false,
|
|
|
})
|
|
|
- .then(() => {});
|
|
|
+ .then(() => {
|
|
|
+ this.normalFlow(res);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 正常流程
|
|
|
+ normalFlow(res) {
|
|
|
+ let imgArr = [];
|
|
|
+ let businessId = [];
|
|
|
+ res.data.forEach((item) => {
|
|
|
+ imgArr.push(item.url);
|
|
|
+ if (item.businessId) businessId.push(item.businessId);
|
|
|
+ });
|
|
|
+ this.$toast('上传成功!');
|
|
|
+ this.$emit('newimgarr', {
|
|
|
+ fileUrl: imgArr.join(','),
|
|
|
+ type: this.type,
|
|
|
+ businessId: businessId.join(','),
|
|
|
+ });
|
|
|
+ },
|
|
|
+ filterResData(res) {
|
|
|
+ let npkpiData = res.data.npkpiData;
|
|
|
+ // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
|
|
|
+ let recognizeType = npkpiData.recognizeType;
|
|
|
},
|
|
|
// 重置loaidng状态
|
|
|
resetProgress() {
|
|
|
@@ -210,6 +246,9 @@ export default {
|
|
|
this.progressFlag = false;
|
|
|
this.percentage = 0;
|
|
|
},
|
|
|
+ confirmUpload(res) {
|
|
|
+ this.normalFlow(res);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|