Browse Source

chore: 目录构建

lanjianrong 4 years ago
parent
commit
bdd69e8a1b

+ 12 - 9
src/api/sys/model/userModel.ts

@@ -31,13 +31,16 @@ export interface LoginResultModel {
  * @description: Get user information return value
  */
 export interface GetUserInfoByUserIdModel {
-  roles: RoleInfo[]
-  // 用户id
-  userId: string | number
-  // 用户名
-  username: string
-  // 真实名字
-  realName: string
-  // 介绍
-  desc?: string
+  id: string
+  account: string
+  password: string
+  name: string
+  company: string
+  position: string
+  role: string
+  mobile: string
+  telephone: string
+  isAdmin: number
+  accountGroup: number
+  enable: number
 }

+ 21 - 0
src/router/menus/modules/design.ts

@@ -0,0 +1,21 @@
+import type { MenuModule } from '/@/router/types'
+import { t } from '/@/hooks/web/useI18n'
+
+const menu: MenuModule = {
+  orderNo: 10,
+  menu: {
+    name: '设计表管理',
+    path: '/design',
+    children: [
+      {
+        path: 'catalog',
+        name: '数量表列表'
+      },
+      {
+        path: 'management',
+        name: '目录管理'
+      }
+    ]
+  }
+}
+export default menu

+ 36 - 0
src/router/routes/modules/design.ts

@@ -0,0 +1,36 @@
+import type { AppRouteModule } from '/@/router/types'
+
+import { LAYOUT } from '/@/router/constant'
+import { t } from '/@/hooks/web/useI18n'
+
+const catalog: AppRouteModule = {
+  path: '/design',
+  name: 'Design',
+  component: LAYOUT,
+  redirect: '/design/main',
+  meta: {
+    title: '数量表列表'
+  },
+  children: [
+    {
+      path: 'catalog',
+      name: 'Catalog',
+      component: () => import('/@/views/design-directive/catalog/index.vue'),
+      meta: {
+        title: '数量表列表'
+        // icon: 'bx:bx-home'
+      }
+    },
+    {
+      path: 'management',
+      name: 'Management',
+      component: () => import('/@/views/design-directive/management/index.vue'),
+      meta: {
+        title: '目录管理'
+        // icon: 'bx:bx-home'
+      }
+    }
+  ]
+}
+
+export default catalog

+ 2 - 1
src/store/modules/permission.ts

@@ -106,6 +106,7 @@ class Permission extends VuexModule {
         return roleList.some(role => roles.includes(role))
       }
       routes = filter(asyncRoutes, routeFilter)
+
       routes = routes.filter(routeFilter)
       // Convert multi-level routing to level 2 routing
       routes = flatMultiLevelRoutes(routes)
@@ -116,7 +117,7 @@ class Permission extends VuexModule {
         duration: 1
       })
       // Here to get the background routing menu logic to modify by yourself
-      const paramId = id || userStore.getUserInfoState.userId
+      const paramId = id || userStore.getUserInfoState.id
 
       // !Simulate to obtain permission codes from the background,
       // this function may only need to be executed once, and the actual project can be put at the right time by itself

+ 5 - 7
src/store/modules/user.ts

@@ -87,18 +87,16 @@ class User extends VuexModule {
     try {
       const { goHome = true, mode, ...loginParams } = params
 
-      const token = await loginApi(loginParams, mode)
-      console.log(token)
+      const data = await loginApi(loginParams, mode)
 
-      // const { token, userId } = data
+      const { token } = data
 
       // save token
       this.commitTokenState(token)
-
       // get user info
       const userInfo = await this.getUserInfoAction()
 
-      goHome && (await router.replace(PageEnum.BASE_HOME))
+      goHome && (await router.replace('/home'))
       return userInfo
     } catch (error) {
       return null
@@ -108,8 +106,8 @@ class User extends VuexModule {
   @Action
   async getUserInfoAction() {
     const userInfo = await getUserInfoById()
-    const { roles } = userInfo
-    const roleList = roles.map(item => item.value) as RoleEnum[]
+    const roles = ['super']
+    const roleList = roles.map(item => item) as RoleEnum[]
     this.commitUserInfoState(userInfo)
     this.commitRoleListState(roleList)
     return userInfo

+ 11 - 8
src/store/types.ts

@@ -6,14 +6,17 @@ export interface LockInfo {
 }
 
 export interface UserInfo {
-  // 用户id
-  userId: string | number
-  // 用户名
-  username: string
-  // 真实名字
-  realName: string
-  // 介绍
-  desc?: string
+  id: string
+  account: string
+  name: string
+  company: string
+  position: string
+  role: string
+  mobile: string
+  telephone: string
+  isAdmin: number
+  accountGroup: number
+  enable: number
 }
 
 export interface BeforeMiniState {

+ 1 - 1
src/utils/http/axios/index.ts

@@ -140,7 +140,7 @@ const transform: AxiosTransform = {
     const token = getToken()
     if (token) {
       // jwt token
-      config.headers.Authorization = token
+      config.headers.Authorization = `bearer ${token}`
     }
     return config
   },

+ 22 - 0
src/views/design-directive/catalog/index.vue

@@ -0,0 +1,22 @@
+<template>
+  <div class="welcome">
+    <!-- <House /> -->
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent } from 'vue'
+  // import House from '../house/index.vue'
+  export default defineComponent({
+    name: 'Catalog'
+    // components: { House }
+  })
+</script>
+<style lang="less" scoped>
+  .welcome {
+    display: flex;
+    width: 100%;
+    height: 100%;
+    justify-content: center;
+    align-items: center;
+  }
+</style>

+ 22 - 0
src/views/design-directive/management/index.vue

@@ -0,0 +1,22 @@
+<template>
+  <div class="welcome">
+    <!-- <House /> -->
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent } from 'vue'
+  // import House from '../house/index.vue'
+  export default defineComponent({
+    name: 'Management'
+    // components: { House }
+  })
+</script>
+<style lang="less" scoped>
+  .welcome {
+    display: flex;
+    width: 100%;
+    height: 100%;
+    justify-content: center;
+    align-items: center;
+  }
+</style>

+ 1 - 1
src/views/sys/login/LoginForm.vue

@@ -152,7 +152,7 @@
           if (userInfo) {
             notification.success({
               message: t('sys.login.loginSuccessTitle'),
-              description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
+              description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.name}`,
               duration: 3
             })
           }