Browse Source

临时身份证明 是否加盖公章&公章图片地址

刘琳琳 3 months ago
parent
commit
f6ede3bca2

+ 2 - 2
.env.development

@@ -4,7 +4,7 @@ ENV = 'development'
 # base api
 # VUE_APP_BASE_API = '/dev-api'
 #  VUE_APP_BASE_API = 'http://192.168.77.65:8081/hanghui/outapi'
-VUE_APP_BASE_API = 'http://192.168.77.13:8081/hanghui/outapi'
+#  VUE_APP_BASE_API = 'http://192.168.77.253:8081/hanghui/outapi'
 #  VUE_APP_BASE_API = 'https://test.hz-hanghui.com:18890/hanghui-server-platform'
-#  VUE_APP_BASE_API = 'https://tx.hz-hanghui.com:8088/hanghui-server-platform'
+VUE_APP_BASE_API = 'https://tx.hz-hanghui.com:8088/hanghui-server-platform'
 #  VUE_APP_BASE_API = 'http://hanghuijishu.natapp1.cc/hanghui/outapi'

BIN
src/assets/officialSealUrl-icon.png


+ 93 - 2
src/views/tempoIDManage/components/EditDeviceModule.vue

@@ -334,6 +334,47 @@
               />
             </el-form-item>
           </div>
+          <div class="wrap-content__item">
+            <el-form-item label="是否加盖公章" prop="officialSealSwitch">
+              <el-radio-group v-model="form.officialSealSwitch">
+                <el-radio :label="true">是</el-radio>
+                <el-radio :label="false">否</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </div>
+          <div v-if="form.officialSealSwitch" class="wrap-content__item">
+            <el-form-item label="临时证明公章" prop="officialSealUrl">
+              <el-upload
+                name="file"
+                class="avatar-uploader"
+                action="#"
+                :show-file-list="false"
+                :http-request="
+                  (event) => {
+                    doUploadAvatar(event, 'officialSealUrl');
+                  }
+                "
+                :before-upload="beforeAvatarUpload"
+                :auto-upload="true"
+                accept="image/png,image/gif,image/jpg,image/jpeg"
+              >
+                <img
+                  v-if="!form.officialSealUrl"
+                  class="upload-img"
+                  src="../../../assets/default-img.png"
+                  alt=""
+                >
+                <div v-else class="upload-img">
+                  <img :src="form.officialSealUrl">
+                  <span
+                    class="del-img"
+                    @click.stop="handleRemove('officialSealUrl')"
+                  >x</span>
+                </div>
+              </el-upload>
+            </el-form-item>
+          </div>
+          <div v-else class="wrap-content__item" />
           <div class="wrap-content__item">
             <el-form-item label="签发单位" prop="issuingAuthority">
               <el-input v-model="form.issuingAuthority" placeholder="请输入" />
@@ -669,7 +710,7 @@
 import TagCard from '@/components/TagCard'
 import { applicationTypeList, deviceModelList, purchaserList } from '@/api/configuration'
 import { deviceAdd, noticeList } from '@/api/titlelib'
