zhujindu vor 1 Jahr
Ursprung
Commit
db2bece0c9

+ 9 - 0
src/api/index.js

@@ -951,3 +951,12 @@ export function getDictOption(query, dictTypr) {
     params: query,
   });
 }
+
+// 仍要上传图片入库
+export function addPhotoToDB(data) {
+  return request({
+    url: 'mobile/storeGroup/addPhotoToDB',
+    method: 'post',
+    data: data,
+  });
+}

+ 50 - 31
src/components/deleteUploadImg1.vue

@@ -1,27 +1,41 @@
 <template>
-  <div >
-  <van-row gutter="10" >
-    <van-col span="6" v-for="(urls, index) in imgs" :key="index">
-      <div class="imgview">
-        <van-icon name="close" size="16" v-on:click="deleteImg(index,urls.id)"/>
-        <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>
-        <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>
-      </div>
-    </van-col>
-  </van-row>
-<!--  <div style="padding: 10px 16px 0;">-->
-<!--    <div class="img-box" v-for="(urls, index) in imgs" :key="index">-->
-<!--      <van-icon name="clear" v-on:click="deleteImg(index,urls.id)"/>-->
-<!--      <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
-<!--      <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
-<!--    </div>-->
-<!--  </div>-->
+  <div>
+    <van-row gutter="10">
+      <van-col span="6" v-for="(urls, index) in imgs" :key="index">
+        <div class="imgview">
+          <van-icon
+            name="close"
+            size="16"
+            v-on:click="deleteImg(index, urls.id)"
+            v-if="photoIdentifyType != 1" />
+          <img
+            v-if="urls.type == '2'"
+            :src="urls.fileUrl"
+            width="100px"
+            height="100px"
+            @click="previewsImg(index)" />
+          <img
+            v-else
+            :src="urls.fileUrl"
+            width="100px"
+            height="100px"
+            @click="previewsImg(index)" />
+        </div>
+      </van-col>
+    </van-row>
+    <!--  <div style="padding: 10px 16px 0;">-->
+    <!--    <div class="img-box" v-for="(urls, index) in imgs" :key="index">-->
+    <!--      <van-icon name="clear" v-on:click="deleteImg(index,urls.id)"/>-->
+    <!--      <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
+    <!--      <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
+    <!--    </div>-->
+    <!--  </div>-->
   </div>
 </template>
 
 <script>
-import {ImagePreview} from "vant";
-import {removePhoto} from "@/api/index";
+import { ImagePreview } from 'vant';
+import { removePhoto } from '@/api/index';
 
 export default {
   name: 'deleteUploadImg',
@@ -29,41 +43,46 @@ export default {
     imgs: {
       type: Array,
       default() {
-        return []
-      }
+        return [];
+      },
+    },
+    photoIdentifyType: {
+      // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
+      type: String,
+      default: '',
     },
   },
   data() {
     return {
-      url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API
-    }
+      url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
+    };
   },
   methods: {
     deleteImg(index, collectionItemId) {
-      removePhoto({fileId: collectionItemId}).then(res => {
+      removePhoto({ fileId: collectionItemId }).then((res) => {
         if (res.code == 200) {
-          this.$toast("删除成功!")
+          this.$toast('删除成功!');
           this.imgs.splice(index, 1);
         } else {
-          this.$toast("删除失败!")
+          this.$toast('删除失败!');
         }
-      })
+      });
     },
     previewsImg(index) {
-      var arrimg = []
+      var arrimg = [];
       for (var imgi = 0; imgi < this.imgs.length; imgi++) {
-        arrimg.push(this.imgs[imgi].fileUrl)
+        arrimg.push(this.imgs[imgi].fileUrl);
       }
       ImagePreview({
         images: arrimg,
         startPosition: index,
         onClose() {
           // do something
-        }
+        },
       });
     },
   },
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 236 - 55
src/components/imageAIVerifyErr.vue

@@ -1,22 +1,116 @@
 <template>
   <div class="imageAIVerifyErr">
