@utogether/udp-core 2.0.0-beta.26 → 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 (183) hide show
  1. package/dist/403-CyoOD-Ik.js +65 -0
  2. package/dist/404-Ch_OHTw0.js +65 -0
  3. package/dist/500-Cf9am7HK.js +67 -0
  4. package/dist/AuthorityInfo-BJ427cqG.js +4 -0
  5. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D9y7AwbB.js +99 -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-qo-lKPkv.js +25 -0
  9. package/dist/CompanyPanel-DkKWAKvY.js +204 -0
  10. package/dist/DataSet-iBHzs75s.js +147 -0
  11. package/dist/Department-CHUQByKX.js +25 -0
  12. package/dist/DepartmentPanel-C742dfOO.js +248 -0
  13. package/dist/DesignPanel-D9oE5R7m.js +4 -0
  14. package/dist/DesignPanel.vue_vue_type_style_index_0_lang-hYldVEbo.js +1097 -0
  15. package/dist/DictView-CrFXprP9.js +110 -0
  16. package/dist/InvOrganization-Cz8SzIgs.js +73 -0
  17. package/dist/Org-Bzt6yKox.js +38 -0
  18. package/dist/Preview-jonigfMQ.js +48 -0
  19. package/dist/ReportDefine-BpiM5Ovq.js +10 -0
  20. package/dist/ReportDesign-fp09cXJ7.js +164 -0
  21. package/dist/ReportQuery-52ZP1PYP.js +74 -0
  22. package/dist/ReportQueryFrom-DSYavJb1.js +4 -0
  23. package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DBGYEp0u.js +177 -0
  24. package/dist/ReportTemplate-CA_UW0eD.js +161 -0
  25. package/dist/Role-DqOt8Bk0.js +25 -0
  26. package/dist/RoleAssign-BdxhefhQ.js +26 -0
  27. package/dist/RolePanel-2gZ3H0ET.js +4 -0
  28. package/dist/RolePanel-BsNd0svJ.js +4 -0
  29. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DLOwgF99.js +152 -0
  30. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DmzD9kab.js +131 -0
  31. package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-B9ptUMeI.js +99 -0
  32. package/dist/Staff-D3L8fEoY.js +26 -0
  33. package/dist/StaffInfo-DYRw6ZYJ.js +4 -0
  34. package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-xqEOQnMs.js +107 -0
  35. package/dist/StaffPanel-DkrNH6Px.js +4 -0
  36. package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-BPBMnliy.js +152 -0
  37. package/dist/SysUser-Bl1-cIpJ.js +15 -0
  38. package/dist/SysUserPanel-yxNLaBwt.js +4 -0
  39. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BDcsgSl5.js +352 -0
  40. package/dist/SystemMenu-C4_Arn12.js +155 -0
  41. package/dist/UserInfo-QcNwJCUR.js +4 -0
  42. package/dist/UserInfo.vue_vue_type_style_index_0_lang-DLIeUphX.js +159 -0
  43. package/dist/childView-B23DEO2u.js +4 -0
  44. package/dist/childView-saDZQv9x.js +4 -0
  45. package/dist/childView.vue_vue_type_style_index_0_lang-RsKR6CAC.js +182 -0
  46. package/dist/childView.vue_vue_type_style_index_0_lang-ZFEfavUY.js +142 -0
  47. package/dist/code-rule-2_Ihx_by.js +147 -0
  48. package/dist/core.es.js +26 -6
  49. package/dist/cron-task-BFOPJQIk.js +134 -0
  50. package/dist/flow-task-PoDnE_kE.js +10 -0
  51. package/dist/frameView-f7Ya0Knj.js +43 -0
  52. package/dist/index-BpdTDaTk.js +3213 -0
  53. package/dist/layout-home-v3DPJ7rB.js +231 -0
  54. package/dist/layoutView-DZHoQDH1.js +3190 -0
  55. package/dist/log-in-BPAMJTwH.js +115 -0
  56. package/dist/log-out-DZACF0jg.js +129 -0
  57. package/dist/login-B8cwozax.js +216 -0
  58. package/dist/login-log-CVvRgZSu.js +70 -0
  59. package/dist/lov-view-Ba7Y7xy0.js +98 -0
  60. package/dist/menuInfo-BpRKFYK8.js +4 -0
  61. package/dist/menuInfo.vue_vue_type_style_index_0_lang-DJ5sUC6m.js +359 -0
  62. package/dist/pda-app-C0jJecrL.js +706 -0
  63. package/dist/redirect-DTz8GSnv.js +15 -0
  64. package/dist/resource-BG22Cw4P.js +97 -0
  65. package/dist/su-welcome-DaxhbrC6.js +879 -0
  66. package/dist/sys-config-CG2fMtak.js +384 -0
  67. package/dist/udp-core.css +1 -2
  68. package/dist/useNav-_u2UAQWk.js +84 -0
  69. package/dist/utogether-MlnyYtNS.js +4 -0
  70. package/dist/wecom-push-B75FLee5.js +70 -0
  71. package/index.ts +54 -50
  72. package/package.json +21 -21
  73. package/src/App.vue +79 -78
  74. package/src/api/http.ts +10 -4
  75. package/src/api/index.ts +51 -51
  76. package/src/api/user.ts +64 -64
  77. package/src/components/SuQrcode/src/index.tsx +231 -236
  78. package/src/components/udp/content/index.vue +93 -93
  79. package/src/components/udp/form-upload/form-upload.vue +496 -496
  80. package/src/components/udp/grid/index.vue +643 -544
  81. package/src/components/udp/index.ts +2 -1
  82. package/src/components/udp/modal-form/index.vue +326 -0
  83. package/src/components/udp/utils.ts +420 -420
  84. package/src/layout/components/lay-navbar/index.vue +240 -240
  85. package/src/layout/components/lay-panel/index.vue +2 -6
  86. package/src/layout/components/lay-search/components/SearchModal.vue +185 -181
  87. package/src/layout/components/lay-sidebar/mixNav.vue +261 -261
  88. package/src/layout/components/lay-sidebar/sidebarItem.vue +199 -195
  89. package/src/layout/components/lay-sidebar/vertical.vue +92 -92
  90. package/src/layout/layoutView.vue +1 -0
  91. package/src/main.ts +111 -109
  92. package/src/plugins/i18n/zh.ts +5 -1
  93. package/src/plugins/vxe-table/index.ts +116 -116
  94. package/src/router/index.ts +5 -34
  95. package/src/router/utils.ts +434 -430
  96. package/src/store/modules/permission.ts +1 -1
  97. package/src/store/modules/system.ts +193 -186
  98. package/src/style/print-lock.css +380 -375
  99. package/src/style/suprint.css +990 -985
  100. package/src/style/vxetable.scss +372 -364
  101. package/src/utils/authority/index.ts +19 -2
  102. package/src/utils/dataFormat/index.ts +309 -222
  103. package/src/utils/udp/http/index.ts +126 -67
  104. package/src/utils/udp/http/types.d.ts +15 -14
  105. package/src/views/login/login-view.vue +4 -21
  106. package/src/views/organization/department/DepartmentPanel.vue +3 -4
  107. package/src/views/system/sys/sys-config.vue +344 -344
  108. package/src/views/uhome/components/home-todo.vue +191 -178
  109. package/src/views/uhome/dynamic-card.vue +31 -31
  110. package/src/views/uhome/su-welcome.vue +310 -310
  111. package/src/views/ulogin/login.vue +292 -296
  112. package/src/views/urpt/design/DesignPanel.vue +538 -507
  113. package/src/views/urpt/design/print-data.ts +39 -59
  114. package/tsconfig.json +2 -3
  115. package/types/global.d.ts +234 -234
  116. package/vite.config.ts +2 -1
  117. package/dist/403-D6Wb3JJh.js +0 -72
  118. package/dist/404-B_HNbPNV.js +0 -72
  119. package/dist/500-BMemTTy1.js +0 -77
  120. package/dist/AuthorityInfo-6wHxwiFM.js +0 -91
  121. package/dist/AuthorityPanel-OqF_DvXA.js +0 -98
  122. package/dist/Company-BLXSfow0.js +0 -21
  123. package/dist/CompanyPanel-B4kRZ5Cg.js +0 -199
  124. package/dist/DataSet-CuGZcKC-.js +0 -141
  125. package/dist/Department-oFhsa7cd.js +0 -21
  126. package/dist/DepartmentPanel-B1UGpu-r.js +0 -242
  127. package/dist/DepartmentPanel-BL58AdoT.js +0 -2
  128. package/dist/DesignPanel-DmkFVw1N.js +0 -1196
  129. package/dist/DictView-CC5yMzOq.js +0 -100
  130. package/dist/File-WJXjGYxr.js +0 -89
  131. package/dist/InvOrganization-BwMmD8Ua.js +0 -76
  132. package/dist/Org-HgnOWubi.js +0 -76
  133. package/dist/Preview-CAzWxLmP.js +0 -45
  134. package/dist/ReIcon-DecitXmg.js +0 -413
  135. package/dist/ReportDefine-BgLM-Rjk.js +0 -10
  136. package/dist/ReportDesign-DwchGG2P.js +0 -158
  137. package/dist/ReportQuery-D5jaRJEn.js +0 -101
  138. package/dist/ReportQueryFrom-CNlmtYey.js +0 -198
  139. package/dist/ReportTemplate-CNcTmccs.js +0 -162
  140. package/dist/Role-Be8WfdCA.js +0 -21
  141. package/dist/RoleAssign-CtehGAUf.js +0 -22
  142. package/dist/RolePanel-CAwITg_q.js +0 -131
  143. package/dist/RolePanel-SN0FGFZ7.js +0 -176
  144. package/dist/ScrollPanel-DW30pGz1.js +0 -88
  145. package/dist/Staff-V2YsNKcj.js +0 -22
  146. package/dist/StaffInfo-CKRPW0r4.js +0 -149
  147. package/dist/StaffPanel-BxcgMg7u.js +0 -143
  148. package/dist/SysUser-Dxyj5w5m.js +0 -12
  149. package/dist/SysUserPanel-DI6CWcZo.js +0 -365
  150. package/dist/SystemMenu-BBHREM8T.js +0 -154
  151. package/dist/UserInfo-BMVQ0xwE.js +0 -194
  152. package/dist/_plugin-vue_export-helper-C6QCLu9I.js +0 -8
  153. package/dist/api-BFNxcxSN.js +0 -30
  154. package/dist/authority-BJFEUdrh.js +0 -20
  155. package/dist/await-to-js.es5-DkWYmPXW.js +0 -10
  156. package/dist/childView-BBjPEraB.js +0 -184
  157. package/dist/childView-DNqG2UVm.js +0 -181
  158. package/dist/code-rule-QFrhqFrW.js +0 -151
  159. package/dist/contant-Q77dU_V3.js +0 -4
  160. package/dist/cron-task-BpUDKEAU.js +0 -131
  161. package/dist/flow-task-DAc2NrDU.js +0 -11
  162. package/dist/frameView-Di0zJZUR.js +0 -39
  163. package/dist/layout-home-BVp7vYLR.js +0 -239
  164. package/dist/layoutView-B6Mx2ERA.js +0 -2662
  165. package/dist/log-in-BrNB0mLz.js +0 -117
  166. package/dist/log-out-dYfqvzy6.js +0 -111
  167. package/dist/login-D_Hjy3Jd.js +0 -231
  168. package/dist/login-log-CJak-ANA.js +0 -79
  169. package/dist/lov-view-DM5Nm5tW.js +0 -95
  170. package/dist/menuInfo-BlOY1KZW.js +0 -346
  171. package/dist/mitt-CQgI7DYU.js +0 -27
  172. package/dist/pda-app-CA7YI37u.js +0 -589
  173. package/dist/redirect-N0k4tImU.js +0 -16
  174. package/dist/resource-CfQTHFcs.js +0 -94
  175. package/dist/su-welcome-DVD3S_du.js +0 -799
  176. package/dist/sys-config-Ddb3vBpK.js +0 -316
  177. package/dist/system-Cm3lyBas.js +0 -1528
  178. package/dist/udp-core-DaQd5CF1.js +0 -2028
  179. package/dist/useDataThemeChange-DJ4K3VGp.js +0 -226
  180. package/dist/useNav-BhOJIdrJ.js +0 -106
  181. package/dist/utogether-l7JXs4Lv.js +0 -4
  182. package/dist/water-mark-WDQZ9YqB.js +0 -119
  183. package/dist/wecom-push-kWkAVRCj.js +0 -77
