MrShi
2024-03-01 f3ce372afc816f947ae64ef2935b282087384b0d
h5/pages/userinfo/userinfo.vue
@@ -27,14 +27,14 @@
            </view>
         </view>
         <view class="cell">
            <view class="title">公司</view>
            <view class="title">公司<b>*</b></view>
            <view class="content">
               <input class="input" maxlength="50" placeholder-style="color: #999999;" v-model="visitorData.companyName" placeholder="请输入您的公司名称" />
            </view>
         </view>
         <view class="cell">
            <view class="title1">
               <text class="title1_a">人脸照片<b>*</b></text>
               <text class="title1_a">人脸照片<b style="color: red;">*</b></text>
               <text class="title1_b">1、请提供五官清晰,人脸居中的正面人脸免冠照片;</text>
               <text class="title1_b">2、照片无逆光、无PS、无过度美颜处理</text>
            </view>
@@ -73,6 +73,7 @@
         return {
            show: false,
            visit: '',
            type: '',
            columns: [[{name: '身份证', id: 0}, {name: '港澳证件', id: 1},{name: '护照', id: 2}]],
            fileList: [],
            visitorData: {
@@ -93,6 +94,9 @@
      onLoad(option) {
         this.visitorData.userAnswerId = option.userAnswerId
         this.getVisit()
         uni.$on('update', (data) => {
            this.uploadImg(data.tempFilePath)
         })
      },
      methods: {
@@ -125,6 +129,10 @@
                  icon: 'none'
               })
            }
            if (!this.visitorData.companyName) return uni.showToast({
               title: '公司不能为空',
               icon: 'none'
            })
            if (!this.visitorData.faceImg) return uni.showToast({
               title: '人脸照片不能为空',
               icon: 'none'
@@ -150,14 +158,41 @@
               }
            })
         },
         uploadImg(file) {
            uni.showLoading({ title: '上传中', mask: true });
            uni.uploadFile({
               url: `${this.$baseUrl}public/api/uploadFtp.do`,
               filePath: file,
               name: 'file',
               formData: {
                  folderCode: 'MEMBER_IMG'
               },
               success: (uploadFileRes) => {
                  let res = JSON.parse(uploadFileRes.data)
                  if (this.type === 'faceImg') {
                     this.visitorData.faceImg = res.data.halfPath
                     this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
                  } else {
                     this.visitorData.imgurl = res.data.halfPath
                     this.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
                  }
               },
               complete() {
                  uni.hideLoading();
               }
            });
         },
         upload(type) {
            this.type = type
            uni.chooseImage({
               count: 1,
               success: (chooseImageRes) => {
                  // console.log(chooseImageRes.tempFilePaths[0])
                  uni.navigateTo({
                     url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}`
                  })
                  return
                  if (type === 'faceImg') {
                     uni.navigateTo({
                        url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}`
                     })
                     return
                  }
                  uni.showLoading({ title: '上传中', mask: true });
                  for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
                     uni.uploadFile({
@@ -167,7 +202,7 @@
                        formData: {
                           folderCode: 'MEMBER_IMG'
                        },
                        success: (uploadFileRes) => {
                        success: (uploadFileRes) => {
                           let res = JSON.parse(uploadFileRes.data)
                           if (type === 'faceImg') {
                              this.visitorData.faceImg = res.data.halfPath