xto-fronted 0.1.1 → 0.1.2

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 (88) hide show
  1. package/dist/{403-MQkNUulz.js → 403-DM5wfQkM.js} +6 -6
  2. package/dist/{404-BOFYLq4X.js → 404-BurAu5LC.js} +7 -7
  3. package/dist/api/auth.d.ts +9 -8
  4. package/dist/api/menu.d.ts +3 -0
  5. package/dist/api/user.d.ts +2 -12
  6. package/dist/composables/index.d.ts +8 -0
  7. package/dist/composables/useApp.d.ts +64 -0
  8. package/dist/composables/useAuth.d.ts +19 -4
  9. package/dist/composables/useMenu.d.ts +34 -0
  10. package/dist/config/index.d.ts +11 -0
  11. package/dist/index-BNiEld34.js +15 -0
  12. package/dist/index-Be9RiEfo.js +98 -0
  13. package/dist/index-BqRv1bdN.js +1185 -0
  14. package/dist/index-CQLVXvNJ.js +15 -0
  15. package/dist/index-CyiE8n2V.js +15 -0
  16. package/dist/index-xauR1bOL.js +15 -0
  17. package/dist/index.d.ts +7 -4
  18. package/dist/index.es.js +50 -66
  19. package/dist/index.umd.js +1 -1
  20. package/dist/stores/auth.d.ts +60 -23
  21. package/dist/stores/menu.d.ts +40 -29
  22. package/dist/stores/user.d.ts +63 -84
  23. package/dist/style.css +1 -1
  24. package/dist/utils/auth.d.ts +15 -7
  25. package/dist/utils/permission.d.ts +1 -6
  26. package/dist/views/system/menu/index.vue.d.ts +1 -3
  27. package/dist/views/system/role/index.vue.d.ts +1 -3
  28. package/dist/views/system/user/index.vue.d.ts +1 -3
  29. package/package.json +21 -26
  30. package/.env.development +0 -4
  31. package/.env.production +0 -4
  32. package/dist/index-BJxYdNPy.js +0 -475
  33. package/dist/index-BvnIIBR1.js +0 -142
  34. package/dist/index-CEvAq6KE.js +0 -372
  35. package/dist/index-DPkqej__.js +0 -345
  36. package/dist/index-pq9Z5K62.js +0 -184
  37. package/dist/index-vVfjShJR.js +0 -1183
  38. package/index.html +0 -13
  39. package/public/vite.svg +0 -10
  40. package/src/App.vue +0 -20
  41. package/src/api/auth.ts +0 -26
  42. package/src/api/system.ts +0 -65
  43. package/src/api/user.ts +0 -46
  44. package/src/assets/styles/_dark.scss +0 -407
  45. package/src/assets/styles/_reset.scss +0 -126
  46. package/src/assets/styles/_root.scss +0 -140
  47. package/src/assets/styles/_transition.scss +0 -119
  48. package/src/assets/styles/_variables.scss +0 -45
  49. package/src/assets/styles/index.scss +0 -187
  50. package/src/components/Layout/Footer.vue +0 -17
  51. package/src/components/Layout/Header.vue +0 -390
  52. package/src/components/Layout/Sidebar.vue +0 -297
  53. package/src/components/Layout/Tabs.vue +0 -134
  54. package/src/components/Layout/index.vue +0 -62
  55. package/src/composables/useAuth.ts +0 -45
  56. package/src/composables/useForm.ts +0 -79
  57. package/src/composables/useTable.ts +0 -97
  58. package/src/directives/permission.ts +0 -38
  59. package/src/enums/index.ts +0 -63
  60. package/src/env.d.ts +0 -17
  61. package/src/index.ts +0 -39
  62. package/src/main.ts +0 -34
  63. package/src/router/dynamicRoutes.ts +0 -163
  64. package/src/router/index.ts +0 -81
  65. package/src/router/staticRoutes.ts +0 -43
  66. package/src/stores/app.ts +0 -145
  67. package/src/stores/auth.ts +0 -32
  68. package/src/stores/index.ts +0 -15
  69. package/src/stores/menu.ts +0 -80
  70. package/src/stores/user.ts +0 -73
  71. package/src/types/api.d.ts +0 -84
  72. package/src/types/global.d.ts +0 -45
  73. package/src/types/router.d.ts +0 -48
  74. package/src/types/xto.d.ts +0 -149
  75. package/src/utils/auth.ts +0 -62
  76. package/src/utils/permission.ts +0 -42
  77. package/src/utils/request.ts +0 -126
  78. package/src/utils/storage.ts +0 -63
  79. package/src/views/dashboard/index.vue +0 -284
  80. package/src/views/error/403.vue +0 -57
  81. package/src/views/error/404.vue +0 -57
  82. package/src/views/login/index.vue +0 -248
  83. package/src/views/system/menu/index.vue +0 -381
  84. package/src/views/system/role/index.vue +0 -304
  85. package/src/views/system/user/index.vue +0 -327
  86. package/tsconfig.json +0 -26
  87. package/tsconfig.node.json +0 -11
  88. package/vite.config.ts +0 -139