-    <van-popup v-model="vanPopup" @close="close">
+    <el-dialog
+      title="提示"
+      :visible.sync="vanPopup"
+      width="80%"
+      :append-to-body="true"
+      custom-class="AIVerifyErrdialog">
+      <div class="AIVerifyErrMask">
+        <!-- <van-popup v-model="vanPopup" @close="close" :close-on-click-overlay="false"> -->
+        <div class="title">图像识别结果</div>
+        <div class="content">
+          <div class="AIVerify">{{ contentMessage }}</div>
+          <div class="uploadImg" @click="uploadImg" v-if="shopSignChange != 1">
+            <div class="label"><span class="van-f-red">*</span>重新拍照上传</div>
+            <div class="icon">
+              <van-icon class="photo photos" name="photograph" size="22px" color="#969696" />
+            </div>
+          </div>
+        </div>
+        <div class="uploadBtn" v-if="shotsNum >= 3 && shopSignChange != 1">
+          <div class="tips"><van-icon name="question-o" @click="openTips" />上传后会有何影响</div>
+          <div class="confirmUpload" @click="confirmUpload">仍要上传</div>
+        </div>
+        <div class="uploadBtn" v-if="shopSignChange == 1">
+          <div class="confirmUpload" @click="uploadImg">重新拍照</div>
+          <div class="changeImage" @click="confirmUpload">更换门店照</div>
+        </div>
+        <div class="historyImage" v-if="shopSignChange == 1">
+          <div class="initImage imageItem" v-if="imageAIVerifyData.createStoreUrl">
+            <img
+              :src="imageAIVerifyData.createStoreUrl"
+              width="100px"
+              height="100px"
+              @click="previewsImg(imageAIVerifyData.createStoreUrl)" />
+            <span>建店时店招</span>
+          </div>
+          <div class="newestImage imageItem" v-if="imageAIVerifyData.lastVisitUrl">
+            <img
+              :src="imageAIVerifyData.lastVisitUrl"
+              width="100px"
+              height="100px"
+              @click="previewsImg(imageAIVerifyData.lastVisitUrl)" />
+            <span>上次拜访店招</span>
+          </div>
+          <div class="presentImage imageItem" v-if="imageAIVerifyData.url">
+            <img
+              :src="imageAIVerifyData.url"
+              width="100px"
+              height="100px"
+              @click="previewsImg(imageAIVerifyData.url)" />
+            <span>本次拜访店招</span>
+          </div>
+        </div>
+        <div class="tipsRemark" v-if="shopSignChange == 1">
+          <p>若历史照片拍摄不规范,请选择<span style="color: #81b337">更新门店照</span></p>
+          <p>本次拜访店招会作为本店标准店招,未来每次拜访时校验</p>
+        </div>
+        <!-- </van-popup> -->
+      </div>
+    </el-dialog>
+    <!-- <div class="AIVerifyErrMask">
+      <van-popup v-model="vanPopup" @close="close" :close-on-click-overlay="false">
       <div class="title">图像识别结果</div>
       <div class="content">
         <div class="AIVerify">{{ contentMessage }}</div>
-        <div class="uploadImg" @click="uploadImg">
+        <div class="uploadImg" @click="uploadImg" v-if="shopSignChange != 1">
           <div class="label"><span class="van-f-red">*</span>重新拍照上传</div>
           <div class="icon">
             <van-icon class="photo photos" name="photograph" size="22px" color="#969696" />
           </div>
         </div>
       </div>
-      <div class="btn">
-        <!--  v-if="shotsNum >= 3" -->
-        <div class="tips"><van-icon name="question-o" />上传后会有何影响</div>
-        <van-button type="danger" @confirmUpload="confirmUpload">{{ shotsNum }}仍要上传</van-button>
+      <div class="uploadBtn" v-if="shotsNum >= 3 && shopSignChange != 1">
+        <div class="tips"><van-icon name="question-o" @click="openTips" />上传后会有何影响</div>
+        <div class="confirmUpload" @click="confirmUpload">仍要上传</div>
+      </div>
+      <div class="uploadBtn" v-if="shopSignChange == 1">
+        <div class="confirmUpload" @click="uploadImg">重新拍照</div>
+        <div class="changeImage" @click="confirmUpload">更换门店照</div>
+      </div>
+      <div class="historyImage" v-if="shopSignChange == 1">
+        <div class="initImage imageItem" v-if="imageAIVerifyData.createStoreUrl">
+          <img
+            :src="imageAIVerifyData.createStoreUrl"
+            width="100px"
+            height="100px"
+            @click="previewsImg(imageAIVerifyData.createStoreUrl)" />
+          <span>建店时店招</span>
+        </div>
+        <div class="newestImage imageItem" v-if="imageAIVerifyData.lastVisitUrl">
+          <img
+            :src="imageAIVerifyData.lastVisitUrl"
+            width="100px"
+            height="100px"
+            @click="previewsImg(imageAIVerifyData.lastVisitUrl)" />
+          <span>上次拜访店招</span>
+        </div>
+        <div class="presentImage imageItem" v-if="imageAIVerifyData.url">
+          <img
+            :src="imageAIVerifyData.url"
+            width="100px"
+            height="100px"
+            @click="previewsImg(imageAIVerifyData.url)" />
+          <span>本次拜访店招</span>
+        </div>
+      </div>
+      <div class="tipsRemark" v-if="shopSignChange == 1">
+        <p>若历史照片拍摄不规范,请选择<span style="color: #81b337">更新门店照</span></p>
+        <p>本次拜访店招会作为本店标准店招,未来每次拜访时校验</p>
       </div>
