guo00guo пре 5 година
родитељ
комит
26429ea0e0
2 измењених фајлова са 14 додато и 18 уклоњено
  1. 12 18
      src/components/commons/HomeSlice.vue
  2. 2 0
      src/js/api.js

+ 12 - 18
src/components/commons/HomeSlice.vue

@@ -45,15 +45,12 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
-                    Http.get(`/api/user/${this.user.id}`).then(res => {
-                        res.roleList.forEach(function(item) {
-                            if(item.indexOf("part") != -1){
-                                this.$router.push('/project/create');
-                            }
-                        })
-                        notify('warning', '请先认证成为发包用户');
-                    });
-
+                    Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                        console.log(res)
+                        this.$router.push('/project/create');
+                    }).catch((error) => {
+                        notify('error', error.data)
+                    })
                 }
             },
             checkCreateTaskAuth() {
@@ -62,15 +59,12 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
-                    Http.get(`/api/user/${this.user.id}`).then(res => {
-                        console.log(res.roleList);
-                        res.roleList.forEach(function(item) {
-                            if(item.indexOf("evaluation") != -1){
-                                this.$router.push("/square")
-                            }
-                        })
-                        notify('warning', '请先认证成为接包用户');
-                    });
+                    Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
+                        console.log(res)
+                        this.$router.push('/square');
+                    }).catch((error) => {
+                        notify('error', error.data)
+                    })
 
                 }
             },

+ 2 - 0
src/js/api.js

@@ -69,6 +69,8 @@ export default {
     REJECT_INDIVIDUAL_AUTH:'/api/user/{userId}/personalAuth/status/reject',
     GET_DETAIL: "/api/user/detail/{userId}",
     GET_ADDRESS: "/api/index/address",
+    IS_PART: "/api/common/check/create/project/{userId}",
+    IS_AGENCY: "/api/common/check/accept/task/{userId}",
   },
   PAGE: {
     HOME_PAGE: '/api/common/index/',