zsysview 0.0.17 → 0.0.19

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 (77) hide show
  1. package/README.md +19 -3
  2. package/dist/backup-B_ecXldN.js +519 -0
  3. package/dist/breadcrumb.vue_vue_type_script_setup_true_lang-LiynoCpU.js +43 -0
  4. package/dist/change_password-DdXbDCW3.js +135 -0
  5. package/dist/department-CkeLYapS.js +410 -0
  6. package/dist/desktop-Dlxt_nj4.js +9 -0
  7. package/dist/http_api_v1-C1nimGbM.js +2758 -0
  8. package/dist/index-BaFHeDAF.js +327 -0
  9. package/dist/index-CX41PbES.js +6688 -0
  10. package/dist/index.es-BcGc183Q.js +170 -0
  11. package/dist/log-B4tgzmW2.js +163 -0
  12. package/dist/login-bJhy9URL.js +111 -0
  13. package/dist/main-EI2iFkT9.js +293 -0
  14. package/dist/message-CdVUOGzt.js +26 -0
  15. package/dist/position-CFiI2C0_.js +311 -0
  16. package/dist/role-BD3_T6lz.js +405 -0
  17. package/dist/self-BsJkA8N-.js +102 -0
  18. package/dist/sys-BjlP52cg.js +30 -0
  19. package/dist/user-E4blW7I0.js +650 -0
  20. package/dist/vite.svg +1 -0
  21. package/dist/zsys_delbutton.vue_vue_type_script_setup_true_lang-BUVzkvi0.js +72 -0
  22. package/dist/zsys_eventBus-DDrk0Aw8.js +178 -0
  23. package/dist/zsys_time-DHEMuVgo.js +17 -0
  24. package/dist/zsyslist.vue_vue_type_script_setup_true_lang-CjpC7Ren.js +466 -0
  25. package/dist/zsysview.css +1 -0
  26. package/dist/zsysview.es.js +3 -0
  27. package/package.json +34 -20
  28. package/assets/default_avatar.png +0 -0
  29. package/assets/default_logo.png +0 -0
  30. package/assets/default_logo_40.png +0 -0
  31. package/assets/login_bg.jpg +0 -0
  32. package/components/export/export_dialog.vue +0 -150
  33. package/components/export/export_progress.vue +0 -62
  34. package/components/list/zsyslist.vue +0 -164
  35. package/components/list/zsyslist_content.vue +0 -29
  36. package/components/list/zsyslist_header.vue +0 -62
  37. package/components/message/index.ts +0 -3
  38. package/components/message/message.ts +0 -35
  39. package/components/zsys_delbutton.vue +0 -60
  40. package/core/app.ts +0 -32
  41. package/core/common/common.ts +0 -29
  42. package/core/common/zsys_eventBus.ts +0 -45
  43. package/core/common/zsys_time.ts +0 -26
  44. package/core/httpapi/http_api_return_data.ts +0 -43
  45. package/core/httpapi/http_api_v1.ts +0 -151
  46. package/core/httpapi/http_axios.ts +0 -54
  47. package/core/router copy.ts +0 -148
  48. package/core/router.ts +0 -153
  49. package/core/runtime.ts +0 -14
  50. package/core/user_token.ts +0 -17
  51. package/css/common.css +0 -16
  52. package/css/style.css +0 -79
  53. package/index.ts +0 -0
  54. package/view/app.vue +0 -10
  55. package/view/backup/backup.vue +0 -308
  56. package/view/building.vue +0 -22
  57. package/view/department/department.vue +0 -111
  58. package/view/department/department_edit_dialog.vue +0 -267
  59. package/view/desktop/desktop.vue +0 -11
  60. package/view/log/log.vue +0 -60
  61. package/view/log/log_setting.vue +0 -41
  62. package/view/login.vue +0 -91
  63. package/view/main/breadcrumb.vue +0 -41
  64. package/view/main/main.vue +0 -60
  65. package/view/main/userHeader.vue +0 -73
  66. package/view/main/userMenu.vue +0 -132
  67. package/view/main/userMenuItem.vue +0 -49
  68. package/view/position/position.vue +0 -58
  69. package/view/position/position_edit_dialog.vue +0 -203
  70. package/view/role/role.vue +0 -72
  71. package/view/role/role_edit_dialog.vue +0 -271
  72. package/view/self/change_password.vue +0 -97
  73. package/view/self/self.vue +0 -62
  74. package/view/sys/sys.vue +0 -19
  75. package/view/user/change_user_password_dialog.vue +0 -155
  76. package/view/user/user.vue +0 -110
  77. package/view/user/user_edit_dialog.vue +0 -283
