ソースを参照

技术信用 为签约 工作经历不可点击

xinfeng 6 年 前
コミット
0822d9becd
3 ファイル変更31 行追加20 行削除
  1. 23 6
      components/credit/dealData.js
  2. 8 4
      pages/credit/_type.vue
  3. 0 10
      plugins/deviceType.js

+ 23 - 6
components/credit/dealData.js

@@ -1,16 +1,29 @@
 export default class DealData {
-  constructor({ $axios, req }) {
+  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 ] = await Promise.all([
-      $axios.$get(`/api/user/cert_status`, { 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 => {
@@ -27,8 +40,12 @@ export default class DealData {
           let o = list[ len - 1 ]
           o.rightStatus = 'ok click'
           o.rightName = "查看详情"
-          //有工作经历
-          if (Array.isArray(workList) && workList.length > 0) {
+          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

+ 8 - 4
pages/credit/_type.vue

@@ -63,9 +63,9 @@
         } ]
       }
     },
-    async asyncData({ $axios, params, req }) {
-      const dealData = new DealData({ $axios, req })
-
+    async asyncData({ $axios, params, req, store}) {
+      let userinfo = store.state.userinfo
+      const dealData = new DealData({ $axios, req, userinfo})
       const type = params.type || 'identify'
       let { topAreaData, list } = data[ type ]
       //处理数据,假若有 跳转链接, 设置按钮样式
@@ -145,7 +145,11 @@
         this.toastType = ''
       },
       async refresh(type) {
-        const dealData = new DealData({ $axios: this.$axios, res: { header: {} } })
+        const dealData = new DealData({
+            $axios: this.$axios,
+            res: { header: {} },
+            userinfo: this.$store.state.userinfo
+        })
         switch (type) {
           case 'openWorkHistory':
             this.list = await dealData.professional(this.list)

+ 0 - 10
plugins/deviceType.js

@@ -46,14 +46,6 @@ export default function ({req}, inject) {
     deviceType.spider = true
   }
   
-  deviceType.isIos = function() {
-    return deviceType.ios
-  }
-  
-  deviceType.isAndroid= function() {
-    return deviceType.android
-  }
-  
   deviceType.isMobile = function() {
     return deviceType.ios || deviceType.android
   }
@@ -65,8 +57,6 @@ export default function ({req}, inject) {
   deviceType.isWx = function() {
     return deviceType.wx
   }
-  console.log('deviceType', deviceType)
-  // inject('deviceType', deviceType)
   
   inject && inject('deviceType', deviceType)
   return deviceType