xto-fronted 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.env.development +7 -7
  2. package/.env.production +7 -7
  3. package/dist/assets/403-AFBQifUI.js +1 -0
  4. package/dist/assets/403-BHEXXbt2.css +1 -0
  5. package/dist/assets/404-Ct_A1n7S.css +1 -0
  6. package/dist/assets/404-WFvpcD2_.js +1 -0
  7. package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
  8. package/dist/assets/index-1juADvYN.js +2 -0
  9. package/dist/assets/index-B-sX4Ru0.js +1 -0
  10. package/dist/assets/index-BMcziU5a.css +1 -0
  11. package/dist/assets/index-BRR97dc6.js +1 -0
  12. package/dist/assets/index-BZA0ksjx.css +1 -0
  13. package/dist/assets/index-BpV_8nl0.js +1 -0
  14. package/dist/assets/index-BvzhR4zp.js +1 -0
  15. package/dist/assets/index-CUh_s55Z.css +1 -0
  16. package/dist/assets/index-CVjdnIgR.css +1 -0
  17. package/dist/assets/index-CYq57-zj.js +1 -0
  18. package/dist/assets/index-CkL3sVAQ.js +2 -0
  19. package/dist/assets/index-CtrKVYJb.css +1 -0
  20. package/dist/assets/index-Cz2P_bsS.js +1 -0
  21. package/dist/assets/index-D9wlAuR_.js +1 -0
  22. package/dist/assets/index-DawJb02s.css +1 -0
  23. package/dist/assets/index-DfFR6NLf.js +1 -0
  24. package/dist/assets/index-DwVgMO8e.js +1 -0
  25. package/dist/assets/index-GDP-IkXE.css +1 -0
  26. package/dist/assets/index-Iaz1ZzPC.js +2 -0
  27. package/dist/assets/index-PfV8pzQz.css +1 -0
  28. package/dist/assets/index-Swfu6yvD.css +1 -0
  29. package/dist/assets/index-Te8_PRgJ.js +1 -0
  30. package/dist/assets/index-WyZ91RLx.css +1 -0
  31. package/dist/assets/index-tFYRoFdE.js +1 -0
  32. package/dist/assets/vendor-42ANG6Sg.js +6 -0
  33. package/dist/assets/vite-Dw-pgLOX.js +1 -0
  34. package/dist/assets/vue-vendor-Br-l7wbK.js +29 -0
  35. package/dist/assets/xto-base-C-IBqjVs.js +1 -0
  36. package/dist/assets/xto-base-C6eqMPdO.css +1 -0
  37. package/dist/assets/xto-business--V1F5Gwb.css +1 -0
  38. package/dist/assets/xto-core-DZK7Cyg0.js +1 -0
  39. package/dist/assets/xto-data-BFpiDgJi.js +1 -0
  40. package/dist/assets/xto-data-CnAQAQH2.css +1 -0
  41. package/dist/assets/xto-feedback-B7ipsTfz.js +1 -0
  42. package/dist/assets/xto-feedback-DBwJzoTj.css +1 -0
  43. package/dist/assets/xto-form-CrsyAjyr.css +1 -0
  44. package/dist/assets/xto-form-NRjKKNcY.js +1 -0
  45. package/dist/assets/xto-layout-BqU8RuWL.css +1 -0
  46. package/dist/assets/xto-navigation-BiSaXPfr.js +1 -0
  47. package/dist/assets/xto-navigation-C1cnSL2E.css +1 -0
  48. package/dist/assets/xto-navigation-CBPg4dCc.css +1 -0
  49. package/dist/assets/xto-navigation-CKabFu9d.js +1 -0
  50. package/dist/index.html +28 -0
  51. package/package.json +85 -85
  52. package/src/api/auth.ts +25 -25
  53. package/src/api/system.ts +66 -66
  54. package/src/assets/styles/_dark.scss +406 -406
  55. package/src/components/Layout/Header.vue +973 -973
  56. package/src/components/Layout/Sidebar.vue +273 -273
  57. package/src/components/Layout/index.vue +443 -63
  58. package/src/composables/useApp.ts +61 -61
  59. package/src/composables/useAuth.ts +16 -16
  60. package/src/directives/permission.ts +27 -27
  61. package/src/env.d.ts +18 -18
  62. package/src/index.ts +47 -47
  63. package/src/router/dynamicRoutes.ts +162 -162
  64. package/src/router/guards.ts +128 -128
  65. package/src/router/index.ts +79 -79
  66. package/src/stores/auth.ts +65 -65
  67. package/src/stores/menu.ts +48 -48
  68. package/src/stores/user.ts +50 -50
  69. package/src/types/api.d.ts +80 -80
  70. package/src/utils/auth.ts +99 -99
  71. package/src/utils/config.ts +80 -80
  72. package/src/utils/permission.ts +32 -32
  73. package/src/utils/request.ts +124 -124
  74. package/src/views/login/index.vue +194 -194
  75. package/vite.config.ts +135 -135
