xto-fronted 0.4.1 → 0.4.3

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 (42) hide show
  1. package/dist/api/system.d.ts +1 -1
  2. package/dist/composables/useApp.d.ts +7 -10
  3. package/dist/composables/useAuth.d.ts +0 -3
  4. package/dist/index-C6Nm0r9k.js +475 -0
  5. package/dist/index-C6w0-8xN.js +1648 -0
  6. package/dist/index-D2fQ8TK8.js +475 -0
  7. package/dist/index-D4crnrO6.js +142 -0
  8. package/dist/index-DFXuyPge.js +1627 -0
  9. package/dist/index-Do1CBqg8.js +345 -0
  10. package/dist/index-Jb4VMHIS.js +142 -0
  11. package/dist/index-TrLCW5xL.js +372 -0
  12. package/dist/index-a_ilWAvi.js +345 -0
  13. package/dist/index-sRwZYbZ4.js +372 -0
  14. package/dist/index.es.js +66 -60
  15. package/dist/index.umd.js +1 -1
  16. package/dist/router/dynamicRoutes.d.ts +18 -22
  17. package/dist/router/guards.d.ts +1 -0
  18. package/dist/stores/auth.d.ts +5 -19
  19. package/dist/stores/menu.d.ts +43 -74
  20. package/dist/stores/user.d.ts +63 -84
  21. package/dist/style.css +1 -1
  22. package/dist/utils/auth.d.ts +12 -3
  23. package/dist/utils/permission.d.ts +5 -4
  24. package/package.json +1 -1
  25. package/src/api/auth.ts +4 -4
  26. package/src/api/system.ts +5 -4
  27. package/src/components/Layout/Header.vue +5 -5
  28. package/src/components/Layout/Sidebar.vue +18 -12
  29. package/src/composables/useApp.ts +1 -1
  30. package/src/composables/useAuth.ts +0 -28
  31. package/src/directives/permission.ts +6 -16
  32. package/src/router/dynamicRoutes.ts +31 -31
  33. package/src/router/guards.ts +6 -10
  34. package/src/router/index.ts +7 -9
  35. package/src/stores/auth.ts +4 -4
  36. package/src/stores/menu.ts +19 -50
  37. package/src/stores/user.ts +18 -40
  38. package/src/types/api.d.ts +28 -31
  39. package/src/utils/auth.ts +45 -7
  40. package/src/utils/permission.ts +10 -19
  41. package/src/utils/request.ts +4 -3
  42. package/src/views/login/index.vue +11 -8
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
6
- import { getToken, clearToken } from './auth'
6
+ import { getToken, getTokenType, clearToken } from './auth'
7
7
  import { Message } from '@xto/feedback'
8
8
 
9
9
  // 响应数据接口(Euler 框架 Result 格式)
@@ -39,8 +39,9 @@ const createRequest = (): AxiosInstance => {
39
39
  instance.interceptors.request.use(
40
40
  (config: InternalAxiosRequestConfig) => {
41
41
  const token = getToken()
42
+ const tokenType = getTokenType() || 'Bearer'
42
43
  if (token) {
43
- config.headers.Authorization = `Bearer ${token}`
44
+ config.headers.Authorization = `${tokenType} ${token}`
44
45
  }
45
46
  return config
46
47
  },
@@ -54,7 +55,7 @@ const createRequest = (): AxiosInstance => {
54
55
  (response: AxiosResponse<ApiResponse>) => {
55
56
  const { data } = response
56
57
 
57
- // Euler 框架返回 Result 包装格式,成功时直接返回 data 中的实际数据
58
+ // Euler 框架返回 Result 包装格式,成功时直接返回 data.data 中的实际数据
58
59
  if (data.code === 200 || data.code === 0) {
59
60
  return data.data as any
60
61
  }
@@ -14,12 +14,12 @@ const loading = ref(false)
14
14
  const rememberMe = ref(false)
15
15
 
16
16
  const formData = reactive({
17
- username: 'admin',
18
- password: '123456'
17
+ uid: '',
18
+ password: ''
19
19
  })
20
20
 
21
21
  const rules: Record<string, any[]> = {
22
- username: [
22
+ uid: [
23
23
  { required: true, message: '请输入用户名', trigger: 'blur' }
24
24
  ],
25
25
  password: [
@@ -38,8 +38,11 @@ const handleLogin = async () => {
38
38
 
39
39
  // 调用登录 API
40
40
  const result = await login({
41
- username: formData.username,
42
- password: formData.password
41
+ appId: import.meta.env.VITE_APP_ID,
42
+ clientId: import.meta.env.VITE_APP_CLIENT_ID,
43
+ uid: formData.uid,
44
+ password: formData.password,
45
+ code: true
43
46
  })
44
47
 
45
48
  // 保存 token
@@ -76,9 +79,9 @@ const handleLogin = async () => {
76
79
  class="login__form"
77
80
  label-width="0"
78
81
  >
79
- <FormItem prop="username">
82
+ <FormItem prop="uid">
80
83
  <Input
81
- v-model="formData.username"
84
+ v-model="formData.uid"
82
85
  placeholder="用户名"
83
86
  prefix-icon="👤"
84
87
  size="large"
@@ -115,7 +118,7 @@ const handleLogin = async () => {
115
118
  </Form>
116
119
 
117
120
  <div class="login__footer">
118
- <p>默认账号: admin / 123456</p>
121
+ <p>请输入您的用户名和密码</p>
119
122
  </div>
120
123
  </div>
121
124
  </div>