Pārlūkot izejas kodu

上传资料页静态

panyong 4 gadi atpakaļ
vecāks
revīzija
f97b775188

+ 1 - 0
htmldev/loan/public/index.html

@@ -30,4 +30,5 @@
     documentCtx.style.fontSize = documentCtx.clientWidth / 10 + 'px'
   }
 </script>
+<script src='//ossstatic.ybren.com/Wx/Public/js/jquery.1.7.2.min.js'></script>
 </html>

+ 102 - 0
htmldev/loan/src/views/attest/components/myUploader.vue

@@ -0,0 +1,102 @@
+<template>
+  <van-uploader v-model="arrUploadFile"
+                multiple
+                :max-count="maxCount"
+                :before-read="beforeRead"
+                :after-read="afterRead" @delete="handleDelete"/>
+</template>
+
+<script>
+  import { Uploader, Toast } from 'vant'
+
+  export default {
+    name: 'myUploader',
+    components: {
+      'van-uploader': Uploader
+    },
+    props: {
+      maxCount: {
+        type: Number,
+        default: 1
+      },
+      uploadType: {
+        type: String,
+        default: 'credit'
+      }
+    },
+    data () {
+      return {
+        arrUploadFile: []
+      }
+    },
+    methods: {
+      handleDelete () {
+        this.$emit('funSetUploadData', this.uploadType, this.arrUploadFile)
+      },
+      beforeRead (file) {
+        const fileList = Array.isArray(file) ? file : [file]
+        const fileType = fileList.every(item => /^image\//.test(item.type) || /(\.png|\.jpeg|\.gif|\.jpg)$/.test(item.name))
+        if (!fileType) {
+          Toast('只能选择图片')
+          return false
+        }
+        return true
+      },
+      afterRead (file) {
+        const fileList = Array.isArray(file) ? file : [file]
+        const result = fileList.map(item => this.funUploadImg(item.file))
+        fileList.forEach(item => {
+          item.status = 'uploading'
+          item.message = '上传中...'
+        })
+        Promise.all(result).then(res => {
+          res.forEach((item, index) => {
+            if (item.Data && item.Data.startsWith('http')) {
+              fileList[index].url = item.Data
+            }
+            fileList[index].status = ''
+            fileList[index].message = ''
+            this.$emit('funSetUploadData', this.uploadType, this.arrUploadFile)
+          })
+        }).catch(() => {
+          fileList.forEach(item => {
+            item.status = 'failed'
+            item.message = '上传失败'
+          })
+        })
+      },
+      funUploadImg (file) {
+        return new Promise((resolve, reject) => {
+          const formData = new FormData()
+          formData.append('Img', file, file.name)
+          window.$.ajax({
+            url: 'https://eapitest.ybren.com/act/ActImgUploadEvent/uploadCommentImg',
+            type: 'POST',
+            data: formData,
+            cache: false,
+            contentType: false,
+            processData: false,
+            success (res) {
+              if (res.Status === 1) {
+                resolve(res)
+                return
+              }
+              reject(res)
+            },
+            error (err) {
+              reject(err)
+            }
+          })
+        })
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .van-uploader__upload {
+    border: 1px dashed #CBB091;
+    border-radius: 8px;
+    background-color: transparent;
+  }
+</style>

+ 130 - 3
htmldev/loan/src/views/attest/index.vue

@@ -1,13 +1,140 @@
 <template>
-  <div></div>
+  <div class="wrapper">
+    <h2>上传资料</h2>
+    <div class="content">
+      <div class="subtitle">
+        <p>
+          <span>*</span>
+          <span>主贷人征信报告</span>
+          <span>(近10天,详版)</span>
+        </p>
+        <a class="btn-help" href="javascript:;">如何获取?</a>
+      </div>
+      <MyUploader :maxCount="2"
+                  :uploadType="uploadType0"
+                  @funSetUploadData="funSetUploadData"/>
+    </div>
+    <div class="content">
+      <div class="subtitle">
+        <p>
+          <span>*</span>
+          <span>上传房产信息凭证照片证件</span>
+        </p>
+      </div>
+      <MyUploader :maxCount="2"
+                  :uploadType="uploadType1"
+                  @funSetUploadData="funSetUploadData"/>
+    </div>
+    <button class="submit" @click="funSubmit">提交</button>
+  </div>
 </template>
 
 <script>
+  import MyUploader from './components/myUploader'
+
   export default {
-    name: 'attest'
+    name: 'attest',
+    components: {
+      MyUploader
+    },
+    data () {
+      return {
+        uploadType0: 'credit',
+        uploadType1: 'house',
+        creditReport: [],
+        houseProperty: []
+      }
+    },
+    methods: {
+      funSetUploadData (type, value) {
+        if (type === this.uploadType0) {
+          this.creditReport = value
+        } else if (type === this.uploadType1) {
+          this.houseProperty = value
+        }
+      },
+      funSubmit () {}
+    }
   }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
+  .wrapper {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    width: 100%;
+    min-height: 100vh;
+    padding-top: 24px;
+    background: #fff;
+  }
+
+  h2 {
+    width: 327px;
+    margin-bottom: 38px;
+    line-height: 33px;
+    font-size: 24px;
+    font-weight: 500;
+    color: #333;
+  }
+
+  .content {
+    width: 327px;
+    padding-bottom: 41px;
+
+    .subtitle,
+    p {
+      display: flex;
+      align-items: center;
+    }
+
+    .subtitle {
+      justify-content: space-between;
+      margin-bottom: 6px;
+    }
 
+    span:nth-of-type(1) {
+      line-height: 33px;
+      font-size: 24px;
+      font-weight: 500;
+      color: #FF3B30;
+    }
+
+    span:nth-of-type(2) {
+      margin-left: 3px;
+      margin-bottom: 4px;
+      line-height: 22px;
+      font-size: 16px;
+      font-weight: 500;
+      color: #333;
+    }
+
+    span:nth-of-type(3) {
+      margin-left: 5px;
+      line-height: 17px;
+      font-size: 12px;
+      color: #333;
+    }
+
+    .btn-help {
+      line-height: 20px;
+      font-size: 15px;
+      font-weight: 500;
+      text-decoration: underline;
+      color: #C7AC8B;
+    }
+  }
+
+  .submit {
+    width: 327px;
+    height: 45px;
+    margin-top: 18px;
+    border-radius: 4px;
+    line-height: 20px;
+    font-size: 14px;
+    font-weight: 500;
+    color: #fff;
+    background: linear-gradient(90deg, #E5C7A5 0%, #CFAA7F 100%);
+    box-shadow: 0 14px 9px -10px rgba(219, 208, 194, 1);
+  }
 </style>