@@ -1,51 +1,51 @@
1
- /**
2
- * 用户状态
3
- */
4
-
5
- import { defineStore } from 'pinia'
6
- import { ref, computed } from 'vue'
7
- import type { UserInfo } from '@/types/api'
8
- import { local } from '@/utils/storage'
9
-
10
- const USER_INFO_KEY = 'user_info'
11
-
12
- export const useUserStore = defineStore('user', () => {
13
- // 状态
14
- const userInfo = ref<UserInfo | null>(local.get<UserInfo>(USER_INFO_KEY))
15
-
16
- // 计算属性
17
- const isLoggedIn = computed(() => !!userInfo.value)
18
- const userId = computed(() => userInfo.value?.userId || '')
19
- const userName = computed(() => userInfo.value?.userName || '')
20
- const departmentName = computed(() => userInfo.value?.departmentName || '')
21
- const email = computed(() => userInfo.value?.email || '')
22
- const mobilePhone = computed(() => userInfo.value?.mobilePhone || '')
23
- const positionName = computed(() => userInfo.value?.positionName || '')
24
- const avatar = computed(() => userInfo.value?.avatar || '')
25
-
26
- // 设置用户信息
27
- const setUserInfo = (info: UserInfo) => {
28
- userInfo.value = info
29
- local.set(USER_INFO_KEY, info)
30
- }
31
-
32
- // 清除用户信息
33
- const clearUserInfo = () => {
34
- userInfo.value = null
35
- local.remove(USER_INFO_KEY)
36
- }
37
-
38
- return {
39
- userInfo,
40
- isLoggedIn,
41
- userId,
42
- userName,
43
- departmentName,
44
- email,
45
- mobilePhone,
46
- positionName,
47
- avatar,
48
- setUserInfo,
49
- clearUserInfo
50
- }
1
+ /**
2
+ * 用户状态
3
+ */
4
+
5
+ import { defineStore } from 'pinia'
6
+ import { ref, computed } from 'vue'
7
+ import type { UserInfo } from '@/types/api'
8
+ import { local } from '@/utils/storage'
9
+
10
+ const USER_INFO_KEY = 'user_info'
11
+
12
+ export const useUserStore = defineStore('user', () => {
13
+ // 状态
14
+ const userInfo = ref<UserInfo | null>(local.get<UserInfo>(USER_INFO_KEY))
15
+
16
+ // 计算属性
17
+ const isLoggedIn = computed(() => !!userInfo.value)
18
+ const userId = computed(() => userInfo.value?.userId || '')
19
+ const userName = computed(() => userInfo.value?.userName || '')
20
+ const departmentName = computed(() => userInfo.value?.departmentName || '')
21
+ const email = computed(() => userInfo.value?.email || '')
22
+ const mobilePhone = computed(() => userInfo.value?.mobilePhone || '')
23
+ const positionName = computed(() => userInfo.value?.positionName || '')
24
+ const avatar = computed(() => userInfo.value?.avatar || '')
25
+
26
+ // 设置用户信息
27
+ const setUserInfo = (info: UserInfo) => {
28
+ userInfo.value = info
29
+ local.set(USER_INFO_KEY, info)
30
+ }
31
+
32
+ // 清除用户信息
33
+ const clearUserInfo = () => {
34
+ userInfo.value = null
35
+ local.remove(USER_INFO_KEY)
36
+ }
37
+
38
+ return {
39
+ userInfo,
40
+ isLoggedIn,
41
+ userId,
42
+ userName,
43
+ departmentName,
44
+ email,
45
+ mobilePhone,
46
+ positionName,
47
+ avatar,
48
+ setUserInfo,
49
+ clearUserInfo
50
+ }
51
51
  })
@@ -1,81 +1,81 @@
1
- /**
2
- * API 通用类型定义
3
- */
4
-
5
- // 基础响应
6
- export interface ApiResponse<T = unknown> {
7
- code: number
8
- data: T
9
- message: string
10
- }
11
-
12
- // 分页请求参数
13
- export interface PageParams {
14
- page: number
15
- pageSize: number
16
- [key: string]: unknown
17
- }
18
-
19
- // 分页响应
20
- export interface PageResponse<T> {
21
- list: T[]
22
- total: number
23
- page: number
24
- pageSize: number
25
- }
26
-
27
- // 用户信息(参考 tineco-ui)
28
- export interface UserInfo {
29
- appId: string
30
- userId: string
31
- userName: string
32
- departmentName?: string
33
- email?: string
34
- mobilePhone?: string
35
- positionName?: string
36
- avatar?: string
37
- }
38
-
39
- // 登录请求参数(参考 tineco-ui)
40
- export interface LoginParams {
41
- appId: string
42
- clientId: string
43
- uid: string
44
- password: string
45
- code?: boolean
46
- }
47
-
48
- // 登录响应(参考 tineco-ui)
49
- export interface LoginResult {
50
- access_token: string
51
- token_type: string
52
- refresh_token: string
53
- expires_time: number
54
- refresh_time: number
55
- code?: string
56
- }
57
-
58
- // 菜单项(参考 tineco-ui)
59
- export interface MenuItem {
60
- menuCode: string
61
- menuName: string
62
- menuUrl: string
63
- icon?: string
64
- closable?: boolean
65
- isDefault?: boolean
66
- isOut?: boolean
67
- type?: number // 1 为按钮,其他为菜单
68
- children?: MenuItem[]
69
- }
70
-
71
- // 角色信息
72
- export interface RoleInfo {
73
- id: number | string
74
- name: string
75
- code: string
76
- description?: string
77
- status: number
78
- permissions: string[]
79
- createTime?: string
80
- updateTime?: string
1
+ /**
2
+ * API 通用类型定义
3
+ */
4
+
5
+ // 基础响应
6
+ export interface ApiResponse<T = unknown> {
7
+ code: number
8
+ data: T
9
+ message: string
10
+ }
11
+
12
+ // 分页请求参数
13
+ export interface PageParams {
14
+ page: number
15
+ pageSize: number
16
+ [key: string]: unknown
17
+ }
18
+
19
+ // 分页响应
20
+ export interface PageResponse<T> {
21
+ list: T[]
22
+ total: number
23
+ page: number
24
+ pageSize: number
25
+ }
26
+
27
+ // 用户信息(参考 tineco-ui)
28
+ export interface UserInfo {
29
+ appId: string
30
+ userId: string
31
+ userName: string
32
+ departmentName?: string
33
+ email?: string
34
+ mobilePhone?: string
35
+ positionName?: string
36
+ avatar?: string
37
+ }
38
+
39
+ // 登录请求参数(参考 tineco-ui)
40
+ export interface LoginParams {
41
+ appId: string
42
+ clientId: string
43
+ uid: string
44
+ password: string
45
+ code?: boolean
46
+ }
47
+
48
+ // 登录响应(参考 tineco-ui)
49
+ export interface LoginResult {
50
+ access_token: string
51
+ token_type: string
52
+ refresh_token: string
53
+ expires_time: number
54
+ refresh_time: number
55
+ code?: string
56
+ }
57
+
58
+ // 菜单项(参考 tineco-ui)
59
+ export interface MenuItem {
60
+ menuCode: string
61
+ menuName: string
62
+ menuUrl: string
63
+ icon?: string
64
+ closable?: boolean
65
+ isDefault?: boolean
66
+ isOut?: boolean
67
+ type?: number // 1 为按钮,其他为菜单
68
+ children?: MenuItem[]
69
+ }
70
+
71
+ // 角色信息
72
+ export interface RoleInfo {
73
+ id: number | string
74
+ name: string
75
+ code: string
76
+ description?: string
77
+ status: number
78
+ permissions: string[]
79
+ createTime?: string
80
+ updateTime?: string
81
81
  }
package/src/utils/auth.ts CHANGED
@@ -1,100 +1,100 @@
1
- /**
2
- * Token 管理
3
- */
4
-
5
- import { local } from './storage'
6
-
7
- const TOKEN_KEY = 'token'
8
- const TOKEN_TYPE_KEY = 'token_type'
9
- const REFRESH_TOKEN_KEY = 'refresh_token'
10
- const TOKEN_EXPIRE_KEY = 'expires_time'
11
- const REFRESH_TIME_KEY = 'refresh_time'
12
- const CODE_KEY = 'code'
13
-
14
- export interface TokenInfo {
15
- access_token: string
16
- token_type: string
17
- refresh_token: string
18
- expires_time: number
19
- refresh_time: number
20
- code?: string
21
- }
22
-
23
- export const getToken = (): string | null => {
24
- return local.get<string>(TOKEN_KEY)
25
- }
26
-
27
- export const setToken = (token: string): void => {
28
- local.set(TOKEN_KEY, token)
29
- }
30
-
31
- export const getTokenType = (): string | null => {
32
- return local.get<string>(TOKEN_TYPE_KEY)
33
- }
34
-
35
- export const setTokenType = (tokenType: string): void => {
36
- local.set(TOKEN_TYPE_KEY, tokenType)
37
- }
38
-
39
- export const getRefreshToken = (): string | null => {
40
- return local.get<string>(REFRESH_TOKEN_KEY)
41
- }
42
-
43
- export const setRefreshToken = (refreshToken: string): void => {
44
- local.set(REFRESH_TOKEN_KEY, refreshToken)
45
- }
46
-
47
- export const getTokenExpire = (): number | null => {
48
- return local.get<number>(TOKEN_EXPIRE_KEY)
49
- }
50
-
51
- export const setTokenExpire = (expireTime: number): void => {
52
- local.set(TOKEN_EXPIRE_KEY, expireTime)
53
- }
54
-
55
- export const getRefreshTime = (): number | null => {
56
- return local.get<number>(REFRESH_TIME_KEY)
57
- }
58
-
59
- export const setRefreshTime = (refreshTime: number): void => {
60
- local.set(REFRESH_TIME_KEY, refreshTime)
61
- }
62
-
63
- export const getCode = (): string | null => {
64
- return local.get<string>(CODE_KEY)
65
- }
66
-
67
- export const setCode = (code: string): void => {
68
- local.set(CODE_KEY, code)
69
- }
70
-
71
- export const setTokenInfo = (info: TokenInfo): void => {
72
- setToken(info.access_token)
73
- setTokenType(info.token_type || 'Bearer')
74
- setRefreshToken(info.refresh_token)
75
- setTokenExpire(info.expires_time)
76
- setRefreshTime(info.refresh_time)
77
- if (info.code) {
78
- setCode(info.code)
79
- }
80
- }
81
-
82
- export const clearToken = (): void => {
83
- local.remove(TOKEN_KEY)
84
- local.remove(TOKEN_TYPE_KEY)
85
- local.remove(REFRESH_TOKEN_KEY)
86
- local.remove(TOKEN_EXPIRE_KEY)
87
- local.remove(REFRESH_TIME_KEY)
88
- local.remove(CODE_KEY)
89
- }
90
-
91
- export const isTokenExpired = (): boolean => {
92
- const expireTime = getTokenExpire()
93
- if (!expireTime) return true
94
- return Date.now() > expireTime
95
- }
96
-
97
- export const hasToken = (): boolean => {
98
- const token = getToken()
99
- return !!token && !isTokenExpired()
1
+ /**
2
+ * Token 管理
3
+ */
4
+
5
+ import { local } from './storage'
6
+
7
+ const TOKEN_KEY = 'token'
8
+ const TOKEN_TYPE_KEY = 'token_type'
9
+ const REFRESH_TOKEN_KEY = 'refresh_token'
10
+ const TOKEN_EXPIRE_KEY = 'expires_time'
11
+ const REFRESH_TIME_KEY = 'refresh_time'
12
+ const CODE_KEY = 'code'
13
+
14
+ export interface TokenInfo {
15
+ access_token: string
16
+ token_type: string
17
+ refresh_token: string
18
+ expires_time: number
19
+ refresh_time: number
20
+ code?: string
21
+ }
22
+
23
+ export const getToken = (): string | null => {
24
+ return local.get<string>(TOKEN_KEY)
25
+ }
26
+
27
+ export const setToken = (token: string): void => {
28
+ local.set(TOKEN_KEY, token)
29
+ }
30
+
31
+ export const getTokenType = (): string | null => {
32
+ return local.get<string>(TOKEN_TYPE_KEY)
33
+ }
34
+
35
+ export const setTokenType = (tokenType: string): void => {
36
+ local.set(TOKEN_TYPE_KEY, tokenType)
37
+ }
38
+
39
+ export const getRefreshToken = (): string | null => {
40
+ return local.get<string>(REFRESH_TOKEN_KEY)
41
+ }
42
+
43
+ export const setRefreshToken = (refreshToken: string): void => {
44
+ local.set(REFRESH_TOKEN_KEY, refreshToken)
45
+ }
46
+
47
+ export const getTokenExpire = (): number | null => {
48
+ return local.get<number>(TOKEN_EXPIRE_KEY)
49
+ }
50
+
51
+ export const setTokenExpire = (expireTime: number): void => {
52
+ local.set(TOKEN_EXPIRE_KEY, expireTime)
53
+ }
54
+
55
+ export const getRefreshTime = (): number | null => {
56
+ return local.get<number>(REFRESH_TIME_KEY)
57
+ }
58
+
59
+ export const setRefreshTime = (refreshTime: number): void => {
60
+ local.set(REFRESH_TIME_KEY, refreshTime)
61
+ }
62
+
63
+ export const getCode = (): string | null => {
64
+ return local.get<string>(CODE_KEY)
65
+ }
66
+
67
+ export const setCode = (code: string): void => {
68
+ local.set(CODE_KEY, code)
69
+ }
70
+
71
+ export const setTokenInfo = (info: TokenInfo): void => {
72
+ setToken(info.access_token)
73
+ setTokenType(info.token_type || 'Bearer')
74
+ setRefreshToken(info.refresh_token)
75
+ setTokenExpire(info.expires_time)
76
+ setRefreshTime(info.refresh_time)
77
+ if (info.code) {
78
+ setCode(info.code)
79
+ }
80
+ }
81
+
82
+ export const clearToken = (): void => {
83
+ local.remove(TOKEN_KEY)
84
+ local.remove(TOKEN_TYPE_KEY)
85
+ local.remove(REFRESH_TOKEN_KEY)
86
+ local.remove(TOKEN_EXPIRE_KEY)
87
+ local.remove(REFRESH_TIME_KEY)
88
+ local.remove(CODE_KEY)
89
+ }
90
+
91
+ export const isTokenExpired = (): boolean => {
92
+ const expireTime = getTokenExpire()
93
+ if (!expireTime) return true
94
+ return Date.now() > expireTime
95
+ }
96
+
97
+ export const hasToken = (): boolean => {
98
+ const token = getToken()
99
+ return !!token && !isTokenExpired()
100
100
  }
@@ -1,81 +1,81 @@
1
- /**
2
- * 应用配置(动态设置,避免 import.meta.env 静态替换)
3
- */
4
-
5
- import { ref } from 'vue'
6
-
7
- // 配置状态
8
- const appId = ref<string>('')
9
- const clientId = ref<string>('')
10
- const apiBaseUrl = ref<string>('')
11
-
12
- /**
13
- * 初始化应用配置
14
- * 在项目入口文件(main.ts)中调用此函数设置配置
15
- */
16
- export function initAppConfig(config: {
17
- appId?: string
18
- clientId?: string
19
- apiBaseUrl?: string
20
- }) {
21
- if (config.appId) {
22
- appId.value = config.appId
23
- }
24
- if (config.clientId) {
25
- clientId.value = config.clientId
26
- }
27
- if (config.apiBaseUrl) {
28
- apiBaseUrl.value = config.apiBaseUrl
29
- }
30
- }
31
-
32
- /**
33
- * 获取 AppId
34
- * 优先使用动态配置,其次使用环境变量
35
- */
36
- export function getAppId(): string {
37
- if (appId.value) {
38
- return appId.value
39
- }
40
- // 尝试从环境变量获取(使用方项目构建时会注入)
41
- try {
42
- return import.meta.env.VITE_APP_ID || ''
43
- } catch {
44
- return ''
45
- }
46
- }
47
-
48
- /**
49
- * 获取 ClientId
50
- */
51
- export function getClientId(): string {
52
- if (clientId.value) {
53
- return clientId.value
54
- }
55
- try {
56
- return import.meta.env.VITE_APP_CLIENT_ID || ''
57
- } catch {
58
- return ''
59
- }
60
- }
61
-
62
- /**
63
- * 获取 API 基础路径
64
- */
65
- export function getApiBaseUrl(): string {
66
- if (apiBaseUrl.value) {
67
- return apiBaseUrl.value
68
- }
69
- try {
70
- return import.meta.env.VITE_API_BASE_URL || ''
71
- } catch {
72
- return ''
73
- }
74
- }
75
-
76
- // 导出响应式引用(供特殊场景直接使用)
77
- export const appConfig = {
78
- appId,
79
- clientId,
80
- apiBaseUrl
1
+ /**
2
+ * 应用配置(动态设置,避免 import.meta.env 静态替换)
3
+ */
4
+
5
+ import { ref } from 'vue'
6
+
7
+ // 配置状态
8
+ const appId = ref<string>('')
9
+ const clientId = ref<string>('')
10
+ const apiBaseUrl = ref<string>('')
11
+
12
+ /**
13
+ * 初始化应用配置
14
+ * 在项目入口文件(main.ts)中调用此函数设置配置
15
+ */
16
+ export function initAppConfig(config: {
17
+ appId?: string
18
+ clientId?: string
19
+ apiBaseUrl?: string
20
+ }) {
21
+ if (config.appId) {
22
+ appId.value = config.appId
23
+ }
24
+ if (config.clientId) {
25
+ clientId.value = config.clientId
26
+ }
27
+ if (config.apiBaseUrl) {
28
+ apiBaseUrl.value = config.apiBaseUrl
29
+ }
30
+ }
31
+
32
+ /**
33
+ * 获取 AppId
34
+ * 优先使用动态配置,其次使用环境变量
35
+ */
36
+ export function getAppId(): string {
37
+ if (appId.value) {
38
+ return appId.value
39
+ }
40
+ // 尝试从环境变量获取(使用方项目构建时会注入)
41
+ try {
42
+ return import.meta.env.VITE_APP_ID || ''
43
+ } catch {
44
+ return ''
45
+ }
46
+ }
47
+
48
+ /**
49
+ * 获取 ClientId
50
+ */
51
+ export function getClientId(): string {
52
+ if (clientId.value) {
53
+ return clientId.value
54
+ }
55
+ try {
56
+ return import.meta.env.VITE_APP_CLIENT_ID || ''
57
+ } catch {
58
+ return ''
59
+ }
60
+ }
61
+
62
+ /**
63
+ * 获取 API 基础路径
64
+ */
65
+ export function getApiBaseUrl(): string {
66
+ if (apiBaseUrl.value) {
67
+ return apiBaseUrl.value
68
+ }
69
+ try {
70
+ return import.meta.env.VITE_API_BASE_URL || ''
71
+ } catch {
72
+ return ''
73
+ }
74
+ }
75
+
76
+ // 导出响应式引用(供特殊场景直接使用)
77
+ export const appConfig = {
78
+ appId,
79
+ clientId,
80
+ apiBaseUrl
81
81
  }
@@ -1,33 +1,33 @@
1
- /**
2
- * 权限工具函数
3
- * 注意:tineco-ui 不支持 permissions 和 roles 字段,这些函数暂时返回登录状态
4
- */
5
-
6
- import { useUserStore } from '@/stores/user'
7
-
8
- /**
9
- * 检查是否有权限
10
- * @param _permission 权限标识(暂不使用)
11
- */
12
- export function hasPermission(_permission: string | string[]): boolean {
13
- const userStore = useUserStore()
14
- // tineco-ui 不支持 permissions 字段,暂时返回已登录状态
15
- return userStore.isLoggedIn
16
- }
17
-
18
- /**
19
- * 检查是否有角色
20
- * @param _role 角色标识(暂不使用)
21
- */
22
- export function hasRole(_role: string | string[]): boolean {
23
- const userStore = useUserStore()
24
- // tineco-ui 不支持 roles 字段,暂时返回已登录状态
25
- return userStore.isLoggedIn
26
- }
27
-
28
- /**
29
- * 检查是否是管理员
30
- */
31
- export function isAdmin(): boolean {
32
- return true // tineco-ui 不支持 roles 字段,暂时返回 true
1
+ /**
2
+ * 权限工具函数
3
+ * 注意:tineco-ui 不支持 permissions 和 roles 字段,这些函数暂时返回登录状态
4
+ */
5
+
6
+ import { useUserStore } from '@/stores/user'
7
+
8
+ /**
9
+ * 检查是否有权限
10
+ * @param _permission 权限标识(暂不使用)
11
+ */
12
+ export function hasPermission(_permission: string | string[]): boolean {
13
+ const userStore = useUserStore()
14
+ // tineco-ui 不支持 permissions 字段,暂时返回已登录状态
15
+ return userStore.isLoggedIn
16
+ }
17
+
18
+ /**
19
+ * 检查是否有角色
20
+ * @param _role 角色标识(暂不使用)
21
+ */
22
+ export function hasRole(_role: string | string[]): boolean {
23
+ const userStore = useUserStore()
24
+ // tineco-ui 不支持 roles 字段,暂时返回已登录状态
25
+ return userStore.isLoggedIn
26
+ }
27
+
28
+ /**
29
+ * 检查是否是管理员
30
+ */
31
+ export function isAdmin(): boolean {
32
+ return true // tineco-ui 不支持 roles 字段,暂时返回 true
33
33
  }