-import { parseTime } from '@/utils'
+import { pictureLocal } from '@/api/ordinary_user'
 
 export default {
   components: { TagCard },
@@ -729,6 +770,8 @@ export default {
           'https://tx.hz-hanghui.com:8087/ti-prove/handleProveRecord/push', // 办证记录推送地址
 
         printIdentityProof: true, // 是否打印临时证明
+        officialSealSwitch: false, // 是否加盖公章
+        officialSealUrl: '', // 公章图片地址
         validTime: 2, // 临证有效期 默认为 2 最小为 1
         issuingAuthority: '', // 签发单位
         riskCheck: true, // 启用风险人员核查
@@ -895,6 +938,45 @@ export default {
         return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
       }
     },
+    handleRemove(type) {
+      if (type) {
+        this.form[type] = null
+      }
+    },
+    // 图片上传前
+    beforeAvatarUpload(file) {
+      if (
+        !(
+          file.type === 'image/png' ||
+          file.type === 'image/gif' ||
+          file.type === 'image/jpg' ||
+          file.type === 'image/jpeg'
+        )
+      ) {
+        this.$notify.warning({
+          title: '警告',
+          message:
+            '请上传格式为image/png, image/gif, image/jpg, image/jpeg的图片'
+        })
+        return false
+      }
+      const isLt2M = file.size / 1024 / 1024 < 2
+      if (!isLt2M) {
+        this.$notify.warning({
+          title: '警告',
+          message: '图片大小必须小于2M'
+        })
+        return false
+      }
+    },
+    doUploadAvatar(obj, type) {
+      var avatar = new FormData()
+      avatar.append('file', obj.file)
+      pictureLocal(avatar).then((res) => {
+        this.value = res.data
+        this.$set(this.form, type, res.data)
+      })
+    },
     back() {
       this.$emit('back')
     },
@@ -911,7 +993,7 @@ export default {
         try {
           // 以下字段根据切换条件重置为默认值
           const fieldArr = [
-            'specialCodeSwitch', 'specialCodeEncryptSwitch'
+            'specialCodeSwitch', 'specialCodeEncryptSwitch', 'officialSealSwitch'
           ]
           fieldArr.forEach(field => {
             const fieldValue = this.form[field]
@@ -943,6 +1025,15 @@ export default {
                   }
                 }
                 break
+              // 是否加盖公章
+              case 'officialSealSwitch':
+                if (!fieldValue) {
+                  this.form = {
+                    ...this.form,
+                    officialSealUrl: '' // 公章图片地址
+                  }
+                }
+                break
             }
           })
           await deviceAdd(this.form)

+ 109 - 9
src/views/tempoIDManageTemplate/components/EditDeviceModule.vue

@@ -178,7 +178,7 @@
         <div v-if="form.specialCodeSwitch" class="wrap-content-detail" style="background: #dcdfe63d;">
           <div class="wrap-content-detail__item">
             <el-form-item label="三要素换特殊码接口地址" prop="specialCodeUrl">
-<!--              <el-input
+              <!--              <el-input
                 v-model="form.specialCodeUrl"
                 placeholder="请输入三要素换特殊码接口地址"
                 maxlength="300"
@@ -312,6 +312,51 @@
               />
             </el-form-item>
           </div>
+          <div class="wrap-content__item">
+            <el-form-item label="是否加盖公章" prop="officialSealSwitch">
+              <el-radio-group v-model="form.officialSealSwitch">
+                <el-radio :label="true">是</el-radio>
+                <el-radio :label="false">否</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </div>
+          <div v-if="form.officialSealSwitch" class="wrap-content__item">
+            <el-form-item label="临时证明公章" prop="officialSealUrl">
+              <el-upload
+                name="file"
+                class="avatar-uploader"
+                action="#"
+                :show-file-list="false"
+                :http-request="
+                  (event) => {
+                    doUploadAvatar(event, 'officialSealUrl');
+                  }
+                "
+                :before-upload="beforeAvatarUpload"
+                :auto-upload="true"
+                accept="image/png,image/gif,image/jpg,image/jpeg"
+              >
+                <div
+                  v-if="!form.officialSealUrl"
+                  class="upload-img"
+                >
+                  <img
+                    src="../../../assets/officialSealUrl-icon.png"
+                    alt=""
+                    style="width: 56px;height: 51px"
+                  >
+                </div>
+                <div v-else class="upload-img">
+                  <img :src="form.officialSealUrl" style="width: 100%;height: 100%;">
+                  <span
+                    class="del-img"
+                    @click.stop="handleRemove('officialSealUrl')"
+                  >x</span>
+                </div>
+              </el-upload>
+            </el-form-item>
+          </div>
+          <div v-else class="wrap-content__item" />
           <div class="wrap-content__item">
             <el-form-item label="签发单位" prop="issuingAuthority">
               <el-input v-model="form.issuingAuthority" placeholder="请输入" />
@@ -646,8 +691,8 @@
 <script>
 import TagCard from '@/components/TagCard'
 import { applicationTypeList, deviceModelList, purchaserList } from '@/api/configuration'
-import { deviceAdd, noticeList, templateAdd } from '@/api/titlelib'
-import { parseTime } from '@/utils'
+import { noticeList, templateAdd } from '@/api/titlelib'
+import { pictureLocal } from '@/api/ordinary_user'
 
 export default {
   components: { TagCard },
@@ -702,6 +747,8 @@ export default {
           'https://tx.hz-hanghui.com:8087/ti-prove/handleProveRecord/push', // 办证记录推送地址
 
         printIdentityProof: true, // 是否打印临时证明
+        officialSealSwitch: false, // 是否加盖公章
+        officialSealUrl: '', // 公章图片地址
         validTime: 2, // 临证有效期 默认为 2 最小为 1
         issuingAuthority: '', // 签发单位
         riskCheck: true, // 启用风险人员核查
@@ -856,6 +903,45 @@ export default {
         return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
       }
     },
+    handleRemove(type) {
+      if (type) {
+        this.form[type] = null
+      }
+    },
+    // 图片上传前
+    beforeAvatarUpload(file) {
+      if (
+        !(
+          file.type === 'image/png' ||
+          file.type === 'image/gif' ||
+          file.type === 'image/jpg' ||
+          file.type === 'image/jpeg'
+        )
+      ) {
+        this.$notify.warning({
+          title: '警告',
+          message:
+            '请上传格式为image/png, image/gif, image/jpg, image/jpeg的图片'
+        })
+        return false
+      }
+      const isLt2M = file.size / 1024 / 1024 < 2
+      if (!isLt2M) {
+        this.$notify.warning({
+          title: '警告',
+          message: '图片大小必须小于2M'
+        })
+        return false
+      }
+    },
+    doUploadAvatar(obj, type) {
+      var avatar = new FormData()
+      avatar.append('file', obj.file)
+      pictureLocal(avatar).then((res) => {
+        this.value = res.data
+        this.$set(this.form, type, res.data)
+      })
+    },
     back() {
       this.$emit('back')
     },
@@ -872,7 +958,7 @@ export default {
         try {
           // 以下字段根据切换条件重置为默认值
           const fieldArr = [
-            'specialCodeSwitch', 'specialCodeEncryptSwitch'
+            'specialCodeSwitch', 'specialCodeEncryptSwitch', 'officialSealSwitch'
           ]
           fieldArr.forEach(field => {
             const fieldValue = this.form[field]
@@ -904,6 +990,15 @@ export default {
                   }
                 }
                 break
+              // 是否加盖公章
+              case 'officialSealSwitch':
+                if (!fieldValue) {
+                  this.form = {
+                    ...this.form,
+                    officialSealUrl: '' // 公章图片地址
+                  }
+                }
+                break
             }
           })
           await templateAdd(this.form)
@@ -971,7 +1066,6 @@ export default {
     }
   }
 }
-
 .avatar-uploader .upload-default {
   border: 1px dashed #d9d9d9;
   border-radius: 0;
@@ -997,14 +1091,20 @@ export default {
   color: #ced3e3;
 }
 .upload-img {
-  width: 50px;
-  height: 91px;
+  width: 100px;
+  height: 100px;
   position: relative;
+  background: #F7F8FC;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border: 1px dashed #C4CAD7;
+  border-radius: 8px;
   img {
-    width: 100%;
-    height: 100%;
     object-fit: contain;
     // border-radius: 12px;
+    overflow: hidden;
+    border-radius: 8px;
   }
   .del-img {
     display: inline-block;