-    </van-popup>
+      </van-popup>
+    </div> -->
   </div>
 </template>
 <script>
@@ -29,8 +123,11 @@ export default {
       default: false,
     },
     imageAIVerifyData: {
-      type: [Array, null],
-      default: null,
+      type: [Array, Object],
+    },
+    source: {
+      // 新建店还是门店拜访 visit/newCreated
+      type: String,
     },
   },
   computed: {
@@ -41,101 +138,185 @@ export default {
   watch: {
     imageAIVerifyFlag: {
       handler(val) {
+        console.log('imageAIVerifyFlag=' + val);
         if (val) this.initData();
       },
+      immediate: true,
     },
   },
   data() {
     return {
       contentMessage: '', //提示内容
       vanPopup: true,
+      shopSignChange: 0,
     };
   },
   methods: {
     initData() {
       // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
-      // if( imageAIVerifyData[0].npkpiData.recognizeType == 1 ){}
+      // shopSignChange  是否更换店招(0:未更换,1:更换) 1不一致,0一致
       // checkInfo 图片检查结果
       // cheatState 是否作弊(0:未作弊,1:作弊)
       // cheatType	作弊类型
       // qualifiedState 是否合格(0:不合格,1:合格)
       // unqualifiedReason	不合格原因
-      console.log(this.imageAIVerifyData);
-      let checkInfo = this.imageAIVerifyData[0].npkpiData.checkInfo || null;
-      if (checkInfo) {
-        if (checkInfo.qualifiedState == 0) {
+      console.log('imageAIVerifyData=' + JSON.stringify(this.imageAIVerifyData));
+      let npkpiData =
+        this.source == 'visit'
+          ? this.imageAIVerifyData.npkpiData
+          : this.imageAIVerifyData[0].npkpiData;
+      // 照片和历史照片是否一致
+      this.shopSignChange = npkpiData.shopSignChange;
+      this.shopSignMatchList = npkpiData.shopSignMatchList;
+      if (npkpiData.shopSignChange == 1) {
+        this.contentMessage = '与历史照片不一致,请确认店招是否更换?';
+        return;
+      }
+      // 照片是否合格
+      if (npkpiData.checkInfo) {
+        if (npkpiData.checkInfo.qualifiedState == 0) {
           // 失败次数增加超过三次特殊处理
           store.dispatch('setShotsNum', this.shotsNum + 1);
           // 不合格
-          this.contentMessage = this.contentMessage + checkInfo.unqualifiedReason;
-          if (checkInfo.cheatState == 1) {
+          this.contentMessage = this.contentMessage + npkpiData.checkInfo.unqualifiedReason;
+          if (npkpiData.checkInfo.cheatState == 1) {
             // 作弊
-            this.contentMessage = this.contentMessage + checkInfo.cheatType;
+            this.contentMessage = this.contentMessage + npkpiData.checkInfo.cheatType;
           }
+        } else {
+          this.close();
+          this.$emit('normalFlow', { data: this.imageAIVerifyData });
         }
       }
     },
     // 重新拍照
     uploadImg() {
+      this.$emit('close');
       this.$emit('uploadImgFun');
     },
     // 仍要上传
     confirmUpload() {
+      this.$emit('close');
       this.$emit('confirmUpload', { data: this.imageAIVerifyData });
     },
     close() {
       this.$emit('close');
     },
+    openTips() {
+      this.$dialog
+        .confirm({
+          title: '系统提示',
+          message: '不规范的照片上传后会更换本店标准店招,未来每次拜访时校验。',
+          showCancelButton: false,
+        })
+        .then(() => {});
+    },
+    previewsImg(url) {
+      ImagePreview({
+        images: [url],
+      });
+    },
   },
 };
 </script>
-<style scoped lang="scss">
-.imageAIVerifyErr {
-  border-radius: 8px;
-  .van-popup {
-    width: 80%;
-    padding: 8px;
-  }
-  .van-f-red {
-    color: red;
-    width: 8px;
-    display: inline-block;
-    line-height: 26px;
-  }
-  .photo {
-    /*margin-top: 9px;*/
-    float: right;
-  }
-  .title {
-    font-size: 16px;
-    text-align: center;
-    padding: 5px;
-  }
-  .content {
-    border-top: 1px solid #ccc;
-    border-bottom: 1px solid #ccc;
-    .AIVerify {
-      padding: 5px;
-      font-size: 14px;
+<style lang="scss">
+.el-dialog__wrapper {
+  z-index: 99999999;
+  .imageAIVerifyErr {
+    .AIVerifyErrMask {
+      width: 90%;
+      padding: 8px;
+      border-radius: 8px;
+      overflow: hidden;
+    }
+    .van-popup {
+      width: 90%;
+      padding: 8px;
+      border-radius: 8px;
+      overflow: hidden;
+    }
+    .van-f-red {
       color: red;
+      width: 8px;
+      display: inline-block;
+      line-height: 26px;
+    }
+    .photo {
+      /*margin-top: 9px;*/
+      float: right;
+    }
+    .title {
+      font-size: 16px;
+      font-weight: 600;
       text-align: center;
+      padding: 5px;
+    }
+    .content {
+      border-top: 1px solid #ccc;
+      .AIVerify {
+        padding: 6px;
+        font-size: 14px;
+        color: red;
+        text-align: center;
+        border-bottom: 1px solid #ccc;
+      }
+      .uploadImg {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        .label {
+          font-size: 14px;
+        }
+      }
     }
-    .uploadImg {
+    .uploadBtn {
+      border-top: 1px solid #ccc;
       display: flex;
       align-items: center;
       justify-content: space-between;
-      .label {
+      padding: 8px 0;
+      div {
+        width: 40%;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-size: 14px;
+        color: #fff;
+        border-radius: 6px;
+      }
+      .tips {
         font-size: 14px;
+        color: #e7e734;
+      }
+      .confirmUpload {
+        background-color: red;
+        padding: 8px 0;
+      }
+      .changeImage {
+        background-color: #81b337;
+        padding: 8px 0;
       }
     }
-  }
-  .btn {
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    .tips {
-      font-size: 14px;
-      color: rgb(232, 232, 100);
+    .historyImage {
+      display: flex;
+      justify-content: space-between;
+      .imageItem {
+        width: 30%;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        span {
+          font-size: 12px;
+        }
+      }
+    }
+    .tipsRemark {
+      border-top: 1px solid #ccc;
+      p {
+        font-size: 12px;
+        padding: 3px 0;
+      }
     }
   }
 }

+ 19 - 16
src/components/uploadImgVStore.vue

@@ -30,6 +30,8 @@
       :imageAIVerifyData="imageAIVerifyData"
       @confirmUpload="confirmUpload"
       @uploadImgFun="uploadImg"
+      :source="'newCreated'"
+      @normalFlow="normalFlow"
       @close="close"></imageAIVerifyErr>
   </div>
 </template>
@@ -39,16 +41,9 @@ 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,
@@ -123,7 +118,7 @@ export default {
         this.wx.chooseImage({
           count: this.count,
           sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
-          sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
+          sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
           defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
           isSaveToAlbum: 0,
           success: (chooseRes) => {
@@ -160,6 +155,9 @@ export default {
       });
     },
     uploadImagev(meidaId) {
+      // 初始化重置 图匠校验
+      this.resetProgress();
+      this.close();
       var that = this;
       var form = {
         mediaId: meidaId,
@@ -169,7 +167,6 @@ export default {
       };
       // 需要图匠校验的添加参数和loading
       if (this.photoIdentifyType) {
-        // store.dispatch('setShotsNum', this.shotsNum + 1);
         form.photoIdentifyType = this.photoIdentifyType;
         this.progress();
       } else {
@@ -186,9 +183,8 @@ export default {
             // 重置loaidng状态
             this.resetProgress();
             this.imageAIVerifyFlag = true;
+            console.log('res.data=' + JSON.stringify(res.data));
             this.imageAIVerifyData = res.data;
-            // 过滤校验数据
-            // this.filterResData(res);
           } else {
             // 正常流程
             this.normalFlow(res);
@@ -212,6 +208,7 @@ export default {
     },
     requestTimeOut(res) {
       this.resetProgress();
+      this.close();
       this.$dialog
         .confirm({
           title: '系统提示',
@@ -237,11 +234,6 @@ export default {
         businessId: businessId.join(','),
       });
     },
-    filterResData(res) {
-      let npkpiData = res.data.npkpiData;
-      // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
-      let recognizeType = npkpiData.recognizeType;
-    },
     // 重置loaidng状态
     resetProgress() {
       this.percentage = 100;
@@ -324,5 +316,16 @@ export default {
   display: flex;
   justify-content: center;
   align-items: center;
+  z-index: 99999999;
+  .el-progress__text {
+    white-space: pre-wrap;
+  }
+}
+</style>
+<style lang="scss">
+.mask {
+  .el-progress__text {
+    white-space: pre-wrap;
+  }
 }
 </style>

+ 144 - 11
src/components/uploadVNormal.vue

@@ -4,15 +4,33 @@
       <van-icon class="photo photos" name="photograph" size="22px" color="#969696" />
     </div>
     <div id="allmap"></div>
+    <div class="mask" v-if="progressFlag">
+      <el-progress
+        type="circle"
+        :percentage="percentage"
+        :show-text="true"
+        :format="format"></el-progress>
+    </div>
+    <imageAIVerifyErr
+      v-if="imageAIVerifyFlag"
+      :imageAIVerifyFlag="imageAIVerifyFlag"
+      :imageAIVerifyData="imageAIVerifyData"
+      @confirmUpload="confirmUpload"
+      @uploadImgFun="uploadImg"
+      :source="'visit'"
+      @normalFlow="normalFlow"
+      @close="close"></imageAIVerifyErr>
   </div>
 </template>
 
 <script>
-import { addstorePhoto, addVisitsPosition } from '@/api/index';
+import { addstorePhoto, addVisitsPosition, addPhotoToDB } from '@/api/index';
+import imageAIVerifyErr from './imageAIVerifyErr';
 import axios from 'axios';
 
 export default {
   name: 'uploadImg',
+  components: { imageAIVerifyErr },
   props: {
     uploadid: {
       type: String,
@@ -80,11 +98,23 @@ export default {
       type: String,
       default: '',
     },
+    photoIdentifyType: {
+      // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
+      type: String,
+      default: '',
+    },
   },
   data() {
     return {
       shows: false,
       url: '',
+      progressFlag: false,
+      percentage: 0,
+      timeFlag: null,
+      imageAIVerifyFlag: false,
+      imageAIVerifyData: null, //图匠校验返回的数据
+      meidaId: '', //当前上传图片id
+      addressesRemark: '', //当前位置信息
     };
   },
   methods: {
@@ -161,7 +191,7 @@ export default {
               wx.chooseImage({
                 count: 1,
                 sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
-                sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
+                sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
                 defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
                 isSaveToAlbum: 0,
                 success: function (res) {
@@ -185,6 +215,9 @@ export default {
         });
     },
     uploadImagev(meidaId, addressesRemark) {
+      // 初始化重置 图匠校验
+      this.resetProgress();
+      this.close();
       var that = this;
       var parentCollectionId = null;
       if (that.parentCollectionId != null && that.parentCollectionId != 'null') {
@@ -206,6 +239,8 @@ export default {
       if (that.thirdCollectionId != null && that.thirdCollectionId != 'null') {
         thirdCollectionId = that.thirdCollectionId;
       }
+      this.meidaId = meidaId;
+      this.addressesRemark = addressesRemark;
       var form = {
         mediaId: meidaId,
         collectionItemId: that.collectionId,
@@ -224,21 +259,98 @@ export default {
         deviceCode: that.deviceCode, //设备编号
         putInCode: that.putInCode, //投放编号
       };
-      var loind1 = that.$toast.loading({
-        duration: 0,
-        message: '上传中...',
-        forbidClick: true,
-      });
+      // 需要图匠校验的添加参数和loading
+      if (this.photoIdentifyType) {
+        form.photoIdentifyType = this.photoIdentifyType;
+        this.progress();
+      } else {
+        this.toastLoading(0, '上传中...', true);
+      }
       addstorePhoto(form).then((res) => {
-        if (res.code == 200) {
-          loind1.clear();
-          that.$toast('上传成功!');
-          that.$emit('newimgarr', { fileUrl: res.data.url, id: res.data.fileId, type: 2 });
+        this.toastLoading().clear();
+        if (res.code == -1) {
+          // 图匠图片校验接口超时
+          this.requestTimeOut(res);
+        } else if (res.code == 200) {
+          // 图匠校验结果返回
+          if (this.photoIdentifyType) {
+            // 重置loaidng状态
+            this.resetProgress();
+            this.imageAIVerifyFlag = true;
+            this.imageAIVerifyData = res.data;
+          } else {
+            // 正常流程
+            this.normalFlow(res);
+          }
         } else {
           that.$toast('上传失败!');
         }
       });
     },
+    // 正常流程
+    normalFlow(res) {
+      this.$toast('上传成功!');
+      this.$emit('newimgarr', {
+        fileUrl: res.data.url,
+        id: res.data.fileId,
+        type: 2,
+      });
+    },
+    progress() {
+      // 后端接口20000ms后失效,每1000m progress加10,到90停止;
+      this.progressFlag = true;
+      this.percentage = 10;
+      this.timeFlag = setInterval(() => {
+        this.percentage = this.percentage + 10;
+        if (this.percentage == 90) clearInterval(this.timeFlag);
+      }, 1000);
+    },
+    format(percentage) {
+      return `${percentage} %\n图像识别中`;
+    },
+    // 重置loaidng状态
+    resetProgress() {
+      this.percentage = 100;
+      clearInterval(this.timeFlag);
+      this.progressFlag = false;
+      this.percentage = 0;
+    },
+    confirmUpload(res) {
+      if (this.photoIdentifyType) {
+        var form = {
+          mediaId: this.meidaId, //	string	图片素材id
+          visitSource: '1', //	Long	拜访模式
+          storeGroupId: this.storeGroupId, //	string	门店任务组,多个用逗号隔开
+          visitsId: localStorage.getItem('visitId'), //	string	拜访id
+          taskId: this.taskId, //	string	任务id
+          objectType: this.objectType, //	string	照片类型,取任务上的照片类型,如果没有则取手动选择的照片类型
+          locationRemark: this.addressesRemark, //	String	当前地址信息
+          firstCollectionId: this.firstCollectionId, //	Long	第一级采集项id,取当前采集项的字段就行
+          secondCollectionId: this.secondCollectionId, //	Long	第二级采集项id,取当前采集项的字段就行
+          putInCode: this.putInCode, //	String	当前任务对应的投放编号
+          deviceCode: this.deviceCode, //	String	当前任务对应的设备编号
+          url: res.data.url, //	String	当前拍摄图片的url
+        };
+        addPhotoToDB(form).then(() => {});
+      }
+      this.normalFlow(res);
+    },
+    close() {
+      this.imageAIVerifyFlag = false;
+    },
+    requestTimeOut(res) {
+      this.resetProgress();
+      this.close();
+      this.$dialog
+        .confirm({
+          title: '系统提示',
+          message: res.msg,
+          showCancelButton: false,
+        })
+        .then(() => {
+          this.normalFlow(res);
+        });
+    },
   },
 };
 </script>
@@ -270,6 +382,20 @@ export default {
       z-index: 89;
     }
   }
+  .mask {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba(255, 255, 255, 0.8);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    z-index: 99999999;
+  }
 }
 #allmap {
   width: 10px;
@@ -278,3 +404,10 @@ export default {
   position: relative;
 }
 </style>
+<style lang="scss">
+.mask {
+  .el-progress__text {
+    white-space: pre-wrap;
+  }
+}
+</style>

+ 3 - 0
src/main.js

@@ -34,12 +34,15 @@ import 'element-ui/lib/theme-chalk/popover.css';
 import Vconsole from 'vconsole';
 import ElProgress from 'element-ui/lib/progress';
 import 'element-ui/lib/theme-chalk/progress.css';
+import ElDialog from 'element-ui/lib/dialog';
+import 'element-ui/lib/theme-chalk/dialog.css';
 // import wx from 'weixin-js-sdk';
 
 Vue.use(ElTable);
 Vue.use(ElTableColumn);
 Vue.use(ElPopover);
 Vue.use(ElProgress);
+Vue.use(ElDialog);
 Vue.config.productionTip = false;
 Vue.prototype.parseTime = parseTime;
 Vue.prototype.selectDictLabel = selectDictLabel;

+ 1 - 0
src/views/deviceOutside/suishenbangOutstoreVisit.vue

@@ -548,6 +548,7 @@ export default {
           locationCity: this.city,
           locationRemark: this.address,
           locationAccuracy: this.locationAccuracy,
+          photoIdentifyType: val.photoIdentifyType,
         },
       });
     },

+ 86 - 19
src/views/deviceWithin/addStoreVisit.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div class="addStoreVisit">
     <!--        顶部条-->
     <div class="navBarTOP">
       <van-nav-bar class="navBar" left-arrow title="拜访任务" @click-left="onClickLeft">
@@ -176,7 +176,9 @@
                 readonly
                 type="textarea" />
             </p>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'date'" class="formLabel z-cell">
             <van-cell>
@@ -212,7 +214,9 @@
                 readonly
                 type="textarea" />
             </p>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'tel'" class="formLabel z-cell">
             <van-cell>
@@ -248,7 +252,9 @@
                 readonly
                 type="textarea" />
             </p>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'zp'" class="formLabel z-cell">
             <van-cell>
@@ -271,7 +277,9 @@
                   @click="imgClick(item, 'A', index)" />
               </template>
             </van-cell>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'wb'" class="formLabel z-cell">
             <van-cell>
@@ -319,7 +327,9 @@
                 >回显历史</span
               >
             </p>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'duox'" class="formLabel z-cell">
             <van-cell>
@@ -351,7 +361,9 @@
               level="A"
               :zCheckboxcolumns="item.collectionOptionList"
               @zSelectVal="zSelectVal"></z-checkbox>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'sm'" class="formLabel z-cell">
             <van-cell>
@@ -400,7 +412,9 @@
                 >
               </div>
             </div>
-            <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
           </div>
           <div v-if="item.answerType == 'dx'" class="formLabel z-cell">
             <div>
@@ -435,7 +449,9 @@
                 :childindex="index"
                 @zSelectVal="zSelectVal"
                 :relevancyItem="item.relevancyItem"></z-radio>
-              <delete-upload-img :imgs="item.fileInfoList"></delete-upload-img>
+              <delete-upload-img
+                :photoIdentifyType="photoIdentifyType"
+                :imgs="item.fileInfoList"></delete-upload-img>
               <div v-for="(child, indexc) in item.collectionOptionList" :key="indexc">
                 <div v-if="child.isCheck == 1">
                   <div v-for="(childitem, childIndex) in child.collectionItems" :key="childIndex">
@@ -488,7 +504,9 @@
                           >回显历史</span
                         >
                       </p>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'sz'" class="formLabel z-cell">
                       <van-cell>
@@ -534,7 +552,9 @@
                           readonly
                           type="textarea" />
                       </p>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'date'" class="formLabel z-cell">
                       <van-cell>
@@ -581,7 +601,9 @@
                           readonly
                           type="textarea" />
                       </p>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'tel'" class="formLabel z-cell">
                       <van-cell>
@@ -627,7 +649,9 @@
                           readonly
                           type="textarea" />
                       </p>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'zp'" class="formLabel z-cell">
                       <van-cell>
@@ -653,7 +677,9 @@
                             @click="imgClick(childitem, 'B', index, childIndex)" />
                         </template>
                       </van-cell>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'duox'" class="formLabel z-cell">
                       <van-cell>
@@ -690,7 +716,9 @@
                         :childindex2="childIndex"
                         level="B"
                         @zSelectVal="zSelectVal"></z-checkbox>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'sm'" class="formLabel z-cell">
                       <van-cell>
@@ -742,7 +770,9 @@
                           >
                         </div>
                       </div>
-                      <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
                     <div v-if="childitem.answerType == 'dx'" class="formLabel z-cell">
                       <div>
@@ -782,7 +812,9 @@
                           :zRadiocolumns="childitem.collectionOptionList"
                           @zSelectVal="zSelectVal"
                           :relevancyItem="childitem.relevancyItem"></z-radio>
-                        <delete-upload-img :imgs="childitem.fileInfoList"></delete-upload-img>
+                        <delete-upload-img
+                          :photoIdentifyType="photoIdentifyType"
+                          :imgs="childitem.fileInfoList"></delete-upload-img>
                         <div
                           v-for="(child1, indexc1) in childitem.collectionOptionList"
                           :key="indexc1">
@@ -850,6 +882,7 @@
                                   >
                                 </p>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'date'" class="formLabel z-cell">
@@ -923,6 +956,7 @@
                                   >
                                 </p>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'sm'" class="formLabel z-cell">
@@ -982,6 +1016,7 @@
                                   </div>
                                 </div>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'duox'" class="formLabel z-cell">
@@ -1032,6 +1067,7 @@
                                   :zCheckboxcolumns="childitem1.collectionOptionList"
                                   @zSelectVal="zSelectVal"></z-checkbox>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'dx'" class="formLabel z-cell">
@@ -1087,6 +1123,7 @@
                                     @zSelectVal="zSelectVal"
                                     :relevancyItem="childitem1.relevancyItem"></z-radio>
                                   <delete-upload-img
+                                    :photoIdentifyType="photoIdentifyType"
                                     :imgs="childitem1.fileInfoList"></delete-upload-img>
                                   <div
                                     v-for="(child33, indexc33) in childitem1.collectionOptionList"
@@ -1179,6 +1216,7 @@
                                             >
                                           </p>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1276,6 +1314,7 @@
                                             >
                                           </p>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1340,6 +1379,7 @@
                                             :zCheckboxcolumns="child33item1.collectionOptionList"
                                             @zSelectVal="zSelectVal"></z-checkbox>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1414,6 +1454,7 @@
                                               type="textarea" />
                                           </p>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1486,6 +1527,7 @@
                                               type="textarea" />
                                           </p>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1535,6 +1577,7 @@
                                             </template>
                                           </van-cell>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1613,6 +1656,7 @@
                                             </div>
                                           </div>
                                           <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
                                         <div
@@ -1680,6 +1724,7 @@
                                               @zSelectVal="zSelectVal"
                                               :relevancyItem="child33item1.relevancyItem"></z-radio>
                                             <delete-upload-img
+                                              :photoIdentifyType="photoIdentifyType"
                                               :imgs="child33item1.fileInfoList"></delete-upload-img>
                                             <div
                                               v-for="(
@@ -1779,6 +1824,7 @@
                                                       >
                                                     </p>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -1885,6 +1931,7 @@
                                                       >
                                                     </p>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -1957,6 +2004,7 @@
                                                       "
                                                       @zSelectVal="zSelectVal"></z-checkbox>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -2038,6 +2086,7 @@
                                                         type="textarea" />
                                                     </p>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -2119,6 +2168,7 @@
                                                         type="textarea" />
                                                     </p>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -2171,6 +2221,7 @@
                                                       </template>
                                                     </van-cell>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -2268,6 +2319,7 @@
                                                       </div>
                                                     </div>
                                                     <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
                                                       :imgs="
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
@@ -2351,6 +2403,7 @@
                                                           child44item1.relevancyItem
                                                         "></z-radio>
                                                       <delete-upload-img
+                                                        :photoIdentifyType="photoIdentifyType"
                                                         :imgs="
                                                           child44item1.fileInfoList
                                                         "></delete-upload-img>
@@ -2421,6 +2474,7 @@
                                     type="textarea" />
                                 </p>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'tel'" class="formLabel z-cell">
@@ -2478,6 +2532,7 @@
                                     type="textarea" />
                                 </p>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                               <div v-if="childitem1.answerType == 'zp'" class="formLabel z-cell">
@@ -2515,6 +2570,7 @@
                                   </template>
                                 </van-cell>
                                 <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
                             </div>
@@ -2566,7 +2622,8 @@
             :deviceCode="deviceCode"
             :putInCode="putInCode"
             @newimgarr="newimgarr1"
-            @typeshow="typeshow"></upload-img>
+            @typeshow="typeshow"
+            :photoIdentifyType="photoIdentifyType"></upload-img>
         </template>
       </van-cell>
     </van-dialog>
@@ -2590,7 +2647,8 @@
         :uploadid="uploadid2"
         :visitsId="visitId"
         @newimgarr="newimgarr1"
-        @typeshow="typeshow"></upload-img>
+        @typeshow="typeshow"
+        :photoIdentifyType="photoIdentifyType"></upload-img>
     </van-popup>
     <van-popup v-model="showPicker" capture position="bottom">
       <van-picker
@@ -2641,6 +2699,7 @@ import deleteUploadImg from '@/components/deleteUploadImg1';
 import jianjie from '@/assets/jianjie.jpg';
 import { ImagePreview } from 'vant';
 import taskTips from './taskTips';
+import store from '@/store';
 export default {
   name: 'abnormalVisit',
   components: { zRadio, zCheckbox, uploadImg, storeCode, deleteUploadImg, taskTips },
@@ -2726,6 +2785,7 @@ export default {
       deviceCode: '',
       putInCode: '',
       examplePhotoImg: '', //示例-操作说明图标地址
+      photoIdentifyType: null, //图片识别类型
     };
   },
   beforeRouteLeave(to, from, next) {
@@ -2745,6 +2805,7 @@ export default {
     this.taskId = this.$route.query.taskId + '';
     this.storeId = this.$route.query.storeId + '';
     this.isMust == this.$route.query.isMust + '';
+    this.photoIdentifyType = this.$route.query.photoIdentifyType;
     this.storeGroupId = this.$route.query.storeGroupId + '';
     if (this.$route.query.photoType != null) {
       this.indexselect = 0;
@@ -2762,6 +2823,7 @@ export default {
     this.taskId = this.$route.query.taskId + '';
     this.storeId = this.$route.query.storeId + '';
     this.isMust == this.$route.query.isMust + '';
+    this.photoIdentifyType = this.$route.query.photoIdentifyType;
     this.storeGroupId = this.$route.query.storeGroupId + '';
     if (this.$route.query.photoType != null) {
       this.indexselect = 0;
@@ -2769,6 +2831,8 @@ export default {
       this.indexselect = 1;
     }
     this.getPhotoTypeList();
+    // 拍照次数重置
+    store.dispatch('setShotsNum', 0);
   },
   methods: {
     viewSM() {
@@ -4760,4 +4824,7 @@ export default {
 .formLabel .mobile-input {
   border: 0 !important;
 }
+.addStoreVisit .van-dialog {
+  overflow: visible;
+}
 </style>

+ 1 - 0
src/views/deviceWithin/storeVisit.vue

@@ -677,6 +677,7 @@ export default {
             types: this.$route.query.type,
             locationAccuracy: this.locationAccuracy,
             insert: this.insert,
+            photoIdentifyType: val.photoIdentifyType,
           },
         });
       }