| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- export default class DealData {
- constructor({ $axios, req, userinfo }) {
- this.$axios = $axios
- this.req = req
- this.userinfo = userinfo || {}
- }
-
- /**处理专业经历*/
- async professional(list) {
- const { req, $axios } = this
- let headers = req && req.headers;
- let res, resUser
-
- if (!this.userinfo.id) {
- [ res, resUser ] = await Promise.all([
- $axios.$get(`/api/user/cert_status`, { headers }),
- $axios.$get(`/api/user/getInfo`, { headers }),
- ])
- this.userinfo = resUser.data
- } else {
- [ res ] = await Promise.all([
- $axios.$get(`/api/user/cert_status`, { headers }),
- ])
- }
-
-
- if (res.data && Array.isArray(res.data)) {
- list = []
- res.data.forEach(item => {
- let len = list.push({
- icon: item.icon_url,
- title: item.name,
- subTitle: '',
- jumpUrl: item.url,
- rightName: item.status_name,
- rightStatus: item.url ? 'ok click' : ''
- })
- if (list[ len - 1 ].title === '工作经历') {
- let workList = item.list
- let o = list[ len - 1 ]
- o.rightStatus = 'ok click'
- o.rightName = "查看详情"
- let realname_re = Number(this.userinfo.realname_re)
- //未签约 不可点击
- if (realname_re !== 2) {
- o.jumpUrl = ''
- o.rightStatus = 'none noClick'
- } else if (Array.isArray(workList) && workList.length > 0) { //有工作经历
- o.jumpUrl = "openWorkHistory"
- o.meta = workList
- } else { //没有工作经历,跳转到/sign/new
- o.jumpUrl = "/sign/new"
- }
- }
- })
- }
- return list
- }
-
- /**处理身份*/
- async identify(list) {
- const { req, $axios } = this
- let headers = req && req.headers;
- //查询是否实名认证 "data": "已认证",(未申请/拒绝/已认证/审核中)
- let [ res, resIndentify ] = await Promise.all([
- $axios.$get(`/api/user/realNameVerifyStatus`, { headers }),
- $axios.$get(`/api/user/identify`, { headers }),
- ])
- let item = list.filter(item => item.title === '实名认证')[ 0 ] || {}
- let itemEdu = list.filter(item => item.title === '最高学历认证')[ 0 ] || {}
- //实名认证
- console.log("list", list, res)
- item.jumpUrl = ""
- if (res.status === 1) {
- switch (res.data) {
- case '已认证':
- item.rightName = '已认证'
- item.rightStatus = 'ok noClick' //不可点击 灰色
- break;
- case '审核中':
- item.rightName = '审核中'
- item.rightStatus = 'none noClick' //不可点击 灰色
- break;
- case '未申请':
- case '拒绝':
- item.rightName = '去认证'
- item.jumpUrl = 'openRealNameAuth'
- item.rightStatus = 'none click' //可点击,灰色
- break;
- }
- }
- //最高学历认证
- 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
- return list
- }
-
- /** 社会信用 */
- async credit(list) {
- const { req, $axios } = this
- return list
- }
-
- }
|