@@ -1,29 +0,0 @@
1
- export class CommonHelper{
2
- //数组中是否存在字符串
3
- static StringArrayHasString(array:string[],str:string):boolean{
4
- return array.indexOf(str) !== -1
5
- }
6
-
7
- //数组中是否存在另一数组中的任意一个元素
8
- static StringArrayHasStringArrayOne(array:string[],array2:string[]):boolean{
9
- for(const s of array2)
10
- {
11
- if(CommonHelper.StringArrayHasString(array,s)){
12
- return true
13
- }
14
- }
15
- return false
16
- }
17
-
18
- //数组2是否包含在数组1中
19
- static StringArrayHasStringArray(array:string[],array2:string[]):boolean{
20
- if(array2.length==0){return false}
21
- for(const s of array2)
22
- {
23
- if(!CommonHelper.StringArrayHasString(array,s)){
24
- return false
25
- }
26
- }
27
- return true
28
- }
29
- }
@@ -1,45 +0,0 @@
1
- // src/utils/eventBus.ts
2
- import mitt, { type Emitter } from 'mitt';
3
-
4
- // 1. 定义所有事件类型
5
- type Events = {
6
- // aud:添加add、修改update、删除del数据事件
7
- 'aud': { module:string, id: bigint };
8
- // 通知事件
9
- // 'notification:show': { message: string; type: 'success' | 'error' | 'warning' };
10
- // 无 payload 的事件
11
- // 'close': void;
12
- // 添加更多事件...
13
- };
14
-
15
- // 2. 创建 emitter 单例
16
- const emitter: Emitter<Events> = mitt<Events>();
17
-
18
- // 3. 导出常用的方法(封装以便统一管理)
19
- export const zsysEventBus = () => {
20
- return {
21
- // 触发事件
22
- emit: emitter.emit,
23
-
24
- // 监听事件
25
- on: emitter.on,
26
-
27
- // 取消监听
28
- off: emitter.off,
29
-
30
- // 一次性监听
31
- once: <T extends keyof Events>(event: T, handler: (payload: Events[T]) => void) => {
32
- const onceHandler = (payload: Events[T]) => {
33
- handler(payload);
34
- emitter.off(event, onceHandler);
35
- };
36
- emitter.on(event, onceHandler);
37
- },
38
-
39
- // 清空所有监听
40
- clearAll: emitter.all.clear
41
- };
42
- };
43
-
44
- // 4. 导出类型
45
- export type EventBus = ReturnType<typeof zsysEventBus>;
@@ -1,26 +0,0 @@
1
- /**
2
- * 格式化日期为 YYYY-MM-DD HH:mm:ss 格式
3
- * @param date 可被Date解析的任何值
4
- * @returns 格式化后的日期字符串
5
- */
6
- export function formatDateTime(date: Date | string | number): string {
7
- if (date == '0001-01-01T00:00:00Z') {
8
- return ''
9
- }
10
-
11
- const d = new Date(date);
12
-
13
- if (isNaN(d.getTime())) {
14
- return ''
15
- }
16
-
17
- return [
18
- d.getFullYear(),
19
- (d.getMonth() + 1).toString().padStart(2, '0'),
20
- d.getDate().toString().padStart(2, '0')
21
- ].join('-') + ' ' + [
22
- d.getHours().toString().padStart(2, '0'),
23
- d.getMinutes().toString().padStart(2, '0'),
24
- d.getSeconds().toString().padStart(2, '0')
25
- ].join(':');
26
- }
@@ -1,43 +0,0 @@
1
- export class HttpApiReturnData{
2
- error_code:number
3
- message:string
4
- data:object
5
-
6
- constructor(){
7
- this.error_code=1
8
- this.message="未知错误"
9
- this.data={}
10
- }
11
-
12
- get IsSuccess():boolean{
13
- return this.error_code==0?true:false
14
- }
15
-
16
- static fromObject(obj: Partial<HttpApiReturnData>): HttpApiReturnData {
17
- const instance = new HttpApiReturnData();
18
- Object.assign(instance, obj);
19
- return instance;
20
- }
21
- }
22
-
23
- // export class ApiV1Res<T>{
24
- // error_code:number
25
- // message:string
26
- // data:object
27
-
28
- // constructor(){
29
- // this.error_code=1
30
- // this.message="未知错误"
31
- // this.data={}
32
- // }
33
-
34
- // get IsSuccess():boolean{
35
- // return this.error_code==0?true:false
36
- // }
37
-
38
- // static fromObject(obj: Partial<HttpApiReturnData>): HttpApiReturnData {
39
- // const instance = new HttpApiReturnData();
40
- // Object.assign(instance, obj);
41
- // return instance;
42
- // }
43
- // }
@@ -1,151 +0,0 @@
1
- // let http_api_v1_url={
2
- // login:'api/login'
3
- // }
4
- const hostUrl = `${window.location.protocol}//${window.location.host}/`;
5
-
6
- // 类型安全声明(防止TS报错)
7
- declare global {
8
- interface Window {
9
- location: Location;
10
- }
11
- }
12
-
13
- import http_axios from "./http_axios"
14
- import { HttpApiReturnData } from "./http_api_return_data"
15
-
16
- export class HttpApiV1 {
17
- //系统基础接口
18
- static api_host = hostUrl//'http://localhost:1788/' //1788
19
- //当前用户
20
- static url_login: string = 'api/login'
21
- static url_usercenter: string = 'api/user_center'
22
- static url_change_password: string = 'api/change_password'
23
- static url_user_permission: string = 'api/user_permission'
24
- //用户管理
25
- static url_user_save: string = 'api/user_save'
26
- static url_user_list: string = 'api/user_list'
27
- static url_user_export: string = 'api/user_export'
28
- static url_user_del: string = 'api/user_del'
29
- static url_user_detail: string = 'api/user_detail'
30
- static url_user_change_pwd: string = 'api/user_change_pwd'
31
- //组织架构
32
- static url_department_save: string = 'api/department_save'
33
- static url_department_list: string = 'api/department_list'
34
- static url_department_del: string = 'api/department_del'
35
- static url_department_detail: string = 'api/department_detail'
36
- //职务
37
- static url_position_list: string = 'api/position_list'
38
- static url_position_detail: string = 'api/position_detail'
39
- static url_position_save: string = 'api/position_save'
40
- static url_position_del: string = 'api/position_del'
41
- //系统日志
42
- static url_syslog_list: string = 'api/syslog_list'
43
- static url_syslog_config_detail: string = 'api/syslog_config_detail'
44
- static url_syslog_config_save: string = 'api/syslog_config_save'
45
- //备份
46
- static url_backup_start: string = 'api/backup_start'
47
- static url_backup_list: string = 'api/backup_list'
48
- static url_backup_del: string = 'api/backup_del'
49
- static url_backup_config_get: string = 'api/backup_config_get'
50
- static url_backup_config_save: string = 'api/backup_config_save'
51
- //权限
52
- static url_syspermission_list: string = 'api/permission_list'
53
- static url_sysrole_list: string = 'api/role_list'
54
- static url_sysrole_del: string = 'api/role_del'
55
- static url_sysrole_save: string = 'api/role_save'
56
- static url_sysrole_detail: string = 'api/role_detail'
57
- //导出
58
- static url_export_detail: string = 'api/export_detail'
59
- static url_export_file: string = 'api/export_file'
60
- // 系统
61
- static url_system_publish: string = 'api/system_publish'
62
-
63
- //应用级接口==========================
64
- //桌面
65
- static url_desktop: string = 'api/desktop'
66
- static url_desktop_config_detail: string = 'api/desktop_config_detail'
67
- static url_desktop_config_save: string = 'api/desktop_config_save'
68
- //数据看板
69
- static url_chart_weekly: string = 'api/chart_weekly'
70
- static url_chart_all: string = 'api/chart_all'
71
- static url_chart_last: string = 'api/chart_last'
72
- //事件
73
- static url_event_list: string = 'api/event_list'
74
- static url_event_detail: string = 'api/event_detail'
75
- static url_event_file: string = 'api/event_file'
76
- static url_event_dispose: string = 'api/event_dispose'
77
- //规则
78
- static url_rule_list: string = 'api/rule_list'
79
- static url_rule_save: string = 'api/rule_save'
80
- static url_rule_del: string = 'api/rule_del'
81
- static url_rule_detail: string = 'api/rule_detail'
82
- //时间模板
83
- static url_time_list: string = 'api/time_list'
84
- static url_time_save: string = 'api/time_save'
85
- static url_time_del: string = 'api/time_del'
86
- static url_time_detail: string = 'api/time_detail'
87
- //区域
88
- static url_area_save: string = 'api/area_save'
89
- static url_area_list: string = 'api/area_list'
90
- static url_area_del: string = 'api/area_del'
91
- static url_area_detail: string = 'api/area_detail'
92
- //设备
93
- static url_equipment_save: string = 'api/equipment_save'
94
- static url_equipment_list: string = 'api/equipment_list'
95
- static url_equipment_detail: string = 'api/equipment_detail'
96
- static url_equipment_del: string = 'api/equipment_del'
97
- //通道画面
98
- static url_channel_save: string = 'api/channel_save'
99
- static url_channel_list: string = 'api/channel_list'
100
- static url_channel_detail: string = 'api/channel_detail'
101
- static url_channel_del: string = 'api/channel_del'
102
-
103
- static GetFullApiUrl(api: string): string {
104
- return this.api_host + api
105
- }
106
-
107
- static async Post(url: string, obj: object): Promise<HttpApiReturnData> {
108
- try {
109
- let res = await http_axios.post(this.api_host + url, obj)
110
- // console.log("请求完毕");
111
-
112
- let re: HttpApiReturnData = HttpApiReturnData.fromObject(res.data)
113
- // let re:HttpApiReturnData=HttpApiReturnData{
114
- // error_code:res.
115
- // }
116
- return re
117
- // if (res.data instanceof HttpApiReturnData) {
118
- // let re: HttpApiReturnData = obj as HttpApiReturnData;
119
- // return re
120
- // }else{
121
- // return Promise.reject('访问服务器失败')
122
- // }
123
- } catch (err) {
124
- console.log(err);
125
-
126
- return Promise.reject('访问服务器失败')
127
- }
128
- // await http_axios.post(url,obj).then(res=>{
129
- // // console.log(res.data.error_code)
130
- // if (res.data instanceof HttpApiReturnData) {
131
- // let re: HttpApiReturnData = obj as HttpApiReturnData;
132
- // return re
133
- // } else {
134
- // return Promise.reject('访问服务器失败')
135
- // // console.error('对象不是Person类型');
136
- // }
137
- // }).catch(err=>{
138
- // return Promise.reject('访问服务器失败')
139
- // })
140
- // // .finally(()=>{
141
-
142
- // // })
143
- // return Promise.reject('访问服务器失败')
144
- }
145
-
146
- // http_axios.interceptors.response.use(res=>{
147
- // return res
148
- // },err=>{
149
- // return Promise.reject(err)
150
- // })
151
- }
@@ -1,54 +0,0 @@
1
- import axios from 'axios'
2
- import {useTokenStore} from '../user_token'
3
- import type { HttpApiReturnData } from './http_api_return_data'
4
- import JSONbig from 'json-bigint';
5
-
6
- const store=useTokenStore()
7
-
8
- // let http_axios=axios
9
- let http_axios=axios.create({
10
- transformResponse: [data => {
11
- try {
12
- // 使用 json-bigint 解析 JSON,它会自动处理大数字
13
- return JSONbig.parse(data);
14
- } catch (error) {
15
- console.error('JSON parse error:', error);
16
- throw error;
17
- }
18
- }],
19
- transformRequest: [data => {
20
- return JSONbig.stringify(data)
21
- }],
22
- // transformRequest: [(data) => {
23
- // return JSON.stringify(data, (_, value) => {
24
- // if (typeof value === 'bigint') {
25
- // return value.toString(); // 自动转换 BigInt
26
- // }
27
- // return value;
28
- // });
29
- // }],
30
- })
31
- // http_axios.defaults.baseURL='http://localhost:1788/'
32
-
33
- http_axios.interceptors.request.use(config=>{
34
- console.log(store.token.value);
35
- config.headers["authorization"]='Bearer '+store.token.value
36
- return config
37
- })
38
-
39
- http_axios.interceptors.response.use(res=>{
40
- //登录信息错误,要求重新登录
41
- let data=res.data as HttpApiReturnData
42
- if(data.error_code==100){
43
- store.saveToken('none')
44
- }
45
- //有token,保存
46
- if (typeof res.headers["authorization"] !== 'undefined'){
47
- store.saveToken(res.headers["authorization"])
48
- }
49
- return res
50
- },err=>{
51
- return Promise.reject(err)
52
- })
53
-
54
- export default http_axios
@@ -1,148 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router/dist/vue-router.ts'//"vue-router"
2
- import { useTokenStore } from "./user_token"
3
-
4
- const routes = [
5
- {
6
- path: "/", //"/main"
7
- redirect: '/main'
8
- // component: () => import("../views/zsys_main/main.vue"),
9
- // meta:{ requiresAuth: true},
10
- },
11
- {
12
- path: "/test", //"/main"
13
- component: () => import("../views/desktop/desktop.vue"),
14
- },
15
- {
16
- path: "/main", //"/main"
17
- component: () => import("../views/zsys_main/main.vue"),
18
- meta: { requiresAuth: true, title: '主界面' },
19
- children: [{
20
- path: "/desktop",//首页
21
- meta: { title: '首页' },
22
- component: () => import("../views/desktop/desktop.vue"),
23
- }, {
24
- path: "/self",//个人中心
25
- meta: { title: '个人中心' },
26
- component: () => import("../views/zsys_main/zsys_self/self.vue"),
27
- },
28
- {
29
- path: "/password",//修改密码
30
- meta: { title: '修改密码' },
31
- component: () => import("../views/zsys_main/zsys_self/change_password.vue"),
32
- },
33
- {
34
- path: "/chart",
35
- meta: { title: '数据看板' },
36
- component: () => import("@/views/chart/chart.vue"),
37
- }, {
38
- path: "/eventgroup/event",
39
- meta: { title: '事件' },
40
- component: () => import("../views/event/event.vue"),
41
- }, {
42
- path: "/eventgroup/event_detail",
43
- meta: { title: '事件详情' },
44
- component: () => import("../views/event/event_detail.vue"),
45
- },
46
- {
47
- path: "/eventgroup",
48
- meta: { title: '事件管理' },
49
- children: [{
50
- path: "/user1",
51
- meta: { title: '数据看板' },
52
- component: () => import("@/views/chart/chart.vue"),
53
- },
54
- {
55
- path: "/eventgroup/event",
56
- meta: { title: '事件' },
57
- component: () => import("../views/event/event.vue"),
58
- }, {
59
- path: "/eventgroup/event_detail",
60
- meta: { title: '事件详情' },
61
- component: () => import("../views/event/event_detail.vue"),
62
- },]
63
- },
64
- {
65
- path: "/engine",
66
- meta: { title: '行为分析引擎' },
67
- component: () => import("../views/engine/engine.vue"),
68
- },
69
- {
70
- path: "/equipment",
71
- meta: { title: '设备管理' },
72
- component: () => import("../views/equipment/equipment.vue"),
73
- },
74
- {
75
- path: "/area",
76
- meta: { title: '区域管理' },
77
- component: () => import("../views/area/area.vue"),
78
- },
79
- {
80
- path: "/sys",//系统管理
81
- meta: { title: '系统管理' },
82
- //component: () => import("../views/zsys_main/zsys_self/self.vue"),
83
- children: [{
84
- path: "/user",
85
- meta: { title: '用户管理' },
86
- component: () => import("../views/zsys_main/zsys/user/user.vue"),
87
- },
88
- {
89
- path: "/department",
90
- meta: { title: '组织架构' },
91
- component: () => import("@/views/zsys_main/zsys/department/department.vue"),
92
- },
93
- {
94
- path: "/position",
95
- meta: { title: '职务' },
96
- component: () => import("../views/zsys_main/zsys/position/position.vue"),
97
- },
98
- {
99
- path: "/role",
100
- meta: { title: '角色权限' },
101
- component: () => import("../views/zsys_main/zsys/role/role.vue"),
102
- },
103
- {
104
- path: "/log",
105
- meta: { title: '日志' },
106
- component: () => import("../views/zsys_main/zsys/log/log.vue"),
107
- },
108
- {
109
- path: "/backup",
110
- meta: { title: '备份' },
111
- component: () => import("../views/zsys_main/zsys/backup/backup.vue"),
112
- },
113
- {
114
- path: "/maintenance",
115
- meta: { title: '维护' },
116
- component: () => import("@/views/zsys_main/zsys/maintenance/maintenance.vue"),
117
- }]
118
- }
119
- ]
120
- },
121
- {
122
- path: "/login",
123
- name: 'login',
124
- component: () => import("../view/login.vue")
125
- }
126
- ]
127
-
128
- const router = createRouter({
129
- history: createWebHistory(),
130
- routes
131
- })
132
-
133
- router.beforeEach((to, _, next) => {
134
- console.log('to', to.fullPath);
135
- if (to.matched.some(r => r.meta?.requiresAuth)) {
136
- let store = useTokenStore()
137
- console.log('store.token.value', store.token.value);
138
- if (!store.token.value || store.token.value == '') {
139
- next({ name: 'login', query: { redirect: to.fullPath } })
140
- } else {
141
- next()
142
- }
143
- } else {
144
- next()
145
- }
146
- })
147
-
148
- export default router
package/core/router.ts DELETED
@@ -1,153 +0,0 @@
1
- import { createRouter, createWebHistory, type Router, type RouteRecordRaw } from "vue-router"
2
- import { useTokenStore } from "./user_token"
3
-
4
- const routes = [
5
- {
6
- path: "/", //"/main"
7
- redirect: '/main'
8
- // component: () => import("../views/zsys_main/main.vue"),
9
- // meta:{ requiresAuth: true},
10
- },
11
- {
12
- path: "/main", //"/main"
13
- component: () => import("../view/main/main.vue"),
14
- meta: { requiresAuth: true, title: '主界面' },
15
- children: [
16
- {
17
- path: "/desktop",
18
- meta: { title: '首页' },
19
- component: () => import("../view/desktop/desktop.vue"),
20
- },
21
- {
22
- path: "/self",//个人中心
23
- meta: { title: '个人中心' },
24
- component: () => import("../view/self/self.vue"),
25
- },
26
- {
27
- path: "/password",//修改密码
28
- meta: { title: '修改密码' },
29
- component: () => import("../view/self/change_password.vue"),
30
- },
31
- {
32
- path: "/sys",//系统管理
33
- meta: { title: '系统管理' },
34
- //component: () => import("../views/zsys_main/zsys_self/self.vue"),
35
- children: [{
36
- path: "/user",
37
- meta: { title: '用户管理' },
38
- component: () => import("../view/user/user.vue"),
39
- },
40
- {
41
- path: "/department",
42
- meta: { title: '组织架构' },
43
- component: () => import("../view/department/department.vue"),
44
- },
45
- {
46
- path: "/position",
47
- meta: { title: '职务' },
48
- component: () => import("../view/position/position.vue"),
49
- },
50
- {
51
- path: "/role",
52
- meta: { title: '角色权限' },
53
- component: () => import("../view/role/role.vue"),
54
- },
55
- {
56
- path: "/log",
57
- meta: { title: '日志' },
58
- component: () => import("../view/log/log.vue"),
59
- },
60
- {
61
- path: "/backup",
62
- meta: { title: '备份' },
63
- component: () => import("../view/backup/backup.vue"),
64
- },
65
- {
66
- path: "/sys",
67
- meta: { title: '系统' },
68
- component: () => import("../view/sys/sys.vue"),
69
- }]
70
- }
71
- ]
72
- },
73
- {
74
- path: "/login",
75
- name: 'login',
76
- component: () => import("../view/login.vue")
77
- }
78
- ] as RouteRecordRaw[]
79
-
80
- const router = createRouter({
81
- history: createWebHistory(),
82
- routes
83
- })
84
-
85
- function addFrameRouter(r: RouteRecordRaw) {
86
- router.addRoute('main', r)
87
- }
88
-
89
- // function addFrameRouter(r: RouteRecordRaw) {
90
- // try {
91
- // // 查找path为"/main"的路由
92
- // const mainRoute = routes.find(route => route.path === "/main");
93
-
94
- // if (!mainRoute) {
95
- // console.error('未找到path为"/main"的路由');
96
- // return
97
- // }
98
-
99
- // // 确保mainRoute有children数组
100
- // if (!mainRoute.children) {
101
- // mainRoute.children = [];
102
- // }
103
-
104
- // // 检查是否已存在相同path的路由
105
- // const existingRouteIndex = mainRoute.children.findIndex(
106
- // child => child.path === r.path
107
- // );
108
-
109
- // if (existingRouteIndex !== -1) {
110
- // // 如果已存在,替换该路由
111
- // mainRoute.children[existingRouteIndex] = r;
112
- // console.log(`已更新路由: ${r.path}`);
113
- // } else {
114
- // // 如果不存在,添加新路由
115
- // mainRoute.children.push(r);
116
- // console.log(`已添加新路由: ${r.path}`);
117
- // }
118
-
119
- // // 重新创建router实例以确保路由更新生效
120
- // // 注意:在实际项目中可能需要更复杂的路由更新逻辑
121
- // // router.addRoute('main', r as RouteRecordRaw);
122
-
123
- // return 1;
124
- // } catch (error) {
125
- // console.error('添加路由失败:', error);
126
- // return 0;
127
- // }
128
- // }
129
-
130
- // function initRouter(): Router {
131
- // return createRouter({
132
- // history: createWebHistory(),
133
- // routes
134
- // })
135
- // }
136
-
137
- router.beforeEach((to, _, next) => {
138
- console.log('to', to.fullPath);
139
- if (to.matched.some(r => r.meta?.requiresAuth)) {
140
- let store = useTokenStore()
141
- console.log('store.token.value', store.token.value);
142
- if (!store.token.value || store.token.value == '') {
143
- next({ name: 'login', query: { redirect: to.fullPath } })
144
- } else {
145
- next()
146
- }
147
- } else {
148
- next()
149
- }
150
- })
151
-
152
- export default router
153
- export { addFrameRouter }
package/core/runtime.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { App } from "vue";
2
- import { HttpApiV1 as http } from "./httpapi/http_api_v1";
3
-
4
- async function GetPublish(app:App){
5
- let res=await http.Post(http.url_system_publish,{})
6
- if(res.IsSuccess){
7
- let data=res.data as {
8
- app_name:string
9
- }
10
- app.config.globalProperties.$appName=data.app_name
11
- }
12
- }
13
-
14
- export {GetPublish}
@@ -1,17 +0,0 @@
1
- import { computed, ref } from "vue";
2
- import { defineStore } from "pinia";
3
-
4
- export const useTokenStore=defineStore("UseToken",()=>{
5
- const token_data=ref("")
6
- const token=computed(()=>{
7
- return token_data
8
- })
9
- function saveToken(data:string){
10
- token_data.value=data
11
- }
12
-
13
- return {token_data,token,saveToken}
14
- },{
15
- // 启用持久化
16
- persist: true,
17
- })