diff --git a/src/api/user/index.ts b/src/api/user/index.ts index a5fe283..8b3bd20 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -7,22 +7,30 @@ class UserAPI { */ static getInfo() { return new Promise((resolve)=>{ - resolve({ - "userId": 2, - "username": "admin", - "nickname": "系统管理员", - "avatar": "", - "roles": [ - "ADMIN" - ], - "perms": [] - }) + // resolve({ + // "userId": 2, + // "username": "admin", + // "nickname": "系统管理员", + // "avatar": "", + // "roles": [ + // "ADMIN" + // ], + // "perms": [] + // }) + request({ + url: "/users/current", + method: "get", + }).then(res =>{ + resolve({ + "userId": res.data.data.user_id, + "username": res.data.data.user_name, + "nickname": "系统管理员", + "avatar": "", + "roles": res.data.data.user_role.split(','), + "perms": [] + }) + }); }) - /* - return request({ - url: "/api/v1/users/me", - method: "get", - });*/ } /** diff --git a/src/assets/images/avatar.png b/src/assets/images/avatar.png new file mode 100644 index 0000000..c38d8bd Binary files /dev/null and b/src/assets/images/avatar.png differ diff --git a/src/layout/components/NavBar/components/NavbarRight.vue b/src/layout/components/NavBar/components/NavbarRight.vue index 4d75c6c..a335527 100644 --- a/src/layout/components/NavBar/components/NavbarRight.vue +++ b/src/layout/components/NavBar/components/NavbarRight.vue @@ -22,10 +22,10 @@
- + {{ userStore.user.username }}