@utogether/udp-core 2.0.0-beta.25 → 2.0.0-beta.27

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 (164) hide show
  1. package/dist/403-gdcH0-Bo.js +65 -0
  2. package/dist/404-Se2SF97M.js +65 -0
  3. package/dist/500-B6j9AqLo.js +67 -0
  4. package/dist/AuthorityInfo-CQ8ydZvr.js +4 -0
  5. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-C4NRvS8p.js +100 -0
  6. package/dist/AuthorityPanel-lVnZ5bce.js +4 -0
  7. package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-nsfhDlvV.js +113 -0
  8. package/dist/Company-BzSVBSC4.js +25 -0
  9. package/dist/CompanyPanel-DBjZB4aJ.js +204 -0
  10. package/dist/DataSet-iBHzs75s.js +147 -0
  11. package/dist/Department-BkgseHo8.js +25 -0
  12. package/dist/DepartmentPanel-Sen93_2M.js +249 -0
  13. package/dist/DesignPanel-pqDcwaFC.js +4 -0
  14. package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BjtYyEw7.js +1013 -0
  15. package/dist/DictView-CJLG4LlE.js +110 -0
  16. package/dist/InvOrganization-D0Jq1IAa.js +74 -0
  17. package/dist/Org-CO_1WT39.js +39 -0
  18. package/dist/Preview-DLI4Bwel.js +48 -0
  19. package/dist/ReportDefine-Cw46OnJ_.js +10 -0
  20. package/dist/ReportDesign-D4sHTXT7.js +165 -0
  21. package/dist/ReportQuery-DtOCvQSN.js +74 -0
  22. package/dist/ReportQueryFrom-QjL-ETPq.js +4 -0
  23. package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-Dj9ne87n.js +177 -0
  24. package/dist/ReportTemplate-BxAgc_Aj.js +161 -0
  25. package/dist/Role-Df77BBD-.js +25 -0
  26. package/dist/RoleAssign-BrunouML.js +26 -0
  27. package/dist/RolePanel-DSVwqhiD.js +4 -0
  28. package/dist/RolePanel-HLA7XBlN.js +4 -0
  29. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CKlbqRa5.js +132 -0
  30. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CN0rUxKz.js +152 -0
  31. package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-D_FeSXKv.js +99 -0
  32. package/dist/Staff-BeL1xcRf.js +26 -0
  33. package/dist/StaffInfo-CIfnltyX.js +4 -0
  34. package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-DbLFwWfG.js +107 -0
  35. package/dist/StaffPanel-BV2CHWac.js +4 -0
  36. package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-CvT-Vp2G.js +153 -0
  37. package/dist/SysUser-DPfNvthk.js +15 -0
  38. package/dist/SysUserPanel-CoLKYlQE.js +4 -0
  39. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-lcO3Cjbq.js +353 -0
  40. package/dist/SystemMenu-sdj1dRDA.js +156 -0
  41. package/dist/UserInfo-CTX4hhFl.js +4 -0
  42. package/dist/UserInfo.vue_vue_type_style_index_0_lang-ClhCd_8z.js +160 -0
  43. package/dist/await-to-js.es5-Bv3Eu4mi.js +10 -0
  44. package/dist/childView-BDmWwJO5.js +4 -0
  45. package/dist/childView-Dx3ACtHa.js +4 -0
  46. package/dist/childView.vue_vue_type_style_index_0_lang-CfKq_0FN.js +183 -0
  47. package/dist/childView.vue_vue_type_style_index_0_lang-DxZNtkhd.js +143 -0
  48. package/dist/code-rule-cvN4gYC_.js +148 -0
  49. package/dist/core.es.js +24 -6
  50. package/dist/cron-task-B0TkxFdp.js +135 -0
  51. package/dist/flow-task-PoDnE_kE.js +10 -0
  52. package/dist/frameView-5cy5BSgS.js +43 -0
  53. package/dist/img/minicolors.png +0 -0
  54. package/dist/index-C5WRTwvI.js +3006 -0
  55. package/dist/layout-home-DrARg-3o.js +232 -0
  56. package/dist/layoutView-25v_ngk5.js +3191 -0
  57. package/dist/log-in-Bmz5Uhbt.js +116 -0
  58. package/dist/log-out-B-8m3oNj.js +130 -0
  59. package/dist/login-Cmp2RvvW.js +217 -0
  60. package/dist/login-log-CVvRgZSu.js +70 -0
  61. package/dist/lov-view-BATtzw2X.js +99 -0
  62. package/dist/menuInfo-BIvrE7nm.js +4 -0
  63. package/dist/menuInfo.vue_vue_type_style_index_0_lang-B6USomit.js +360 -0
  64. package/dist/pda-app-CzHVyeEa.js +707 -0
  65. package/dist/redirect-DTz8GSnv.js +15 -0
  66. package/dist/resource-Y5lGB38n.js +97 -0
  67. package/dist/su-welcome-CXA6OzBw.js +878 -0
  68. package/dist/sys-config-CqO03LeC.js +385 -0
  69. package/dist/udp-core.css +1 -2
  70. package/dist/useNav-C-rCgubt.js +84 -0
  71. package/dist/utogether-MlnyYtNS.js +4 -0
  72. package/dist/wecom-push-B75FLee5.js +70 -0
  73. package/index.ts +3 -2
  74. package/package.json +1 -1
  75. package/src/App.vue +79 -73
  76. package/src/api/index.ts +1 -1
  77. package/src/components/SuQrcode/src/index.tsx +231 -236
  78. package/src/components/udp/grid/index.vue +9 -11
  79. package/src/components/udp/utils.ts +420 -414
  80. package/src/layout/components/lay-panel/index.vue +2 -6
  81. package/src/layout/components/lay-search/components/SearchModal.vue +7 -3
  82. package/src/main.ts +111 -110
  83. package/src/router/index.ts +156 -187
  84. package/src/router/utils.ts +2 -3
  85. package/src/store/modules/system.ts +7 -0
  86. package/src/style/vxetable.scss +372 -364
  87. package/src/utils/authority/index.ts +46 -29
  88. package/src/utils/udp/http/index.ts +115 -64
  89. package/src/utils/udp/http/types.d.ts +15 -14
  90. package/src/views/login/login-view.vue +280 -301
  91. package/src/views/organization/department/DepartmentPanel.vue +3 -4
  92. package/src/views/system/sys/sys-config.vue +344 -344
  93. package/src/views/uhome/components/home-todo.vue +179 -178
  94. package/src/views/ulogin/login.vue +8 -41
  95. package/tsconfig.json +2 -3
  96. package/types/global.d.ts +234 -234
  97. package/vite.config.ts +2 -1
  98. package/dist/403-QwBKrRZE.js +0 -72
  99. package/dist/404-Cr7MbzNV.js +0 -72
  100. package/dist/500-B7kCOeIA.js +0 -77
  101. package/dist/AuthorityInfo-Dwml2K4S.js +0 -91
  102. package/dist/AuthorityPanel-DzPhsPpa.js +0 -98
  103. package/dist/Company-BhOlvl7Q.js +0 -21
  104. package/dist/CompanyPanel-ByhY5-Sq.js +0 -199
  105. package/dist/DataSet-CuGZcKC-.js +0 -141
  106. package/dist/Department-QvngN63N.js +0 -21
  107. package/dist/DepartmentPanel-BCXqC39J.js +0 -2
  108. package/dist/DepartmentPanel-DntGycxr.js +0 -242
  109. package/dist/DesignPanel-BMN4DZ0R.js +0 -1196
  110. package/dist/DictView-ERFqZ5VD.js +0 -100
  111. package/dist/File-WJXjGYxr.js +0 -89
  112. package/dist/InvOrganization-BwMmD8Ua.js +0 -76
  113. package/dist/Org-HgnOWubi.js +0 -76
  114. package/dist/Preview-CVZdnHB1.js +0 -45
  115. package/dist/ReIcon-DecitXmg.js +0 -413
  116. package/dist/ReportDefine-BgLM-Rjk.js +0 -10
  117. package/dist/ReportDesign-CjfTyyy_.js +0 -158
  118. package/dist/ReportQuery-CP-E0Puv.js +0 -101
  119. package/dist/ReportQueryFrom-D7SPPAps.js +0 -198
  120. package/dist/ReportTemplate-DE25zc1f.js +0 -162
  121. package/dist/Role-K7v_ZhFE.js +0 -21
  122. package/dist/RoleAssign-C16fjLaX.js +0 -22
  123. package/dist/RolePanel-CV-xPlYJ.js +0 -176
  124. package/dist/RolePanel-DPCe9k8f.js +0 -131
  125. package/dist/ScrollPanel-DW30pGz1.js +0 -88
  126. package/dist/Staff-w2ly4qd0.js +0 -22
  127. package/dist/StaffInfo-DPDRpz6F.js +0 -149
  128. package/dist/StaffPanel-DI1eTTp9.js +0 -143
  129. package/dist/SysUser-BMTX1cJM.js +0 -12
  130. package/dist/SysUserPanel-xwZdVjdp.js +0 -365
  131. package/dist/SystemMenu-TXhiQZVm.js +0 -154
  132. package/dist/UserInfo-JQqw8FMT.js +0 -194
  133. package/dist/_plugin-vue_export-helper-C6QCLu9I.js +0 -8
  134. package/dist/api-BFNxcxSN.js +0 -30
  135. package/dist/authority-Bi6BGB5B.js +0 -20
  136. package/dist/await-to-js.es5-DkWYmPXW.js +0 -10
  137. package/dist/childView-Bk8OD9bV.js +0 -181
  138. package/dist/childView-CyrcwshT.js +0 -184
  139. package/dist/code-rule-QFrhqFrW.js +0 -151
  140. package/dist/contant-Q77dU_V3.js +0 -4
  141. package/dist/cron-task-BpUDKEAU.js +0 -131
  142. package/dist/flow-task-DAc2NrDU.js +0 -11
  143. package/dist/frameView-Di0zJZUR.js +0 -39
  144. package/dist/layout-home-BVp7vYLR.js +0 -239
  145. package/dist/layoutView-DFUjrqAS.js +0 -2662
  146. package/dist/log-in-BrNB0mLz.js +0 -117
  147. package/dist/log-out-dYfqvzy6.js +0 -111
  148. package/dist/login-BdCDnuXL.js +0 -233
  149. package/dist/login-log-CJak-ANA.js +0 -79
  150. package/dist/lov-view-DkmG4K57.js +0 -95
  151. package/dist/menuInfo-kp2wNYOp.js +0 -346
  152. package/dist/mitt-CQgI7DYU.js +0 -27
  153. package/dist/pda-app-CA7YI37u.js +0 -589
  154. package/dist/redirect-N0k4tImU.js +0 -16
  155. package/dist/resource-CfQTHFcs.js +0 -94
  156. package/dist/router-CeluSGiD.js +0 -1531
  157. package/dist/su-welcome-JeiovGpe.js +0 -799
  158. package/dist/sys-config-Ddb3vBpK.js +0 -316
  159. package/dist/udp-core-Dhm-BlAs.js +0 -2032
  160. package/dist/useDataThemeChange-BCy8JBG7.js +0 -226
  161. package/dist/useNav-DY8FkltH.js +0 -106
  162. package/dist/utogether-l7JXs4Lv.js +0 -4
  163. package/dist/water-mark-WDQZ9YqB.js +0 -119
  164. package/dist/wecom-push-kWkAVRCj.js +0 -77
