@deppon/create-deppon-app 2.4.12 → 2.4.15
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.
package/deppon.js
CHANGED
|
@@ -333,7 +333,7 @@ async function mergeDepponSkillsIntoProject(root) {
|
|
|
333
333
|
if (!fs.existsSync(pkgPath)) return;
|
|
334
334
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
335
335
|
pkg.devDependencies = pkg.devDependencies || {};
|
|
336
|
-
const skillsVersion = await getPackageVersion('@deppon/deppon-skills', '^2.4.
|
|
336
|
+
const skillsVersion = await getPackageVersion('@deppon/deppon-skills', '^2.4.12');
|
|
337
337
|
pkg.devDependencies['@deppon/deppon-skills'] = skillsVersion;
|
|
338
338
|
delete pkg.devDependencies['deppon-skills'];
|
|
339
339
|
pkg.scripts = pkg.scripts || {};
|
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.15",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "deppon-skills-install",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"format": "prettier --write **/*.{js,ts,vue} && eslint . --ext js,ts,vue --fix"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@deppon/deppon-assets": "^2.4.
|
|
21
|
-
"@deppon/deppon-auth": "^2.4.
|
|
22
|
-
"@deppon/deppon-pinia": "^2.4.
|
|
23
|
-
"@deppon/deppon-request": "^2.4.
|
|
24
|
-
"@deppon/deppon-router": "^2.4.
|
|
25
|
-
"@deppon/deppon-template": "^2.4.
|
|
26
|
-
"@deppon/deppon-ui": "^2.4.
|
|
27
|
-
"@deppon/deppon-utils": "^2.4.
|
|
20
|
+
"@deppon/deppon-assets": "^2.4.15",
|
|
21
|
+
"@deppon/deppon-auth": "^2.4.15",
|
|
22
|
+
"@deppon/deppon-pinia": "^2.4.15",
|
|
23
|
+
"@deppon/deppon-request": "^2.4.15",
|
|
24
|
+
"@deppon/deppon-router": "^2.4.15",
|
|
25
|
+
"@deppon/deppon-template": "^2.4.15",
|
|
26
|
+
"@deppon/deppon-ui": "^2.4.15",
|
|
27
|
+
"@deppon/deppon-utils": "^2.4.15",
|
|
28
28
|
"dayjs": "^1.11.19",
|
|
29
29
|
"echarts": "^6.0.0",
|
|
30
30
|
"element-plus": "^2.11.7",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"vue": "^3.5.24"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@deppon/deppon-skills": "^2.4.
|
|
39
|
-
"@deppon/deppon-eslint-config": "^2.4.
|
|
38
|
+
"@deppon/deppon-skills": "^2.4.15",
|
|
39
|
+
"@deppon/deppon-eslint-config": "^2.4.15",
|
|
40
40
|
"@types/node": "^24.10.1",
|
|
41
41
|
"@types/nprogress": "^0.2.3",
|
|
42
42
|
"@vitejs/plugin-legacy": "^5.4.0",
|
|
@@ -169,6 +169,7 @@ const userStore = useUserStore();
|
|
|
169
169
|
const route = useRoute();
|
|
170
170
|
const router = useRouter();
|
|
171
171
|
const collapsed = ref(false);
|
|
172
|
+
const HOME_PATH = '/home';
|
|
172
173
|
|
|
173
174
|
/** 头像占位文字:取姓名首字,最多 2 字 */
|
|
174
175
|
const avatarText = computed(() => {
|
|
@@ -190,20 +191,24 @@ function handleLogout() {
|
|
|
190
191
|
router.push('/');
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
// 初始化 menu store,传入 commonMenusMax
|
|
194
|
+
// 初始化 menu store,传入 commonMenusMax
|
|
194
195
|
onMounted(() => {
|
|
195
196
|
menuStore.init(props.commonMenusMax);
|
|
196
|
-
|
|
197
|
+
if (route.path === '/') {
|
|
198
|
+
router.replace(HOME_PATH);
|
|
199
|
+
}
|
|
197
200
|
});
|
|
198
201
|
|
|
199
202
|
// 监听路由变化,记录访问历史
|
|
200
203
|
watch(
|
|
201
204
|
() => route.path,
|
|
202
205
|
newPath => {
|
|
206
|
+
if (newPath === HOME_PATH) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
203
209
|
const routeMeta = route.meta as { title?: string } | undefined;
|
|
204
210
|
const title = (routeMeta?.title as string) || route.name?.toString() || newPath;
|
|
205
211
|
menuStore.addRouteToHistory(newPath, title);
|
|
206
|
-
userStore.fetchUserInfoByCode();
|
|
207
212
|
},
|
|
208
213
|
{ immediate: true },
|
|
209
214
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineStore } from '@deppon/deppon-pinia';
|
|
2
|
-
import { findUserByCode } from '@/api/user';
|
|
3
2
|
|
|
4
3
|
export interface UserProfile {
|
|
5
4
|
userName?: string;
|
|
@@ -31,6 +30,7 @@ export interface UserProfile {
|
|
|
31
30
|
export interface AuthState {
|
|
32
31
|
profile: UserProfile | null;
|
|
33
32
|
token: string;
|
|
33
|
+
useLayoutEnabled: boolean;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface AuthPayload {
|
|
@@ -40,6 +40,8 @@ export interface AuthPayload {
|
|
|
40
40
|
|
|
41
41
|
const PROFILE_STORAGE_KEY = 'deppon-user-profile';
|
|
42
42
|
const TOKEN_STORAGE_KEY = 'deppon-auth-token';
|
|
43
|
+
const USE_LAYOUT_STORAGE_KEY = 'deppon-use-layout-enabled';
|
|
44
|
+
const DEFAULT_USE_LAYOUT = false;
|
|
43
45
|
|
|
44
46
|
const readProfileFromCache = (): UserProfile | null => {
|
|
45
47
|
if (typeof window === 'undefined') {
|
|
@@ -65,6 +67,16 @@ const readTokenFromCache = (): string => {
|
|
|
65
67
|
return window.localStorage.getItem(TOKEN_STORAGE_KEY) ?? '';
|
|
66
68
|
};
|
|
67
69
|
|
|
70
|
+
export const readUseLayoutEnabledFromCache = (): boolean => {
|
|
71
|
+
if (typeof window === 'undefined') {
|
|
72
|
+
return DEFAULT_USE_LAYOUT;
|
|
73
|
+
}
|
|
74
|
+
const cached = String(window.localStorage.getItem(USE_LAYOUT_STORAGE_KEY) ?? '').trim();
|
|
75
|
+
if (cached === '1') return true;
|
|
76
|
+
if (cached === '0') return false;
|
|
77
|
+
return DEFAULT_USE_LAYOUT;
|
|
78
|
+
};
|
|
79
|
+
|
|
68
80
|
const persistProfile = (profile: UserProfile | null) => {
|
|
69
81
|
if (typeof window === 'undefined') {
|
|
70
82
|
return;
|
|
@@ -87,10 +99,18 @@ const persistToken = (token: string | null) => {
|
|
|
87
99
|
}
|
|
88
100
|
};
|
|
89
101
|
|
|
102
|
+
const persistUseLayoutEnabled = (enabled: boolean) => {
|
|
103
|
+
if (typeof window === 'undefined') {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
window.localStorage.setItem(USE_LAYOUT_STORAGE_KEY, enabled ? '1' : '0');
|
|
107
|
+
};
|
|
108
|
+
|
|
90
109
|
export const useUserStore = defineStore('user', {
|
|
91
110
|
state: (): AuthState => ({
|
|
92
111
|
profile: readProfileFromCache(),
|
|
93
112
|
token: readTokenFromCache(),
|
|
113
|
+
useLayoutEnabled: readUseLayoutEnabledFromCache(),
|
|
94
114
|
}),
|
|
95
115
|
getters: {
|
|
96
116
|
displayName: state =>
|
|
@@ -104,42 +124,13 @@ export const useUserStore = defineStore('user', {
|
|
|
104
124
|
persistProfile(payload.profile);
|
|
105
125
|
persistToken(payload.token);
|
|
106
126
|
},
|
|
127
|
+
setUseLayoutEnabled(enabled: boolean) {
|
|
128
|
+
this.useLayoutEnabled = !!enabled;
|
|
129
|
+
persistUseLayoutEnabled(!!enabled);
|
|
130
|
+
},
|
|
107
131
|
clearAuth() {
|
|
108
132
|
this.setAuth({ profile: null, token: null });
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 根据当前 profile.userCode(empCode)请求 UAP 用户信息并更新 profile
|
|
112
|
-
*/
|
|
113
|
-
async fetchUserInfoByCode() {
|
|
114
|
-
const empCode = this.profile?.userCode;
|
|
115
|
-
if (!empCode) return;
|
|
116
|
-
try {
|
|
117
|
-
const res = await findUserByCode(empCode);
|
|
118
|
-
if (res?.status === 'SUCCESS' && res?.body) {
|
|
119
|
-
const body = res.body;
|
|
120
|
-
const prev = this.profile ?? {};
|
|
121
|
-
this.profile = {
|
|
122
|
-
...prev,
|
|
123
|
-
userCode: body.empCode ?? prev.userCode,
|
|
124
|
-
userName: body.empName ?? prev.userName,
|
|
125
|
-
deptCode: body.deptCode ?? prev.deptCode,
|
|
126
|
-
deptName: body.deptName ?? prev.deptName,
|
|
127
|
-
crowdCode: body.crowdCode ?? prev.crowdCode,
|
|
128
|
-
crowdName: body.crowdName ?? prev.crowdName,
|
|
129
|
-
currentTime: body.currentTime ?? prev.currentTime,
|
|
130
|
-
deptStandCode: body.deptStandCode ?? prev.deptStandCode,
|
|
131
|
-
deptStandName: body.deptStandName ?? prev.deptStandName,
|
|
132
|
-
jobCode: body.jobCode ?? prev.jobCode,
|
|
133
|
-
position: body.position ?? prev.position,
|
|
134
|
-
gender: body.gender ?? prev.gender,
|
|
135
|
-
status: body.status ?? prev.status,
|
|
136
|
-
id: body.id ?? prev.id,
|
|
137
|
-
} as UserProfile;
|
|
138
|
-
persistProfile(this.profile);
|
|
139
|
-
}
|
|
140
|
-
} catch (e) {
|
|
141
|
-
console.warn('[user] findUserByCode 失败', e);
|
|
142
|
-
}
|
|
133
|
+
this.setUseLayoutEnabled(DEFAULT_USE_LAYOUT);
|
|
143
134
|
},
|
|
144
135
|
},
|
|
145
136
|
});
|
|
@@ -4,26 +4,4 @@
|
|
|
4
4
|
// Element Plus 样式(deppon-ui 基于 element-plus,需要先导入)
|
|
5
5
|
import 'element-plus/dist/index.css';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import '@deppon/deppon-template/es/styles/index.less';
|
|
9
|
-
|
|
10
|
-
// deppon-template 组件样式(按需导入)
|
|
11
|
-
// ProLayout 样式
|
|
12
|
-
import '@deppon/deppon-template/es/pro-layout/ProLayout.vue.less';
|
|
13
|
-
|
|
14
|
-
// ProTable 样式(包含子组件样式)
|
|
15
|
-
import '@deppon/deppon-template/es/pro-table/ProTable.vue.less';
|
|
16
|
-
import '@deppon/deppon-template/es/pro-table/ProTableColumn.vue.less';
|
|
17
|
-
import '@deppon/deppon-template/es/pro-table/ProTableActionSlotWrapper.vue.less';
|
|
18
|
-
|
|
19
|
-
// ProForm 样式
|
|
20
|
-
import '@deppon/deppon-template/es/pro-form/ProForm.vue.less';
|
|
21
|
-
|
|
22
|
-
// ProDialog 样式
|
|
23
|
-
import '@deppon/deppon-template/es/pro-dialog/ProDialog.vue.less';
|
|
24
|
-
|
|
25
|
-
// ProField 样式(包含子组件样式)
|
|
26
|
-
import '@deppon/deppon-template/es/pro-field/ProField.vue.less';
|
|
27
|
-
import '@deppon/deppon-template/es/pro-field/components/Select/FieldSelect.vue.less';
|
|
28
|
-
import '@deppon/deppon-template/es/pro-field/components/Text/FieldText.vue.less';
|
|
29
|
-
|
|
7
|
+
import '@deppon/deppon-assets/dist/css/fonts.css';
|