Browse Source

🐛 修复 user 在 IDEA 报错的问题

shizhong 1 year ago
parent
commit
f372fc0cdc
2 changed files with 18 additions and 30 deletions
  1. 16 28
      src/api/system/user/profile.ts
  2. 2 2
      src/views/Profile/components/ProfileUser.vue

+ 16 - 28
src/api/system/user/profile.ts

@@ -1,37 +1,25 @@
 import request from '@/config/axios'
 
-export interface ProfileDept {
-  id: number
-  name: string
-}
-export interface ProfileRole {
-  id: number
-  name: string
-}
-export interface ProfilePost {
-  id: number
-  name: string
-}
-export interface SocialUser {
-  id: number
-  type: number
-  openid: string
-  token: string
-  rawTokenInfo: string
-  nickname: string
-  avatar: string
-  rawUserInfo: string
-  code: string
-  state: string
-}
 export interface ProfileVO {
   id: number
   username: string
   nickname: string
-  dept: ProfileDept
-  roles: ProfileRole[]
-  posts: ProfilePost[]
-  socialUsers: SocialUser[]
+  dept: {
+    id: number
+    name: string
+  }
+  roles: {
+    id: number
+    name: string
+  }[]
+  posts: {
+    id: number
+    name: string
+  }[]
+  socialUsers: {
+    type: number
+    openid: string
+  }[]
   email: string
   mobile: string
   sex: number

+ 2 - 2
src/views/Profile/components/ProfileUser.vue

@@ -41,7 +41,7 @@
       <li class="list-group-item">
         <Icon class="mr-5px" icon="ep:calendar" />
         {{ t('profile.user.createTime') }}
-        <div class="pull-right">{{ formatDate(userInfo?.createTime) }}</div>
+        <div class="pull-right">{{ formatDate(userInfo.createTime) }}</div>
       </li>
     </ul>
   </div>
@@ -55,7 +55,7 @@ import { getUserProfileApi, ProfileVO } from '@/api/system/user/profile'
 defineOptions({ name: 'ProfileUser' })
 
 const { t } = useI18n()
-const userInfo = ref<ProfileVO>()
+const userInfo = ref({} as ProfileVO)
 const getUserInfo = async () => {
   const users = await getUserProfileApi()
   userInfo.value = users