@@ -1,296 +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
- <IconifyIconOffline :icon="UserFill" width="30" height="30" />
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
- <IconifyIconOffline :icon="LockFill" width="30" height="30" />
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 bg from '../../assets/svg/bg.svg?component';
122
- import utogether from '../../assets/images/utogether.png';
123
- import welcome from '../../assets/images/welcome.png';
124
-
125
- import LockFill from '@iconify-icons/ri/lock-fill';
126
- import UserFill from '@iconify-icons/ri/user-3-fill';
127
-
128
- interface IContextProps {
129
- username: string;
130
- passWord: string;
131
- verify: number | null;
132
- svg: any;
133
- domain: string;
134
- }
135
- interface IRSAPublic {
136
- publicKeyExponent: string;
137
- publicKeyModulus: string;
138
- requestKey: string;
139
- }
140
- const contextInfo: IContextProps = reactive({
141
- username: '',
142
- passWord: '',
143
- requestKey: '',
144
- verify: null,
145
- svg: null,
146
- domain: ''
147
- });
148
- const publicRSA: IRSAPublic = reactive({
149
- publicKeyExponent: '10001',
150
- publicKeyModulus:
151
- 'a12708ab26367e1711bd767f6bb1f29afbd85380185723d7b492230e2567c95cf5718eca745da0643400ca619fbeec892df61abe1f71ad3b822d076ed831080c53782edf8c0627ee95c57e2bee12fe55da2b3cadec59947a75ccccbbf36fb3b781c93b4bf51489789f1c0849f9023a16ec70bef41a504785e1082b6f13588e29',
152
- requestKey: ''
153
- });
154
-
155
- const bgStyle = ref({
156
- backgroundImage: '',
157
- backgroundRepeat: 'no-repeat',
158
- backgroundPosition: 'center'
159
- });
160
- const refreshKey = ref(0);
161
-
162
- const sysConfig = ref<IRecord>({});
163
- const router = useRouter();
164
- const { t } = useI18n();
165
- const serviceApi = getServiceApi();
166
- // const { $config } = useGlobal();
167
-
168
- const { initStorage } = useLayout();
169
- const { overallStyle, dataThemeChange } = useDataThemeChange();
170
- initStorage();
171
-
172
- const loading = ref(false);
173
- // 登录
174
- const onLogin = async () => {
175
- // return;
176
- const { username, passWord, verify } = contextInfo;
177
- if (isEmpty(username) || isEmpty(passWord)) {
178
- return errorMessage(t('message.tip.loginFailure'));
179
- }
180
- // @ts-ignore
181
- setMaxDigits(200);
182
- // @ts-ignore
183
- const rsakeypair = new RSAKeyPair(publicRSA.publicKeyExponent, '', publicRSA.publicKeyModulus);
184
- // @ts-ignore
185
- const password = encryptedString(rsakeypair, passWord.split('').reverse().join(''));
186
- // const key = new JSEencrypt();
187
- // key.setPublicKey(
188
- // '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChJwirJjZ+FxG9dn9rsfKa+9hTgBhXI9e0kiMOJWfJXPVxjsp0XaBkNADKYZ++7Ikt9hq+H3GtO4ItB27YMQgMU3gu34wGJ+6VxX4r7hL+VdorPK3sWZR6dczMu/Nvs7eByTtL9RSJeJ8cCEn5AjoW7HC+9BpQR4XhCCtvE1iOKQIDAQAB-----END PUBLIC KEY-----'
189
- // );
190
- // const password = key.encrypt(passWord);
191
- // // console.log('password1 ===', password1);
192
- // console.log('password ===', password);
193
- // 执行登录成功后的函数
194
- onBeforeLogined();
195
- const param = {
196
- username,
197
- password,
198
- requestKey: publicRSA.requestKey,
199
- verify: verify,
200
- domain: getBaseURL()
201
- };
202
- loading.value = true;
203
- const [err, data] = await to(serviceApi.post('/uath/login', param));
204
- if (err) {
205
- loading.value = false;
206
- return;
207
- }
208
- cookies.set(kPASSWORD, CryptoJS.AES.encrypt(contextInfo.passWord, kCRYPTO));
209
- useSystemStoreHook().setPassword(contextInfo.passWord);
210
- useSystemStoreHook().setSessionKey(data);
211
- cacheToken(data);
212
- cookies.set(kLOGINER, username);
213
-
214
- // initSocket(username);
215
- await delay(64);
216
- // 执行登录成功后的函数
217
- onLogined();
218
- router.push('/');
219
- userMonitor(username);
220
- loading.value = false;
221
- };
222
-
223
- function onUserBlur() {
224
- if (contextInfo.username.length === 0) removeClass(document.querySelector('.user'), 'focus');
225
- }
226
-
227
- function onPwdBlur() {
228
- if (contextInfo.passWord.length === 0) removeClass(document.querySelector('.pwd'), 'focus');
229
- }
230
-
231
- /**
232
- * @description: 缓存token
233
- * @param {*} token token数据
234
- * @return {*}
235
- */
236
- const cacheToken = token => {
237
- const { access_token, expires_in, refresh_token } = token;
238
- const cache = {
239
- accessToken: access_token,
240
- refreshToken: refresh_token,
241
- // expires: Date.now() + expires_in
242
- expires: Date.now() + expires_in * 1000
243
- };
244
-
245
- cookies.set(kCKTOKEN, token.access_token);
246
- const dataString = JSON.stringify(cache);
247
- expires_in > 0 ? cookies.set(kTOKEN, dataString) : cookies.set(kTOKEN, dataString);
248
- };
249
-
250
- // let socketIo = null;
251
- // const initSocket = username => {
252
- // socketIo = io(`ws://119.145.169.186:10006/webSocket/${username}`, {
253
- // transports: ['websocket']
254
- // });
255
- // socketIo.on('connection', res => {
256
- // console.log('connection', res);
257
- // });
258
- // socketIo.on('connected', res => {
259
- // console.log('connected', res);
260
- // });
261
- // socketIo.on('close', res => {
262
- // console.log('connected', res);
263
- // });
264
- // socketIo.on('message', res => {
265
- // console.log('message', res);
266
- // // ElNotification({
267
- // // title: '您有一条新的消息',
268
- // // message: res,
269
- // // type: 'success'
270
- // // });
271
- // });
272
- // };
273
-
274
- const getSysConfig = async () => {
275
- sysConfig.value = storageLocal.getItem(kSYSCONFIG);
276
-
277
- bgStyle.value = {
278
- backgroundImage: sysConfig.value['backgroundImg'] ? `url(${sysConfig.value['backgroundImg']})` : ``,
279
- backgroundRepeat: 'no-repeat',
280
- backgroundPosition: 'center'
281
- };
282
-
283
- const favicon = useFavicon();
284
- favicon.value = sysConfig.value.favicon || utogether;
285
- };
286
-
287
- dataThemeChange(overallStyle.value);
288
-
289
- onBeforeMount(() => {
290
- getSysConfig();
291
- });
292
- </script>
293
-
294
- <style scoped>
295
- @import url('../../style/login.css');
296
- </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>