sunjh 6 anni fa
parent
commit
b138188dfc
4 ha cambiato i file con 29 aggiunte e 14 eliminazioni
  1. 5 5
      src/components/Mine.vue
  2. 16 8
      src/components/commons/Header.vue
  3. 6 1
      src/js/userService.js
  4. 2 0
      src/main.js

+ 5 - 5
src/components/Mine.vue

@@ -293,31 +293,31 @@ export default {
             name: '接收项目数量',
             type: 'line',
             stack: '总量',
-            data: [120, 132, 101, 134, 90, 230, 210]
+            data: [2, 3, 3, 2, 4, 5, 6]
           },
           {
             name: '完成项目数量',
             type: 'line',
             stack: '总量',
-            data: [220, 182, 191, 234, 290, 330, 310]
+            data: [2, 3, 3, 2, 4, 5, 6]
           },
           {
             name: '接收任务数量',
             type: 'line',
             stack: '总量',
-            data: [150, 232, 201, 154, 190, 330, 410]
+            data: [22, 33, 41, 14, 55, 33, 41]
           },
           {
             name: '完成任务数量',
             type: 'line',
             stack: '总量',
-            data: [320, 332, 301, 334, 390, 330, 320]
+            data: [21, 33, 31, 14, 39, 33, 32]
           },
           {
             name: '发布项目数量',
             type: 'line',
             stack: '总量',
-            data: [820, 932, 901, 934, 1290, 1330, 1320]
+            data: [2, 3, 1, 0, 1, 2, 2]
           }
         ]
       }

+ 16 - 8
src/components/commons/Header.vue

@@ -395,7 +395,7 @@ export default {
           'isSystemAdministrator': false
         })
         console.log('本地没有用户信息,开始加载用户信息')
-        getCurrentUser().then((res) => {
+        getCurrentUser().then((res)=>{
           console.log(res)
           storageSave('user', res)
           this.user = res
@@ -404,14 +404,9 @@ export default {
           console.log('用户信息加载成功')
           this.isLogin = true
           this.fullScreenLoading = false
-        }).catch(error => {
+        }).catch((error)=>{
           console.log('用户信息加载失败')
           this.fullScreenLoading = false
-          // if (error.status == 401) {
-          //   notify('warning', error.data)
-          // } else {
-          //   notify('error', error.data)
-          // }
         })
       } else {
         this.user = storageGet('user')
@@ -419,8 +414,21 @@ export default {
         this.isLogin = true
       }
     },
+    getCurrentUserSuccess (res) {
+      console.log(res)
+      storageSave('user', res)
+      this.user = res
+      this.rolesPermissions = getRolesPermissions(res.roleList)
+      storageSave('rolesPermissions', getRolesPermissions(res.roleList))
+      console.log('用户信息加载成功')
+      this.isLogin = true
+      this.fullScreenLoading = false
+    },
+    getCurrentUserFail (error) {
+      console.log('用户信息加载失败')
+      this.fullScreenLoading = false
+    },
     userLogout () {
-      console.log('ee')
       this.isLogin = false
       logout().then((res) => {
         this.$router.push({

+ 6 - 1
src/js/userService.js

@@ -1,7 +1,7 @@
 import Http from './http'
 import Apis from './api'
 //获取用户信息
-export const getCurrentUser = () => {
+export const getCurrentUser = (getCurrentUserSuccess, getCurrentUserFail) => {
   // const data = {
   //   userVO: {
   //     id: 3,
@@ -17,6 +17,11 @@ export const getCurrentUser = () => {
   //   resolve(data)
   // })
   return Http.get(Apis.USER.GET_CURRENT_USER)
+  // Http.get(Apis.USER.GET_CURRENT_USER).then((res) => {
+  //   getCurrentUserSuccess(res)
+  // }).catch((error) => {
+  //   getCurrentUserFail(error)
+  // })
 }
 //
 export const getRolesPermissions = (roleList) => {

+ 2 - 0
src/main.js

@@ -59,7 +59,9 @@ import {
   Tooltip,
   Upload,
 } from 'element-ui'
+function getCurrentUserSuccess(res){
 
+}
 router.beforeEach((to, from, next) => {
   const urls = getAuthUrls()
   if (storageGet('user') == null) {