@utogether/udp-core 2.0.0-beta.18 → 2.0.0-beta.21
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-CiwygkcS.js → 403-DICzHwBh.js} +1 -1
- package/dist/{404-Cp-gBEnO.js → 404-CE2ilza7.js} +1 -1
- package/dist/{500-cRj1gJQn.js → 500-DqbOUpFQ.js} +1 -1
- package/dist/{AuthorityInfo-B8VRZwdl.js → AuthorityInfo-DD9xMuFM.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Cl_qNHPP.js → AuthorityInfo.vue_vue_type_style_index_0_lang-aH0WIYDG.js} +1 -1
- package/dist/{Company-ajM0vpY2.js → Company-CZSbX6Cr.js} +3 -3
- package/dist/{CompanyPanel-0dEaYB0h.js → CompanyPanel-DRz2RdEP.js} +1 -1
- package/dist/{Department-CAlWe8Wn.js → Department-B8HWfFX7.js} +3 -3
- package/dist/{DepartmentPanel-B4h93Kuj.js → DepartmentPanel-DXfqf0O-.js} +1 -1
- package/dist/{DesignPanel-Zc4q17fX.js → DesignPanel-DCemiRmN.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DP36xCZj.js → DesignPanel.vue_vue_type_style_index_0_lang-BpI6lZ8h.js} +2 -2
- package/dist/{DictView-Drz8HJmr.js → DictView-CQZ_Z-_n.js} +1 -1
- package/dist/{InvOrganization-v8x_yv3U.js → InvOrganization-Nq87pxzj.js} +1 -1
- package/dist/{Org-BdLnDwgE.js → Org-DuqSCs0N.js} +1 -1
- package/dist/{Preview-C9LXkjsk.js → Preview-Du_1OWoT.js} +1 -1
- package/dist/{ReportDefine-CoA638hX.js → ReportDefine-QSidK9OU.js} +1 -1
- package/dist/{ReportDesign-CKrMhVOG.js → ReportDesign-BH7WbI4K.js} +2 -2
- package/dist/{ReportQuery-DsDoTEqD.js → ReportQuery-Br5UKVjQ.js} +1 -1
- package/dist/{ReportQueryFrom-jgNExGqj.js → ReportQueryFrom-Dg-DjcMi.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-Bb6M-rZo.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-D3RWJEGQ.js} +1 -1
- package/dist/{ReportTemplate-9pjbcVHQ.js → ReportTemplate-BU3VS8FO.js} +1 -1
- package/dist/{Role-D9JLITgR.js → Role-CN18RZjI.js} +3 -3
- package/dist/{RoleAssign-DKqZllUB.js → RoleAssign-DXloJByw.js} +3 -3
- package/dist/{RolePanel-CHBsrafh.js → RolePanel-CZmXekBA.js} +1 -1
- package/dist/{RolePanel-C2rcyamx.js → RolePanel-DGW5mWjQ.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DGzK_ck0.js → RolePanel.vue_vue_type_script_setup_true_lang-DAtJnQI4.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DP0VC493.js → RolePanel.vue_vue_type_script_setup_true_lang-DdvxxsMl.js} +3 -3
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CaXC_ulv.js → ScrollPanel.vue_vue_type_style_index_0_lang-DzZ9CZig.js} +1 -1
- package/dist/{Staff-B1aymzYG.js → Staff-qG73AUgD.js} +3 -3
- package/dist/{StaffInfo-Ci9NZsLz.js → StaffInfo-COP7bCup.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CoHO3jph.js → StaffInfo.vue_vue_type_script_setup_true_lang-BityQi7n.js} +1 -1
- package/dist/{StaffPanel-Br8DfRfB.js → StaffPanel-CB7cBhYD.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BTmtH0UN.js → StaffPanel.vue_vue_type_script_setup_true_lang-DcPck6b8.js} +2 -2
- package/dist/{SysUser-f5Qg4Vsh.js → SysUser-Dmfu9N7S.js} +2 -2
- package/dist/{SysUserPanel-DREu1Uiy.js → SysUserPanel-C2O-P9nB.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-BIhUUyW-.js → SysUserPanel.vue_vue_type_script_setup_true_lang-DyF3Tmps.js} +1 -1
- package/dist/{SystemMenu-BL68-3Xm.js → SystemMenu-QZaHtPet.js} +2 -2
- package/dist/{UserInfo-DCe29kjk.js → UserInfo-CxP5kr_T.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-BGPCq8hF.js → UserInfo.vue_vue_type_style_index_0_lang-pe7FALf9.js} +1 -1
- package/dist/{childView-CjSSEVFP.js → childView-LCu_Df1q.js} +1 -1
- package/dist/{childView-DQdo-iv3.js → childView-ohYBzZ0o.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-aPIG_1O3.js → childView.vue_vue_type_style_index_0_lang-DJletJUx.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-BUP9awcV.js → childView.vue_vue_type_style_index_0_lang-jbOoVsYJ.js} +1 -1
- package/dist/{code-rule-BSzvKfCf.js → code-rule-B9eZeeo8.js} +1 -1
- package/dist/core.es.js +1 -1
- package/dist/{cron-task-DEkAUgcL.js → cron-task-Dp71tYa4.js} +1 -1
- package/dist/{frameView-BMNuZId1.js → frameView-02snW4T6.js} +1 -1
- package/dist/{index-Dhl7TR-F.js → index-gL1hMTqJ.js} +687 -683
- package/dist/{layout-home-CJyZTH-R.js → layout-home-DCrNKejz.js} +1 -1
- package/dist/{layoutView-BzW2fsIc.js → layoutView-Cu3YZ1zM.js} +3 -7
- package/dist/{log-in-Dq-BEOqT.js → log-in-C0oqCCsq.js} +1 -1
- package/dist/{log-out-dth-hdr5.js → log-out-DsTsQcQT.js} +1 -1
- package/dist/{login-B_v04MUg.js → login-_IgWG4L5.js} +41 -39
- package/dist/{lov-view-Bcfnp2nx.js → lov-view-B4HvQI1i.js} +2 -2
- package/dist/{menuInfo-CmuL8Me4.js → menuInfo-y_CFBZLU.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-By7X_7bs.js → menuInfo.vue_vue_type_style_index_0_lang-BNgwCBo4.js} +1 -1
- package/dist/{pda-app-DRNZip_A.js → pda-app-DplNCuYS.js} +1 -1
- package/dist/{resource-DFFHyEub.js → resource-C2fCs2gF.js} +1 -1
- package/dist/{su-welcome-CPGWmjVc.js → su-welcome-Q0C5LnI_.js} +8 -5
- package/dist/{sys-config-C-Lq7iOM.js → sys-config-Bsb7aFcn.js} +1 -1
- package/dist/udp-core.css +1 -1
- package/dist/{useNav-zFR-ehRp.js → useNav-D5jP-2AH.js} +1 -1
- package/package.json +1 -1
- package/src/components/udp/utils.ts +414 -414
- package/src/layout/components/lay-sidebar/sidebarItem.vue +3 -13
- package/src/router/utils.ts +431 -420
- package/src/views/login/login-view.vue +301 -301
- package/src/views/uhome/components/dynamic-component.vue +10 -1
- package/src/views/uhome/su-welcome.vue +1 -0
- package/src/views/ulogin/login.vue +6 -4
|
@@ -1,301 +1,301 @@
|
|
|
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 { initDict } from '../../api/user';
|
|
109
|
-
import { getPlatform, getBrower } from '@/utils/browers';
|
|
110
|
-
// import dayIcon from '@/assets/svg/day.svg?component';
|
|
111
|
-
// import darkIcon from '@/assets/svg/dark.svg?component';
|
|
112
|
-
// import globalization from '@/assets/svg/globalization.svg?component';
|
|
113
|
-
import Lock from '@iconify-icons/ri/lock-fill';
|
|
114
|
-
import User from '@iconify-icons/ri/user-3-fill';
|
|
115
|
-
|
|
116
|
-
defineOptions({ name: 'LoginView' });
|
|
117
|
-
|
|
118
|
-
interface IRSAPublic {
|
|
119
|
-
publicKeyExponent: string;
|
|
120
|
-
publicKeyModulus: string;
|
|
121
|
-
requestKey: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const router = useRouter();
|
|
125
|
-
|
|
126
|
-
// const bgStyle = ref({});
|
|
127
|
-
const sysConfig = ref({});
|
|
128
|
-
const loading = ref(false);
|
|
129
|
-
const ruleFormRef = ref<FormInstance>();
|
|
130
|
-
|
|
131
|
-
const serviceApi = getServiceApi();
|
|
132
|
-
|
|
133
|
-
const { initStorage } = useLayout();
|
|
134
|
-
initStorage();
|
|
135
|
-
// const { dataTheme, dataThemeChange } = useDataThemeChange();
|
|
136
|
-
// dataThemeChange();
|
|
137
|
-
// const { getDropdownItemStyle, getDropdownItemClass } = useNav();
|
|
138
|
-
// const { locale, translationCh, translationEn } = useTranslationLang();
|
|
139
|
-
|
|
140
|
-
const ruleForm = reactive({
|
|
141
|
-
username: '',
|
|
142
|
-
passWord: ''
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const publicRSA: IRSAPublic = reactive({
|
|
146
|
-
publicKeyExponent: '10001',
|
|
147
|
-
publicKeyModulus:
|
|
148
|
-
'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
|
|
149
|
-
requestKey: ''
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const onLogin = async (formEl: FormInstance | undefined) => {
|
|
153
|
-
if (!formEl) return;
|
|
154
|
-
await formEl.validate(valid => {
|
|
155
|
-
if (valid) {
|
|
156
|
-
loading.value = true;
|
|
157
|
-
const { username, passWord } = ruleForm;
|
|
158
|
-
|
|
159
|
-
// @ts-ignore
|
|
160
|
-
setMaxDigits(200);
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
|
|
163
|
-
// @ts-ignore
|
|
164
|
-
const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
|
|
165
|
-
const param = {
|
|
166
|
-
username,
|
|
167
|
-
password,
|
|
168
|
-
requestKey: publicRSA.requestKey,
|
|
169
|
-
domain: window.location.origin
|
|
170
|
-
};
|
|
171
|
-
serviceApi
|
|
172
|
-
.post('/uath/login', param)
|
|
173
|
-
.then(async (data: IResponseData) => {
|
|
174
|
-
successMessage(`👏 恭喜,成功登录${sysConfig.value['title']}!!!🎉`);
|
|
175
|
-
useSystemStoreHook().setSessionKey(data);
|
|
176
|
-
cacheToken(data);
|
|
177
|
-
cookies.set('loginer', username);
|
|
178
|
-
if (!storageLocal.getItem('kLov')) {
|
|
179
|
-
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
180
|
-
}
|
|
181
|
-
await delay(300);
|
|
182
|
-
router.push('/');
|
|
183
|
-
await insertLoginInfo(username);
|
|
184
|
-
})
|
|
185
|
-
.finally(() => {
|
|
186
|
-
loading.value = false;
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @description: 缓存token
|
|
194
|
-
* @param {*} token token数据
|
|
195
|
-
* @return {*}
|
|
196
|
-
*/
|
|
197
|
-
const cacheToken = token => {
|
|
198
|
-
const { access_token, expires_in, refresh_token } = token;
|
|
199
|
-
const cache = {
|
|
200
|
-
accessToken: access_token,
|
|
201
|
-
refreshToken: refresh_token,
|
|
202
|
-
expires: Date.now() + expires_in * 1000
|
|
203
|
-
};
|
|
204
|
-
const kTOKENKEY = 'authorized-token';
|
|
205
|
-
|
|
206
|
-
cookies.set('kCookies_token', token.access_token);
|
|
207
|
-
const dataString = JSON.stringify(cache);
|
|
208
|
-
expires_in > 0 ? cookies.set(kTOKENKEY, dataString) : cookies.set(kTOKENKEY, dataString);
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const insertLoginInfo = username => {
|
|
212
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
213
|
-
const { browser, browserVersion } = getBrower(userAgent);
|
|
214
|
-
const obj = {
|
|
215
|
-
userName: username,
|
|
216
|
-
loginTime: toDateString(new Date()),
|
|
217
|
-
browser,
|
|
218
|
-
browserVersion,
|
|
219
|
-
operatingSystem: getPlatform(userAgent)
|
|
220
|
-
};
|
|
221
|
-
serviceApi.post('/upfm/v1/userMonitor', obj);
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
/** 使用公共函数,避免`removeEventListener`失效 */
|
|
225
|
-
function onkeypress({ code }: KeyboardEvent) {
|
|
226
|
-
if (['Enter', 'NumpadEnter'].includes(code)) {
|
|
227
|
-
onLogin(ruleFormRef.value);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
onMounted(() => {
|
|
232
|
-
window.document.addEventListener('keypress', onkeypress);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
onBeforeUnmount(() => {
|
|
236
|
-
window.document.removeEventListener('keypress', onkeypress);
|
|
237
|
-
});
|
|
238
|
-
/**
|
|
239
|
-
* @description: 获取系统配置
|
|
240
|
-
* @return {*}
|
|
241
|
-
*/
|
|
242
|
-
const getSysConfig = async () => {
|
|
243
|
-
const [err, data]: [Error, any] = await to(serviceApi.get('/upfm/v1/sysConfig', {}));
|
|
244
|
-
if (!err) {
|
|
245
|
-
const config = {};
|
|
246
|
-
data.list?.forEach(item => {
|
|
247
|
-
config[item.configCode] = item.configValue;
|
|
248
|
-
if (item.fileName) {
|
|
249
|
-
config[item.configCode] = window.location.origin + '/ufil' + item.configValue;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
const env = process.env.NODE_ENV;
|
|
253
|
-
const title = data.list?.find(f => f.configCode === `${env}Title` || f.configCode === 'title')?.configValue;
|
|
254
|
-
config['title'] = title || 'U-DP';
|
|
255
|
-
sysConfig.value = config;
|
|
256
|
-
setFavicon();
|
|
257
|
-
storageLocal.setItem('kSysConfig', config);
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const setFavicon = () => {
|
|
262
|
-
let favicon = document.querySelector('link[rel="icon"]') as HTMLElement;
|
|
263
|
-
// console.log('app', favicon)
|
|
264
|
-
if (favicon !== null) {
|
|
265
|
-
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
266
|
-
} else {
|
|
267
|
-
favicon = document.createElement('link');
|
|
268
|
-
favicon['rel'] = 'icon';
|
|
269
|
-
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
270
|
-
document.head.appendChild(favicon);
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
onBeforeMount(() => {
|
|
275
|
-
getSysConfig();
|
|
276
|
-
});
|
|
277
|
-
</script>
|
|
278
|
-
|
|
279
|
-
<style scoped>
|
|
280
|
-
@import url('@/style/login2.css');
|
|
281
|
-
|
|
282
|
-
/* .translation {
|
|
283
|
-
::v-deep(.el-dropdown-menu__item) {
|
|
284
|
-
padding: 5px 40px;
|
|
285
|
-
}
|
|
286
|
-
} */
|
|
287
|
-
|
|
288
|
-
.check-zh {
|
|
289
|
-
position: absolute;
|
|
290
|
-
left: 20px;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.check-en {
|
|
294
|
-
position: absolute;
|
|
295
|
-
left: 20px;
|
|
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 { initDict } from '../../api/user';
|
|
109
|
+
import { getPlatform, getBrower } from '@/utils/browers';
|
|
110
|
+
// import dayIcon from '@/assets/svg/day.svg?component';
|
|
111
|
+
// import darkIcon from '@/assets/svg/dark.svg?component';
|
|
112
|
+
// import globalization from '@/assets/svg/globalization.svg?component';
|
|
113
|
+
import Lock from '@iconify-icons/ri/lock-fill';
|
|
114
|
+
import User from '@iconify-icons/ri/user-3-fill';
|
|
115
|
+
|
|
116
|
+
defineOptions({ name: 'LoginView' });
|
|
117
|
+
|
|
118
|
+
interface IRSAPublic {
|
|
119
|
+
publicKeyExponent: string;
|
|
120
|
+
publicKeyModulus: string;
|
|
121
|
+
requestKey: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const router = useRouter();
|
|
125
|
+
|
|
126
|
+
// const bgStyle = ref({});
|
|
127
|
+
const sysConfig = ref({});
|
|
128
|
+
const loading = ref(false);
|
|
129
|
+
const ruleFormRef = ref<FormInstance>();
|
|
130
|
+
|
|
131
|
+
const serviceApi = getServiceApi();
|
|
132
|
+
|
|
133
|
+
const { initStorage } = useLayout();
|
|
134
|
+
initStorage();
|
|
135
|
+
// const { dataTheme, dataThemeChange } = useDataThemeChange();
|
|
136
|
+
// dataThemeChange();
|
|
137
|
+
// const { getDropdownItemStyle, getDropdownItemClass } = useNav();
|
|
138
|
+
// const { locale, translationCh, translationEn } = useTranslationLang();
|
|
139
|
+
|
|
140
|
+
const ruleForm = reactive({
|
|
141
|
+
username: '',
|
|
142
|
+
passWord: ''
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const publicRSA: IRSAPublic = reactive({
|
|
146
|
+
publicKeyExponent: '10001',
|
|
147
|
+
publicKeyModulus:
|
|
148
|
+
'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
|
|
149
|
+
requestKey: ''
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const onLogin = async (formEl: FormInstance | undefined) => {
|
|
153
|
+
if (!formEl) return;
|
|
154
|
+
await formEl.validate(valid => {
|
|
155
|
+
if (valid) {
|
|
156
|
+
loading.value = true;
|
|
157
|
+
const { username, passWord } = ruleForm;
|
|
158
|
+
|
|
159
|
+
// @ts-ignore
|
|
160
|
+
setMaxDigits(200);
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
|
|
165
|
+
const param = {
|
|
166
|
+
username,
|
|
167
|
+
password,
|
|
168
|
+
requestKey: publicRSA.requestKey,
|
|
169
|
+
domain: window.location.origin
|
|
170
|
+
};
|
|
171
|
+
serviceApi
|
|
172
|
+
.post('/uath/login', param)
|
|
173
|
+
.then(async (data: IResponseData) => {
|
|
174
|
+
successMessage(`👏 恭喜,成功登录${sysConfig.value['title']}!!!🎉`);
|
|
175
|
+
useSystemStoreHook().setSessionKey(data);
|
|
176
|
+
cacheToken(data);
|
|
177
|
+
cookies.set('loginer', username);
|
|
178
|
+
if (!storageLocal.getItem('kLov')) {
|
|
179
|
+
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
180
|
+
}
|
|
181
|
+
await delay(300);
|
|
182
|
+
router.push('/');
|
|
183
|
+
await insertLoginInfo(username);
|
|
184
|
+
})
|
|
185
|
+
.finally(() => {
|
|
186
|
+
loading.value = false;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @description: 缓存token
|
|
194
|
+
* @param {*} token token数据
|
|
195
|
+
* @return {*}
|
|
196
|
+
*/
|
|
197
|
+
const cacheToken = token => {
|
|
198
|
+
const { access_token, expires_in, refresh_token } = token;
|
|
199
|
+
const cache = {
|
|
200
|
+
accessToken: access_token,
|
|
201
|
+
refreshToken: refresh_token,
|
|
202
|
+
expires: Date.now() + expires_in * 1000
|
|
203
|
+
};
|
|
204
|
+
const kTOKENKEY = 'authorized-token';
|
|
205
|
+
|
|
206
|
+
cookies.set('kCookies_token', token.access_token);
|
|
207
|
+
const dataString = JSON.stringify(cache);
|
|
208
|
+
expires_in > 0 ? cookies.set(kTOKENKEY, dataString) : cookies.set(kTOKENKEY, dataString);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const insertLoginInfo = username => {
|
|
212
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
213
|
+
const { browser, browserVersion } = getBrower(userAgent);
|
|
214
|
+
const obj = {
|
|
215
|
+
userName: username,
|
|
216
|
+
loginTime: toDateString(new Date()),
|
|
217
|
+
browser,
|
|
218
|
+
browserVersion,
|
|
219
|
+
operatingSystem: getPlatform(userAgent)
|
|
220
|
+
};
|
|
221
|
+
serviceApi.post('/upfm/v1/userMonitor', obj);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/** 使用公共函数,避免`removeEventListener`失效 */
|
|
225
|
+
function onkeypress({ code }: KeyboardEvent) {
|
|
226
|
+
if (['Enter', 'NumpadEnter'].includes(code)) {
|
|
227
|
+
onLogin(ruleFormRef.value);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
onMounted(() => {
|
|
232
|
+
window.document.addEventListener('keypress', onkeypress);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
onBeforeUnmount(() => {
|
|
236
|
+
window.document.removeEventListener('keypress', onkeypress);
|
|
237
|
+
});
|
|
238
|
+
/**
|
|
239
|
+
* @description: 获取系统配置
|
|
240
|
+
* @return {*}
|
|
241
|
+
*/
|
|
242
|
+
const getSysConfig = async () => {
|
|
243
|
+
const [err, data]: [Error, any] = await to(serviceApi.get('/upfm/v1/sysConfig', {}));
|
|
244
|
+
if (!err) {
|
|
245
|
+
const config = {};
|
|
246
|
+
data.list?.forEach(item => {
|
|
247
|
+
config[item.configCode] = item.configValue;
|
|
248
|
+
if (item.fileName) {
|
|
249
|
+
config[item.configCode] = window.location.origin + '/ufil' + item.configValue;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const env = process.env.NODE_ENV;
|
|
253
|
+
const title = data.list?.find(f => f.configCode === `${env}Title` || f.configCode === 'title')?.configValue;
|
|
254
|
+
config['title'] = title || 'U-DP';
|
|
255
|
+
sysConfig.value = config;
|
|
256
|
+
setFavicon();
|
|
257
|
+
storageLocal.setItem('kSysConfig', config);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const setFavicon = () => {
|
|
262
|
+
let favicon = document.querySelector('link[rel="icon"]') as HTMLElement;
|
|
263
|
+
// console.log('app', favicon)
|
|
264
|
+
if (favicon !== null) {
|
|
265
|
+
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
266
|
+
} else {
|
|
267
|
+
favicon = document.createElement('link');
|
|
268
|
+
favicon['rel'] = 'icon';
|
|
269
|
+
favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
|
|
270
|
+
document.head.appendChild(favicon);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
onBeforeMount(() => {
|
|
275
|
+
getSysConfig();
|
|
276
|
+
});
|
|
277
|
+
</script>
|
|
278
|
+
|
|
279
|
+
<style scoped>
|
|
280
|
+
@import url('@/style/login2.css');
|
|
281
|
+
|
|
282
|
+
/* .translation {
|
|
283
|
+
::v-deep(.el-dropdown-menu__item) {
|
|
284
|
+
padding: 5px 40px;
|
|
285
|
+
}
|
|
286
|
+
} */
|
|
287
|
+
|
|
288
|
+
.check-zh {
|
|
289
|
+
position: absolute;
|
|
290
|
+
left: 20px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.check-en {
|
|
294
|
+
position: absolute;
|
|
295
|
+
left: 20px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
:deep(.el-input-group__append, .el-input-group__prepend) {
|
|
299
|
+
padding: 0;
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2026-01-05 17:14:44
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2026-03-20 13:31:02
|
|
6
|
+
* @FilePath: \udp-front\packages\udp-core\src\views\uhome\components\dynamic-component.vue
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
-->
|
|
1
9
|
<template>
|
|
2
10
|
<remoteComponent />
|
|
3
11
|
</template>
|
|
@@ -59,7 +67,8 @@ const options = {
|
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
const remoteComponent = defineAsyncComponent(async () => {
|
|
62
|
-
const
|
|
70
|
+
const url = `${window.origin}${domain ? '/' + domain : ''}${props.data.url}.vue`;
|
|
71
|
+
const res = await loadModule(url, options);
|
|
63
72
|
console.log('res', res);
|
|
64
73
|
return res;
|
|
65
74
|
});
|
|
@@ -102,7 +102,7 @@ export default { name: 'LoginView' };
|
|
|
102
102
|
</script>
|
|
103
103
|
|
|
104
104
|
<script setup lang="ts">
|
|
105
|
-
import { ref, reactive, onBeforeMount } from 'vue';
|
|
105
|
+
import { ref, reactive, onBeforeMount, onMounted } from 'vue';
|
|
106
106
|
import { useRouter } from 'vue-router';
|
|
107
107
|
import { useI18n } from 'vue-i18n';
|
|
108
108
|
// import io from 'socket.io-client';
|
|
@@ -210,9 +210,7 @@ const onLogin = async () => {
|
|
|
210
210
|
useSystemStoreHook().setSessionKey(data);
|
|
211
211
|
cacheToken(data);
|
|
212
212
|
cookies.set(kLOGINER, username);
|
|
213
|
-
|
|
214
|
-
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
215
|
-
}
|
|
213
|
+
|
|
216
214
|
// initSocket(username);
|
|
217
215
|
await delay(200);
|
|
218
216
|
// 执行登录成功后的函数
|
|
@@ -312,6 +310,10 @@ const getSysConfig = async () => {
|
|
|
312
310
|
|
|
313
311
|
dataThemeChange(overallStyle.value);
|
|
314
312
|
|
|
313
|
+
onMounted(() => {
|
|
314
|
+
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
315
|
+
});
|
|
316
|
+
|
|
315
317
|
onBeforeMount(() => {
|
|
316
318
|
getSysConfig();
|
|
317
319
|
// cookies.addPrefix('sitzone-mes');
|