dealData.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. export default class DealData {
  2. constructor({ $axios, req, userinfo }) {
  3. this.$axios = $axios
  4. this.req = req
  5. this.userinfo = userinfo || {}
  6. }
  7. /**处理专业经历*/
  8. async professional(list) {
  9. const { req, $axios } = this
  10. let headers = req && req.headers;
  11. let res, resUser
  12. if (!this.userinfo.id) {
  13. [ res, resUser ] = await Promise.all([
  14. $axios.$get(`/api/user/cert_status`, { headers }),
  15. $axios.$get(`/api/user/getInfo`, { headers }),
  16. ])
  17. this.userinfo = resUser.data
  18. } else {
  19. [ res ] = await Promise.all([
  20. $axios.$get(`/api/user/cert_status`, { headers }),
  21. ])
  22. }
  23. if (res.data && Array.isArray(res.data)) {
  24. list = []
  25. res.data.forEach(item => {
  26. let len = list.push({
  27. icon: item.icon_url,
  28. title: item.name,
  29. subTitle: '',
  30. jumpUrl: item.url,
  31. rightName: item.status_name,
  32. rightStatus: item.url ? 'ok click' : ''
  33. })
  34. if (list[ len - 1 ].title === '工作经历') {
  35. let workList = item.list
  36. let o = list[ len - 1 ]
  37. o.rightStatus = 'ok click'
  38. o.rightName = "查看详情"
  39. let realname_re = Number(this.userinfo.realname_re)
  40. //未签约 不可点击
  41. if (realname_re !== 2) {
  42. o.jumpUrl = ''
  43. o.rightStatus = 'none noClick'
  44. } else if (Array.isArray(workList) && workList.length > 0) { //有工作经历
  45. o.jumpUrl = "openWorkHistory"
  46. o.meta = workList
  47. } else { //没有工作经历,跳转到/sign/new
  48. o.jumpUrl = "/sign/new"
  49. }
  50. }
  51. })
  52. }
  53. return list
  54. }
  55. /**处理身份*/
  56. async identify(list) {
  57. const { req, $axios } = this
  58. let headers = req && req.headers;
  59. //查询是否实名认证 "data": "已认证",(未申请/拒绝/已认证/审核中)
  60. let [ res, resIndentify ] = await Promise.all([
  61. $axios.$get(`/api/user/realNameVerifyStatus`, { headers }),
  62. $axios.$get(`/api/user/identify`, { headers }),
  63. ])
  64. let item = list.filter(item => item.title === '实名认证')[ 0 ] || {}
  65. let itemEdu = list.filter(item => item.title === '最高学历认证')[ 0 ] || {}
  66. //实名认证
  67. console.log("list", list, res)
  68. item.jumpUrl = ""
  69. if (res.status === 1) {
  70. switch (res.data) {
  71. case '已认证':
  72. item.rightName = '已认证'
  73. item.rightStatus = 'ok noClick' //不可点击 灰色
  74. break;
  75. case '审核中':
  76. item.rightName = '审核中'
  77. item.rightStatus = 'none noClick' //不可点击 灰色
  78. break;
  79. case '未申请':
  80. case '拒绝':
  81. item.rightName = '去认证'
  82. item.jumpUrl = 'openRealNameAuth'
  83. item.rightStatus = 'none click' //可点击,灰色
  84. break;
  85. }
  86. }
  87. //最高学历认证
  88. if (resIndentify.status === 1) {
  89. let education = resIndentify.data.education && resIndentify.data.education[ 0 ] || {}
  90. let status = Number(education.status || 0)
  91. itemEdu.rightName = education.status_name || '去认证'
  92. itemEdu.meta = resIndentify.data.education || []
  93. switch (status) {
  94. case 0:
  95. itemEdu.jumpUrl = "/sign/new"
  96. itemEdu.rightStatus = 'none click' //可点击,灰色
  97. break;
  98. case 1:
  99. itemEdu.rightStatus = 'none noClick' //不可点击 灰色
  100. break;
  101. case 2:
  102. itemEdu.jumpUrl = 'openEducation'
  103. itemEdu.rightStatus = 'ok click' //可点击 灰色
  104. break;
  105. case 3:
  106. itemEdu.jumpUrl = 'openEducation'
  107. itemEdu.rightStatus = 'none click' //可点击,灰色
  108. break;
  109. }
  110. if (education.id) {
  111. itemEdu.jumpUrl = 'openEducation'
  112. itemEdu.rightStatus = 'ok click' //可点击 灰色
  113. }
  114. }
  115. return list
  116. }
  117. /** 项目经验 */
  118. async project(list) {
  119. const { req, $axios } = this
  120. return list
  121. }
  122. /** 社会信用 */
  123. async credit(list) {
  124. const { req, $axios } = this
  125. return list
  126. }
  127. }