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

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 (100) hide show
  1. package/dist/{403-gdcH0-Bo.js → 403-CyoOD-Ik.js} +1 -1
  2. package/dist/{404-Se2SF97M.js → 404-Ch_OHTw0.js} +1 -1
  3. package/dist/{500-B6j9AqLo.js → 500-Cf9am7HK.js} +1 -1
  4. package/dist/{AuthorityInfo-CQ8ydZvr.js → AuthorityInfo-BJ427cqG.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-C4NRvS8p.js → AuthorityInfo.vue_vue_type_style_index_0_lang-D9y7AwbB.js} +11 -12
  6. package/dist/{Company-BzSVBSC4.js → Company-qo-lKPkv.js} +3 -3
  7. package/dist/{CompanyPanel-DBjZB4aJ.js → CompanyPanel-DkKWAKvY.js} +7 -7
  8. package/dist/{Department-BkgseHo8.js → Department-CHUQByKX.js} +3 -3
  9. package/dist/{DepartmentPanel-Sen93_2M.js → DepartmentPanel-C742dfOO.js} +27 -28
  10. package/dist/{DesignPanel-pqDcwaFC.js → DesignPanel-D9oE5R7m.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BjtYyEw7.js → DesignPanel.vue_vue_type_style_index_0_lang-hYldVEbo.js} +192 -108
  12. package/dist/{DictView-CJLG4LlE.js → DictView-CrFXprP9.js} +1 -1
  13. package/dist/{InvOrganization-D0Jq1IAa.js → InvOrganization-Cz8SzIgs.js} +6 -7
  14. package/dist/{Org-CO_1WT39.js → Org-Bzt6yKox.js} +9 -10
  15. package/dist/{Preview-DLI4Bwel.js → Preview-jonigfMQ.js} +1 -1
  16. package/dist/{ReportDefine-Cw46OnJ_.js → ReportDefine-BpiM5Ovq.js} +1 -1
  17. package/dist/{ReportDesign-D4sHTXT7.js → ReportDesign-fp09cXJ7.js} +24 -25
  18. package/dist/{ReportQuery-DtOCvQSN.js → ReportQuery-52ZP1PYP.js} +1 -1
  19. package/dist/{ReportQueryFrom-QjL-ETPq.js → ReportQueryFrom-DSYavJb1.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-Dj9ne87n.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-DBGYEp0u.js} +4 -4
  21. package/dist/{ReportTemplate-BxAgc_Aj.js → ReportTemplate-CA_UW0eD.js} +3 -3
  22. package/dist/{Role-Df77BBD-.js → Role-DqOt8Bk0.js} +3 -3
  23. package/dist/{RoleAssign-BrunouML.js → RoleAssign-BdxhefhQ.js} +3 -3
  24. package/dist/{RolePanel-HLA7XBlN.js → RolePanel-2gZ3H0ET.js} +1 -1
  25. package/dist/{RolePanel-DSVwqhiD.js → RolePanel-BsNd0svJ.js} +1 -1
  26. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CN0rUxKz.js → RolePanel.vue_vue_type_script_setup_true_lang-DLOwgF99.js} +9 -9
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CKlbqRa5.js → RolePanel.vue_vue_type_script_setup_true_lang-DmzD9kab.js} +26 -27
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-D_FeSXKv.js → ScrollPanel.vue_vue_type_style_index_0_lang-B9ptUMeI.js} +7 -7
  29. package/dist/{Staff-BeL1xcRf.js → Staff-D3L8fEoY.js} +3 -3
  30. package/dist/{StaffInfo-CIfnltyX.js → StaffInfo-DYRw6ZYJ.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DbLFwWfG.js → StaffInfo.vue_vue_type_script_setup_true_lang-xqEOQnMs.js} +1 -1
  32. package/dist/{StaffPanel-BV2CHWac.js → StaffPanel-DkrNH6Px.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-CvT-Vp2G.js → StaffPanel.vue_vue_type_script_setup_true_lang-BPBMnliy.js} +8 -9
  34. package/dist/{SysUser-DPfNvthk.js → SysUser-Bl1-cIpJ.js} +2 -2
  35. package/dist/{SysUserPanel-CoLKYlQE.js → SysUserPanel-yxNLaBwt.js} +1 -1
  36. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-lcO3Cjbq.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BDcsgSl5.js} +11 -12
  37. package/dist/{SystemMenu-sdj1dRDA.js → SystemMenu-C4_Arn12.js} +9 -10
  38. package/dist/{UserInfo-CTX4hhFl.js → UserInfo-QcNwJCUR.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-ClhCd_8z.js → UserInfo.vue_vue_type_style_index_0_lang-DLIeUphX.js} +5 -6
  40. package/dist/{childView-BDmWwJO5.js → childView-B23DEO2u.js} +1 -1
  41. package/dist/{childView-Dx3ACtHa.js → childView-saDZQv9x.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang-CfKq_0FN.js → childView.vue_vue_type_style_index_0_lang-RsKR6CAC.js} +14 -15
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-DxZNtkhd.js → childView.vue_vue_type_style_index_0_lang-ZFEfavUY.js} +11 -12
  44. package/dist/{code-rule-cvN4gYC_.js → code-rule-2_Ihx_by.js} +12 -13
  45. package/dist/core.es.js +21 -19
  46. package/dist/{cron-task-B0TkxFdp.js → cron-task-BFOPJQIk.js} +3 -4
  47. package/dist/{frameView-5cy5BSgS.js → frameView-f7Ya0Knj.js} +1 -1
  48. package/dist/img/minicolors.png +0 -0
  49. package/dist/{index-C5WRTwvI.js → index-BpdTDaTk.js} +811 -604
  50. package/dist/{layout-home-DrARg-3o.js → layout-home-v3DPJ7rB.js} +12 -13
  51. package/dist/{layoutView-25v_ngk5.js → layoutView-DZHoQDH1.js} +186 -187
  52. package/dist/{log-in-Bmz5Uhbt.js → log-in-BPAMJTwH.js} +4 -5
  53. package/dist/{log-out-B-8m3oNj.js → log-out-DZACF0jg.js} +8 -9
  54. package/dist/{login-Cmp2RvvW.js → login-B8cwozax.js} +22 -23
  55. package/dist/{lov-view-BATtzw2X.js → lov-view-Ba7Y7xy0.js} +4 -5
  56. package/dist/{menuInfo-BIvrE7nm.js → menuInfo-BpRKFYK8.js} +1 -1
  57. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-B6USomit.js → menuInfo.vue_vue_type_style_index_0_lang-DJ5sUC6m.js} +17 -18
  58. package/dist/{pda-app-CzHVyeEa.js → pda-app-C0jJecrL.js} +7 -8
  59. package/dist/{resource-Y5lGB38n.js → resource-BG22Cw4P.js} +4 -4
  60. package/dist/su-welcome-DaxhbrC6.js +879 -0
  61. package/dist/{sys-config-CqO03LeC.js → sys-config-CG2fMtak.js} +22 -23
  62. package/dist/udp-core.css +1 -1
  63. package/dist/{useNav-C-rCgubt.js → useNav-_u2UAQWk.js} +24 -24
  64. package/index.ts +54 -51
  65. package/package.json +21 -21
  66. package/src/api/http.ts +10 -4
  67. package/src/api/index.ts +51 -51
  68. package/src/api/user.ts +64 -64
  69. package/src/components/udp/content/index.vue +93 -93
  70. package/src/components/udp/form-upload/form-upload.vue +496 -496
  71. package/src/components/udp/grid/index.vue +643 -544
  72. package/src/components/udp/index.ts +2 -1
  73. package/src/components/udp/modal-form/index.vue +326 -0
  74. package/src/components/udp/utils.ts +420 -420
  75. package/src/layout/components/lay-navbar/index.vue +240 -240
  76. package/src/layout/components/lay-search/components/SearchModal.vue +185 -185
  77. package/src/layout/components/lay-sidebar/mixNav.vue +261 -261
  78. package/src/layout/components/lay-sidebar/sidebarItem.vue +199 -195
  79. package/src/layout/components/lay-sidebar/vertical.vue +92 -92
  80. package/src/layout/layoutView.vue +1 -0
  81. package/src/main.ts +111 -111
  82. package/src/plugins/i18n/zh.ts +5 -1
  83. package/src/plugins/vxe-table/index.ts +116 -116
  84. package/src/router/index.ts +158 -156
  85. package/src/router/utils.ts +434 -430
  86. package/src/store/modules/permission.ts +1 -1
  87. package/src/store/modules/system.ts +193 -193
  88. package/src/style/print-lock.css +380 -375
  89. package/src/style/suprint.css +990 -985
  90. package/src/utils/authority/index.ts +46 -46
  91. package/src/utils/dataFormat/index.ts +309 -222
  92. package/src/utils/udp/http/index.ts +19 -11
  93. package/src/views/uhome/components/home-todo.vue +15 -3
  94. package/src/views/uhome/dynamic-card.vue +31 -31
  95. package/src/views/uhome/su-welcome.vue +310 -310
  96. package/src/views/ulogin/login.vue +292 -292
  97. package/src/views/urpt/design/DesignPanel.vue +538 -507
  98. package/src/views/urpt/design/print-data.ts +39 -59
  99. package/dist/await-to-js.es5-Bv3Eu4mi.js +0 -10
  100. package/dist/su-welcome-CXA6OzBw.js +0 -878
