Browse Source

最高学历认证

xinfeng 6 years ago
parent
commit
73dbe6eb8a

+ 44 - 16
components/credit/dealData.js

@@ -1,19 +1,19 @@
-export default  class DealData {
-  constructor({$axios, req}) {
+export default class DealData {
+  constructor({ $axios, req }) {
     this.$axios = $axios
     this.req = req
   }
   
   /**处理专业经历*/
   async professional(list) {
-    const {req, $axios} = this
+    const { req, $axios } = this
     let headers = req && req.headers;
-    let [res] = await Promise.all([
+    let [ res ] = await Promise.all([
       $axios.$get(`/api/user/cert_status`, { headers }),
     ])
     if (res.data && Array.isArray(res.data)) {
       list = []
-      res.data.forEach(item=> {
+      res.data.forEach(item => {
         let len = list.push({
           icon: item.icon_url,
           title: item.name,
@@ -22,9 +22,9 @@ export default  class DealData {
           rightName: item.status_name,
           rightStatus: item.url ? 'ok click' : ''
         })
-        if (list[len-1].title === '工作经历') {
+        if (list[ len - 1 ].title === '工作经历') {
           let workList = item.list
-          let o = list[len-1]
+          let o = list[ len - 1 ]
           o.rightStatus = 'ok click'
           o.rightName = "查看详情"
           //有工作经历
@@ -42,15 +42,16 @@ export default  class DealData {
   
   /**处理身份*/
   async identify(list) {
-    const {req, $axios} = this
+    const { req, $axios } = this
     let headers = req && req.headers;
     //查询是否实名认证 "data": "已认证",(未申请/拒绝/已认证/审核中)
-    let [res] = await Promise.all([
+    let [ res, resIndentify ] = await Promise.all([
       $axios.$get(`/api/user/realNameVerifyStatus`, { headers }),
+      $axios.$get(`/api/user/identify`, { headers }),
     ])
-  
-    console.log('查询是否实名认证', res)
-    let item = list.filter(item => item.title === '实名认证')[0] || {}
+    let item = list.filter(item => item.title === '实名认证')[ 0 ] || {}
+    let itemEdu = list.filter(item => item.title === '最高学历认证')[ 0 ] || {}
+    //实名认证
     if (res.status === 1) {
       switch (res.data) {
         case '已认证':
@@ -68,21 +69,48 @@ export default  class DealData {
           item.rightStatus = 'none click' //可点击,灰色
           break;
       }
-    } else {
-    
     }
+    //最高学历认证
+    if (resIndentify.status === 1) {
+      let education = resIndentify.data.education && resIndentify.data.education[ 0 ] || {}
+      let status = Number(education.status || 0)
+      itemEdu.rightName = education.status_name
+      itemEdu.meta = resIndentify.data.education || []
+      switch (status) {
+        case 0:
+          itemEdu.jumpUrl = "/sign/new"
+          itemEdu.rightStatus = 'none click' //可点击,灰色
+          break;
+        case 1:
+          itemEdu.rightStatus = 'none noClick' //不可点击 灰色
+          break;
+        case 2:
+          itemEdu.jumpUrl = 'openEducation'
+          itemEdu.rightStatus = 'ok click' //可点击 灰色
+          break;
+        case 3:
+          itemEdu.jumpUrl = 'openEducation'
+          itemEdu.rightStatus = 'none click' //可点击,灰色
+          break;
+      }
+      if (education.id) {
+        itemEdu.jumpUrl = 'openEducation'
+        itemEdu.rightStatus = 'ok click' //可点击 灰色
+      }
+    }
+    
     return list
   }
   
   /** 项目经验 */
   async project(list) {
-    const {req, $axios} = this
+    const { req, $axios } = this
     return list
   }
   
   /** 社会信用 */
   async credit(list) {
-    const {req, $axios} = this
+    const { req, $axios } = this
     return list
   }
   

+ 444 - 0
components/credit/toast/education.vue

@@ -0,0 +1,444 @@
+<template>
+  <div class="education">
+    <div class="title">最高学历认证</div>
+    <div class="workList">
+      <div class="cell" v-for="item in dataInfo.meta" :key="item.id">
+        <div class="left">
+          <div class="cellTitle">
+            {{item.university}}
+          </div>
+          <div class="cellSubTitle">
+            {{item.start_time}} - {{item.end_time}} {{item.major}} &nbsp;|&nbsp; {{item.education_background}}
+          </div>
+        </div>
+        <div class="right" @click="openDialog(item)" :class="calcClass(item)">
+          <p>{{item.status_name}}</p>
+        </div>
+      </div>
+    </div>
+    <el-dialog
+      title="工作经历认证"
+      :visible.sync="dialogVisible"
+      width="657px"
+      :append-to-body="true"
+      :center="true"
+    >
+      <div class="diaContentWork">
+        <div class="leftInfo">
+          <div
+            class="leftTitle">{{itemData.start_time}} - {{itemData.end_time}} &nbsp;&nbsp;&nbsp; {{itemData.university}} &nbsp;&nbsp; {{itemData.education_background}}
+          </div>
+          <div class="leftInput">
+            <input type="text" placeholder="请输入学信网在线验证报告地址" v-model="word">
+          </div>
+          <div class="leftTips">
+            <p>学信网在线验证报告,例如:https://www.poginn.com</p>
+            <p>注:学历证明可以是毕业证图片或学信网在线验证报告(二选一即可)</p>
+          </div>
+        </div>
+        <div class="rightInfo">
+          <el-upload
+            class="avatar-uploader"
+            action="#"
+            :show-file-list="false"
+            :multiple="false"
+            accept="image/png, image/jpeg"
+            :before-upload="handleFileChange"
+          >
+            <i v-if="imageUrl" class="el-icon-delete avatar-uploader-icon" @click.stop="handleDeleteFile"></i>
+            <img v-if="imageUrl" :src="imageUrl" class="avatar"/>
+            <div v-else class="noneImage">
+              <i class="el-icon-plus avatar-uploader-icon"></i>
+              <span class="title">上传照片</span>
+            </div>
+          </el-upload>
+          <p class="rightTips">只支持JPG格式</p>
+        </div>
+      </div>
+      <div class="dialog-footer">
+        <div class="submit"><p @click="submitChange">确定</p></div>
+        <div class="cancle"><p @click="dialogVisible=false">取消</p></div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+  export default {
+    name: 'workHistory',
+    props: {
+      dataInfo: {
+        type: Object,
+        default: function () {
+          return {}
+        }
+      },
+      submitRefresh: {
+        type: Function,
+        default: function () {
+
+        }
+      }
+    },
+    data() {
+      return {
+        dialogVisible: false,
+        itemData: {},
+        imageUrl: '',
+        word: '',
+        handleAvatarSuccess: '',
+        beforeAvatarUpload: ''
+      }
+    },
+    mounted() {
+    },
+    methods: {
+      /** 打开弹窗 **/
+      openDialog(item) {
+        if (Number(item.status) === 1 || Number(item.status) === 2) {
+          return
+        }
+        this.itemData = item
+        this.word = item.diploma_url
+        this.imageUrl = item.diploma_photo
+        this.dialogVisible = true
+      },
+      /** 计算样式 **/
+      calcClass(item) {
+        let className = {}
+        if (Number(item.status) === 1) { //审核中
+          className.noClick = true
+          className.none = true
+        } else if ( Number(item.status) === 2) { //已认证
+          className.noClick = true
+          className.ok = true
+        } else {
+          className.click = true
+          className.none = false
+        }
+        return className
+      },
+      /** 删除问及爱你 **/
+      handleDeleteFile() {
+        this.imageUrl = ''
+      },
+      handleFileChange(file) {
+        const formData = new FormData();
+        formData.append("file", file);
+        formData.append("original_filename", file.name);
+        this.uploading = true;
+        this.$axios
+          .$post(`/upload_image`, formData, {
+            headers: { "Content-Type": "multipart/form-data" }
+          })
+          .then(res => {
+            this.imageUrl = res.filename
+            this.itemData.diploma_photo = res.filename || ''
+          })
+          .finally(() => {
+            this.uploading = false;
+          });
+      },
+      submitChange() {
+        const {id, diploma_photo} = this.itemData
+        let p = {
+          id,
+          diploma_photo: diploma_photo || '',
+          diploma_url: this.word || '',
+        }
+
+        if (!p.diploma_photo && !p.diploma_url) {
+          this.$message.warning('至少填写一个!')
+          return
+        }
+
+        this.$axios.$post(`/api/user_education/update`, p).then(res=>{
+          if (Number(res.status) === 1) {
+            this.$message.closeAll()
+            this.$message.success(res.info || '提交成功!')
+            this.submitRefresh('openEducation')
+          }
+        })
+        this.dialogVisible = false
+      }
+    }
+  };
+</script>
+<style lang="scss">
+  .el-dialog {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    margin: 0 !important;
+    transform: translate(-50%, -50%);
+    background: rgba(255, 255, 255, 1);
+    border-radius: 11px;
+    padding: 43px 37px 39px 30px;
+
+    .el-dialog__header {
+      padding: 0;
+      .el-dialog__title {
+        font-size: 21px;
+        font-weight: 500;
+        color: rgba(34, 34, 34, 1);
+        line-height: 29px;
+      }
+    }
+
+    .el-dialog__close {
+      color: #666666;
+      font-size: 20px;
+      font-weight: 600;
+      transform: scale(1.2);
+      transform-origin: center;
+    }
+
+    .el-dialog__body {
+      padding: 54px 0 30px 0;
+
+      .diaContentWork {
+        display: flex;
+        justify-content: space-between;
+
+        .leftInfo {
+          width: 450px;
+          flex-shrink: 0;
+          overflow: hidden;
+          .leftTitle {
+            height: 27px;
+            font-size: 15px;
+            font-weight: 600;
+            color: rgba(51, 51, 51, 1);
+            line-height: 27px;
+          }
+          .leftInput {
+            margin-top: 29px;
+            input {
+              margin-top:5px;
+              width: 450px;
+              height: 44px;
+              background: rgba(255, 255, 255, 1);
+              border-radius: 3px;
+              border: 1px solid rgba(221, 225, 230, 1);
+              padding: 10px;
+            }
+          }
+          .leftTips {
+            margin-top: 5px;
+            width: 450px;
+            height: 96px;
+            font-size: 14px;
+            font-weight: 400;
+            color: rgba(153, 153, 153, 1);
+            line-height: 19px;
+          }
+        }
+        .rightInfo {
+          width: 126px;
+          flex-shrink: 0;
+          overflow: hidden;
+
+          position: relative;
+          background: #fff;
+          .el-icon-delete {
+            display: none;
+          }
+          .avatar-uploader .el-upload {
+            width: 126px;
+            height: 155px;
+            border: 1px dashed #409eff;
+            border-radius: 6px;
+            cursor: pointer;
+            position: relative;
+            overflow: hidden;
+            img {
+              width: 100%;
+              height: auto;
+              object-fit: contain;
+              object-position: top left;
+            }
+          }
+          .avatar-uploader .el-upload:hover {
+            border-color: #409eff;
+            .el-icon-delete {
+              display: block;
+            }
+          }
+          .avatar-uploader-icon {
+            position: absolute;
+            top: 0;
+            left: 0;
+            font-size: 44px;
+            color: #409eff;;
+            width: 126px;
+            height: 155px;
+            line-height: 120px;
+            text-align: center;
+          }
+          .avatar {
+            width: 126px;
+            height: 155px;
+            display: block;
+          }
+          .title {
+            position: absolute;
+            left: 50%;
+            bottom: 40px;
+            transform: translateX(-50%);
+            font-size: 13px;
+            font-weight: 500;
+            color: #409eff;
+            line-height: 18px;
+            text-decoration: underline;
+          }
+
+          .rightTips {
+            height: 19px;
+            font-size: 14px;
+            font-weight: 400;
+            color: rgba(153, 153, 153, 1);
+            line-height: 19px;
+            text-align: center;
+          }
+        }
+
+      }
+    }
+
+    .dialog-footer {
+      text-align: left;
+
+      display: flex;
+
+      .submit {
+        width: 129px;
+        height: 50px;
+        background: rgba(48, 142, 255, 1);
+        box-shadow: 0 2px 7px 0 rgba(48, 142, 255, 0.3);
+        border-radius: 2px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        cursor: pointer;
+        p {
+          font-size: 16px;
+          font-weight: 500;
+          color: rgba(255, 255, 255, 1);
+          line-height: 23px;
+        }
+      }
+
+      .cancle {
+        margin-left: 11px;
+        width: 129px;
+        height: 50px;
+        background: rgba(236, 236, 236, 1);
+        border-radius: 2px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        cursor: pointer;
+        p {
+          font-size: 16px;
+          font-weight: 500;
+          color: rgba(102, 102, 102, 1);
+          line-height: 23px;
+        }
+      }
+    }
+  }
+</style>
+
+<style scoped lang="scss">
+  .education {
+    width: 657px;
+    min-height: 100px;
+    padding: 43px 47px 63px 57px;
+
+    .title {
+      height: 29px;
+      font-size: 21px;
+      font-weight: 500;
+      color: rgba(34, 34, 34, 1);
+      line-height: 29px;
+      text-align: center;
+    }
+
+    .workList {
+      width: 100%;
+
+      .cell {
+        margin-top: 18px;
+        width: 100%;
+        height: 44px;
+        display: flex;
+        justify-content: space-between;
+
+        &:first-child {
+          margin-top: 46px;
+        }
+
+        .left {
+          width: calc(100% - 130px);
+          flex-shrink: 0;
+          .cellTitle {
+            height: 27px;
+            font-size: 16px;
+            font-weight: 500;
+            color: rgba(51, 51, 51, 1);
+            line-height: 27px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            word-break: keep-all;
+          }
+          .cellSubTitle {
+            height: 19px;
+            font-size: 14px;
+            font-weight: 400;
+            color: rgba(153, 153, 153, 1);
+            line-height: 19px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            word-break: keep-all;
+          }
+        }
+        .right {
+          flex-shrink: 0;
+          width: 96px;
+          height: 38px;
+          background: rgba(236, 236, 236, 1);
+          border-radius: 2px;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          p {
+            font-size: 16px;
+            color: rgba(102, 102, 102, 1);
+            font-weight: 500;
+            line-height: 23px;
+          }
+          &.none {
+            background: rgba(236, 236, 236, 1);
+            & p {
+              color: rgba(102, 102, 102, 1);
+            }
+          }
+          &.ok {
+            background: rgba(48, 142, 255, 1);
+            box-shadow: 0px 2px 7px 0px rgba(48, 142, 255, 0.3);
+            & p {
+              color: rgba(255, 255, 255, 1);
+            }
+          }
+          &.click {
+            cursor: pointer;
+          }
+          &.noClick {
+            cursor: not-allowed;
+          }
+        }
+      }
+    }
+  }
+</style>

+ 1 - 2
components/credit/toast/workHistory.vue

@@ -135,7 +135,6 @@
           });
       },
       submitChange() {
-        this.$message.success('修改成功')
         let p = {
           data: JSON.stringify(this.dataInfo.meta)
         }
@@ -143,7 +142,7 @@
           if (Number(res.status) === 2) {
             this.$message.closeAll()
             this.$message.success(res.info || '提交成功!')
-            this.submitRefresh()
+            this.submitRefresh('openWorkHistory')
           }
         })
         this.dialogVisible = false

+ 5 - 1
components/credit/toastIndex.vue

@@ -6,6 +6,9 @@
         <realNameAuth v-if="type === 'openRealNameAuth'"/>
         <!--工作经历-->
         <workHistory v-if="type === 'openWorkHistory'" :dataInfo="dataInfo" :submitRefresh="submitRefresh"/>
+        <!--最高学历认证-->
+        <Education v-if="type === 'openEducation'" :dataInfo="dataInfo" :submitRefresh="submitRefresh"/>
+
         <i class="el-icon-close closeIcon" @click="closeToast"></i>
       </div>
     </div>
@@ -15,9 +18,10 @@
 <script>
   import realNameAuth from './toast/realNameAuth'
   import workHistory from './toast/workHistory'
+  import Education from './toast/education'
 
   export default {
-    components: { realNameAuth, workHistory },
+    components: { realNameAuth, workHistory, Education },
     props: {
       closeToast: {
         type: Function,

+ 8 - 1
pages/credit/_type.vue

@@ -126,12 +126,16 @@
               this.toastType = 'openRealNameAuth'
               this.toastDataInfo = item || {}
               break;
+            case 'openEducation':  //打开最高学历认证
+              console.log('openEducation 打开最高学历认证')
+              this.toastType = 'openEducation'
+              this.toastDataInfo = item || {}
+              break;
             case 'openWorkHistory':  //工作经历弹窗
               console.log('openWorkHistory 工作经历弹窗')
               this.toastType = 'openWorkHistory'
               this.toastDataInfo = item || {}
               break;
-
             default:
               location.href = url
           }
@@ -146,6 +150,9 @@
           case 'openWorkHistory':
             this.list = await dealData.professional(this.list)
             break
+          case 'openEducation':
+            this.list = await dealData.identify(this.list)
+            break
         }
       }
     }