@utogether/udp-core 2.0.0-beta.24 → 2.0.0-beta.26
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/dist/403-D6Wb3JJh.js +72 -0
- package/dist/404-B_HNbPNV.js +72 -0
- package/dist/500-BMemTTy1.js +77 -0
- package/dist/AuthorityInfo-6wHxwiFM.js +91 -0
- package/dist/AuthorityPanel-OqF_DvXA.js +98 -0
- package/dist/Company-BLXSfow0.js +21 -0
- package/dist/CompanyPanel-B4kRZ5Cg.js +199 -0
- package/dist/DataSet-CuGZcKC-.js +141 -0
- package/dist/Department-oFhsa7cd.js +21 -0
- package/dist/DepartmentPanel-B1UGpu-r.js +242 -0
- package/dist/DepartmentPanel-BL58AdoT.js +2 -0
- package/dist/DesignPanel-DmkFVw1N.js +1196 -0
- package/dist/DictView-CC5yMzOq.js +100 -0
- package/dist/File-WJXjGYxr.js +89 -0
- package/dist/InvOrganization-BwMmD8Ua.js +76 -0
- package/dist/Org-HgnOWubi.js +76 -0
- package/dist/Preview-CAzWxLmP.js +45 -0
- package/dist/ReIcon-DecitXmg.js +413 -0
- package/dist/ReportDefine-BgLM-Rjk.js +10 -0
- package/dist/ReportDesign-DwchGG2P.js +158 -0
- package/dist/ReportQuery-D5jaRJEn.js +101 -0
- package/dist/ReportQueryFrom-CNlmtYey.js +198 -0
- package/dist/ReportTemplate-CNcTmccs.js +162 -0
- package/dist/Role-Be8WfdCA.js +21 -0
- package/dist/RoleAssign-CtehGAUf.js +22 -0
- package/dist/RolePanel-CAwITg_q.js +131 -0
- package/dist/RolePanel-SN0FGFZ7.js +176 -0
- package/dist/ScrollPanel-DW30pGz1.js +88 -0
- package/dist/Staff-V2YsNKcj.js +22 -0
- package/dist/StaffInfo-CKRPW0r4.js +149 -0
- package/dist/StaffPanel-BxcgMg7u.js +143 -0
- package/dist/SysUser-Dxyj5w5m.js +12 -0
- package/dist/SysUserPanel-DI6CWcZo.js +365 -0
- package/dist/SystemMenu-BBHREM8T.js +154 -0
- package/dist/UserInfo-BMVQ0xwE.js +194 -0
- package/dist/_plugin-vue_export-helper-C6QCLu9I.js +8 -0
- package/dist/api-BFNxcxSN.js +30 -0
- package/dist/authority-BJFEUdrh.js +20 -0
- package/dist/await-to-js.es5-DkWYmPXW.js +10 -0
- package/dist/childView-BBjPEraB.js +184 -0
- package/dist/childView-DNqG2UVm.js +181 -0
- package/dist/code-rule-QFrhqFrW.js +151 -0
- package/dist/contant-Q77dU_V3.js +4 -0
- package/dist/core.es.js +6 -23
- package/dist/cron-task-BpUDKEAU.js +131 -0
- package/dist/flow-task-DAc2NrDU.js +11 -0
- package/dist/frameView-Di0zJZUR.js +39 -0
- package/dist/img/v_img.svg +1 -1
- package/dist/layout-home-BVp7vYLR.js +239 -0
- package/dist/layoutView-B6Mx2ERA.js +2662 -0
- package/dist/log-in-BrNB0mLz.js +117 -0
- package/dist/log-out-dYfqvzy6.js +111 -0
- package/dist/login-D_Hjy3Jd.js +231 -0
- package/dist/login-log-CJak-ANA.js +79 -0
- package/dist/lov-view-DM5Nm5tW.js +95 -0
- package/dist/menuInfo-BlOY1KZW.js +346 -0
- package/dist/mitt-CQgI7DYU.js +27 -0
- package/dist/pda-app-CA7YI37u.js +589 -0
- package/dist/redirect-N0k4tImU.js +16 -0
- package/dist/resource-CfQTHFcs.js +94 -0
- package/dist/su-welcome-DVD3S_du.js +799 -0
- package/dist/sys-config-Ddb3vBpK.js +316 -0
- package/dist/system-Cm3lyBas.js +1528 -0
- package/dist/udp-core-DaQd5CF1.js +2028 -0
- package/dist/udp-core.css +2 -1
- package/dist/useDataThemeChange-DJ4K3VGp.js +226 -0
- package/dist/useNav-BhOJIdrJ.js +106 -0
- package/dist/utogether-l7JXs4Lv.js +4 -0
- package/dist/water-mark-WDQZ9YqB.js +119 -0
- package/dist/wecom-push-kWkAVRCj.js +77 -0
- package/package.json +1 -1
- package/src/App.vue +5 -0
- package/src/api/index.ts +51 -51
- package/src/components/udp/grid/index.vue +9 -11
- package/src/components/udp/index.ts +9 -8
- package/src/components/udp/lov/index.vue +430 -0
- package/src/components/udp/upload/index.vue +444 -444
- package/src/components/udp/utils.ts +420 -414
- package/src/main.ts +4 -6
- package/src/plugins/vxe-table/index.ts +1 -1
- package/src/plugins/vxe-table/render.tsx +999 -998
- package/src/router/utils.ts +2 -3
- package/src/views/login/login-view.vue +297 -301
- package/src/views/ulogin/login.vue +3 -32
- package/tsconfig.json +1 -1
- package/vite.config.ts +8 -3
- package/dist/403-DDCAPCYb.js +0 -65
- package/dist/404-BclWW4UB.js +0 -65
- package/dist/500-BAggMgTl.js +0 -67
- package/dist/AuthorityInfo-liCxYVNc.js +0 -4
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-Bd5A4CD-.js +0 -100
- package/dist/AuthorityPanel-CRlAwbaI.js +0 -4
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S.js +0 -114
- package/dist/Company-DjaOAaWM.js +0 -25
- package/dist/CompanyPanel-Dp_2z717.js +0 -206
- package/dist/DataSet-DT-rGICv.js +0 -147
- package/dist/Department-Bp5RGbl9.js +0 -25
- package/dist/DepartmentPanel-Bg4xM4Lx.js +0 -254
- package/dist/DesignPanel-BS2ioHd_.js +0 -4
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-DWwfRVCj.js +0 -1013
- package/dist/DictView-pYJXt6IS.js +0 -111
- package/dist/InvOrganization-D90gRzlN.js +0 -74
- package/dist/Org-Dk4KuIx2.js +0 -39
- package/dist/Preview-DpZR6uKs.js +0 -48
- package/dist/ReportDefine-PtJnfaLw.js +0 -10
- package/dist/ReportDesign-4HWkcTtA.js +0 -165
- package/dist/ReportQuery-BPY1lWFn.js +0 -75
- package/dist/ReportQueryFrom-CHFlkZ42.js +0 -4
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DbbQydKz.js +0 -178
- package/dist/ReportTemplate-C2F3oy8I.js +0 -161
- package/dist/Role-iTP6DYOi.js +0 -25
- package/dist/RoleAssign-DIYNHQeF.js +0 -26
- package/dist/RolePanel-0ojFIz9G.js +0 -4
- package/dist/RolePanel-B0Yr5vjo.js +0 -4
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CHAj3dCD.js +0 -132
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CXZBxePU.js +0 -154
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-DtNzPRjS.js +0 -101
- package/dist/Staff-sftZ0bIV.js +0 -26
- package/dist/StaffInfo-BG2FMXzR.js +0 -4
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-DzGn0pYY.js +0 -108
- package/dist/StaffPanel-BydqiitC.js +0 -4
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-C42Pnb-b.js +0 -154
- package/dist/SysUser-qMGVHpJ_.js +0 -15
- package/dist/SysUserPanel-Bh1HgSAr.js +0 -4
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BBEMYLQN.js +0 -356
- package/dist/SystemMenu-DUbWmLip.js +0 -156
- package/dist/UserInfo-DNkiTdWm.js +0 -4
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-B1eNklEd.js +0 -160
- package/dist/await-to-js.es5-Bv3Eu4mi.js +0 -10
- package/dist/childView-CjUjh8Da.js +0 -4
- package/dist/childView-DT9luEEK.js +0 -4
- package/dist/childView.vue_vue_type_style_index_0_lang-CgqosFJQ.js +0 -183
- package/dist/childView.vue_vue_type_style_index_0_lang-DkXHMFPd.js +0 -143
- package/dist/code-rule-uOazxFfn.js +0 -148
- package/dist/cron-task-DEykunjo.js +0 -135
- package/dist/flow-task-B07st2aD.js +0 -10
- package/dist/frameView-FxzlbkeM.js +0 -44
- package/dist/index-BnxyUGKa.js +0 -7944
- package/dist/layout-home-C0jme8Ju.js +0 -232
- package/dist/layoutView-BqMAHIxF.js +0 -3239
- package/dist/log-in-skZaWMBY.js +0 -117
- package/dist/log-out-BiND7muW.js +0 -130
- package/dist/login-C-184YPO.js +0 -235
- package/dist/login-log-BEHYT0v0.js +0 -70
- package/dist/lov-view-Df-swRfy.js +0 -99
- package/dist/menuInfo-CpyjX4a4.js +0 -4
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-D09-OKji.js +0 -363
- package/dist/pda-app-DP87aTBc.js +0 -710
- package/dist/redirect-BqegffKC.js +0 -15
- package/dist/resource-CAldbnw4.js +0 -97
- package/dist/su-welcome-DoBUqadB.js +0 -42225
- package/dist/sys-config-hGuE7DUf.js +0 -385
- package/dist/useNav-Cf_e5pBY.js +0 -92
- package/dist/utogether-MlnyYtNS.js +0 -4
- package/dist/wecom-push-DR7NsNro.js +0 -70
package/src/router/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: levi7754 levi7754@163.com
|
|
3
3
|
* @Date: 2024-08-01 21:42:39
|
|
4
4
|
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2026-
|
|
5
|
+
* @LastEditTime: 2026-04-16 09:56:45
|
|
6
6
|
* @FilePath: \udp-front\packages\udp-core\src\router\utils.ts
|
|
7
7
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
8
|
*/
|
|
@@ -26,7 +26,7 @@ const Layout = () => import('../layout/layoutView.vue');
|
|
|
26
26
|
const IFrame = () => import('../layout/frameView.vue');
|
|
27
27
|
|
|
28
28
|
// 动态路由
|
|
29
|
-
import {
|
|
29
|
+
import { initSystemInfo, getAsyncRoutes } from '../api/user';
|
|
30
30
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
|
31
31
|
// const modulesRoutes = import.meta.glob('/src/views/**/*.{vue,tsx}');
|
|
32
32
|
|
|
@@ -190,7 +190,6 @@ async function initRouter(userName) {
|
|
|
190
190
|
if (getConfig().CachingAsyncRoutes) {
|
|
191
191
|
await dbstorage.getItem(key).then(data => (asyncRouteList = data));
|
|
192
192
|
}
|
|
193
|
-
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
194
193
|
await initSystemInfo().then(async (res: IRecord) => {
|
|
195
194
|
useSystemStoreHook().setSystemInfo(res);
|
|
196
195
|
await getServiceApi()
|
|
@@ -1,301 +1,297 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="select-none">
|
|
3
|
-
<div class="absolute flex justify-center items-center right-5 top-3">
|
|
4
|
-
<!-- 主题 -->
|
|
5
|
-
<!-- <el-switch
|
|
6
|
-
v-model="dataTheme"
|
|
7
|
-
inline-prompt
|
|
8
|
-
:active-icon="dayIcon"
|
|
9
|
-
:inactive-icon="darkIcon"
|
|
10
|
-
@change="dataThemeChange"
|
|
11
|
-
/> -->
|
|
12
|
-
<!-- 国际化 -->
|
|
13
|
-
<!-- <el-dropdown v-if="sysConfig['i18nEnabled'] === 'Y'" trigger="click">
|
|
14
|
-
<globalization
|
|
15
|
-
class="hover:text-primary hover:!bg-[transparent] w-[20px] h-[20px] ml-1.5 cursor-pointer outline-hidden duration-300"
|
|
16
|
-
/>
|
|
17
|
-
<template #dropdown>
|
|
18
|
-
<el-dropdown-menu class="translation">
|
|
19
|
-
<el-dropdown-item
|
|
20
|
-
:style="getDropdownItemStyle(locale, 'zh')"
|
|
21
|
-
:class="['dark:text-white!', getDropdownItemClass(locale, 'zh')]"
|
|
22
|
-
@click="translationCh"
|
|
23
|
-
>
|
|
24
|
-
<IconifyIconOffline v-show="locale === 'zh'" class="check-zh" :icon="ri:check-line" />
|
|
25
|
-
简体中文
|
|
26
|
-
</el-dropdown-item>
|
|
27
|
-
<el-dropdown-item
|
|
28
|
-
:style="getDropdownItemStyle(locale, 'en')"
|
|
29
|
-
:class="['dark:text-white!', getDropdownItemClass(locale, 'en')]"
|
|
30
|
-
@click="translationEn"
|
|
31
|
-
>
|
|
32
|
-
<span v-show="locale === 'en'" class="check-en">
|
|
33
|
-
<IconifyIconOffline :icon="ri:check-line" />
|
|
34
|
-
</span>
|
|
35
|
-
English
|
|
36
|
-
</el-dropdown-item>
|
|
37
|
-
</el-dropdown-menu>
|
|
38
|
-
</template>
|
|
39
|
-
</el-dropdown> -->
|
|
40
|
-
</div>
|
|
41
|
-
<div class="login-container">
|
|
42
|
-
<div class="bg-img" :style="{ backgroundImage: `url(${sysConfig['backgroundImg']}` }" />
|
|
43
|
-
<div class="login-box">
|
|
44
|
-
<div class="login-form">
|
|
45
|
-
<img v-if="sysConfig['logo']" class="login-logo-img" :src="sysConfig['logo']" />
|
|
46
|
-
<Motion v-if="sysConfig['title']">
|
|
47
|
-
<h2 class="outline-hidden">
|
|
48
|
-
<TypeIt :values="[sysConfig['title']]" :cursor="false" :speed="150" />
|
|
49
|
-
</h2>
|
|
50
|
-
</Motion>
|
|
51
|
-
|
|
52
|
-
<el-form ref="ruleFormRef" :model="ruleForm" :rules="loginRules" size="large">
|
|
53
|
-
<Motion :delay="100">
|
|
54
|
-
<el-form-item
|
|
55
|
-
:rules="[{ required: true, message: $t('message.udp.loginUser'), trigger: 'blur' }]"
|
|
56
|
-
:label="$t('message.udp.loginUser')"
|
|
57
|
-
prop="username"
|
|
58
|
-
>
|
|
59
|
-
<el-input v-model.trim="ruleForm.username" autofocus clearable :prefix-icon="useRenderIcon(User)" />
|
|
60
|
-
</el-form-item>
|
|
61
|
-
</Motion>
|
|
62
|
-
|
|
63
|
-
<Motion :delay="150">
|
|
64
|
-
<el-form-item prop="passWord">
|
|
65
|
-
<el-input v-model="ruleForm.passWord" clearable show-password :prefix-icon="useRenderIcon(Lock)" />
|
|
66
|
-
</el-form-item>
|
|
67
|
-
</Motion>
|
|
68
|
-
<Motion :delay="250">
|
|
69
|
-
<el-form-item>
|
|
70
|
-
<el-button
|
|
71
|
-
class="w-full mt-4"
|
|
72
|
-
size="default"
|
|
73
|
-
type="primary"
|
|
74
|
-
:loading="loading"
|
|
75
|
-
@click="onLogin(ruleFormRef)"
|
|
76
|
-
>
|
|
77
|
-
{{ $t('message.udp.login') }}
|
|
78
|
-
</el-button>
|
|
79
|
-
</el-form-item>
|
|
80
|
-
</Motion>
|
|
81
|
-
</el-form>
|
|
82
|
-
</div>
|
|
83
|
-
<div class="fixed text-xs text-gray-500 bottom-4">Copyright ©2021{{ sysConfig['copyright'] }}版权所有</div>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script setup lang="ts">
|
|
90
|
-
import { ref, reactive, onMounted, onBeforeMount, onBeforeUnmount } from 'vue';
|
|
91
|
-
import { useRouter } from 'vue-router';
|
|
92
|
-
import type { FormInstance } from 'element-plus';
|
|
93
|
-
import { storageLocal, cookies, successMessage, delay } from '@utogether/utils';
|
|
94
|
-
import { toDateString } from 'xe-utils';
|
|
95
|
-
import to from 'await-to-js';
|
|
96
|
-
|
|
97
|
-
import Motion from './utils/motion';
|
|
98
|
-
import { loginRules } from './utils/rule';
|
|
99
|
-
import TypeIt from '@/components/SuTypeit';
|
|
100
|
-
import { useRenderIcon } from '@/components/ReIcon/src/hooks';
|
|
101
|
-
// import { useTranslationLang } from '@/layout/hooks/useTranslationLang';
|
|
102
|
-
import { useLayout } from '@/layout/hooks/useLayout';
|
|
103
|
-
// import { useNav } from '@/layout/hooks/useNav';
|
|
104
|
-
// import { useDataThemeChange } from '@/layout/hooks/useDataThemeChange';
|
|
105
|
-
import { useSystemStoreHook } from '@/store/modules/system';
|
|
106
|
-
|
|
107
|
-
import { getServiceApi } from '../../api';
|
|
108
|
-
import {
|
|
109
|
-
import
|
|
110
|
-
// import
|
|
111
|
-
// import
|
|
112
|
-
|
|
113
|
-
import
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
// const {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
window.document.
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
:deep(.el-input-group__append, .el-input-group__prepend) {
|
|
299
|
-
padding: 0;
|
|
300
|
-
}
|
|
301
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="select-none">
|
|
3
|
+
<div class="absolute flex justify-center items-center right-5 top-3">
|
|
4
|
+
<!-- 主题 -->
|
|
5
|
+
<!-- <el-switch
|
|
6
|
+
v-model="dataTheme"
|
|
7
|
+
inline-prompt
|
|
8
|
+
:active-icon="dayIcon"
|
|
9
|
+
:inactive-icon="darkIcon"
|
|
10
|
+
@change="dataThemeChange"
|
|
11
|
+
/> -->
|
|
12
|
+
<!-- 国际化 -->
|
|
13
|
+
<!-- <el-dropdown v-if="sysConfig['i18nEnabled'] === 'Y'" trigger="click">
|
|
14
|
+
<globalization
|
|
15
|
+
class="hover:text-primary hover:!bg-[transparent] w-[20px] h-[20px] ml-1.5 cursor-pointer outline-hidden duration-300"
|
|
16
|
+
/>
|
|
17
|
+
<template #dropdown>
|
|
18
|
+
<el-dropdown-menu class="translation">
|
|
19
|
+
<el-dropdown-item
|
|
20
|
+
:style="getDropdownItemStyle(locale, 'zh')"
|
|
21
|
+
:class="['dark:text-white!', getDropdownItemClass(locale, 'zh')]"
|
|
22
|
+
@click="translationCh"
|
|
23
|
+
>
|
|
24
|
+
<IconifyIconOffline v-show="locale === 'zh'" class="check-zh" :icon="ri:check-line" />
|
|
25
|
+
简体中文
|
|
26
|
+
</el-dropdown-item>
|
|
27
|
+
<el-dropdown-item
|
|
28
|
+
:style="getDropdownItemStyle(locale, 'en')"
|
|
29
|
+
:class="['dark:text-white!', getDropdownItemClass(locale, 'en')]"
|
|
30
|
+
@click="translationEn"
|
|
31
|
+
>
|
|
32
|
+
<span v-show="locale === 'en'" class="check-en">
|
|
33
|
+
<IconifyIconOffline :icon="ri:check-line" />
|
|
34
|
+
</span>
|
|
35
|
+
English
|
|
36
|
+
</el-dropdown-item>
|
|
37
|
+
</el-dropdown-menu>
|
|
38
|
+
</template>
|
|
39
|
+
</el-dropdown> -->
|
|
40
|
+
</div>
|
|
41
|
+
<div class="login-container">
|
|
42
|
+
<div class="bg-img" :style="{ backgroundImage: `url(${sysConfig['backgroundImg']}` }" />
|
|
43
|
+
<div class="login-box">
|
|
44
|
+
<div class="login-form">
|
|
45
|
+
<img v-if="sysConfig['logo']" class="login-logo-img" :src="sysConfig['logo']" />
|
|
46
|
+
<Motion v-if="sysConfig['title']">
|
|
47
|
+
<h2 class="outline-hidden">
|
|
48
|
+
<TypeIt :values="[sysConfig['title']]" :cursor="false" :speed="150" />
|
|
49
|
+
</h2>
|
|
50
|
+
</Motion>
|
|
51
|
+
|
|
52
|
+
<el-form ref="ruleFormRef" :model="ruleForm" :rules="loginRules" size="large">
|
|
53
|
+
<Motion :delay="100">
|
|
54
|
+
<el-form-item
|
|
55
|
+
:rules="[{ required: true, message: $t('message.udp.loginUser'), trigger: 'blur' }]"
|
|
56
|
+
:label="$t('message.udp.loginUser')"
|
|
57
|
+
prop="username"
|
|
58
|
+
>
|
|
59
|
+
<el-input v-model.trim="ruleForm.username" autofocus clearable :prefix-icon="useRenderIcon(User)" />
|
|
60
|
+
</el-form-item>
|
|
61
|
+
</Motion>
|
|
62
|
+
|
|
63
|
+
<Motion :delay="150">
|
|
64
|
+
<el-form-item prop="passWord">
|
|
65
|
+
<el-input v-model="ruleForm.passWord" clearable show-password :prefix-icon="useRenderIcon(Lock)" />
|
|
66
|
+
</el-form-item>
|
|
67
|
+
</Motion>
|
|
68
|
+
<Motion :delay="250">
|
|
69
|
+
<el-form-item>
|
|
70
|
+
<el-button
|
|
71
|
+
class="w-full mt-4"
|
|
72
|
+
size="default"
|
|
73
|
+
type="primary"
|
|
74
|
+
:loading="loading"
|
|
75
|
+
@click="onLogin(ruleFormRef)"
|
|
76
|
+
>
|
|
77
|
+
{{ $t('message.udp.login') }}
|
|
78
|
+
</el-button>
|
|
79
|
+
</el-form-item>
|
|
80
|
+
</Motion>
|
|
81
|
+
</el-form>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="fixed text-xs text-gray-500 bottom-4">Copyright ©2021{{ sysConfig['copyright'] }}版权所有</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script setup lang="ts">
|
|
90
|
+
import { ref, reactive, onMounted, onBeforeMount, onBeforeUnmount } from 'vue';
|
|
91
|
+
import { useRouter } from 'vue-router';
|
|
92
|
+
import type { FormInstance } from 'element-plus';
|
|
93
|
+
import { storageLocal, cookies, successMessage, delay } from '@utogether/utils';
|
|
94
|
+
import { toDateString } from 'xe-utils';
|
|
95
|
+
import to from 'await-to-js';
|
|
96
|
+
|
|
97
|
+
import Motion from './utils/motion';
|
|
98
|
+
import { loginRules } from './utils/rule';
|
|
99
|
+
import TypeIt from '@/components/SuTypeit';
|
|
100
|
+
import { useRenderIcon } from '@/components/ReIcon/src/hooks';
|
|
101
|
+
// import { useTranslationLang } from '@/layout/hooks/useTranslationLang';
|
|
102
|
+
import { useLayout } from '@/layout/hooks/useLayout';
|
|
103
|
+
// import { useNav } from '@/layout/hooks/useNav';
|
|
104
|
+
// import { useDataThemeChange } from '@/layout/hooks/useDataThemeChange';
|
|
105
|
+
import { useSystemStoreHook } from '@/store/modules/system';
|
|
106
|
+
|
|
107
|
+
import { getServiceApi } from '../../api';
|
|
108
|
+
import { getPlatform, getBrower } from '@/utils/browers';
|
|
109
|
+
// import dayIcon from '@/assets/svg/day.svg?component';
|
|
110
|
+
// import darkIcon from '@/assets/svg/dark.svg?component';
|
|
111
|
+
// import globalization from '@/assets/svg/globalization.svg?component';
|
|
112
|
+
import Lock from '@iconify-icons/ri/lock-fill';
|
|
113
|
+
import User from '@iconify-icons/ri/user-3-fill';
|
|
114
|
+
|
|
115
|
+
defineOptions({ name: 'LoginView' });
|
|
116
|
+
|
|
117
|
+
interface IRSAPublic {
|
|
118
|
+
publicKeyExponent: string;
|
|
119
|
+
publicKeyModulus: string;
|
|
120
|
+
requestKey: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const router = useRouter();
|
|
124
|
+
|
|
125
|
+
// const bgStyle = ref({});
|
|
126
|
+
const sysConfig = ref({});
|
|
127
|
+
const loading = ref(false);
|
|
128
|
+
const ruleFormRef = ref<FormInstance>();
|
|
129
|
+
|
|
130
|
+
const serviceApi = getServiceApi();
|
|
131
|
+
|
|
132
|
+
const { initStorage } = useLayout();
|
|
133
|
+
initStorage();
|
|
134
|
+
// const { dataTheme, dataThemeChange } = useDataThemeChange();
|
|
135
|
+
// dataThemeChange();
|
|
136
|
+
// const { getDropdownItemStyle, getDropdownItemClass } = useNav();
|
|
137
|
+
// const { locale, translationCh, translationEn } = useTranslationLang();
|
|
138
|
+
|
|
139
|
+
const ruleForm = reactive({
|
|
140
|
+
username: '',
|
|
141
|
+
passWord: ''
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const publicRSA: IRSAPublic = reactive({
|
|
145
|
+
publicKeyExponent: '10001',
|
|
146
|
+
publicKeyModulus:
|
|
147
|
+
'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
|
|
148
|
+
requestKey: ''
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const onLogin = async (formEl: FormInstance | undefined) => {
|
|
152
|
+
if (!formEl) return;
|
|
153
|
+
await formEl.validate(valid => {
|
|
154
|
+
if (valid) {
|
|
155
|
+
loading.value = true;
|
|
156
|
+
const { username, passWord } = ruleForm;
|
|
157
|
+
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
setMaxDigits(200);
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
|
|
164
|
+
const param = {
|
|
165
|
+
username,
|
|
166
|
+
password,
|
|
167
|
+
requestKey: publicRSA.requestKey,
|
|
168
|
+
domain: window.location.origin
|
|
169
|
+
};
|
|
170
|
+
serviceApi
|
|
171
|
+
.post('/uath/login', param)
|
|
172
|
+
.then(async (data: IResponseData) => {
|
|
173
|
+
successMessage(`👏 恭喜,成功登录${sysConfig.value['title']}!!!🎉`);
|
|
174
|
+
useSystemStoreHook().setSessionKey(data);
|
|
175
|
+
cacheToken(data);
|
|
176
|
+
cookies.set('loginer', username);
|
|
177
|
+
await delay(300);
|
|
178
|
+
router.push('/');
|
|
179
|
+
await insertLoginInfo(username);
|
|
180
|
+
})
|
|
181
|
+
.finally(() => {
|
|
182
|
+
loading.value = false;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @description: 缓存token
|
|
190
|
+
* @param {*} token token数据
|
|
191
|
+
* @return {*}
|
|
192
|
+
*/
|
|
193
|
+
const cacheToken = token => {
|
|
194
|
+
const { access_token, expires_in, refresh_token } = token;
|
|
195
|
+
const cache = {
|
|
196
|
+
accessToken: access_token,
|
|
197
|
+
refreshToken: refresh_token,
|
|
198
|
+
expires: Date.now() + expires_in * 1000
|
|
199
|
+
};
|
|
200
|
+
const kTOKENKEY = 'authorized-token';
|
|
201
|
+
|
|
202
|
+
cookies.set('kCookies_token', token.access_token);
|
|
203
|
+
const dataString = JSON.stringify(cache);
|
|
204
|
+
expires_in > 0 ? cookies.set(kTOKENKEY, dataString) : cookies.set(kTOKENKEY, dataString);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const insertLoginInfo = username => {
|
|
208
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
209
|
+
const { browser, browserVersion } = getBrower(userAgent);
|
|
210
|
+
const obj = {
|
|
211
|
+
userName: username,
|
|
212
|
+
loginTime: toDateString(new Date()),
|
|
213
|
+
browser,
|
|
214
|
+
browserVersion,
|
|
215
|
+
operatingSystem: getPlatform(userAgent)
|
|
216
|
+
};
|
|
217
|
+
serviceApi.post('/upfm/v1/userMonitor', obj);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/** 使用公共函数,避免`removeEventListener`失效 */
|
|
221
|
+
function onkeypress({ code }: KeyboardEvent) {
|
|
222
|
+
if (['Enter', 'NumpadEnter'].includes(code)) {
|
|
223
|
+
onLogin(ruleFormRef.value);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
onMounted(() => {
|
|
228
|
+
window.document.addEventListener('keypress', onkeypress);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
onBeforeUnmount(() => {
|
|
232
|
+
window.document.removeEventListener('keypress', onkeypress);
|
|
233
|
+
});
|
|
234
|
+
/**
|
|
235
|
+
* @description: 获取系统配置
|
|
236
|
+
* @return {*}
|
|
237
|
+
*/
|
|
238
|
+
const getSysConfig = async () => {
|
|
239
|
+
const [err, data]: [Error, any] = await to(serviceApi.get('/upfm/v1/sysConfig', {}));
|
|
240
|
+
if (!err) {
|
|
241
|
+
const config = {};
|
|
242
|
+
data.list?.forEach(item => {
|
|
243
|
+
config[item.configCode] = item.configValue;
|
|
244
|
+
if (item.fileName) {
|
|
245
|
+
config[item.configCode] = window.location.origin + '/ufil' + item.configValue;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
const env = process.env.NODE_ENV;
|
|
249
|
+
const title = data.list?.find(f => f.configCode === `${env}Title` || f.configCode === 'title')?.configValue;
|
|
250
|
+
config['title'] = title || 'U-DP';
|
|
251
|
+
sysConfig.value = config;
|
|
252
|
+
setFavicon();
|
|
253
|
+
storageLocal.setItem('kSysConfig', config);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const setFavicon = () => {
|
|
258
|
+
let favicon = document.querySelector('link[rel="icon"]') as HTMLElement;
|
|
259
|
+
// console.log('app', favicon)
|
|
260
|
+
if (favicon !== null) {
|
|
261
|
+
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
262
|
+
} else {
|
|
263
|
+
favicon = document.createElement('link');
|
|
264
|
+
favicon['rel'] = 'icon';
|
|
265
|
+
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
266
|
+
document.head.appendChild(favicon);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
onBeforeMount(() => {
|
|
271
|
+
getSysConfig();
|
|
272
|
+
});
|
|
273
|
+
</script>
|
|
274
|
+
|
|
275
|
+
<style scoped>
|
|
276
|
+
@import url('@/style/login2.css');
|
|
277
|
+
|
|
278
|
+
/* .translation {
|
|
279
|
+
::v-deep(.el-dropdown-menu__item) {
|
|
280
|
+
padding: 5px 40px;
|
|
281
|
+
}
|
|
282
|
+
} */
|
|
283
|
+
|
|
284
|
+
.check-zh {
|
|
285
|
+
position: absolute;
|
|
286
|
+
left: 20px;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.check-en {
|
|
290
|
+
position: absolute;
|
|
291
|
+
left: 20px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:deep(.el-input-group__append, .el-input-group__prepend) {
|
|
295
|
+
padding: 0;
|
|
296
|
+
}
|
|
297
|
+
</style>
|