@@ -1,292 +1,292 @@
1
- <template>
2
- <!-- <img :src="bg" class="wave" /> -->
3
- <div :key="refreshKey" class="login-container" :style="bgStyle">
4
- <div v-if="!bgStyle.backgroundImage" class="img pr-24">
5
- <img :src="welcome" />
6
- </div>
7
- <div class="login-box">
8
- <div class="login-form">
9
- <h2 v-motion :initial="{ opacity: 0, y: 100 }" :enter="{ opacity: 1, y: 0, transition: { delay: 100 } }">
10
- {{ sysConfig['title'] }}
11
- </h2>
12
- <div
13
- v-motion
14
- class="input-group user focus"
15
- :initial="{ opacity: 0, y: 100 }"
16
- :enter="{ opacity: 1, y: 0, transition: { delay: 200 } }"
17
- >
18
- <div class="icon">
19
- <i class="ri-user-fill ri-lg" />
20
- </div>
21
- <div>
22
- <i class="ri-logout-box-line" />
23
- <h5>{{ $t('message.udp.loginAccount') }}</h5>
24
- <input
25
- v-model.trim="contextInfo.username"
26
- v-focus
27
- type="text"
28
- class="input"
29
- @blur="onUserBlur"
30
- @keyup.enter="onLogin"
31
- />
32
- </div>
33
- </div>
34
- <div
35
- v-motion
36
- class="input-group pwd focus"
37
- :initial="{ opacity: 0, y: 100 }"
38
- :enter="{
39
- opacity: 1,
40
- y: 0,
41
- transition: { delay: 300 }
42
- }"
43
- >
44
- <div class="icon">
45
- <i class="ri-lock-fill ri-lg" />
46
- </div>
47
- <div>
48
- <h5>{{ $t('message.udp.password') }}</h5>
49
- <input
50
- v-model.trim="contextInfo.passWord"
51
- type="password"
52
- class="input"
53
- @blur="onPwdBlur"
54
- @keyup.enter="onLogin"
55
- />
56
- </div>
57
- </div>
58
- <button
59
- v-motion
60
- class="btn"
61
- :initial="{ opacity: 0, y: 10 }"
62
- :enter="{ opacity: 1, y: 0, transition: { delay: 400 } }"
63
- :disabled="loading"
64
- :class="{ loading: loading }"
65
- @click="onLogin"
66
- >
67
- {{ $t('message.udp.login') }}
68
- </button>
69
- </div>
70
- </div>
71
- <div v-if="sysConfig.techSupport === 'Y'" class="absolute flex justify-center w-full font-bold bottom-1">
72
- <img :src="utogether" class="h-10!" style="height: 40px" />
73
- <span class="flex flex-row justify-center" style="width: 300px">
74
- <span style="font-size: 0; text-align: center">
75
- <a
76
- href="http://www.u-together.cn/"
77
- target="_blank"
78
- class="inline-block!"
79
- style="margin-bottom: -5px; font-size: 17px; color: #fff; mix-blend-mode: difference"
80
- :style="{ color: sysConfig.baseColor || '#FFF' }"
81
- >
82
- 深圳友聚信息技术有限公司
83
- </a>
84
- <a
85
- href="http://www.u-together.cn/"
86
- target="_blank"
87
- class="inline-block!"
88
- style="font-size: 12px; color: #fff; mix-blend-mode: difference"
89
- :style="{ color: sysConfig.baseColor || '#FFF' }"
90
- >
91
- SHENZHEN U-TOGETHER CO. LTD
92
- </a>
93
- </span>
94
- <span class="flex items-center text-white" style="width: 75px; font-size: 10px">技术支持</span>
95
- </span>
96
- </div>
97
- </div>
98
- </template>
99
-
100
- <script lang="ts">
101
- export default { name: 'LoginView' };
102
- </script>
103
-
104
- <script setup lang="ts">
105
- import { ref, reactive, onBeforeMount } from 'vue';
106
- import { useRouter } from 'vue-router';
107
- import { useI18n } from 'vue-i18n';
108
- // import io from 'socket.io-client';
109
- import { useFavicon } from '@vueuse/core';
110
- import { isEmpty } from 'xe-utils';
111
- import { removeClass, storageLocal, errorMessage, cookies, delay } from '@utogether/utils';
112
- import to from 'await-to-js';
113
- import CryptoJS from 'crypto-js';
114
- import { useSystemStoreHook } from '../../store/modules/system';
115
- import { useLayout } from '../../layout/hooks/useLayout';
116
- import { useDataThemeChange } from '../../layout/hooks/useDataThemeChange';
117
- import { getBaseURL, getServiceApi } from '../../api';
118
- import { userMonitor } from '../../api/user';
119
- import { kTOKEN, kCKTOKEN, kLOGINER, kSYSCONFIG, kCRYPTO, kPASSWORD } from '../../contant';
120
- import { onLogined, onBeforeLogined } from '../../utils/lifecycle';
121
- import utogether from '../../assets/images/utogether.png';
122
- import welcome from '../../assets/images/welcome.png';
123
-
124
- interface IContextProps {
125
- username: string;
126
- passWord: string;
127
- verify: number | null;
128
- svg: any;
129
- domain: string;
130
- }
131
- interface IRSAPublic {
132
- publicKeyExponent: string;
133
- publicKeyModulus: string;
134
- requestKey: string;
135
- }
136
- const contextInfo: IContextProps = reactive({
137
- username: '',
138
- passWord: '',
139
- requestKey: '',
140
- verify: null,
141
- svg: null,
142
- domain: ''
143
- });
144
- const publicRSA: IRSAPublic = reactive({
145
- publicKeyExponent: '10001',
146
- publicKeyModulus:
147
- 'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
148
- requestKey: ''
149
- });
150
-
151
- const bgStyle = ref({
152
- backgroundImage: '',
153
- backgroundRepeat: 'no-repeat',
154
- backgroundPosition: 'center'
155
- });
156
- const refreshKey = ref(0);
157
-
158
- const sysConfig = ref<IRecord>({});
159
- const router = useRouter();
160
- const { t } = useI18n();
161
- const serviceApi = getServiceApi();
162
- // const { $config } = useGlobal();
163
-
164
- const { initStorage } = useLayout();
165
- const { overallStyle, dataThemeChange } = useDataThemeChange();
166
- initStorage();
167
-
168
- const loading = ref(false);
169
- // 登录
170
- const onLogin = async () => {
171
- // return;
172
- const { username, passWord, verify } = contextInfo;
173
- if (isEmpty(username) || isEmpty(passWord)) {
174
- return errorMessage(t('message.tip.loginFailure'));
175
- }
176
- // @ts-ignore
177
- setMaxDigits(200);
178
- // @ts-ignore
179
- const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
180
- // @ts-ignore
181
- const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
182
- // const key = new JSEencrypt();
183
- // key.setPublicKey(
184
- // '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChJwirJjZ+FxG9dn9rsfKa+9hTgBhXI9e0kiMOJWfJXPVxjsp0XaBkNADKYZ++7Ikt9hq+H3GtO4ItB27YMQgMU3gu34wGJ+6VxX4r7hL+VdorPK3sWZR6dczMu/Nvs7eByTtL9RSJeJ8cCEn5AjoW7HC+9BpQR4XhCCtvE1iOKQIDAQAB-----END PUBLIC KEY-----'
185
- // );
186
- // const password = key.encrypt(passWord);
187
- // // console.log('password1 ===', password1);
188
- // console.log('password ===', password);
189
- // 执行登录成功后的函数
190
- onBeforeLogined();
191
- const param = {
192
- username,
193
- password,
194
- requestKey: publicRSA.requestKey,
195
- verify: verify,
196
- domain: getBaseURL()
197
- };
198
- loading.value = true;
199
- const [err, data] = await to(serviceApi.post('/uath/login', param));
200
- if (err) {
201
- loading.value = false;
202
- return;
203
- }
204
- cookies.set(kPASSWORD, CryptoJS.AES.encrypt(contextInfo.passWord, kCRYPTO));
205
- useSystemStoreHook().setPassword(contextInfo.passWord);
206
- useSystemStoreHook().setSessionKey(data);
207
- cacheToken(data);
208
- cookies.set(kLOGINER, username);
209
-
210
- // initSocket(username);
211
- await delay(64);
212
- // 执行登录成功后的函数
213
- onLogined();
214
- router.push('/');
215
- userMonitor(username);
216
- loading.value = false;
217
- };
218
-
219
- function onUserBlur() {
220
- if (contextInfo.username.length === 0) removeClass(document.querySelector('.user'), 'focus');
221
- }
222
-
223
- function onPwdBlur() {
224
- if (contextInfo.passWord.length === 0) removeClass(document.querySelector('.pwd'), 'focus');
225
- }
226
-
227
- /**
228
- * @description: 缓存token
229
- * @param {*} token token数据
230
- * @return {*}
231
- */
232
- const cacheToken = token => {
233
- const { access_token, expires_in, refresh_token } = token;
234
- const cache = {
235
- accessToken: access_token,
236
- refreshToken: refresh_token,
237
- // expires: Date.now() + expires_in
238
- expires: Date.now() + expires_in * 1000
239
- };
240
-
241
- cookies.set(kCKTOKEN, token.access_token);
242
- const dataString = JSON.stringify(cache);
243
- expires_in > 0 ? cookies.set(kTOKEN, dataString) : cookies.set(kTOKEN, dataString);
244
- };
245
-
246
- // let socketIo = null;
247
- // const initSocket = username => {
248
- // socketIo = io(`ws://119.145.169.186:10006/webSocket/${username}`, {
249
- // transports: ['websocket']
250
- // });
251
- // socketIo.on('connection', res => {
252
- // console.log('connection', res);
253
- // });
254
- // socketIo.on('connected', res => {
255
- // console.log('connected', res);
256
- // });
257
- // socketIo.on('close', res => {
258
- // console.log('connected', res);
259
- // });
260
- // socketIo.on('message', res => {
261
- // console.log('message', res);
262
- // // ElNotification({
263
- // // title: '您有一条新的消息',
264
- // // message: res,
265
- // // type: 'success'
266
- // // });
267
- // });
268
- // };
269
-
270
- const getSysConfig = async () => {
271
- sysConfig.value = storageLocal.getItem(kSYSCONFIG);
272
-
273
- bgStyle.value = {
274
- backgroundImage: sysConfig.value['backgroundImg'] ? `url(${sysConfig.value['backgroundImg']})` : ``,
275
- backgroundRepeat: 'no-repeat',
276
- backgroundPosition: 'center'
277
- };
278
-
279
- const favicon = useFavicon();
280
- favicon.value = sysConfig.value.favicon || utogether;
281
- };
282
-
283
- dataThemeChange(overallStyle.value);
284
-
285
- onBeforeMount(() => {
286
- getSysConfig();
287
- });
288
- </script>
289
-
290
- <style scoped>
291
- @import url('../../style/login.css');
292
- </style>
1
+ <template>
2
+ <!-- <img :src="bg" class="wave" /> -->
3
+ <div :key="refreshKey" class="login-container" :style="bgStyle">
4
+ <div v-if="!bgStyle.backgroundImage" class="img pr-24">
5
+ <img :src="welcome" />
6
+ </div>
7
+ <div class="login-box">
8
+ <div class="login-form">
9
+ <h2 v-motion :initial="{ opacity: 0, y: 100 }" :enter="{ opacity: 1, y: 0, transition: { delay: 100 } }">
10
+ {{ sysConfig['title'] }}
11
+ </h2>
12
+ <div
13
+ v-motion
14
+ class="input-group user focus"
15
+ :initial="{ opacity: 0, y: 100 }"
16
+ :enter="{ opacity: 1, y: 0, transition: { delay: 200 } }"
17
+ >
18
+ <div class="icon">
19
+ <i class="ri-user-fill ri-lg" />
20
+ </div>
21
+ <div>
22
+ <i class="ri-logout-box-line" />
23
+ <h5>{{ $t('message.udp.loginAccount') }}</h5>
24
+ <input
25
+ v-model.trim="contextInfo.username"
26
+ v-focus
27
+ type="text"
28
+ class="input"
29
+ @blur="onUserBlur"
30
+ @keyup.enter="onLogin"
31
+ />
32
+ </div>
33
+ </div>
34
+ <div
35
+ v-motion
36
+ class="input-group pwd focus"
37
+ :initial="{ opacity: 0, y: 100 }"
38
+ :enter="{
39
+ opacity: 1,
40
+ y: 0,
41
+ transition: { delay: 300 }
42
+ }"
43
+ >
44
+ <div class="icon">
45
+ <i class="ri-lock-fill ri-lg" />
46
+ </div>
47
+ <div>
48
+ <h5>{{ $t('message.udp.password') }}</h5>
49
+ <input
50
+ v-model.trim="contextInfo.passWord"
51
+ type="password"
52
+ class="input"
53
+ @blur="onPwdBlur"
54
+ @keyup.enter="onLogin"
55
+ />
56
+ </div>
57
+ </div>
58
+ <button
59
+ v-motion
60
+ class="btn"
61
+ :initial="{ opacity: 0, y: 10 }"
62
+ :enter="{ opacity: 1, y: 0, transition: { delay: 400 } }"
63
+ :disabled="loading"
64
+ :class="{ loading: loading }"
65
+ @click="onLogin"
66
+ >
67
+ {{ $t('message.udp.login') }}
68
+ </button>
69
+ </div>
70
+ </div>
71
+ <div v-if="sysConfig.techSupport === 'Y'" class="absolute flex justify-center w-full font-bold bottom-1">
72
+ <img :src="utogether" class="h-10!" style="height: 40px" />
73
+ <span class="flex flex-row justify-center" style="width: 300px">
74
+ <span style="font-size: 0; text-align: center">
75
+ <a
76
+ href="http://www.u-together.cn/"
77
+ target="_blank"
78
+ class="inline-block!"
79
+ style="margin-bottom: -5px; font-size: 17px; color: #fff; mix-blend-mode: difference"
80
+ :style="{ color: sysConfig.baseColor || '#FFF' }"
81
+ >
82
+ 深圳友聚信息技术有限公司
83
+ </a>
84
+ <a
85
+ href="http://www.u-together.cn/"
86
+ target="_blank"
87
+ class="inline-block!"
88
+ style="font-size: 12px; color: #fff; mix-blend-mode: difference"
89
+ :style="{ color: sysConfig.baseColor || '#FFF' }"
90
+ >
91
+ SHENZHEN U-TOGETHER CO. LTD
92
+ </a>
93
+ </span>
94
+ <span class="flex items-center text-white" style="width: 75px; font-size: 10px">技术支持</span>
95
+ </span>
96
+ </div>
97
+ </div>
98
+ </template>
99
+
100
+ <script lang="ts">
101
+ export default { name: 'LoginView' };
102
+ </script>
103
+
104
+ <script setup lang="ts">
105
+ import { ref, reactive, onBeforeMount } from 'vue';
106
+ import { useRouter } from 'vue-router';
107
+ import { useI18n } from 'vue-i18n';
108
+ // import io from 'socket.io-client';
109
+ import { useFavicon } from '@vueuse/core';
110
+ import { isEmpty } from 'xe-utils';
111
+ import { removeClass, storageLocal, errorMessage, cookies, delay } from '@utogether/utils';
112
+ import to from 'await-to-js';
113
+ import CryptoJS from 'crypto-js';
114
+ import { useSystemStoreHook } from '../../store/modules/system';
115
+ import { useLayout } from '../../layout/hooks/useLayout';
116
+ import { useDataThemeChange } from '../../layout/hooks/useDataThemeChange';
117
+ import { getBaseURL, getServiceApi } from '../../api';
118
+ import { userMonitor } from '../../api/user';
119
+ import { kTOKEN, kCKTOKEN, kLOGINER, kSYSCONFIG, kCRYPTO, kPASSWORD } from '../../contant';
120
+ import { onLogined, onBeforeLogined } from '../../utils/lifecycle';
121
+ import utogether from '../../assets/images/utogether.png';
122
+ import welcome from '../../assets/images/welcome.png';
123
+
124
+ interface IContextProps {
125
+ username: string;
126
+ passWord: string;
127
+ verify: number | null;
128
+ svg: any;
129
+ domain: string;
130
+ }
131
+ interface IRSAPublic {
132
+ publicKeyExponent: string;
133
+ publicKeyModulus: string;
134
+ requestKey: string;
135
+ }
136
+ const contextInfo: IContextProps = reactive({
137
+ username: '',
138
+ passWord: '',
139
+ requestKey: '',
140
+ verify: null,
141
+ svg: null,
142
+ domain: ''
143
+ });
144
+ const publicRSA: IRSAPublic = reactive({
145
+ publicKeyExponent: '10001',
146
+ publicKeyModulus:
147
+ 'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
148
+ requestKey: ''
149
+ });
150
+
151
+ const bgStyle = ref({
152
+ backgroundImage: '',
153
+ backgroundRepeat: 'no-repeat',
154
+ backgroundPosition: 'center'
155
+ });
156
+ const refreshKey = ref(0);
157
+
158
+ const sysConfig = ref<IRecord>({});
159
+ const router = useRouter();
160
+ const { t } = useI18n();
161
+ const serviceApi = getServiceApi();
162
+ // const { $config } = useGlobal();
163
+
164
+ const { initStorage } = useLayout();
165
+ const { overallStyle, dataThemeChange } = useDataThemeChange();
166
+ initStorage();
167
+
168
+ const loading = ref(false);
169
+ // 登录
170
+ const onLogin = async () => {
171
+ // return;
172
+ const { username, passWord, verify } = contextInfo;
173
+ if (isEmpty(username) || isEmpty(passWord)) {
174
+ return errorMessage(t('message.tip.loginFailure'));
175
+ }
176
+ // @ts-ignore
177
+ setMaxDigits(200);
178
+ // @ts-ignore
179
+ const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
180
+ // @ts-ignore
181
+ const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
182
+ // const key = new JSEencrypt();
183
+ // key.setPublicKey(
184
+ // '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChJwirJjZ+FxG9dn9rsfKa+9hTgBhXI9e0kiMOJWfJXPVxjsp0XaBkNADKYZ++7Ikt9hq+H3GtO4ItB27YMQgMU3gu34wGJ+6VxX4r7hL+VdorPK3sWZR6dczMu/Nvs7eByTtL9RSJeJ8cCEn5AjoW7HC+9BpQR4XhCCtvE1iOKQIDAQAB-----END PUBLIC KEY-----'
185
+ // );
186
+ // const password = key.encrypt(passWord);
187
+ // // console.log('password1 ===', password1);
188
+ // console.log('password ===', password);
189
+ // 执行登录成功后的函数
190
+ onBeforeLogined();
191
+ const param = {
192
+ username,
193
+ password,
194
+ requestKey: publicRSA.requestKey,
195
+ verify: verify,
196
+ domain: getBaseURL()
197
+ };
198
+ loading.value = true;
199
+ const [err, data] = await to(serviceApi.post('/uath/login', param));
200
+ if (err) {
201
+ loading.value = false;
202
+ return;
203
+ }
204
+ cookies.set(kPASSWORD, CryptoJS.AES.encrypt(contextInfo.passWord, kCRYPTO));
205
+ useSystemStoreHook().setPassword(contextInfo.passWord);
206
+ useSystemStoreHook().setSessionKey(data);
207
+ cacheToken(data);
208
+ cookies.set(kLOGINER, username);
209
+
210
+ // initSocket(username);
211
+ await delay(64);
212
+ // 执行登录成功后的函数
213
+ onLogined();
214
+ router.push('/');
215
+ userMonitor(username);
216
+ loading.value = false;
217
+ };
218
+
219
+ function onUserBlur() {
220
+ if (contextInfo.username.length === 0) removeClass(document.querySelector('.user'), 'focus');
221
+ }
222
+
223
+ function onPwdBlur() {
224
+ if (contextInfo.passWord.length === 0) removeClass(document.querySelector('.pwd'), 'focus');
225
+ }
226
+
227
+ /**
228
+ * @description: 缓存token
229
+ * @param {*} token token数据
230
+ * @return {*}
231
+ */
232
+ const cacheToken = token => {
233
+ const { access_token, expires_in, refresh_token } = token;
234
+ const cache = {
235
+ accessToken: access_token,
236
+ refreshToken: refresh_token,
237
+ expires: Date.now() + expires_in
238
+ // expires: Date.now() + expires_in * 1000
239
+ };
240
+
241
+ cookies.set(kCKTOKEN, token.access_token);
242
+ const dataString = JSON.stringify(cache);
243
+ expires_in > 0 ? cookies.set(kTOKEN, dataString) : cookies.set(kTOKEN, dataString);
244
+ };
245
+
246
+ // let socketIo = null;
247
+ // const initSocket = username => {
248
+ // socketIo = io(`ws://119.145.169.186:10006/webSocket/${username}`, {
249
+ // transports: ['websocket']
250
+ // });
251
+ // socketIo.on('connection', res => {
252
+ // console.log('connection', res);
253
+ // });
254
+ // socketIo.on('connected', res => {
255
+ // console.log('connected', res);
256
+ // });
257
+ // socketIo.on('close', res => {
258
+ // console.log('connected', res);
259
+ // });
260
+ // socketIo.on('message', res => {
261
+ // console.log('message', res);
262
+ // // ElNotification({
263
+ // // title: '您有一条新的消息',
264
+ // // message: res,
265
+ // // type: 'success'
266
+ // // });
267
+ // });
268
+ // };
269
+
270
+ const getSysConfig = async () => {
271
+ sysConfig.value = storageLocal.getItem(kSYSCONFIG);
272
+
273
+ bgStyle.value = {
274
+ backgroundImage: sysConfig.value['backgroundImg'] ? `url(${sysConfig.value['backgroundImg']})` : ``,
275
+ backgroundRepeat: 'no-repeat',
276
+ backgroundPosition: 'center'
277
+ };
278
+
279
+ const favicon = useFavicon();
280
+ favicon.value = sysConfig.value.favicon || utogether;
281
+ };
282
+
283
+ dataThemeChange(overallStyle.value);
284
+
285
+ onBeforeMount(() => {
286
+ getSysConfig();
287
+ });
288
+ </script>
289
+
290
+ <style scoped>
291
+ @import url('../../style/login.css');
292
+ </style>