@@ -1,301 +1,280 @@
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 to from 'await-to-js';
95
+
96
+ import Motion from './utils/motion';
97
+ import { loginRules } from './utils/rule';
98
+ import TypeIt from '@/components/SuTypeit';
99
+ import { useRenderIcon } from '@/components/ReIcon/src/hooks';
100
+ // import { useTranslationLang } from '@/layout/hooks/useTranslationLang';
101
+ import { useLayout } from '@/layout/hooks/useLayout';
102
+
103
+ import { useSystemStoreHook } from '@/store/modules/system';
104
+
105
+ import { getServiceApi } from '../../api';
106
+ import { userMonitor } from '../../api/user';
107
+
108
+ import Lock from '@iconify-icons/ri/lock-fill';
109
+ import User from '@iconify-icons/ri/user-3-fill';
110
+
111
+ defineOptions({ name: 'LoginView' });
112
+
113
+ interface IRSAPublic {
114
+ publicKeyExponent: string;
115
+ publicKeyModulus: string;
116
+ requestKey: string;
117
+ }
118
+
119
+ const router = useRouter();
120
+
121
+ // const bgStyle = ref({});
122
+ const sysConfig = ref({});
123
+ const loading = ref(false);
124
+ const ruleFormRef = ref<FormInstance>();
125
+
126
+ const serviceApi = getServiceApi();
127
+
128
+ const { initStorage } = useLayout();
129
+ initStorage();
130
+ // const { dataTheme, dataThemeChange } = useDataThemeChange();
131
+ // dataThemeChange();
132
+ // const { getDropdownItemStyle, getDropdownItemClass } = useNav();
133
+ // const { locale, translationCh, translationEn } = useTranslationLang();
134
+
135
+ const ruleForm = reactive({
136
+ username: '',
137
+ passWord: ''
138
+ });
139
+
140
+ const publicRSA: IRSAPublic = reactive({
141
+ publicKeyExponent: '10001',
142
+ publicKeyModulus:
143
+ 'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
144
+ requestKey: ''
145
+ });
146
+
147
+ const onLogin = async (formEl: FormInstance | undefined) => {
148
+ if (!formEl) return;
149
+ await formEl.validate(valid => {
150
+ if (valid) {
151
+ loading.value = true;
152
+ const { username, passWord } = ruleForm;
153
+
154
+ // @ts-ignore
155
+ setMaxDigits(200);
156
+ // @ts-ignore
157
+ const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
158
+ // @ts-ignore
159
+ const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
160
+ const param = {
161
+ username,
162
+ password,
163
+ requestKey: publicRSA.requestKey,
164
+ domain: window.location.origin
165
+ };
166
+ serviceApi
167
+ .post('/uath/login', param)
168
+ .then(async (data: IResponseData) => {
169
+ successMessage(`👏 恭喜,成功登录${sysConfig.value['title']}!!!🎉`);
170
+ useSystemStoreHook().setSessionKey(data);
171
+ cacheToken(data);
172
+ cookies.set('loginer', username);
173
+ await delay(300);
174
+ router.push('/');
175
+ userMonitor(username);
176
+ })
177
+ .finally(() => {
178
+ loading.value = false;
179
+ });
180
+ }
181
+ });
182
+ };
183
+
184
+ /**
185
+ * @description: 缓存token
186
+ * @param {*} token token数据
187
+ * @return {*}
188
+ */
189
+ const cacheToken = token => {
190
+ const { access_token, expires_in, refresh_token } = token;
191
+ const cache = {
192
+ accessToken: access_token,
193
+ refreshToken: refresh_token,
194
+ expires: Date.now() + expires_in * 1000
195
+ };
196
+ const kTOKENKEY = 'authorized-token';
197
+
198
+ cookies.set('kCookies_token', token.access_token);
199
+ const dataString = JSON.stringify(cache);
200
+ expires_in > 0 ? cookies.set(kTOKENKEY, dataString) : cookies.set(kTOKENKEY, dataString);
201
+ };
202
+
203
+ /** 使用公共函数,避免`removeEventListener`失效 */
204
+ function onkeypress({ code }: KeyboardEvent) {
205
+ if (['Enter', 'NumpadEnter'].includes(code)) {
206
+ onLogin(ruleFormRef.value);
207
+ }
208
+ }
209
+
210
+ onMounted(() => {
211
+ window.document.addEventListener('keypress', onkeypress);
212
+ });
213
+
214
+ onBeforeUnmount(() => {
215
+ window.document.removeEventListener('keypress', onkeypress);
216
+ });
217
+ /**
218
+ * @description: 获取系统配置
219
+ * @return {*}
220
+ */
221
+ const getSysConfig = async () => {
222
+ const [err, data]: [Error, any] = await to(serviceApi.get('/upfm/v1/sysConfig', {}));
223
+ if (!err) {
224
+ const config = {};
225
+ data.list?.forEach(item => {
226
+ config[item.configCode] = item.configValue;
227
+ if (item.fileName) {
228
+ config[item.configCode] = window.location.origin + '/ufil' + item.configValue;
229
+ }
230
+ });
231
+ const env = process.env.NODE_ENV;
232
+ const title = data.list?.find(f => f.configCode === `${env}Title` || f.configCode === 'title')?.configValue;
233
+ config['title'] = title || 'U-DP';
234
+ sysConfig.value = config;
235
+ setFavicon();
236
+ storageLocal.setItem('kSysConfig', config);
237
+ }
238
+ };
239
+
240
+ const setFavicon = () => {
241
+ let favicon = document.querySelector('link[rel="icon"]') as HTMLElement;
242
+ // console.log('app', favicon)
243
+ if (favicon !== null) {
244
+ favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
245
+ } else {
246
+ favicon = document.createElement('link');
247
+ favicon['rel'] = 'icon';
248
+ favicon['href'] = sysConfig.value['favicon'] || '../../../public/favicon.ico';
249
+ document.head.appendChild(favicon);
250
+ }
251
+ };
252
+
253
+ onBeforeMount(() => {
254
+ getSysConfig();
255
+ });
256
+ </script>
257
+
258
+ <style scoped>
259
+ @import url('@/style/login2.css');
260
+
261
+ /* .translation {
262
+ ::v-deep(.el-dropdown-menu__item) {
263
+ padding: 5px 40px;
264
+ }
265
+ } */
266
+
267
+ .check-zh {
268
+ position: absolute;
269
+ left: 20px;
270
+ }
271
+
272
+ .check-en {
273
+ position: absolute;
274
+ left: 20px;
275
+ }
276
+
277
+ :deep(.el-input-group__append, .el-input-group__prepend) {
278
+ padding: 0;
279
+ }
280
+ </style>
@@ -113,15 +113,14 @@
113
113
 
114
114
  <script setup lang="ts">
115
115
  import { useI18n } from 'vue-i18n';
116
- import { reactive, watch, inject } from 'vue';
117
- import { templateRef } from '@vueuse/core';
116
+ import { reactive, watch, inject, ref } from 'vue';
118
117
  import { clone } from 'xe-utils';
119
118
  import to from 'await-to-js';
120
119
  import { VxeUI } from 'vxe-table';
121
120
  import { successMessage, warnMessage } from '@utogether/utils';
122
121
  import { useSystemStoreHook } from '../../../store/modules/system';
123
122
  import { getServiceApi } from '../../../api';
124
- import hasAuthority from '../../../utils/authority';
123
+ import { hasAuthority } from '../../../utils/authority';
125
124
 
126
125
  const data = reactive<IRecord>({
127
126
  record: {},
@@ -186,7 +185,7 @@ const handleEdit = dataStatus => {
186
185
  data.dialogFormVisible = true;
187
186
  };
188
187
 
189
- const xForm = templateRef<any>('xForm', null);
188
+ const xForm = ref<any>('xForm');
190
189
  const handleComfirm = () => {
191
190
  xForm.value.validate(async valid => {
192
191
  if (!valid) {