@@ -1,7 +1,7 @@
1
- import { defineComponent as s, openBlock as n, createElementBlock as p, createElementVNode as o, createVNode as d, unref as _, withCtx as a, createTextVNode as i } from "vue";
1
+ import { defineComponent as s, openBlock as n, createElementBlock as p, createElementVNode as o, createVNode as a, unref as d, withCtx as _, createTextVNode as i } from "vue";
2
2
  import { useRouter as m } from "vue-router";
3
- import { Button as c } from "@xto/base";
4
- import { c as l } from "./index-vVfjShJR.js";
3
+ import { Button as l } from "@xto/base";
4
+ import { a as c } from "./index-BqRv1bdN.js";
5
5
  const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /* @__PURE__ */ s({
6
6
  __name: "403",
7
7
  setup(v) {
@@ -13,11 +13,11 @@ const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /*
13
13
  e[1] || (e[1] = o("div", { class: "error-page__code" }, "403", -1)),
14
14
  e[2] || (e[2] = o("div", { class: "error-page__title" }, "无访问权限", -1)),
15
15
  e[3] || (e[3] = o("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
16
- d(_(c), {
16
+ a(d(l), {
17
17
  type: "primary",
18
18
  onClick: t
19
19
  }, {
20
- default: a(() => [...e[0] || (e[0] = [
20
+ default: _(() => [...e[0] || (e[0] = [
21
21
  i("返回首页", -1)
22
22
  ])]),
23
23
  _: 1
@@ -25,7 +25,7 @@ const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /*
25
25
  ])
26
26
  ]));
27
27
  }
28
- }), V = /* @__PURE__ */ l(g, [["__scopeId", "data-v-f6105e3d"]]);
28
+ }), V = /* @__PURE__ */ c(g, [["__scopeId", "data-v-f6105e3d"]]);
29
29
  export {
30
30
  V as default
31
31
  };
@@ -1,19 +1,19 @@
1
- import { defineComponent as s, openBlock as n, createElementBlock as p, createElementVNode as o, createVNode as a, unref as _, withCtx as d, createTextVNode as i } from "vue";
2
- import { useRouter as c } from "vue-router";
3
- import { Button as m } from "@xto/base";
4
- import { c as l } from "./index-vVfjShJR.js";
1
+ import { defineComponent as s, openBlock as n, createElementBlock as a, createElementVNode as o, createVNode as p, unref as _, withCtx as d, createTextVNode as i } from "vue";
2
+ import { useRouter as m } from "vue-router";
3
+ import { Button as c } from "@xto/base";
4
+ import { a as l } from "./index-BqRv1bdN.js";
5
5
  const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /* @__PURE__ */ s({
6
6
  __name: "404",
7
7
  setup(v) {
8
- const r = c(), t = () => {
8
+ const r = m(), t = () => {
9
9
  r.push("/");
10
10
  };
11
- return (x, e) => (n(), p("div", f, [
11
+ return (x, e) => (n(), a("div", f, [
12
12
  o("div", u, [
13
13
  e[1] || (e[1] = o("div", { class: "error-page__code" }, "404", -1)),
14
14
  e[2] || (e[2] = o("div", { class: "error-page__title" }, "页面不存在", -1)),
15
15
  e[3] || (e[3] = o("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
16
- a(_(m), {
16
+ p(_(c), {
17
17
  type: "primary",
18
18
  onClick: t
19
19
  }, {
@@ -1,8 +1,9 @@
1
- import { LoginParams, LoginResult, UserInfo } from '../types/api';
2
- export declare function login(data: LoginParams): Promise<import('../utils/request').ApiResponse<LoginResult>>;
3
- export declare function logout(): Promise<import('../utils/request').ApiResponse<unknown>>;
4
- export declare function getUserInfo(): Promise<import('../utils/request').ApiResponse<UserInfo>>;
5
- export declare function refreshToken(refreshToken: string): Promise<import('../utils/request').ApiResponse<{
6
- token: string;
7
- expireTime: number;
8
- }>>;
1
+ import { ApiResponse } from '../utils/request';
2
+ import { LoginResult } from '../types/api';
3
+ export interface LoginParams {
4
+ uid: string;
5
+ password: string;
6
+ }
7
+ export declare function login(data: LoginParams): Promise<ApiResponse<LoginResult>>;
8
+ export declare function logout(): Promise<ApiResponse<null>>;
9
+ export declare function loginByCode(appId: string, code: string): Promise<ApiResponse<LoginResult>>;
@@ -0,0 +1,3 @@
1
+ import { ApiResponse } from '../utils/request';
2
+ import { RemoteMenuItem } from '../types/api';
3
+ export declare function getUserMenu(): Promise<ApiResponse<RemoteMenuItem[]>>;
@@ -1,13 +1,3 @@
1
- import { PageParams, PageResponse } from '../utils/request';
1
+ import { ApiResponse } from '../utils/request';
2
2
  import { UserInfo } from '../types/api';
3
- export declare function getUserList(params: PageParams & {
4
- status?: number;
5
- keyword?: string;
6
- }): Promise<import('../utils/request').ApiResponse<PageResponse<UserInfo>>>;
7
- export declare function getUserDetail(id: string | number): Promise<import('../utils/request').ApiResponse<UserInfo>>;
8
- export declare function createUser(data: Partial<UserInfo>): Promise<import('../utils/request').ApiResponse<UserInfo>>;
9
- export declare function updateUser(id: string | number, data: Partial<UserInfo>): Promise<import('../utils/request').ApiResponse<UserInfo>>;
10
- export declare function deleteUser(id: string | number): Promise<import('../utils/request').ApiResponse<unknown>>;
11
- export declare function batchDeleteUsers(ids: (string | number)[]): Promise<import('../utils/request').ApiResponse<unknown>>;
12
- export declare function updateUserStatus(id: string | number, status: number): Promise<import('../utils/request').ApiResponse<unknown>>;
13
- export declare function resetPassword(id: string | number): Promise<import('../utils/request').ApiResponse<unknown>>;
3
+ export declare function getCurrentUser(): Promise<ApiResponse<UserInfo>>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Composables 统一导出
3
+ */
4
+ export { useApp } from './useApp';
5
+ export { useAuth } from './useAuth';
6
+ export { useMenu } from './useMenu';
7
+ export { useForm } from './useForm';
8
+ export { useTable } from './useTable';
@@ -0,0 +1,64 @@
1
+ import { UserInfo, LoginResult } from '../types/api';
2
+ export declare function useApp(): {
3
+ loading: import('vue').Ref<boolean, boolean>;
4
+ isLoggedIn: import('vue').ComputedRef<boolean>;
5
+ userInfo: import('vue').ComputedRef<{
6
+ uId: string;
7
+ appId: string;
8
+ userId: string;
9
+ userName: string;
10
+ departmentName?: string | undefined;
11
+ email?: string | undefined;
12
+ mobilePhone?: string | undefined;
13
+ positionName?: string | undefined;
14
+ avatar?: string | undefined;
15
+ workNo?: string | undefined;
16
+ } | null>;
17
+ userName: import('vue').ComputedRef<string>;
18
+ menuList: import('vue').ComputedRef<{
19
+ code: string;
20
+ name: string;
21
+ path: string;
22
+ component?: string | undefined;
23
+ redirect?: string | undefined;
24
+ icon?: string | undefined;
25
+ title: string;
26
+ hidden?: boolean | undefined;
27
+ keepAlive?: boolean | undefined;
28
+ affix?: boolean | undefined;
29
+ default?: boolean | undefined;
30
+ out?: boolean | undefined;
31
+ closable?: boolean | undefined;
32
+ children?: /*elided*/ any[] | undefined;
33
+ }[]>;
34
+ indexPath: import('vue').ComputedRef<string>;
35
+ login: (uid: string, password: string) => Promise<{
36
+ success: boolean;
37
+ data: LoginResult;
38
+ error?: undefined;
39
+ } | {
40
+ success: boolean;
41
+ error: any;
42
+ data?: undefined;
43
+ }>;
44
+ logout: (showMessage?: boolean) => Promise<void>;
45
+ loadUserInfo: () => Promise<UserInfo>;
46
+ loadMenu: () => Promise<{
47
+ code: string;
48
+ name: string;
49
+ path: string;
50
+ component?: string | undefined;
51
+ redirect?: string | undefined;
52
+ icon?: string | undefined;
53
+ title: string;
54
+ hidden?: boolean | undefined;
55
+ keepAlive?: boolean | undefined;
56
+ affix?: boolean | undefined;
57
+ default?: boolean | undefined;
58
+ out?: boolean | undefined;
59
+ closable?: boolean | undefined;
60
+ children?: /*elided*/ any[] | undefined;
61
+ }[]>;
62
+ initApp: () => Promise<boolean>;
63
+ clearAllState: () => void;
64
+ };
@@ -1,9 +1,24 @@
1
1
  /**
2
- * 权限组合函数
2
+ * 权限 Hook
3
+ * 封装权限检查、按钮权限等逻辑
3
4
  */
4
5
  export declare function useAuth(): {
5
- hasPermission: (permission: string | string[]) => boolean;
6
- hasRole: (role: string | string[]) => boolean;
7
- isAdmin: import('vue').ComputedRef<boolean>;
8
6
  isLoggedIn: import('vue').ComputedRef<boolean>;
7
+ userName: import('vue').ComputedRef<string>;
8
+ userInfo: import('vue').ComputedRef<{
9
+ uId: string;
10
+ appId: string;
11
+ userId: string;
12
+ userName: string;
13
+ departmentName?: string | undefined;
14
+ email?: string | undefined;
15
+ mobilePhone?: string | undefined;
16
+ positionName?: string | undefined;
17
+ avatar?: string | undefined;
18
+ workNo?: string | undefined;
19
+ } | null>;
20
+ hasPermission: (permission: string | string[]) => boolean;
21
+ hasAnyPermission: (permissions: string[]) => boolean;
22
+ hasAllPermissions: (permissions: string[]) => boolean;
23
+ getCurrentPagePermissions: () => string[];
9
24
  };
@@ -0,0 +1,34 @@
1
+ import { MenuItem } from '../types/api';
2
+ export declare function useMenu(iconMap?: Record<string, string>): {
3
+ searchKeyword: import('vue').Ref<string, string>;
4
+ activeMenu: import('vue').ComputedRef<string>;
5
+ isCollapsed: import('vue').ComputedRef<boolean>;
6
+ menuList: import('vue').ComputedRef<{
7
+ code: string;
8
+ name: string;
9
+ path: string;
10
+ component?: string | undefined;
11
+ redirect?: string | undefined;
12
+ icon?: string | undefined;
13
+ title: string;
14
+ hidden?: boolean | undefined;
15
+ keepAlive?: boolean | undefined;
16
+ affix?: boolean | undefined;
17
+ default?: boolean | undefined;
18
+ out?: boolean | undefined;
19
+ closable?: boolean | undefined;
20
+ children?: /*elided*/ any[] | undefined;
21
+ }[]>;
22
+ hasMenu: import('vue').ComputedRef<boolean>;
23
+ searchResults: import('vue').ComputedRef<(MenuItem & {
24
+ parentTitle: string;
25
+ })[]>;
26
+ filteredMenuList: import('vue').ComputedRef<MenuItem[]>;
27
+ flattenMenus: (menus: MenuItem[], parentTitle?: string) => (MenuItem & {
28
+ parentTitle: string;
29
+ })[];
30
+ getMenuIcon: (icon?: string) => string;
31
+ handleMenuSelect: (index: string) => void;
32
+ handleSearchItemClick: (path: string) => void;
33
+ clearSearch: () => void;
34
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 应用配置
3
+ */
4
+ export interface AppConfig {
5
+ webTitle: string;
6
+ baseUrl: string;
7
+ appId: string;
8
+ clientId: string;
9
+ }
10
+ declare const config: AppConfig;
11
+ export default config;
@@ -0,0 +1,15 @@
1
+ import { openBlock as t, createElementBlock as c, createElementVNode as e } from "vue";
2
+ import { a as n } from "./index-BqRv1bdN.js";
3
+ const r = {}, s = { class: "page" };
4
+ function a(l, o) {
5
+ return t(), c("div", s, [...o[0] || (o[0] = [
6
+ e("div", { class: "page__placeholder" }, [
7
+ e("h2", null, "角色管理"),
8
+ e("p", null, "功能开发中...")
9
+ ], -1)
10
+ ])]);
11
+ }
12
+ const p = /* @__PURE__ */ n(r, [["render", a], ["__scopeId", "data-v-0802c3db"]]);
13
+ export {
14
+ p as default
15
+ };
@@ -0,0 +1,98 @@
1
+ import { defineComponent as c, reactive as f, ref as w, openBlock as y, createElementBlock as V, createElementVNode as s, createVNode as l, unref as o, withCtx as t, withKeys as b, createTextVNode as v } from "vue";
2
+ import { u as x, _ as h, a as k } from "./index-BqRv1bdN.js";
3
+ import { Button as z } from "@xto/base";
4
+ import { Form as B, FormItem as i, Input as p } from "@xto/form";
5
+ import "vue-router";
6
+ const C = { class: "login" }, I = { class: "login__container" }, N = /* @__PURE__ */ c({
7
+ __name: "index",
8
+ setup(q) {
9
+ const { login: m, loading: _ } = x(), r = f({
10
+ uid: "",
11
+ password: ""
12
+ }), g = {
13
+ uid: [
14
+ { required: !0, message: "请输入账号", trigger: "blur" }
15
+ ],
16
+ password: [
17
+ { required: !0, message: "请输入密码", trigger: "blur" }
18
+ ]
19
+ }, n = w(), u = async () => {
20
+ var a;
21
+ try {
22
+ await ((a = n.value) == null ? void 0 : a.validate()), await m(r.uid, r.password);
23
+ } catch (e) {
24
+ console.error("登录失败", e);
25
+ }
26
+ };
27
+ return (a, e) => (y(), V("div", C, [
28
+ s("div", I, [
29
+ e[3] || (e[3] = s("div", { class: "login__header" }, [
30
+ s("img", {
31
+ src: h,
32
+ alt: "Logo",
33
+ class: "login__logo"
34
+ }),
35
+ s("h1", { class: "login__title" }, "Analysis Web"),
36
+ s("p", { class: "login__subtitle" }, "后台管理系统")
37
+ ], -1)),
38
+ l(o(B), {
39
+ ref_key: "formRef",
40
+ ref: n,
41
+ model: r,
42
+ rules: g,
43
+ class: "login__form",
44
+ "label-width": "0"
45
+ }, {
46
+ default: t(() => [
47
+ l(o(i), { prop: "uid" }, {
48
+ default: t(() => [
49
+ l(o(p), {
50
+ modelValue: r.uid,
51
+ "onUpdate:modelValue": e[0] || (e[0] = (d) => r.uid = d),
52
+ placeholder: "请输入账号",
53
+ size: "large"
54
+ }, null, 8, ["modelValue"])
55
+ ]),
56
+ _: 1
57
+ }),
58
+ l(o(i), { prop: "password" }, {
59
+ default: t(() => [
60
+ l(o(p), {
61
+ modelValue: r.password,
62
+ "onUpdate:modelValue": e[1] || (e[1] = (d) => r.password = d),
63
+ type: "password",
64
+ placeholder: "请输入密码",
65
+ size: "large",
66
+ "show-password": "",
67
+ onKeyup: b(u, ["enter"])
68
+ }, null, 8, ["modelValue"])
69
+ ]),
70
+ _: 1
71
+ }),
72
+ l(o(i), null, {
73
+ default: t(() => [
74
+ l(o(z), {
75
+ type: "primary",
76
+ size: "large",
77
+ loading: o(_),
78
+ class: "login__submit",
79
+ onClick: u
80
+ }, {
81
+ default: t(() => [...e[2] || (e[2] = [
82
+ v(" 登录 ", -1)
83
+ ])]),
84
+ _: 1
85
+ }, 8, ["loading"])
86
+ ]),
87
+ _: 1
88
+ })
89
+ ]),
90
+ _: 1
91
+ }, 8, ["model"])
92
+ ])
93
+ ]));
94
+ }
95
+ }), R = /* @__PURE__ */ k(N, [["__scopeId", "data-v-728dba9d"]]);
96
+ export {
97
+ R as default
98
+ };