eoss-ui 0.6.37 → 0.6.39

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 (261) hide show
  1. package/lib/button-group.js +535 -374
  2. package/lib/button.js +535 -374
  3. package/lib/checkbox-group.js +536 -375
  4. package/lib/config/api.js +31 -19
  5. package/lib/data-table-form.js +547 -386
  6. package/lib/data-table.js +547 -382
  7. package/lib/date-picker.js +535 -374
  8. package/lib/dialog.js +535 -374
  9. package/lib/eoss-ui.common.js +12508 -5609
  10. package/lib/error-page.js +4 -4
  11. package/lib/flow-group.js +553 -377
  12. package/lib/flow-list.js +621 -460
  13. package/lib/flow.js +9822 -2988
  14. package/lib/form.js +552 -380
  15. package/lib/handle-user.js +536 -375
  16. package/lib/handler.js +536 -375
  17. package/lib/icon.js +536 -375
  18. package/lib/index.js +1 -1
  19. package/lib/input-number.js +535 -374
  20. package/lib/input.js +535 -374
  21. package/lib/layout.js +2 -2
  22. package/lib/login.js +550 -389
  23. package/lib/main.js +704 -543
  24. package/lib/nav.js +535 -374
  25. package/lib/notify.js +127 -109
  26. package/lib/page.js +535 -374
  27. package/lib/pagination.js +535 -374
  28. package/lib/player.js +535 -374
  29. package/lib/qr-code.js +548 -387
  30. package/lib/radio-group.js +536 -375
  31. package/lib/retrial-auth.js +538 -377
  32. package/lib/select-ganged.js +536 -375
  33. package/lib/select.js +536 -375
  34. package/lib/selector-panel.js +594 -409
  35. package/lib/selector.js +539 -378
  36. package/lib/sizer.js +541 -380
  37. package/lib/steps.js +535 -374
  38. package/lib/switch.js +535 -374
  39. package/lib/table-form.js +535 -374
  40. package/lib/tabs.js +539 -378
  41. package/lib/theme-chalk/flow.css +1 -1
  42. package/lib/theme-chalk/index.css +1 -1
  43. package/lib/tips.js +536 -375
  44. package/lib/tree-group.js +535 -374
  45. package/lib/tree.js +536 -375
  46. package/lib/upload.js +564 -392
  47. package/lib/utils/util.js +411 -268
  48. package/lib/wujie.js +535 -374
  49. package/lib/wxlogin.js +535 -374
  50. package/package.json +159 -158
  51. package/packages/button/index.js +5 -5
  52. package/packages/button/src/main.vue +418 -418
  53. package/packages/button-group/index.js +5 -5
  54. package/packages/button-group/src/main.vue +298 -298
  55. package/packages/calendar/index.js +5 -5
  56. package/packages/card/index.js +5 -5
  57. package/packages/card/src/main.vue +156 -156
  58. package/packages/cascader/index.js +5 -5
  59. package/packages/cascader/src/main.vue +168 -168
  60. package/packages/checkbox-group/index.js +5 -5
  61. package/packages/checkbox-group/src/main.vue +333 -333
  62. package/packages/clients/index.js +5 -5
  63. package/packages/clients/src/main.vue +144 -144
  64. package/packages/data-table/index.js +5 -5
  65. package/packages/data-table/src/children.vue +39 -39
  66. package/packages/data-table/src/column.vue +983 -983
  67. package/packages/data-table/src/main.vue +1820 -1816
  68. package/packages/data-table/src/sizer.vue +195 -195
  69. package/packages/data-table-form/index.js +5 -5
  70. package/packages/data-table-form/src/checkbox.vue +101 -101
  71. package/packages/data-table-form/src/colgroup.vue +17 -17
  72. package/packages/data-table-form/src/main.vue +181 -181
  73. package/packages/data-table-form/src/radio.vue +65 -65
  74. package/packages/data-table-form/src/table.vue +233 -233
  75. package/packages/data-table-form/src/tbody.vue +336 -336
  76. package/packages/data-table-form/src/thead.vue +68 -68
  77. package/packages/date-picker/index.js +5 -5
  78. package/packages/date-picker/src/main.vue +236 -236
  79. package/packages/dialog/index.js +5 -5
  80. package/packages/enterprise/index.js +5 -5
  81. package/packages/enterprise/src/main.vue +66 -66
  82. package/packages/error-page/index.js +5 -5
  83. package/packages/error-page/src/main.vue +44 -44
  84. package/packages/flow/index.js +5 -5
  85. package/packages/flow/src/component/CommonOpinions.vue +345 -341
  86. package/packages/flow/src/component/CustomPreset.vue +322 -322
  87. package/packages/flow/src/component/FileList.vue +99 -99
  88. package/packages/flow/src/component/Preset.vue +255 -255
  89. package/packages/flow/src/component/SendMsg.vue +229 -229
  90. package/packages/flow/src/component/TimeLimit.vue +190 -190
  91. package/packages/flow/src/component/taskUnionExamine.vue +603 -547
  92. package/packages/flow/src/form.vue +121 -121
  93. package/packages/flow/src/freeStartFlow.vue +2843 -0
  94. package/packages/flow/src/main.vue +2864 -2731
  95. package/packages/flow/src/processForm.vue +1007 -954
  96. package/packages/flow/src/processReject.vue +293 -293
  97. package/packages/flow/src/reset.vue +901 -0
  98. package/packages/flow/src/selectUser.vue +5 -0
  99. package/packages/flow/src/startTaskRead.vue +596 -596
  100. package/packages/flow/src/table.vue +58 -58
  101. package/packages/flow-group/index.js +5 -5
  102. package/packages/flow-group/src/main.vue +688 -684
  103. package/packages/flow-list/index.js +5 -5
  104. package/packages/flow-list/src/main.vue +1172 -1172
  105. package/packages/form/index.js +5 -5
  106. package/packages/form/src/main.vue +3584 -3582
  107. package/packages/form/src/table.vue +1420 -1420
  108. package/packages/handle-user/index.js +5 -5
  109. package/packages/handle-user/src/main.vue +138 -138
  110. package/packages/handler/index.js +5 -5
  111. package/packages/handler/src/main.vue +388 -388
  112. package/packages/icon/index.js +5 -5
  113. package/packages/icon/src/main.vue +101 -101
  114. package/packages/icons/index.js +5 -5
  115. package/packages/icons/src/main.vue +81 -81
  116. package/packages/input/index.js +5 -5
  117. package/packages/input/src/main.vue +356 -356
  118. package/packages/input-number/index.js +5 -5
  119. package/packages/input-number/src/main.vue +106 -106
  120. package/packages/label/index.js +5 -5
  121. package/packages/label/src/main.vue +457 -457
  122. package/packages/layout/index.js +5 -5
  123. package/packages/layout/src/item.vue +152 -152
  124. package/packages/layout/src/main.vue +31 -31
  125. package/packages/login/index.js +5 -5
  126. package/packages/login/src/main.vue +1892 -1894
  127. package/packages/login/src/resetPassword.vue +562 -562
  128. package/packages/main/index.js +5 -5
  129. package/packages/main/src/default/message.vue +249 -249
  130. package/packages/main/src/default/notice.vue +157 -157
  131. package/packages/main/src/default/userinfo.vue +505 -505
  132. package/packages/main/src/public/online.vue +89 -89
  133. package/packages/main/src/public/search.vue +454 -454
  134. package/packages/main/src/public/settings.vue +221 -221
  135. package/packages/main/src/simplicity/apps.vue +388 -388
  136. package/packages/main/src/simplicity/avatar.vue +82 -82
  137. package/packages/main/src/simplicity/handler.vue +221 -221
  138. package/packages/main/src/simplicity/index.vue +1993 -1993
  139. package/packages/main/src/simplicity/lists.vue +84 -84
  140. package/packages/main/src/simplicity/menu-list.vue +128 -128
  141. package/packages/main/src/simplicity/message.vue +259 -259
  142. package/packages/main/src/simplicity/notice.vue +190 -190
  143. package/packages/main/src/simplicity/router-page.vue +45 -45
  144. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  145. package/packages/main/src/simplicity/user.vue +257 -257
  146. package/packages/main/src/simplicity/userinfo.vue +312 -312
  147. package/packages/menu/index.js +5 -5
  148. package/packages/menu/src/main.vue +536 -536
  149. package/packages/nav/index.js +5 -5
  150. package/packages/nav/src/main.vue +402 -402
  151. package/packages/notify/index.js +5 -5
  152. package/packages/notify/src/main.vue +538 -538
  153. package/packages/page/index.js +5 -5
  154. package/packages/page/src/main.vue +167 -167
  155. package/packages/pagination/index.js +5 -5
  156. package/packages/pagination/src/main.vue +96 -96
  157. package/packages/player/index.js +5 -5
  158. package/packages/player/src/main.vue +194 -194
  159. package/packages/qr-code/index.js +5 -5
  160. package/packages/qr-code/src/main.vue +170 -170
  161. package/packages/radio-group/index.js +6 -6
  162. package/packages/radio-group/src/main.vue +319 -319
  163. package/packages/retrial-auth/index.js +5 -5
  164. package/packages/retrial-auth/src/main.vue +280 -280
  165. package/packages/select/index.js +5 -5
  166. package/packages/select/src/main.vue +775 -775
  167. package/packages/select-ganged/index.js +5 -5
  168. package/packages/select-ganged/src/main.vue +724 -724
  169. package/packages/selector/index.js +5 -5
  170. package/packages/selector/src/main.vue +677 -677
  171. package/packages/selector-panel/index.js +5 -5
  172. package/packages/selector-panel/src/main.vue +1028 -1020
  173. package/packages/selector-panel/src/selection.vue +177 -160
  174. package/packages/selector-panel/src/tree.vue +129 -129
  175. package/packages/sizer/index.js +5 -5
  176. package/packages/sizer/src/main.vue +254 -254
  177. package/packages/steps/index.js +5 -5
  178. package/packages/steps/src/main.vue +181 -181
  179. package/packages/switch/index.js +5 -5
  180. package/packages/switch/src/main.vue +154 -154
  181. package/packages/table-form/index.js +5 -5
  182. package/packages/tabs/index.js +5 -5
  183. package/packages/tabs/src/main.vue +788 -788
  184. package/packages/tabs-panel/index.js +5 -5
  185. package/packages/tabs-panel/src/main.vue +29 -29
  186. package/packages/theme-chalk/lib/flow.css +1 -1
  187. package/packages/theme-chalk/lib/index.css +1 -1
  188. package/packages/theme-chalk/src/base.scss +260 -260
  189. package/packages/theme-chalk/src/button-group.scss +175 -175
  190. package/packages/theme-chalk/src/button.scss +24 -24
  191. package/packages/theme-chalk/src/calendar.scss +113 -113
  192. package/packages/theme-chalk/src/card.scss +99 -99
  193. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  194. package/packages/theme-chalk/src/clients.scss +87 -87
  195. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  196. package/packages/theme-chalk/src/data-table.scss +293 -293
  197. package/packages/theme-chalk/src/date-picker.scss +7 -7
  198. package/packages/theme-chalk/src/dialog.scss +77 -77
  199. package/packages/theme-chalk/src/enterprise.scss +5 -5
  200. package/packages/theme-chalk/src/error-page.scss +18 -18
  201. package/packages/theme-chalk/src/flow-group.scss +110 -110
  202. package/packages/theme-chalk/src/flow-list.scss +36 -36
  203. package/packages/theme-chalk/src/flow.scss +310 -308
  204. package/packages/theme-chalk/src/form.scss +496 -496
  205. package/packages/theme-chalk/src/handle-user.scss +40 -40
  206. package/packages/theme-chalk/src/handler.scss +143 -143
  207. package/packages/theme-chalk/src/icon.scss +1760 -1760
  208. package/packages/theme-chalk/src/icons.scss +99 -99
  209. package/packages/theme-chalk/src/input.scss +9 -9
  210. package/packages/theme-chalk/src/label.scss +24 -24
  211. package/packages/theme-chalk/src/layout.scss +46 -46
  212. package/packages/theme-chalk/src/login.scss +939 -939
  213. package/packages/theme-chalk/src/main.scss +632 -632
  214. package/packages/theme-chalk/src/menu.scss +222 -222
  215. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  216. package/packages/theme-chalk/src/nav.scss +125 -125
  217. package/packages/theme-chalk/src/page.scss +3 -3
  218. package/packages/theme-chalk/src/pagination.scss +29 -29
  219. package/packages/theme-chalk/src/player.scss +9 -9
  220. package/packages/theme-chalk/src/qr-code.scss +17 -17
  221. package/packages/theme-chalk/src/radio-group.scss +9 -9
  222. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  223. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  224. package/packages/theme-chalk/src/select.scss +8 -8
  225. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  226. package/packages/theme-chalk/src/selector.scss +91 -91
  227. package/packages/theme-chalk/src/simplicity.scss +1262 -1262
  228. package/packages/theme-chalk/src/sizer.scss +36 -36
  229. package/packages/theme-chalk/src/steps.scss +88 -88
  230. package/packages/theme-chalk/src/switch.scss +3 -3
  231. package/packages/theme-chalk/src/table-form.scss +1 -1
  232. package/packages/theme-chalk/src/tabs.scss +87 -87
  233. package/packages/theme-chalk/src/tips.scss +7 -7
  234. package/packages/theme-chalk/src/toolbar.scss +179 -179
  235. package/packages/theme-chalk/src/tree-group.scss +72 -72
  236. package/packages/theme-chalk/src/tree.scss +165 -165
  237. package/packages/theme-chalk/src/upload.scss +167 -167
  238. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  239. package/packages/tips/index.js +5 -5
  240. package/packages/tips/src/main.vue +141 -141
  241. package/packages/toolbar/index.js +5 -5
  242. package/packages/toolbar/src/main.vue +430 -430
  243. package/packages/tree/index.js +5 -5
  244. package/packages/tree-group/index.js +5 -5
  245. package/packages/upload/index.js +5 -5
  246. package/packages/upload/src/main.vue +1334 -1323
  247. package/packages/upload/src/picture.js +15 -15
  248. package/packages/wujie/index.js +5 -5
  249. package/packages/wujie/src/main.vue +145 -145
  250. package/packages/wxlogin/index.js +5 -5
  251. package/packages/wxlogin/src/main.vue +128 -128
  252. package/src/config/api.js +248 -236
  253. package/src/config/image.js +2 -2
  254. package/src/index.js +1 -1
  255. package/src/utils/bus.js +3 -3
  256. package/src/utils/date-util.js +312 -312
  257. package/src/utils/http.js +50 -50
  258. package/src/utils/rules.js +18 -18
  259. package/src/utils/store.js +21 -21
  260. package/src/utils/util.js +398 -258
  261. package/src/utils/webSocket.js +107 -107
@@ -1,1894 +1,1892 @@
1
- <template>
2
- <div
3
- v-if="!code"
4
- class="es-login-screen"
5
- :class="{
6
- 'es-login-medium': size == 'medium',
7
- 'es-login-small': size == 'small',
8
- 'es-login-mini': size == 'mini'
9
- }"
10
- :style="getBackground(loginBackgroundImg)"
11
- >
12
- <div
13
- v-if="loginDownloadApp"
14
- class="es-download-app"
15
- @click="handleDownLoadApps"
16
- >
17
- <i class="el-icon-mobile-phone"></i>下载APP
18
- </div>
19
- <img v-if="loginLogoImg" class="es-login-logo" :src="loginLogoImg" />
20
- <slot></slot>
21
- <div
22
- class="es-login"
23
- v-loading.fullscreen.lock="submit"
24
- element-loading-text="登录中..."
25
- element-loading-spinner="el-icon-loading"
26
- element-loading-background="rgba(0, 0, 0, 0.65)"
27
- :class="{
28
- 'es-simple': mode == 'simple',
29
- 'es-adaptive': !isScale && !isFixed
30
- }"
31
- :style="transform"
32
- >
33
- <img v-if="loginNameImg" class="es-login-name" :src="loginNameImg" />
34
- <div
35
- class="es-login-main"
36
- :style="getBackground(loginMainImg)"
37
- :class="{
38
- 'es-models': modelLength > 2 && mode !== 'complex',
39
- 'es-complex': mode == 'complex'
40
- }"
41
- >
42
- <div class="es-login-complex-title" v-if="mode == 'complex'">
43
- 欢迎登录
44
- </div>
45
- <div
46
- v-if="modelLength > 1 || mode == 'complex'"
47
- :class="{
48
- 'es-login-models': modelLength > 2 && mode !== 'complex',
49
- 'es-login-model': modelLength == 2 || mode == 'complex'
50
- }"
51
- >
52
- <template v-if="this.mode == 'complex'">
53
- <template v-for="item in switchs">
54
- <div
55
- v-if="item.tips"
56
- v-show="active != item.type"
57
- class="es-login-model-tips"
58
- :key="item.type + '_0'"
59
- :style="getBackground(item.background)"
60
- >
61
- {{ item.tips }}
62
- </div>
63
- <span
64
- v-show="switchActive != item.type"
65
- class="es-icon-box"
66
- @click="switchLoginType(item)"
67
- :title="modelLength > 2 ? item.name : ''"
68
- :key="item.type + '_1'"
69
- >
70
- <i :class="[item.icon, 'es-icon']"></i>
71
- </span>
72
- </template>
73
- </template>
74
- <template v-else>
75
- <span
76
- v-for="(item, index) in icons"
77
- v-show="modelLength > 2 || active != item.type"
78
- class="es-icon-box"
79
- @click="switchLogin(item)"
80
- :title="modelLength > 2 ? item.name : ''"
81
- :key="index"
82
- :class="[{ 'es-icon-active': active == item.type }]"
83
- >
84
- <i :class="[item.icon, 'es-icon']"></i>
85
- </span>
86
- </template>
87
- </div>
88
- <div v-if="loginTitleImg" class="es-login-title-image">
89
- <img class="es-login-title-img" :src="loginTitleImg" />
90
- </div>
91
- <template v-else-if="mode !== 'complex'">
92
- <slot name="login-title" :type="active">
93
- <div class="es-login-title">
94
- <span class="es-login-title-content">{{ title }}</span>
95
- </div>
96
- </slot>
97
- </template>
98
- <div class="es-login-form-box">
99
- <div
100
- v-if="mode == 'complex'"
101
- class="es-login-complex-models"
102
- :class="{ 'es-complex-title': active == '3' }"
103
- >
104
- <template v-if="active == '3'">
105
- <div class="es-login-complex-models-item es-active">
106
- {{ title }}
107
- </div>
108
- </template>
109
- <template v-else>
110
- <template v-for="item in icons">
111
- <div
112
- v-if="item.type !== '3'"
113
- class="es-login-complex-models-item"
114
- :class="{ 'es-active': active == item.type }"
115
- :key="item.type"
116
- @click="switchLogin(item)"
117
- >
118
- {{ item.name }}
119
- </div>
120
- </template>
121
- </template>
122
- </div>
123
- <template v-if="isShow(active) && (active == 0 || active == 12)">
124
- <el-form
125
- :ref="'login' + active"
126
- class="es-login-form"
127
- :model="formData"
128
- >
129
- <el-form-item prop="username" :rules="username.rules">
130
- <es-input
131
- v-model="formData.username"
132
- type="text"
133
- name="username"
134
- tabindex="1"
135
- exclude
136
- :placeholder="username.placeholder"
137
- :focusShow="focusShow"
138
- :data="users"
139
- @select="handleBlur"
140
- >
141
- <template slot="prefix">
142
- <i class="es-icon-zhanghao es-label-user"></i>
143
- </template>
144
- </es-input>
145
- </el-form-item>
146
- <el-form-item prop="password" :rules="password.rules">
147
- <el-input
148
- v-model="formData.password"
149
- name="password"
150
- tabindex="2"
151
- type="password"
152
- :placeholder="password.placeholder"
153
- autocomplete="off"
154
- show-password
155
- @paste.native.capture="handlePaste"
156
- @copy.native.capture="handlePaste"
157
- >
158
- <template slot="prefix">
159
- <i class="es-icon-mima es-label-password"></i>
160
- </template>
161
- </el-input>
162
- </el-form-item>
163
- <el-form-item
164
- prop="identifyingCode"
165
- :rules="[
166
- {
167
- required: true,
168
- message: '验证码不能为空',
169
- trigger: 'change'
170
- }
171
- ]"
172
- v-if="imgCode || showVerifyCode"
173
- >
174
- <el-input
175
- name="identifyingCode"
176
- tabindex="3"
177
- type="text"
178
- v-model="formData.identifyingCode"
179
- placeholder="请输入验证码"
180
- autocomplete="off"
181
- class="es-label-image-code"
182
- >
183
- <template slot="prefix">
184
- <i class="es-icon-yanzheng es-label-code-image"></i>
185
- </template>
186
- <template slot="suffix">
187
- <img
188
- v-show="imgCode && (active == '0' || active == '12')"
189
- class="es-img-code"
190
- :src="imageCode"
191
- @click.stop="getImgCode"
192
- />
193
- </template>
194
- </el-input>
195
- </el-form-item>
196
- <div>
197
- <div class="es-password-handle">
198
- <el-checkbox
199
- v-show="remember && (active == '0' || active == '12')"
200
- v-model="checked"
201
- >记住密码</el-checkbox
202
- >
203
- <div v-show="showForget" class="es-password-forget">
204
- <span @click="handleForget">忘记密码</span>
205
- </div>
206
- </div>
207
- <el-button
208
- class="es-button-submit"
209
- type="primary"
210
- @click="handleLogin"
211
- >登录</el-button
212
- >
213
- </div>
214
- </el-form>
215
- </template>
216
- <template
217
- v-if="isShow(active) && (active == 3 || active == 7 || active == 9)"
218
- >
219
- <div
220
- class="es-login-qrcode"
221
- :class="{ 'es-login-qrcode-complex': mode == 'complex' }"
222
- >
223
- <div class="es-login-down-app" v-if="mode !== 'complex'">
224
- 打开
225
- <template v-if="active == 3">
226
- <a
227
- class="es-login-app-name es-pointer"
228
- target="_blank"
229
- :href="downloadApp"
230
- v-if="downloadApp"
231
- >{{ app }}app</a
232
- >
233
- <span
234
- class="es-login-app-name es-pointer"
235
- v-else
236
- @click="handleDownLoadApp"
237
- >{{ app }}app
238
- </span>
239
- </template>
240
- <span class="es-login-app-name" v-else
241
- >{{ active == 7 ? '钉钉' : '微信' }}app </span
242
- >,扫描二维码
243
- </div>
244
- <div class="es-login-qrcode-box">
245
- <es-qr-code
246
- :content="identifyingId"
247
- :logo="qrimg"
248
- auto
249
- v-if="active == 3 && identifyingId"
250
- ></es-qr-code>
251
- <div class="es-wx-qrcode-box" v-if="active == 9">
252
- <es-wxlogin
253
- href="data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICB3aWR0aDogMTAwJSAhaW1wb3J0YW50OwogICAgYm94LXNpemluZzogYm9yZGVyLWJveCAhaW1wb3J0YW50OwogICAgbWFyZ2luOiAwICFpbXBvcnRhbnQ7Cn0KCi5pbXBvd2VyQm94IC5pbmZvLAouaW1wb3dlckJveCAudGl0bGUgewogICAgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50Owp9"
254
- auto
255
- :appid="wechatAppid"
256
- :scope="wechatScope"
257
- :redirect_uri="redirectUri"
258
- ></es-wxlogin>
259
- </div>
260
- </div>
261
- <div
262
- v-if="active == 3 && mode == 'complex'"
263
- class="es-login-complex-app"
264
- >
265
- <div class="es-login-complex-scan">
266
- <i class="es-icon-scan"></i>
267
- <span class="es-login-complex-scan-tips"
268
- >打开app<br />扫一扫登录</span
269
- >
270
- </div>
271
- <div class="es-login-complex-download">
272
- <a
273
- class="es-login-app-name es-pointer"
274
- target="_blank"
275
- :href="downloadApp"
276
- v-if="downloadApp"
277
- >下载app</a
278
- >
279
- <span
280
- class="es-login-app-name es-pointer"
281
- v-else
282
- @click="handleDownLoadApp"
283
- >下载app
284
- </span>
285
- </div>
286
- </div>
287
- <div v-if="active == 3 && mode == 'complex'" class="es-to-login">
288
- <span class="es-pointer" @click="switchLoginType()"
289
- >账号登录<i class="es-icon-youbian"></i
290
- ></span>
291
- </div>
292
- </div>
293
- </template>
294
- <template v-if="isShow(active) && (active == 6 || active == 11)">
295
- <el-form
296
- :ref="'login' + active"
297
- class="es-login-form es-login-verify"
298
- :model="formData"
299
- >
300
- <el-form-item
301
- prop="target"
302
- :rules="active == 6 ? phone.rules : email.rules"
303
- >
304
- <el-input
305
- v-model="formData.target"
306
- type="text"
307
- name="target"
308
- tabindex="4"
309
- :placeholder="
310
- active == 6 ? phone.placeholder : email.placeholder
311
- "
312
- autocomplete="off"
313
- >
314
- <template slot="prefix">
315
- <i class="es-icon-zhanghao es-label-user"></i>
316
- </template>
317
- </el-input>
318
- </el-form-item>
319
- <el-form-item
320
- prop="verificationCode"
321
- :rules="[{ required: true, message: '验证码不能为空' }]"
322
- >
323
- <el-input
324
- name="verificationCode"
325
- type="text"
326
- v-model="formData.verificationCode"
327
- placeholder="请输入验证码"
328
- autocomplete="off"
329
- class="es-label-image-code es-label-get-code"
330
- tabindex="5"
331
- >
332
- <template slot="prefix">
333
- <i class="es-icon-yanzheng es-label-code-image"></i>
334
- </template>
335
- <template slot="suffix">
336
- <el-button
337
- class="es-get-code"
338
- type="primary"
339
- :disabled="disabled"
340
- @click.stop="getCode"
341
- >{{ btnText }}</el-button
342
- >
343
- </template>
344
- </el-input>
345
- </el-form-item>
346
- <div>
347
- <div class="es-password-handle">
348
- <el-checkbox
349
- v-show="remember && active == '0'"
350
- v-model="checked"
351
- >记住密码</el-checkbox
352
- >
353
- <div
354
- v-show="showForget"
355
- class="es-password-forget"
356
- @click="handleForget"
357
- >
358
- 忘记密码
359
- </div>
360
- </div>
361
- <el-button
362
- class="es-button-submit"
363
- type="primary"
364
- @click="handleLogin"
365
- >登录</el-button
366
- >
367
- </div>
368
- </el-form>
369
- </template>
370
- <div class="es-downloadSetup" v-if="downloadSetup || $slots.button">
371
- <slot name="button"></slot>
372
- <span class="es-setup" @click="downloadExe"
373
- >初次使用请下载一键安装包</span
374
- >
375
- </div>
376
- <div class="es-warning" v-if="warnInfo">
377
- {{ warnInfo }}
378
- </div>
379
- </div>
380
- </div>
381
- </div>
382
- <div v-if="icp && icpInfo" class="es-login-icp">
383
- <span class="es-login-icp-item" :style="_copyrightStyle">{{
384
- icpInfo.copyright_unit
385
- }}</span>
386
- <a
387
- class="es-login-icp-item"
388
- target="_blank"
389
- :style="_copyrightStyle"
390
- :href="icpInfo.copyright_icp_url"
391
- >{{ icpInfo.copyright_icp }}</a
392
- >
393
- </div>
394
- <es-dialog
395
- :title="operationCheckCode ? '修改密码' : '密码重置'"
396
- width="680px"
397
- height="auto"
398
- :visible.sync="showResetPassword"
399
- >
400
- <slot
401
- name="resetPassword"
402
- :secret="secret"
403
- :is-encrypt="isEncrypt"
404
- v-if="showResetPassword"
405
- >
406
- <reset-password
407
- :secret="secret"
408
- :is-encrypt="isEncrypt"
409
- :type="passModifyModel"
410
- :username="formData.username"
411
- :operationCheckCode="operationCheckCode"
412
- @success="handleSuccess"
413
- ></reset-password>
414
- </slot>
415
- </es-dialog>
416
- <es-dialog
417
- title="客户端下载"
418
- width="80%"
419
- height="80%"
420
- custom-class="es-clients-dialog"
421
- :visible.sync="showDownLoadApp"
422
- >
423
- <es-clients :downloads="download" :showTips="showIosTips"></es-clients>
424
- </es-dialog>
425
- <slot name="calogin"></slot>
426
- <es-dialog
427
- title="请进行身份效验"
428
- width="420px"
429
- height="380px"
430
- :show-scale="false"
431
- :visible.sync="showAssistance"
432
- @close="closeAssistance"
433
- >
434
- <es-qr-code :content="checkCode" v-if="checkCode"></es-qr-code>
435
- </es-dialog>
436
- <transition name="launch-fade">
437
- <div class="es-launch-image" :style="_launchImage" v-show="showLaunch">
438
- <p class="es-launch-text es-launch-user-name">{{ userName }},你好!</p>
439
- <p class="es-launch-text es-launch-system-name">
440
- 欢迎进入{{ sysName }}
441
- </p>
442
- </div>
443
- </transition>
444
- </div>
445
- </template>
446
- <script>
447
- import { debounce } from 'throttle-debounce';
448
- import resetPassword from './resetPassword.vue';
449
- import store from 'eoss-ui/src/utils/store';
450
- import util from 'eoss-ui/src/utils/util';
451
- import rules from 'eoss-ui/src/utils/rules.js';
452
- import {
453
- initLogin,
454
- changeImg,
455
- doUserLogin,
456
- doQrLogin,
457
- getLoginCode,
458
- doCodeLogin,
459
- getTwoFactorLoginCode,
460
- doTwoFactorLogin,
461
- doWechatQrLogin,
462
- doCaLogin,
463
- doAssistanceQrLogin
464
- } from 'eoss-ui/src/config/api.js';
465
- const ceshi = util.getParams('ceshi');
466
- import { dayImg, nightImg } from 'eoss-ui/src/config/image';
467
- export default {
468
- name: 'EsLogin',
469
- inheritAttrs: false,
470
- components: {
471
- resetPassword
472
- },
473
- props: {
474
- //初始登录配置接口地址
475
- initLogin: {
476
- type: String,
477
- default: initLogin
478
- },
479
- size: String,
480
- mode: {
481
- type: String,
482
- default: 'default'
483
- },
484
- switchs: {
485
- type: Array,
486
- default() {
487
- return [
488
- {
489
- type: '0',
490
- icon: 'es-icon-zhuomian'
491
- },
492
- {
493
- type: '3',
494
- name: '手机扫码登录',
495
- icon: 'es-icon-qrcode',
496
- tips: '扫码登录在这里',
497
- background:
498
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAoCAYAAAA2cfJIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDA2IDc5LmRhYmFjYmIsIDIwMjEvMDQvMTQtMDA6Mzk6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi40IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjZFRTVERTUxQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjZFRTVERTUyQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NkVFNURFNEZDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NkVFNURFNTBDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz64XoEfAAAB/UlEQVR42uycOUsDQRiG99vdHJ4JHhFN1EhEQkBsRVACghBbKytBf4OiNrZipQHtRLASsbJIQDQGBVHBysIDAxIvPBCCGpO4ZvwWrCT+gZ33gWV2mam+95mZPWDpcGZYCYQjY4oQs0Y+lxDF4qcCLAFpWrVud/QqRJOpZHy55Jjn3dUODv/oJXU+krm9vkPZrIXL29JU2x5aIaIeluDyb7/KxyDP/C2Eb00yd+l7znfHzLlUvymAk5f9LEplXYRhPHHT8J8AQGIgAAQAEABAAAABAAQAEABAAAABAAQAEABYAiGKBW66A+FIGQSQkIfTk3UjnzM/+G2zBDUQQDK+C3kjfZic+cp+XPHlPkvQCgGk2waESB/vRfNvmdivBJ0QQEJuTw7Wsq/PS7/bQRgCSEjh4/2GlwTNXAAggGS4m9uaXT7/vEI0mkrGExBAIqoafZ6ato5FIprg8DdxDyAR5bUed317KEqqusDhr+ApQCLsFZXOhlDXPGnaBoc/h/cAkuEJdg2pmp7i0+m/fRBAAnjPt3FzxrNfQAAAAQAEABAAQAAAASAAgAAAAgAIAGQVIEeqWo5SWBfSdQ83j/8JENMdzgGXz+9FqayH+ZMozrefT+Ol+nXzz1GBcGS8LhBcdvv8iaJhPKJsFlnebTavbnf0KURTnPNFqTE/AgwAPZCY5D/YjJ4AAAAASUVORK5CYII='
499
- }
500
- ];
501
- }
502
- },
503
- switchsActive: {
504
- type: String,
505
- default: '0'
506
- },
507
- launch: Boolean,
508
- param: {
509
- type: Object,
510
- default() {
511
- return {};
512
- }
513
- },
514
- loginBackground: [String, Array, Object],
515
- loginImage: [String, Array, Object],
516
- loginLogo: String,
517
- loginTitle: String,
518
- loginName: String,
519
- type: {
520
- type: String,
521
- default: '0'
522
- },
523
- firstLoginModel: String,
524
- //是否加密传输
525
- isEncrypt: {
526
- type: Boolean,
527
- default: true
528
- },
529
- model: {
530
- type: Object,
531
- default() {
532
- return {};
533
- }
534
- },
535
- username: {
536
- type: Object,
537
- default: () => {
538
- return {
539
- placeholder: '请输入账号',
540
- rules: [
541
- { required: true, message: '账号不能为空', trigger: 'change' }
542
- ]
543
- };
544
- }
545
- },
546
- phone: {
547
- type: Object,
548
- default: () => {
549
- return {
550
- placeholder: '请输入手机号',
551
- rules: [
552
- { required: true, message: '手机号不能为空', trigger: 'change' },
553
- {
554
- ...rules.phone,
555
- trigger: 'change'
556
- }
557
- ]
558
- };
559
- }
560
- },
561
- email: {
562
- type: Object,
563
- default: () => {
564
- return {
565
- placeholder: '请输入邮箱地址',
566
- rules: [
567
- {
568
- required: true,
569
- message: '请输入邮箱地址',
570
- trigger: 'change'
571
- },
572
- {
573
- type: 'email',
574
- message: '请输入正确的邮箱地址',
575
- trigger: 'blur'
576
- }
577
- ]
578
- };
579
- }
580
- },
581
- password: {
582
- type: Object,
583
- default: () => {
584
- return {
585
- placeholder: '请输入密码',
586
- rules: [
587
- { required: true, message: '密码不能为空', trigger: 'change' }
588
- ]
589
- };
590
- }
591
- },
592
- toUrl: String,
593
- //账号登录接口地址
594
- action: {
595
- type: String,
596
- default: doUserLogin
597
- },
598
- //ca登录地址
599
- caAction: {
600
- type: String,
601
- default: doCaLogin
602
- },
603
- //扫码登录接口地址
604
- scanAction: {
605
- type: String,
606
- default: doQrLogin
607
- },
608
- //图片验证码接口地址
609
- codeAction: {
610
- type: String,
611
- default: changeImg
612
- },
613
- getLoginCode: {
614
- type: String,
615
- default: getLoginCode
616
- },
617
- doCodeLogin: {
618
- type: String,
619
- default: doCodeLogin
620
- },
621
- getTwoFactorLoginCode: {
622
- type: String,
623
- default: getTwoFactorLoginCode
624
- },
625
- doTwoFactorLogin: {
626
- type: String,
627
- default: doTwoFactorLogin
628
- },
629
- doWechatQrLogin: {
630
- type: String,
631
- default: doWechatQrLogin
632
- },
633
- imgCode: {
634
- type: [Boolean, Object],
635
- default: true
636
- },
637
- onLogin: Function,
638
- onSuccess: Function,
639
- onError: {
640
- type: Function,
641
- default: () => {}
642
- },
643
- doorIndex: {
644
- type: Boolean,
645
- default: true
646
- },
647
- storage: String,
648
- warning: {
649
- type: [Boolean, String],
650
- default: false
651
- },
652
- icp: {
653
- type: Boolean,
654
- default: true
655
- },
656
- copyrightStyle: {
657
- type: Object,
658
- default() {
659
- return { color: '#ffffff' };
660
- }
661
- },
662
- appName: String,
663
- qrImage: String,
664
- forget: {
665
- type: [Boolean, String],
666
- default: true
667
- },
668
- remember: {
669
- type: Boolean,
670
- default: true
671
- },
672
- downloadApp: String,
673
- downLoadUrls: {
674
- type: Object,
675
- default() {
676
- return {};
677
- }
678
- },
679
- onDownLoadApp: [Function, Boolean],
680
- redirect_uri: String,
681
- position: {
682
- type: String,
683
- default: 'center'
684
- },
685
- translate: String,
686
- useResults: {
687
- type: Boolean,
688
- default: true
689
- },
690
- scanIntervalTime: {
691
- type: Number,
692
- default: 1500
693
- },
694
- isScale: Boolean,
695
- isFixed: Boolean,
696
- showIosTips: Boolean,
697
- safe: Boolean,
698
- launchImage: {
699
- type: [String, Object],
700
- default() {
701
- return {
702
- day: dayImg,
703
- night: nightImg
704
- };
705
- }
706
- },
707
- loginDownloadApps: Boolean
708
- },
709
- computed: {
710
- transform() {
711
- let translate = this.translate
712
- ? this.translate
713
- : this.align === 'center'
714
- ? '-50%, -51%'
715
- : '-51%';
716
- if (this.align.indexOf('%') > -1) {
717
- return {
718
- left: this.align,
719
- top: '50%',
720
- transform: `translateY(${translate})`
721
- };
722
- }
723
- if (this.align === 'left') {
724
- return {
725
- left: '30%',
726
- top: '50%',
727
- transform: `translateY(${translate})`
728
- };
729
- }
730
- if (this.align === 'right') {
731
- return {
732
- left: '70%',
733
- top: '50%',
734
- transform: `translateY(${translate})`
735
- };
736
- }
737
- return {
738
- left: '50%',
739
- top: '50%',
740
- transform: `translate(${translate})`
741
- };
742
- },
743
- redirectUri() {
744
- if (this.redirect_uri) {
745
- return this.redirect_uri;
746
- } else {
747
- return window.location.href || window.href;
748
- }
749
- },
750
- warnInfo() {
751
- if (this.warning === false && !this.warningText) {
752
- return false;
753
- }
754
- if (
755
- this.warningText &&
756
- this.warningText !== 'true' &&
757
- this.warningText !== true
758
- ) {
759
- return this.warningText;
760
- }
761
- if (this.warning && typeof this.warning === 'string') {
762
- return this.warning;
763
- }
764
- return '本系统为非涉密系统,禁止上传和处理任何涉密文件';
765
- },
766
- modelLength() {
767
- return Array.isArray(this.loginModel)
768
- ? this.loginModel.length
769
- : this.loginModel.split(',').length;
770
- },
771
- iconfonts() {
772
- const types = this.loginModel.split(',');
773
- return types.length > 2
774
- ? {
775
- 0: {
776
- type: '0',
777
- icon: 'es-icon-shuru',
778
- icon2: '',
779
- name: '账号登录'
780
- },
781
- 1: { type: '1', icon: 'es-icon-usb-key', name: '证书登录' },
782
- 3: {
783
- type: '3',
784
- icon: 'es-icon-saoma',
785
- icon2: '',
786
- name: '扫码登录'
787
- },
788
- 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
789
- 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
790
- 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
791
- 11: { type: '11', icon: 'es-icon-youxiang', name: '邮箱登录' },
792
- 12: { type: '12', icon: 'es-icon-shuru', name: '账号登录' } //双因素
793
- }
794
- : {
795
- 0: { type: '0', icon: 'es-icon-zhanghaodenglu', name: '账号登录' },
796
- 1: { type: '1', icon: 'es-icon-ca', name: '证书登录' },
797
- 3: { type: '3', icon: 'es-icon-saomadenglu', name: '扫码登录' },
798
- 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
799
- 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
800
- 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
801
- 11: { type: '11', icon: 'es-icon-wodeyouxiang', name: '邮箱登录' },
802
- 12: { type: '12', icon: 'es-icon-zhanghaodenglu', name: '账号登录' } //双因素
803
- };
804
- },
805
- icons() {
806
- let icon = [];
807
- const types = this.loginModel.split(',');
808
- types.forEach((item) => {
809
- icon.push(this.iconfonts[item]);
810
- });
811
- return icon;
812
- },
813
- _copyrightStyle() {
814
- let style = {};
815
- this.copyrightBgColor &&
816
- (style['background-color'] = this.copyrightBgColor);
817
- this.copyrightColor && (style['color'] = this.copyrightColor);
818
- return { ...this.copyrightStyle, ...style };
819
- },
820
- showVerifyCode() {
821
- return (
822
- this.passModifyModel &&
823
- (this.passModifyModel.indexOf('6') > -1 ||
824
- this.passModifyModel.indexOf('11') > -1)
825
- );
826
- },
827
- _launchImage() {
828
- let img = util.isObject(this.launchImages)
829
- ? this.launchImages[this.launchKey]
830
- : this.launchImages;
831
- return { 'background-image': `url(${img})` };
832
- },
833
- showForget() {
834
- return this.forgetUrl && typeof this.forgetUrl === 'string'
835
- ? true
836
- : this.forgetUrl === true &&
837
- (this.loginModel.indexOf('11') > -1 ||
838
- this.loginModel.indexOf('6') > -1);
839
- }
840
- },
841
- watch: {
842
- loginModel: {
843
- immediate: true,
844
- handler(val) {
845
- this.active = val.split(',')[0];
846
- this.title = this.iconfonts[this.active].name;
847
- }
848
- },
849
- active: {
850
- immediate: true,
851
- handler(val) {
852
- this.loginInfo(val == 3);
853
- }
854
- },
855
- identifyingId(val) {
856
- if (val) {
857
- this.loginInfo(this.active == 3);
858
- }
859
- },
860
- appName: {
861
- immediate: true,
862
- handler(val) {
863
- if (val) {
864
- this.app = val;
865
- }
866
- }
867
- },
868
- qrImage: {
869
- immediate: true,
870
- handler(val) {
871
- if (val) {
872
- this.qrimg = val;
873
- }
874
- }
875
- },
876
- checked(val) {
877
- if (!val) {
878
- localStorage.removeItem('unpd');
879
- //localStorage.removeItem('remember');
880
- }
881
- }
882
- // secret: {
883
- // immediate: true,
884
- // handler(val) {
885
- // if (val) {
886
- // if (this.storage) {
887
- // localStorage.setItem('secret', val);
888
- // } else {
889
- // sessionStorage.setItem('secret', val);
890
- // }
891
- // }
892
- // }
893
- // }
894
- },
895
- data() {
896
- return {
897
- title: '',
898
- align: this.position,
899
- loginBackgroundImg: this.loginBackground,
900
- loginMainImg: this.loginImage,
901
- loginNameImg: this.loginName,
902
- loginTitleImg: this.loginTitle,
903
- loginLogoImg: this.loginLogo,
904
- loginModel: this.type,
905
- passModifyModel: null,
906
- active: 0,
907
- submit: false,
908
- checked: false,
909
- formData: this.model,
910
- focusShow: false,
911
- users: [],
912
- imageCode: '',
913
- secret: null,
914
- identifyingId: '',
915
- download: {},
916
- setup: '',
917
- sysName: '',
918
- icpInfo: '',
919
- forgetUrl: this.forget,
920
- actionUrl: this.action,
921
- downloadSetup: '',
922
- app: '',
923
- qrimg: '',
924
- ios: '',
925
- android: '',
926
- pad: '',
927
- ipad: '',
928
- interval: null,
929
- showResetPassword: false,
930
- operationCheckCode: '',
931
- showDownLoadApp: false,
932
- wechatAppid: null,
933
- wechatScope: null,
934
- disabled: false,
935
- btnText: '获取验证码',
936
- timer: null,
937
- countdown: 0,
938
- code: null,
939
- defaultModel: JSON.parse(JSON.stringify(this.model)),
940
- copyrightColor: null,
941
- copyrightBgColor: null,
942
- checkCode: '',
943
- showAssistance: false,
944
- doAssistance: null,
945
- warningText: '',
946
- safes: {
947
- paste: (event) => {
948
- event.preventDefault();
949
- return false;
950
- },
951
- contextmenu: (event) => {
952
- event.preventDefault();
953
- return false;
954
- },
955
- copy: (event) => {
956
- event.preventDefault();
957
- return false;
958
- },
959
- cut: (event) => {
960
- event.preventDefault();
961
- return false;
962
- }
963
- },
964
- userName: '',
965
- launchShow: this.launch,
966
- showLaunch: false,
967
- launchImages: this.launchImage,
968
- launchKey: 'day',
969
- launchTime: 2000,
970
- switchActive: this.switchsActive,
971
- loginDownloadApp: this.loginDownloadApps
972
- };
973
- },
974
- beforeCreate() {
975
- this.setScale = debounce(300, () => {
976
- util.setScale();
977
- });
978
- util.removeStorage([
979
- 'remind',
980
- 'ssId',
981
- 'token',
982
- 'Authorization',
983
- 'deviceUnique',
984
- 'userId',
985
- 'userName',
986
- 'useCaseCodes'
987
- ]);
988
- },
989
- created() {
990
- this.launchKey = 5 < new Date().getHours() < 18 ? 'day' : 'night';
991
- if (ceshi == 'true' || ceshi == true) {
992
- this.loginModel = '0';
993
- }
994
- if (this.isScale || util.getParams('scale')) {
995
- util.setScale();
996
- window.addEventListener('resize', this.setScale);
997
- }
998
- this.code = util.getParams('code');
999
- if (this.code) {
1000
- this.doWechatLogin(this.code);
1001
- } else {
1002
- this.getLogin();
1003
- document.addEventListener('keyup', this.doLogin);
1004
- document.addEventListener('keydown', this.forbiddenTab);
1005
- }
1006
- this.init();
1007
- },
1008
- mounted() {
1009
- this.getRemember();
1010
- //delete util.win.websocket;
1011
- },
1012
- methods: {
1013
- init() {
1014
- let loginBoxAlign = localStorage.getItem('loginBoxAlign');
1015
- loginBoxAlign && (this.align = loginBoxAlign);
1016
- },
1017
- doWechatLogin(code) {
1018
- util
1019
- .ajax({
1020
- method: 'post',
1021
- url: this.doWechatQrLogin,
1022
- data: { code: code }
1023
- })
1024
- .then((res) => {
1025
- if (res.rCode == 0) {
1026
- const results = res.results;
1027
- this.handleResults(results);
1028
- } else {
1029
- const msg =
1030
- res.results && res.results.msg ? res.results.msg : res.msg;
1031
- this.$message({
1032
- message: msg || '系统错误,请联系管理员!',
1033
- type: 'error',
1034
- duration: 1500,
1035
- onClose: () => {
1036
- window.location.href = util.delUrlParam({ key: 'code' });
1037
- if (window.location.hash) {
1038
- location.reload();
1039
- }
1040
- }
1041
- });
1042
- }
1043
- })
1044
- .catch((err) => {
1045
- if (err.message && err.message !== 'canceled') {
1046
- this.$message.error(err.message);
1047
- }
1048
- });
1049
- },
1050
- getBackground(res) {
1051
- let style = {};
1052
- if (!res || (Array.isArray(res) && !res.length)) {
1053
- return style;
1054
- }
1055
- if (Array.isArray(res)) {
1056
- let url = [];
1057
- let image = [];
1058
- res.forEach((item) => {
1059
- if (item.indexOf('url(') > -1) {
1060
- url.push(item);
1061
- } else {
1062
- image.push(`url(${item})`);
1063
- }
1064
- });
1065
- if (url.length == res.length) {
1066
- style = { background: url.join(',') };
1067
- } else if (image.length == res.length) {
1068
- style = { 'background-image': image.join(',') };
1069
- } else {
1070
- console.error('设置的样式不一致!');
1071
- }
1072
- } else if (util.isObject(res)) {
1073
- style = res;
1074
- } else if (res.indexOf('url(') > -1) {
1075
- style = { background: res };
1076
- } else {
1077
- style = { 'background-image': `url(${res})` };
1078
- }
1079
- return style;
1080
- },
1081
- getRemember(user) {
1082
- let values = localStorage.getItem('unpd');
1083
- let value = {};
1084
- if (values) {
1085
- try {
1086
- values = JSON.parse(values);
1087
- let users = [];
1088
- for (let i in values) {
1089
- let k = util.esDecode(i);
1090
- value[k] = util.esDecode(values[i]);
1091
- users.push({ value: k });
1092
- }
1093
- this.users = users;
1094
- let keys = Object.keys(value);
1095
- if (keys.length) {
1096
- this.checked = true;
1097
- }
1098
- if (!user && keys.length == 1) {
1099
- user = keys[0];
1100
- // user = localStorage.getItem('remember');
1101
- // if (user) {
1102
- // user = util.esDecode(user);
1103
- // } else {
1104
- // user = keys[0];
1105
- // }
1106
- }
1107
- if (keys.length > 1) {
1108
- this.focusShow = true;
1109
- }
1110
- if (user) {
1111
- this.$set(this.formData, 'username', user);
1112
- this.$set(this.formData, 'password', value[user]);
1113
- }
1114
- } catch (error) {
1115
- localStorage.removeItem('unpd');
1116
- }
1117
- }
1118
- },
1119
- handleBlur(res) {
1120
- this.getRemember(res.value);
1121
- },
1122
- handleRemember() {
1123
- let values = localStorage.getItem('unpd');
1124
- let value = {};
1125
- if (values) {
1126
- values = JSON.parse(values);
1127
- for (let i in values) {
1128
- value[util.esDecode(i)] = util.esDecode(values[i]);
1129
- }
1130
- }
1131
- if (this.checked) {
1132
- //localStorage.setItem('remember', util.esEncode(this.formData.username));
1133
- value[this.formData.username] = this.formData.password;
1134
- let data = {};
1135
- for (let i in value) {
1136
- data[util.esEncode(i)] = util.esEncode(value[i]);
1137
- }
1138
- localStorage.setItem('unpd', JSON.stringify(data));
1139
- } else {
1140
- delete value[this.formData.username];
1141
- if (Object.keys(value)) {
1142
- let data = {};
1143
- for (let i in value) {
1144
- data[util.esEncode(i)] = util.esEncode(value[i]);
1145
- }
1146
- localStorage.setItem('unpd', JSON.stringify(data));
1147
- } else {
1148
- localStorage.removeItem('unpd');
1149
- }
1150
- //localStorage.removeItem('remember');
1151
- }
1152
- },
1153
- // 下载app的弹窗
1154
- handleDownLoadApp() {
1155
- if (this.onDownLoadApp) {
1156
- if (typeof this.onDownLoadApp === 'function') {
1157
- this.onDownLoadApp();
1158
- } else {
1159
- this.$emit('handleDownLoadApp');
1160
- this.$emit('handle-down-load-app');
1161
- }
1162
- } else {
1163
- this.showDownLoadApp = true;
1164
- }
1165
- },
1166
- handleDownLoadApps() {
1167
- if (this.downloadApp) {
1168
- window.open(this.downloadApp);
1169
- } else {
1170
- this.handleDownLoadApp();
1171
- }
1172
- },
1173
- switchLogin(res) {
1174
- if (res != 1) {
1175
- this.active = res.type;
1176
- this.title = res.name;
1177
- Object.keys(this.defaultModel).length &&
1178
- (this.formData = JSON.parse(JSON.stringify(this.defaultModel)));
1179
- }
1180
- this.countdown = 0;
1181
- this.$emit('change-type', res, this.identifyingId);
1182
- this.$nextTick(() => {
1183
- let ref = 'login' + this.active;
1184
- this.$refs[ref] && this.$refs[ref].clearValidate();
1185
- });
1186
- },
1187
- switchLoginType(res) {
1188
- this.countdown = 0;
1189
- if (res) {
1190
- this.active = res.type;
1191
- this.title = res.name || '';
1192
- this.switchActive = res.type;
1193
- } else {
1194
- this.active = this.switchs[0].type;
1195
- this.title = '';
1196
- this.switchActive = this.switchs[0].type;
1197
- }
1198
- this.$emit('change-type', res, this.identifyingId);
1199
- this.$nextTick(() => {
1200
- let ref = 'login' + this.active;
1201
- this.$refs[ref] && this.$refs[ref].clearValidate();
1202
- });
1203
- },
1204
- isShow(res) {
1205
- return this.loginModel.indexOf(res) > -1;
1206
- },
1207
- async getLogin() {
1208
- const config = util.getStorage('initLogin');
1209
- if (config) {
1210
- this.setConfig(JSON.parse(config));
1211
- }
1212
- await util
1213
- .ajax({ url: this.initLogin })
1214
- .then((res) => {
1215
- if (res && res.rCode === 0) {
1216
- store.set('initLogin', res.results);
1217
- util.setStorage({
1218
- type: 'localStorage',
1219
- key: 'initLogin',
1220
- value: JSON.stringify(res.results)
1221
- });
1222
- this.$emit('initLogin', res.results);
1223
- this.setConfig(res.results);
1224
- } else {
1225
- this.$message({
1226
- message: res.msg || '系统错误,请联系管理员!',
1227
- type: 'error',
1228
- duration: 2000
1229
- });
1230
- }
1231
- })
1232
- .catch((err) => {
1233
- if (err.message && err.message !== 'canceled') {
1234
- this.$message.error(err.message);
1235
- }
1236
- });
1237
- },
1238
- setConfig(res) {
1239
- const isLogined = localStorage.getItem('isLogined');
1240
- this.identifyingId = res.identifyingId || '';
1241
- this.getImgCode();
1242
- let downloads = {};
1243
- if (res.androidDownloadUrl) {
1244
- downloads['android'] = res.androidDownloadUrl;
1245
- }
1246
- if (res.iosDownloadUrl) {
1247
- downloads['ios'] = res.iosDownloadUrl;
1248
- }
1249
- if (res.iosDownloadUrl2) {
1250
- downloads['pad'] = res.iosDownloadUrl2;
1251
- }
1252
- if (res.macDownloadUrl) {
1253
- downloads['mac'] = res.macDownloadUrl;
1254
- }
1255
- if (res.winDownloadUrl) {
1256
- downloads['win'] = res.winDownloadUrl;
1257
- }
1258
- if (res.linuxDownloadUrl) {
1259
- downloads['linux'] = res.linuxDownloadUrl;
1260
- }
1261
- this.sysName = res.subsystemName;
1262
- this.secret = res.secret;
1263
- this.setup = res.setup;
1264
- this.downloadSetup = res.downloadSetup;
1265
- if (res.subsystemName) {
1266
- document.title = res.subsystemName;
1267
- }
1268
- this.app = res.appName || res.subsystemName;
1269
- if (res.qrimg || res.qrImg) {
1270
- this.qrimg = res.qrimg || res.qrImg;
1271
- }
1272
- if (res.loginModel && ceshi !== 'true' && ceshi !== true) {
1273
- this.loginModel =
1274
- (res.firstLoginModel || this.firstLoginModel) && !isLogined
1275
- ? res.firstLoginModel || this.firstLoginModel
1276
- : res.loginModel;
1277
- }
1278
- if (res.loginBackgroundUrl) {
1279
- this.loginBackgroundImg = res.loginBackgroundUrl.split(',');
1280
- }
1281
- if (res.loginLogoUrl) {
1282
- this.loginLogoImg = res.loginLogoUrl;
1283
- }
1284
- res.loginPage && sessionStorage.setItem('loginPage', res.loginPage);
1285
- if (res.subsystemExtend && Object.keys(res.subsystemExtend).length) {
1286
- this.icpInfo = res.subsystemExtend;
1287
- //忘记密码地址
1288
- if (
1289
- res.subsystemExtend.forgetPassUrl ||
1290
- res.subsystemExtend.look_pass_url
1291
- ) {
1292
- this.forgetUrl =
1293
- res.subsystemExtend.forgetPassUrl ||
1294
- res.subsystemExtend.look_pass_url;
1295
- }
1296
- res.subsystemExtend.loginPage &&
1297
- sessionStorage.setItem('loginPage', res.subsystemExtend.loginPage);
1298
- if (res.subsystemExtend.login_url) {
1299
- this.actionUrl = res.subsystemExtend.login_url;
1300
- }
1301
- if (
1302
- res.subsystemExtend.loginModel &&
1303
- (ceshi == 'true' || ceshi == true)
1304
- ) {
1305
- this.loginModel =
1306
- (res.firstLoginModel || this.firstLoginModel) && !isLogined
1307
- ? res.firstLoginModel || this.firstLoginModel
1308
- : res.subsystemExtend.loginModel;
1309
- }
1310
- if (res.subsystemExtend.applicationName) {
1311
- localStorage.setItem('appcode', res.subsystemExtend.applicationName);
1312
- }
1313
- if (res.subsystemExtend.loginBoxBackgroun) {
1314
- this.loginMainImg = res.subsystemExtend.loginBoxBackground.split(',');
1315
- }
1316
- if (res.subsystemExtend.loginBoxTitle) {
1317
- this.loginTitleImg = res.subsystemExtend.loginBoxTitle;
1318
- }
1319
- if (res.subsystemExtend.loginBoxName) {
1320
- this.loginNameImg = res.subsystemExtend.loginBoxName;
1321
- }
1322
- if (res.subsystemExtend.loginBoxAlign && this.useResults) {
1323
- localStorage.setItem(
1324
- 'loginBoxAlign',
1325
- res.subsystemExtend.loginBoxAlign
1326
- );
1327
- this.align = res.subsystemExtend.loginBoxAlign;
1328
- }
1329
- if (res.subsystemExtend.copyrightColor) {
1330
- this.copyrightColor = res.subsystemExtend.copyrightColor;
1331
- }
1332
- if (res.subsystemExtend.copyrightBackgroundColor) {
1333
- this.copyrightBgColor = res.subsystemExtend.copyrightBackgroundColor;
1334
- }
1335
- if (res.subsystemExtend.themeColor) {
1336
- util.updateTheme(res.subsystemExtend.themeColor);
1337
- localStorage.setItem('theme', res.subsystemExtend.themeColor);
1338
- }
1339
- if (res.subsystemExtend.macDownloadUrl) {
1340
- downloads.mac = res.subsystemExtend.macDownloadUrl;
1341
- }
1342
- if (res.subsystemExtend.winDownloadUrl) {
1343
- downloads.win = res.subsystemExtend.winDownloadUrl;
1344
- }
1345
- if (res.subsystemExtend.linuxDownloadUrl) {
1346
- downloads.linux = res.subsystemExtend.linuxDownloadUrl;
1347
- }
1348
- if (res.subsystemExtend.uosDownloadUrl) {
1349
- downloads.uos = res.subsystemExtend.uosDownloadUrl;
1350
- }
1351
- if (res.subsystemExtend.warningText) {
1352
- this.warningText = res.subsystemExtend.warningText;
1353
- }
1354
- if (res.subsystemExtend.launchTime) {
1355
- this.launchTime = parseInt(res.subsystemExtend.launchTime, 10);
1356
- }
1357
- if (res.subsystemExtend.launchImage) {
1358
- if (!this.launchShow) {
1359
- this.launchShow = true;
1360
- }
1361
- if (
1362
- res.subsystemExtend.launchImage != 'true' &&
1363
- res.subsystemExtend.launchImage != true
1364
- ) {
1365
- this.launchImages =
1366
- res.subsystemExtend.launchImage.indexOf('{') > -1 &&
1367
- res.subsystemExtend.launchImage.indexOf('}') > -1
1368
- ? JSON.parse(res.subsystemExtend.launchImage)
1369
- : res.subsystemExtend.launchImage;
1370
- }
1371
- }
1372
- if (res.subsystemExtend.loginDownloadApp) {
1373
- this.loginDownloadApp = res.subsystemExtend.loginDownloadApp;
1374
- }
1375
- }
1376
- this.passModifyModel = res.passModifyModel;
1377
- this.wechatAppid = res.wechatAppid;
1378
- this.wechatScope = res.wechatScope;
1379
- this.download = { ...this.downLoadUrls, ...downloads };
1380
- if (res.sysLogoIco) {
1381
- localStorage.setItem('sysLogoIco', res.sysLogoIco);
1382
- util.setFavicon(res.sysLogoIco);
1383
- }
1384
- },
1385
-
1386
- getImgCode() {
1387
- if (this.identifyingId === '') {
1388
- return;
1389
- }
1390
- this.imageCode =
1391
- util.getStorage('host') +
1392
- this.codeAction +
1393
- '?identifyingId=' +
1394
- this.identifyingId +
1395
- (this.imgCode && typeof this.imgCode == 'object'
1396
- ? '&' + util.queryParams(this.imgCode)
1397
- : '') +
1398
- '&heightflag=' +
1399
- Math.random().toString().split('.')[1];
1400
- delete this.formData.identifyingCode;
1401
- delete this.formData.verificationCode;
1402
- return this.imageCode;
1403
- },
1404
- getCode() {
1405
- if (this.countdown) {
1406
- return false;
1407
- }
1408
- let data = {};
1409
- let flag = false;
1410
- let ref = 'login' + this.active;
1411
- if (this.active == 12) {
1412
- if (!this.formData.username) {
1413
- this.$refs[ref].validateField('username');
1414
- return false;
1415
- }
1416
- this.$refs[ref].validateField('username', (res) => {
1417
- flag = res != '';
1418
- });
1419
- if (flag) {
1420
- return false;
1421
- }
1422
- data = {
1423
- username: this.formData.username,
1424
- targetType: this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS'
1425
- // targetType: 'SMS'
1426
- };
1427
- } else {
1428
- if (!this.formData.target) {
1429
- this.$refs[ref].validateField('target');
1430
- return false;
1431
- }
1432
- this.$refs[ref].validateField('target', (res) => {
1433
- flag = res != '';
1434
- });
1435
- if (flag) {
1436
- return false;
1437
- }
1438
- data = {
1439
- target: this.formData.target,
1440
- targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1441
- };
1442
- }
1443
- this.countdown = 60;
1444
- this.timer = setInterval(() => {
1445
- if (this.countdown > 0) {
1446
- this.countdown--;
1447
- this.disabled = true;
1448
- this.btnText = '重新获取' + this.countdown + 's';
1449
- } else {
1450
- this.btnText = '重新获取';
1451
- this.disabled = false;
1452
- this.submit = false;
1453
- }
1454
- }, 1000);
1455
- util
1456
- .ajax({
1457
- method: 'post',
1458
- url:
1459
- this.active == 12 ? this.getTwoFactorLoginCode : this.getLoginCode,
1460
- data: data
1461
- })
1462
- .then((res) => {
1463
- this.$message({
1464
- message: res.msg,
1465
- duration: 2000,
1466
- type: res.rCode == 0 ? 'success' : 'error'
1467
- });
1468
-
1469
- if (res.rCode === 2) {
1470
- this.btnText = '获取验证码';
1471
- this.disabled = false;
1472
- this.countdown = 0;
1473
- clearInterval(this.timer);
1474
- }
1475
- })
1476
- .catch((err) => {
1477
- if (err.message && err.message !== 'canceled') {
1478
- this.$message.error(err.message);
1479
- }
1480
- });
1481
- },
1482
- handleLogin() {
1483
- if (this.submit) {
1484
- return false;
1485
- }
1486
- let ref = 'login' + this.active;
1487
- this.$refs[ref].validate((valid) => {
1488
- if (valid) {
1489
- this.submit = true;
1490
- let param = util.getParams() || {};
1491
- const data =
1492
- this.active == '0'
1493
- ? {
1494
- username: this.formData.username,
1495
- password:
1496
- this.secret && this.isEncrypt
1497
- ? util.esmEncrypt({
1498
- data: this.formData.password,
1499
- key: this.secret
1500
- })
1501
- : this.formData.password,
1502
- identifyingCode: this.formData.identifyingCode,
1503
- identifyingId: this.identifyingId
1504
- }
1505
- : this.active == '12'
1506
- ? {
1507
- username: this.formData.username,
1508
- password:
1509
- this.secret && this.isEncrypt
1510
- ? util.esmEncrypt({
1511
- data: this.formData.password,
1512
- key: this.secret
1513
- })
1514
- : this.formData.password,
1515
- targetType:
1516
- this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS',
1517
- verificationCode: this.formData.identifyingCode
1518
- }
1519
- : {
1520
- target: this.formData.target,
1521
- verificationCode: this.formData.verificationCode,
1522
- targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1523
- };
1524
- if (this.onLogin) {
1525
- if (this.active == '0') {
1526
- this.onLogin(
1527
- { ...param, ...data },
1528
- this.getImgCode,
1529
- this.handleRemember
1530
- );
1531
- } else {
1532
- this.onLogin({ ...param, ...data });
1533
- }
1534
- } else {
1535
- this.handleUserLogin({ ...param, ...this.param, ...data });
1536
- }
1537
- } else {
1538
- this.submit = false;
1539
- return false;
1540
- }
1541
- });
1542
- },
1543
- doLogin(e) {
1544
- if (util.win.event == undefined) {
1545
- var key = e.keyCode;
1546
- } else {
1547
- var key = util.win.event.keyCode;
1548
- }
1549
- if (key == 13) {
1550
- this.handleLogin();
1551
- }
1552
- },
1553
- handleUserLogin(data) {
1554
- let extUserBindHandleId = sessionStorage.getItem('extUserBindHandleId');
1555
- util
1556
- .ajax({
1557
- method: 'post',
1558
- url:
1559
- this.active == '0'
1560
- ? this.actionUrl
1561
- : this.active == '12'
1562
- ? this.doTwoFactorLogin
1563
- : this.doCodeLogin,
1564
- data: extUserBindHandleId
1565
- ? { ...data, extUserBindHandleId: extUserBindHandleId }
1566
- : data
1567
- })
1568
- .then((res) => {
1569
- this.submit = false;
1570
- if (res.rCode == 0) {
1571
- util.removeStorage('extUserBindHandleId');
1572
- this.handleRemember();
1573
- const results = res.results;
1574
- this.handleResults(results);
1575
- if (this.onSuccess) {
1576
- this.onSuccess(res);
1577
- }
1578
- } else {
1579
- const msg =
1580
- res.results && res.results.msg ? res.results.msg : res.msg;
1581
- this.$message({
1582
- message: msg || '系统错误,请联系管理员!',
1583
- type: 'error',
1584
- duration: 1500,
1585
- onClose: () => {
1586
- this.btnText = '获取验证码';
1587
- this.disabled = false;
1588
- this.countdown = 0;
1589
- clearInterval(this.timer);
1590
- this.getImgCode();
1591
- }
1592
- });
1593
- this.onError(res);
1594
- }
1595
- })
1596
- .catch((err) => {
1597
- this.submit = false;
1598
- if (err.message && err.message !== 'canceled') {
1599
- this.$message.error(err.message);
1600
- }
1601
- });
1602
- },
1603
- caLogin(signedData) {
1604
- util
1605
- .ajax({
1606
- method: 'post',
1607
- url: this.caAction,
1608
- data: { identifyingId: this.identifyingId, signedData: signedData }
1609
- })
1610
- .then((res) => {
1611
- this.submit = false;
1612
- if (res.rCode == 0) {
1613
- const results = res.results;
1614
- this.handleResults(results);
1615
- if (this.onSuccess) {
1616
- this.onSuccess(res);
1617
- }
1618
- } else {
1619
- const msg =
1620
- res.results && res.results.msg ? res.results.msg : res.msg;
1621
- this.$message({
1622
- message: msg || '系统错误,请联系管理员!',
1623
- type: 'error',
1624
- duration: 1500,
1625
- onClose: () => {
1626
- this.getImgCode();
1627
- }
1628
- });
1629
- this.onError(res);
1630
- }
1631
- })
1632
- .catch((err) => {
1633
- if (err.message && err.message !== 'canceled') {
1634
- this.$message.error(err.message);
1635
- }
1636
- });
1637
- },
1638
- handleForget() {
1639
- if (typeof this.forgetUrl === 'string') {
1640
- util.win.open(this.forgetUrl);
1641
- } else {
1642
- this.showResetPassword = true;
1643
- }
1644
- },
1645
- downloadExe() {
1646
- util.win.open(this.downloadSetup);
1647
- },
1648
- //获取app登录信息
1649
- loginInfo(res) {
1650
- clearTimeout(this.interval);
1651
- if (res) {
1652
- this.interval = setTimeout(() => {
1653
- this.initRequestLoginInfo();
1654
- }, this.scanIntervalTime);
1655
- }
1656
- },
1657
- initRequestLoginInfo() {
1658
- if (this.identifyingId == '') {
1659
- return false;
1660
- }
1661
- util
1662
- .ajax({
1663
- method: 'post',
1664
- url: this.scanAction,
1665
- data: {
1666
- identifyingId: this.identifyingId
1667
- }
1668
- })
1669
- .then((res) => {
1670
- if (res.rCode === 0) {
1671
- const results = res.results;
1672
- if (results.statusCode === 0) {
1673
- clearTimeout(this.interval);
1674
- this.handleResults(results, 3);
1675
- } else {
1676
- this.loginInfo(true);
1677
- }
1678
- }
1679
- })
1680
- .catch((err) => {
1681
- clearTimeout(this.interval);
1682
- if (err.message && err.message !== 'canceled') {
1683
- this.$message.error(err.message);
1684
- }
1685
- });
1686
- },
1687
- handleResults(results, type) {
1688
- switch (results.statusCode) {
1689
- case 0:
1690
- this.userName = results.userName;
1691
- util.setStorage({
1692
- type: this.storage,
1693
- key: {
1694
- ssId: results.ssId,
1695
- token: results.token,
1696
- Authorization: results.token,
1697
- deviceUnique: results.deviceUnique,
1698
- userId: results.userId,
1699
- userName: results.userName,
1700
- useCaseCodes: results.resourceCodes
1701
- }
1702
- });
1703
- if (this.launchShow) {
1704
- this.$message({
1705
- message: '登录成功!',
1706
- type: 'success',
1707
- duration: 1000
1708
- });
1709
- this.showLaunch = true;
1710
- setTimeout(() => {
1711
- if (this.toUrl) {
1712
- window.location.href = this.toUrl;
1713
- } else if (results.doorIndex && this.doorIndex) {
1714
- sessionStorage.setItem('doorIndex', results.doorIndex);
1715
- localStorage.setItem('isLogined', true);
1716
- window.location.href = results.doorIndex;
1717
- } else {
1718
- if (window.location.href.indexOf('login.html') > -1) {
1719
- window.location.href = './main.html';
1720
- } else {
1721
- this.$router.push({ name: 'main' });
1722
- this.$nextTick(() => {
1723
- this.showLaunch = false;
1724
- });
1725
- }
1726
- }
1727
- }, this.launchTime);
1728
- } else {
1729
- this.$message({
1730
- message: '登录成功!',
1731
- type: 'success',
1732
- duration: 1500,
1733
- onClose: () => {
1734
- if (this.toUrl) {
1735
- window.location.href = this.toUrl;
1736
- } else if (results.doorIndex && this.doorIndex) {
1737
- sessionStorage.setItem('doorIndex', results.doorIndex);
1738
- localStorage.setItem('isLogined', true);
1739
- window.location.href = results.doorIndex;
1740
- } else {
1741
- if (window.location.href.indexOf('login.html') > -1) {
1742
- window.location.href = './main.html';
1743
- } else {
1744
- this.$router.push({ name: 'main' });
1745
- }
1746
- }
1747
- }
1748
- });
1749
- }
1750
- break;
1751
- case 2:
1752
- this.$confirm(
1753
- results.msg ? results.msg : '密码太简单了, 请修改密码?',
1754
- '提示',
1755
- {
1756
- confirmButtonText: '确定',
1757
- //cancelButtonText: '取消',
1758
- type: 'warning'
1759
- }
1760
- )
1761
- .then(() => {
1762
- this.operationCheckCode = results.checkCode;
1763
- if (typeof this.forgetUrl === 'string') {
1764
- util.win.open(this.forgetUrl);
1765
- } else {
1766
- this.showResetPassword = true;
1767
- }
1768
- })
1769
- .catch((e) => {});
1770
- break;
1771
- case 3:
1772
- let url =
1773
- results.doorIndex && this.doorIndex
1774
- ? results.doorIndex
1775
- : window.location.href.indexOf('main.html') > -1
1776
- ? './login.html'
1777
- : window.location.hash
1778
- ? window.location.href.replace('login', 'main')
1779
- : window.location.href;
1780
- const href = results.authorizeUrl.replace(
1781
- '{redirectUri}',
1782
- encodeURIComponent(url)
1783
- );
1784
- window.location.href = href;
1785
- // window.location.href =
1786
- // results.authorizeUrl.indexOf('?') > -1
1787
- // ? results.authorizeUrl + '&token=' + results.token
1788
- // : results.authorizeUrl + '?token=' + results.token;
1789
- break;
1790
- case 4:
1791
- this.$alert(
1792
- results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1793
- '提示',
1794
- {
1795
- confirmButtonText: '确定',
1796
- type: 'error'
1797
- }
1798
- )
1799
- .then(() => {
1800
- sessionStorage.setItem(
1801
- 'extUserBindHandleId',
1802
- results.extUserBindHandleId
1803
- );
1804
- window.location.href = util.delUrlParam({ key: 'code' });
1805
- if (window.location.hash) {
1806
- location.reload();
1807
- }
1808
- })
1809
- .catch((e) => {});
1810
- break;
1811
- case 102:
1812
- this.checkCode = results.checkCode;
1813
- this.showAssistance = true;
1814
- let { operationCheckCode } = JSON.parse(results.checkCode);
1815
- this.handleAssistance({ operationCheckCode });
1816
- break;
1817
- default:
1818
- if (type !== 3) {
1819
- this.$message({
1820
- message: results.msg,
1821
- type: 'error',
1822
- duration: 1500,
1823
- onClose: () => {
1824
- if (this.code) {
1825
- window.location.href = util.delUrlParam({ key: 'code' });
1826
- if (window.location.hash) {
1827
- location.reload();
1828
- }
1829
- } else {
1830
- this.getImgCode();
1831
- }
1832
- }
1833
- });
1834
- } else if (this.active == 3) {
1835
- this.loginInfo(true);
1836
- }
1837
- }
1838
- },
1839
- handleAssistance(data) {
1840
- clearTimeout(this.doAssistance);
1841
- this.doAssistance = setTimeout(() => {
1842
- this.doAssistanceLogin(data);
1843
- }, this.scanIntervalTime);
1844
- },
1845
- doAssistanceLogin(data) {
1846
- util
1847
- .ajax({
1848
- method: 'post',
1849
- url: doAssistanceQrLogin,
1850
- data: data
1851
- })
1852
- .then((res) => {
1853
- if (res.rCode === 0) {
1854
- const results = res.results;
1855
- if (results.statusCode === 0) {
1856
- clearTimeout(this.doAssistance);
1857
- this.handleResults(results, 3);
1858
- } else {
1859
- this.handleAssistance(data);
1860
- }
1861
- } else {
1862
- clearTimeout(this.doAssistance);
1863
- this.$message.error(res.msg);
1864
- }
1865
- })
1866
- .catch((err) => {
1867
- clearTimeout(this.doAssistance);
1868
- if (err.message && err.message !== 'canceled') {
1869
- this.$message.error(err.message);
1870
- }
1871
- });
1872
- },
1873
- closeAssistance() {
1874
- clearTimeout(this.doAssistance);
1875
- },
1876
- handleSuccess() {
1877
- this.showResetPassword = false;
1878
- },
1879
- forbiddenTab(e) {
1880
- if (e.keyCode == 9) {
1881
- return false;
1882
- }
1883
- },
1884
- handlePaste(event) {
1885
- this.safe && event.preventDefault();
1886
- }
1887
- },
1888
- beforeDestroy() {
1889
- window.removeEventListener('resize', this.setScale);
1890
- document.removeEventListener('keyup', this.doLogin);
1891
- document.removeEventListener('keydown', this.forbiddenTab);
1892
- }
1893
- };
1894
- </script>
1
+ <template>
2
+ <div
3
+ v-if="!code"
4
+ class="es-login-screen"
5
+ :class="{
6
+ 'es-login-medium': size == 'medium',
7
+ 'es-login-small': size == 'small',
8
+ 'es-login-mini': size == 'mini'
9
+ }"
10
+ :style="getBackground(loginBackgroundImg)"
11
+ >
12
+ <div
13
+ v-if="loginDownloadApp"
14
+ class="es-download-app"
15
+ @click="handleDownLoadApps"
16
+ >
17
+ <i class="el-icon-mobile-phone"></i>下载APP
18
+ </div>
19
+ <img v-if="loginLogoImg" class="es-login-logo" :src="loginLogoImg" />
20
+ <slot></slot>
21
+ <div
22
+ class="es-login"
23
+ v-loading.fullscreen.lock="submit"
24
+ element-loading-text="登录中..."
25
+ element-loading-spinner="el-icon-loading"
26
+ element-loading-background="rgba(0, 0, 0, 0.65)"
27
+ :class="{
28
+ 'es-simple': mode == 'simple',
29
+ 'es-adaptive': !isScale && !isFixed
30
+ }"
31
+ :style="transform"
32
+ >
33
+ <img v-if="loginNameImg" class="es-login-name" :src="loginNameImg" />
34
+ <div
35
+ class="es-login-main"
36
+ :style="getBackground(loginMainImg)"
37
+ :class="{
38
+ 'es-models': modelLength > 2 && mode !== 'complex',
39
+ 'es-complex': mode == 'complex'
40
+ }"
41
+ >
42
+ <div class="es-login-complex-title" v-if="mode == 'complex'">
43
+ 欢迎登录
44
+ </div>
45
+ <div
46
+ v-if="modelLength > 1 || mode == 'complex'"
47
+ :class="{
48
+ 'es-login-models': modelLength > 2 && mode !== 'complex',
49
+ 'es-login-model': modelLength == 2 || mode == 'complex'
50
+ }"
51
+ >
52
+ <template v-if="this.mode == 'complex'">
53
+ <template v-for="item in switchs">
54
+ <div
55
+ v-if="item.tips"
56
+ v-show="active != item.type"
57
+ class="es-login-model-tips"
58
+ :key="item.type + '_0'"
59
+ :style="getBackground(item.background)"
60
+ >
61
+ {{ item.tips }}
62
+ </div>
63
+ <span
64
+ v-show="switchActive != item.type"
65
+ class="es-icon-box"
66
+ @click="switchLoginType(item)"
67
+ :title="modelLength > 2 ? item.name : ''"
68
+ :key="item.type + '_1'"
69
+ >
70
+ <i :class="[item.icon, 'es-icon']"></i>
71
+ </span>
72
+ </template>
73
+ </template>
74
+ <template v-else>
75
+ <span
76
+ v-for="(item, index) in icons"
77
+ v-show="modelLength > 2 || active != item.type"
78
+ class="es-icon-box"
79
+ @click="switchLogin(item)"
80
+ :title="modelLength > 2 ? item.name : ''"
81
+ :key="index"
82
+ :class="[{ 'es-icon-active': active == item.type }]"
83
+ >
84
+ <i :class="[item.icon, 'es-icon']"></i>
85
+ </span>
86
+ </template>
87
+ </div>
88
+ <div v-if="loginTitleImg" class="es-login-title-image">
89
+ <img class="es-login-title-img" :src="loginTitleImg" />
90
+ </div>
91
+ <template v-else-if="mode !== 'complex'">
92
+ <slot name="login-title" :type="active">
93
+ <div class="es-login-title">
94
+ <span class="es-login-title-content">{{ title }}</span>
95
+ </div>
96
+ </slot>
97
+ </template>
98
+ <div class="es-login-form-box">
99
+ <div
100
+ v-if="mode == 'complex'"
101
+ class="es-login-complex-models"
102
+ :class="{ 'es-complex-title': active == '3' }"
103
+ >
104
+ <template v-if="active == '3'">
105
+ <div class="es-login-complex-models-item es-active">
106
+ {{ title }}
107
+ </div>
108
+ </template>
109
+ <template v-else>
110
+ <template v-for="item in icons">
111
+ <div
112
+ v-if="item.type !== '3'"
113
+ class="es-login-complex-models-item"
114
+ :class="{ 'es-active': active == item.type }"
115
+ :key="item.type"
116
+ @click="switchLogin(item)"
117
+ >
118
+ {{ item.name }}
119
+ </div>
120
+ </template>
121
+ </template>
122
+ </div>
123
+ <template v-if="isShow(active) && (active == 0 || active == 12)">
124
+ <el-form
125
+ :ref="'login' + active"
126
+ class="es-login-form"
127
+ :model="formData"
128
+ >
129
+ <el-form-item prop="username" :rules="username.rules">
130
+ <es-input
131
+ v-model="formData.username"
132
+ type="text"
133
+ name="username"
134
+ tabindex="1"
135
+ exclude
136
+ :placeholder="username.placeholder"
137
+ :focusShow="focusShow"
138
+ :data="users"
139
+ @select="handleBlur"
140
+ >
141
+ <template slot="prefix">
142
+ <i class="es-icon-zhanghao es-label-user"></i>
143
+ </template>
144
+ </es-input>
145
+ </el-form-item>
146
+ <el-form-item prop="password" :rules="password.rules">
147
+ <el-input
148
+ v-model="formData.password"
149
+ name="password"
150
+ tabindex="2"
151
+ type="password"
152
+ :placeholder="password.placeholder"
153
+ autocomplete="off"
154
+ show-password
155
+ @paste.native.capture="handlePaste"
156
+ @copy.native.capture="handlePaste"
157
+ >
158
+ <template slot="prefix">
159
+ <i class="es-icon-mima es-label-password"></i>
160
+ </template>
161
+ </el-input>
162
+ </el-form-item>
163
+ <el-form-item
164
+ prop="identifyingCode"
165
+ :rules="[
166
+ {
167
+ required: true,
168
+ message: '验证码不能为空',
169
+ trigger: 'change'
170
+ }
171
+ ]"
172
+ v-if="imgCode || showVerifyCode"
173
+ >
174
+ <el-input
175
+ name="identifyingCode"
176
+ tabindex="3"
177
+ type="text"
178
+ v-model="formData.identifyingCode"
179
+ placeholder="请输入验证码"
180
+ autocomplete="off"
181
+ class="es-label-image-code"
182
+ >
183
+ <template slot="prefix">
184
+ <i class="es-icon-yanzheng es-label-code-image"></i>
185
+ </template>
186
+ <template slot="suffix">
187
+ <img
188
+ v-show="imgCode && (active == '0' || active == '12')"
189
+ class="es-img-code"
190
+ :src="imageCode"
191
+ @click.stop="getImgCode"
192
+ />
193
+ </template>
194
+ </el-input>
195
+ </el-form-item>
196
+ <div>
197
+ <div class="es-password-handle">
198
+ <el-checkbox
199
+ v-show="remember && (active == '0' || active == '12')"
200
+ v-model="checked"
201
+ >记住密码</el-checkbox
202
+ >
203
+ <div v-show="showForget" class="es-password-forget">
204
+ <span @click="handleForget">忘记密码</span>
205
+ </div>
206
+ </div>
207
+ <el-button
208
+ class="es-button-submit"
209
+ type="primary"
210
+ @click="handleLogin"
211
+ >登录</el-button
212
+ >
213
+ </div>
214
+ </el-form>
215
+ </template>
216
+ <template
217
+ v-if="isShow(active) && (active == 3 || active == 7 || active == 9)"
218
+ >
219
+ <div
220
+ class="es-login-qrcode"
221
+ :class="{ 'es-login-qrcode-complex': mode == 'complex' }"
222
+ >
223
+ <div class="es-login-down-app" v-if="mode !== 'complex'">
224
+ 打开
225
+ <template v-if="active == 3">
226
+ <a
227
+ class="es-login-app-name es-pointer"
228
+ target="_blank"
229
+ :href="downloadApp"
230
+ v-if="downloadApp"
231
+ >{{ app }}app</a
232
+ >
233
+ <span
234
+ class="es-login-app-name es-pointer"
235
+ v-else
236
+ @click="handleDownLoadApp"
237
+ >{{ app }}app
238
+ </span>
239
+ </template>
240
+ <span class="es-login-app-name" v-else
241
+ >{{ active == 7 ? '钉钉' : '微信' }}app </span
242
+ >,扫描二维码
243
+ </div>
244
+ <div class="es-login-qrcode-box">
245
+ <es-qr-code
246
+ :content="identifyingId"
247
+ :logo="qrimg"
248
+ auto
249
+ v-if="active == 3 && identifyingId"
250
+ ></es-qr-code>
251
+ <div class="es-wx-qrcode-box" v-if="active == 9">
252
+ <es-wxlogin
253
+ href="data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICB3aWR0aDogMTAwJSAhaW1wb3J0YW50OwogICAgYm94LXNpemluZzogYm9yZGVyLWJveCAhaW1wb3J0YW50OwogICAgbWFyZ2luOiAwICFpbXBvcnRhbnQ7Cn0KCi5pbXBvd2VyQm94IC5pbmZvLAouaW1wb3dlckJveCAudGl0bGUgewogICAgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50Owp9"
254
+ auto
255
+ :appid="wechatAppid"
256
+ :scope="wechatScope"
257
+ :redirect_uri="redirectUri"
258
+ ></es-wxlogin>
259
+ </div>
260
+ </div>
261
+ <div
262
+ v-if="active == 3 && mode == 'complex'"
263
+ class="es-login-complex-app"
264
+ >
265
+ <div class="es-login-complex-scan">
266
+ <i class="es-icon-scan"></i>
267
+ <span class="es-login-complex-scan-tips"
268
+ >打开app<br />扫一扫登录</span
269
+ >
270
+ </div>
271
+ <div class="es-login-complex-download">
272
+ <a
273
+ class="es-login-app-name es-pointer"
274
+ target="_blank"
275
+ :href="downloadApp"
276
+ v-if="downloadApp"
277
+ >下载app</a
278
+ >
279
+ <span
280
+ class="es-login-app-name es-pointer"
281
+ v-else
282
+ @click="handleDownLoadApp"
283
+ >下载app
284
+ </span>
285
+ </div>
286
+ </div>
287
+ <div v-if="active == 3 && mode == 'complex'" class="es-to-login">
288
+ <span class="es-pointer" @click="switchLoginType()"
289
+ >账号登录<i class="es-icon-youbian"></i
290
+ ></span>
291
+ </div>
292
+ </div>
293
+ </template>
294
+ <template v-if="isShow(active) && (active == 6 || active == 11)">
295
+ <el-form
296
+ :ref="'login' + active"
297
+ class="es-login-form es-login-verify"
298
+ :model="formData"
299
+ >
300
+ <el-form-item
301
+ prop="target"
302
+ :rules="active == 6 ? phone.rules : email.rules"
303
+ >
304
+ <el-input
305
+ v-model="formData.target"
306
+ type="text"
307
+ name="target"
308
+ tabindex="4"
309
+ :placeholder="
310
+ active == 6 ? phone.placeholder : email.placeholder
311
+ "
312
+ autocomplete="off"
313
+ >
314
+ <template slot="prefix">
315
+ <i class="es-icon-zhanghao es-label-user"></i>
316
+ </template>
317
+ </el-input>
318
+ </el-form-item>
319
+ <el-form-item
320
+ prop="verificationCode"
321
+ :rules="[{ required: true, message: '验证码不能为空' }]"
322
+ >
323
+ <el-input
324
+ name="verificationCode"
325
+ type="text"
326
+ v-model="formData.verificationCode"
327
+ placeholder="请输入验证码"
328
+ autocomplete="off"
329
+ class="es-label-image-code es-label-get-code"
330
+ tabindex="5"
331
+ >
332
+ <template slot="prefix">
333
+ <i class="es-icon-yanzheng es-label-code-image"></i>
334
+ </template>
335
+ <template slot="suffix">
336
+ <el-button
337
+ class="es-get-code"
338
+ type="primary"
339
+ :disabled="disabled"
340
+ @click.stop="getCode"
341
+ >{{ btnText }}</el-button
342
+ >
343
+ </template>
344
+ </el-input>
345
+ </el-form-item>
346
+ <div>
347
+ <div class="es-password-handle">
348
+ <el-checkbox
349
+ v-show="remember && active == '0'"
350
+ v-model="checked"
351
+ >记住密码</el-checkbox
352
+ >
353
+ <div
354
+ v-show="showForget"
355
+ class="es-password-forget"
356
+ @click="handleForget"
357
+ >
358
+ 忘记密码
359
+ </div>
360
+ </div>
361
+ <el-button
362
+ class="es-button-submit"
363
+ type="primary"
364
+ @click="handleLogin"
365
+ >登录</el-button
366
+ >
367
+ </div>
368
+ </el-form>
369
+ </template>
370
+ <div class="es-downloadSetup" v-if="downloadSetup || $slots.button">
371
+ <slot name="button"></slot>
372
+ <span class="es-setup" @click="downloadExe"
373
+ >初次使用请下载一键安装包</span
374
+ >
375
+ </div>
376
+ <div class="es-warning" v-if="warnInfo">
377
+ {{ warnInfo }}
378
+ </div>
379
+ </div>
380
+ </div>
381
+ </div>
382
+ <div v-if="icp && icpInfo" class="es-login-icp">
383
+ <span class="es-login-icp-item" :style="_copyrightStyle">{{
384
+ icpInfo.copyright_unit
385
+ }}</span>
386
+ <a
387
+ class="es-login-icp-item"
388
+ target="_blank"
389
+ :style="_copyrightStyle"
390
+ :href="icpInfo.copyright_icp_url"
391
+ >{{ icpInfo.copyright_icp }}</a
392
+ >
393
+ </div>
394
+ <es-dialog
395
+ :title="operationCheckCode ? '修改密码' : '密码重置'"
396
+ width="680px"
397
+ height="auto"
398
+ :visible.sync="showResetPassword"
399
+ >
400
+ <slot
401
+ name="resetPassword"
402
+ :secret="secret"
403
+ :is-encrypt="isEncrypt"
404
+ v-if="showResetPassword"
405
+ >
406
+ <reset-password
407
+ :secret="secret"
408
+ :is-encrypt="isEncrypt"
409
+ :type="passModifyModel"
410
+ :username="formData.username"
411
+ :operationCheckCode="operationCheckCode"
412
+ @success="handleSuccess"
413
+ ></reset-password>
414
+ </slot>
415
+ </es-dialog>
416
+ <es-dialog
417
+ title="客户端下载"
418
+ width="80%"
419
+ height="80%"
420
+ custom-class="es-clients-dialog"
421
+ :visible.sync="showDownLoadApp"
422
+ >
423
+ <es-clients :downloads="download" :showTips="showIosTips"></es-clients>
424
+ </es-dialog>
425
+ <slot name="calogin"></slot>
426
+ <es-dialog
427
+ title="请进行身份效验"
428
+ width="420px"
429
+ height="380px"
430
+ :show-scale="false"
431
+ :visible.sync="showAssistance"
432
+ @close="closeAssistance"
433
+ >
434
+ <es-qr-code :content="checkCode" v-if="checkCode"></es-qr-code>
435
+ </es-dialog>
436
+ <transition name="launch-fade">
437
+ <div class="es-launch-image" :style="_launchImage" v-show="showLaunch">
438
+ <p class="es-launch-text es-launch-user-name">{{ userName }},你好!</p>
439
+ <p class="es-launch-text es-launch-system-name">
440
+ 欢迎进入{{ sysName }}
441
+ </p>
442
+ </div>
443
+ </transition>
444
+ </div>
445
+ </template>
446
+ <script>
447
+ import { debounce } from 'throttle-debounce';
448
+ import resetPassword from './resetPassword.vue';
449
+ import store from 'eoss-ui/src/utils/store';
450
+ import util from 'eoss-ui/src/utils/util';
451
+ import rules from 'eoss-ui/src/utils/rules.js';
452
+ import {
453
+ initLogin,
454
+ changeImg,
455
+ doUserLogin,
456
+ doQrLogin,
457
+ getLoginCode,
458
+ doCodeLogin,
459
+ getTwoFactorLoginCode,
460
+ doTwoFactorLogin,
461
+ doWechatQrLogin,
462
+ doCaLogin,
463
+ doAssistanceQrLogin
464
+ } from 'eoss-ui/src/config/api.js';
465
+ const ceshi = util.getParams('ceshi');
466
+ import { dayImg, nightImg } from 'eoss-ui/src/config/image';
467
+ export default {
468
+ name: 'EsLogin',
469
+ inheritAttrs: false,
470
+ components: {
471
+ resetPassword
472
+ },
473
+ props: {
474
+ //初始登录配置接口地址
475
+ initLogin: {
476
+ type: String,
477
+ default: initLogin
478
+ },
479
+ size: String,
480
+ mode: {
481
+ type: String,
482
+ default: 'default'
483
+ },
484
+ switchs: {
485
+ type: Array,
486
+ default() {
487
+ return [
488
+ {
489
+ type: '0',
490
+ icon: 'es-icon-zhuomian'
491
+ },
492
+ {
493
+ type: '3',
494
+ name: '手机扫码登录',
495
+ icon: 'es-icon-qrcode',
496
+ tips: '扫码登录在这里',
497
+ background:
498
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAoCAYAAAA2cfJIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDA2IDc5LmRhYmFjYmIsIDIwMjEvMDQvMTQtMDA6Mzk6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi40IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjZFRTVERTUxQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjZFRTVERTUyQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NkVFNURFNEZDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NkVFNURFNTBDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz64XoEfAAAB/UlEQVR42uycOUsDQRiG99vdHJ4JHhFN1EhEQkBsRVACghBbKytBf4OiNrZipQHtRLASsbJIQDQGBVHBysIDAxIvPBCCGpO4ZvwWrCT+gZ33gWV2mam+95mZPWDpcGZYCYQjY4oQs0Y+lxDF4qcCLAFpWrVud/QqRJOpZHy55Jjn3dUODv/oJXU+krm9vkPZrIXL29JU2x5aIaIeluDyb7/KxyDP/C2Eb00yd+l7znfHzLlUvymAk5f9LEplXYRhPHHT8J8AQGIgAAQAEABAAAABAAQAEABAAAABAAQAEABYAiGKBW66A+FIGQSQkIfTk3UjnzM/+G2zBDUQQDK+C3kjfZic+cp+XPHlPkvQCgGk2waESB/vRfNvmdivBJ0QQEJuTw7Wsq/PS7/bQRgCSEjh4/2GlwTNXAAggGS4m9uaXT7/vEI0mkrGExBAIqoafZ6ato5FIprg8DdxDyAR5bUed317KEqqusDhr+ApQCLsFZXOhlDXPGnaBoc/h/cAkuEJdg2pmp7i0+m/fRBAAnjPt3FzxrNfQAAAAQAEABAAQAAAASAAgAAAAgAIAGQVIEeqWo5SWBfSdQ83j/8JENMdzgGXz+9FqayH+ZMozrefT+Ol+nXzz1GBcGS8LhBcdvv8iaJhPKJsFlnebTavbnf0KURTnPNFqTE/AgwAPZCY5D/YjJ4AAAAASUVORK5CYII='
499
+ }
500
+ ];
501
+ }
502
+ },
503
+ switchsActive: {
504
+ type: String,
505
+ default: '0'
506
+ },
507
+ launch: Boolean,
508
+ param: {
509
+ type: Object,
510
+ default() {
511
+ return {};
512
+ }
513
+ },
514
+ loginBackground: [String, Array, Object],
515
+ loginImage: [String, Array, Object],
516
+ loginLogo: String,
517
+ loginTitle: String,
518
+ loginName: String,
519
+ type: {
520
+ type: String,
521
+ default: '0'
522
+ },
523
+ firstLoginModel: String,
524
+ //是否加密传输
525
+ isEncrypt: {
526
+ type: Boolean,
527
+ default: true
528
+ },
529
+ model: {
530
+ type: Object,
531
+ default() {
532
+ return {};
533
+ }
534
+ },
535
+ username: {
536
+ type: Object,
537
+ default: () => {
538
+ return {
539
+ placeholder: '请输入账号',
540
+ rules: [
541
+ { required: true, message: '账号不能为空', trigger: 'change' }
542
+ ]
543
+ };
544
+ }
545
+ },
546
+ phone: {
547
+ type: Object,
548
+ default: () => {
549
+ return {
550
+ placeholder: '请输入手机号',
551
+ rules: [
552
+ { required: true, message: '手机号不能为空', trigger: 'change' },
553
+ {
554
+ ...rules.phone,
555
+ trigger: 'change'
556
+ }
557
+ ]
558
+ };
559
+ }
560
+ },
561
+ email: {
562
+ type: Object,
563
+ default: () => {
564
+ return {
565
+ placeholder: '请输入邮箱地址',
566
+ rules: [
567
+ {
568
+ required: true,
569
+ message: '请输入邮箱地址',
570
+ trigger: 'change'
571
+ },
572
+ {
573
+ type: 'email',
574
+ message: '请输入正确的邮箱地址',
575
+ trigger: 'blur'
576
+ }
577
+ ]
578
+ };
579
+ }
580
+ },
581
+ password: {
582
+ type: Object,
583
+ default: () => {
584
+ return {
585
+ placeholder: '请输入密码',
586
+ rules: [
587
+ { required: true, message: '密码不能为空', trigger: 'change' }
588
+ ]
589
+ };
590
+ }
591
+ },
592
+ toUrl: String,
593
+ //账号登录接口地址
594
+ action: {
595
+ type: String,
596
+ default: doUserLogin
597
+ },
598
+ //ca登录地址
599
+ caAction: {
600
+ type: String,
601
+ default: doCaLogin
602
+ },
603
+ //扫码登录接口地址
604
+ scanAction: {
605
+ type: String,
606
+ default: doQrLogin
607
+ },
608
+ //图片验证码接口地址
609
+ codeAction: {
610
+ type: String,
611
+ default: changeImg
612
+ },
613
+ getLoginCode: {
614
+ type: String,
615
+ default: getLoginCode
616
+ },
617
+ doCodeLogin: {
618
+ type: String,
619
+ default: doCodeLogin
620
+ },
621
+ getTwoFactorLoginCode: {
622
+ type: String,
623
+ default: getTwoFactorLoginCode
624
+ },
625
+ doTwoFactorLogin: {
626
+ type: String,
627
+ default: doTwoFactorLogin
628
+ },
629
+ doWechatQrLogin: {
630
+ type: String,
631
+ default: doWechatQrLogin
632
+ },
633
+ imgCode: {
634
+ type: [Boolean, Object],
635
+ default: true
636
+ },
637
+ onLogin: Function,
638
+ onSuccess: Function,
639
+ onError: {
640
+ type: Function,
641
+ default: () => {}
642
+ },
643
+ doorIndex: {
644
+ type: Boolean,
645
+ default: true
646
+ },
647
+ storage: String,
648
+ warning: {
649
+ type: [Boolean, String],
650
+ default: false
651
+ },
652
+ icp: {
653
+ type: Boolean,
654
+ default: true
655
+ },
656
+ copyrightStyle: {
657
+ type: Object,
658
+ default() {
659
+ return { color: '#ffffff' };
660
+ }
661
+ },
662
+ appName: String,
663
+ qrImage: String,
664
+ forget: {
665
+ type: [Boolean, String],
666
+ default: true
667
+ },
668
+ remember: {
669
+ type: Boolean,
670
+ default: true
671
+ },
672
+ downloadApp: String,
673
+ downLoadUrls: {
674
+ type: Object,
675
+ default() {
676
+ return {};
677
+ }
678
+ },
679
+ onDownLoadApp: [Function, Boolean],
680
+ redirect_uri: String,
681
+ position: {
682
+ type: String,
683
+ default: 'center'
684
+ },
685
+ translate: String,
686
+ useResults: {
687
+ type: Boolean,
688
+ default: true
689
+ },
690
+ scanIntervalTime: {
691
+ type: Number,
692
+ default: 1500
693
+ },
694
+ isScale: Boolean,
695
+ isFixed: Boolean,
696
+ showIosTips: Boolean,
697
+ safe: Boolean,
698
+ launchImage: {
699
+ type: [String, Object],
700
+ default() {
701
+ return {
702
+ day: dayImg,
703
+ night: nightImg
704
+ };
705
+ }
706
+ },
707
+ loginDownloadApps: Boolean
708
+ },
709
+ computed: {
710
+ transform() {
711
+ let translate = this.translate
712
+ ? this.translate
713
+ : this.align === 'center'
714
+ ? '-50%, -51%'
715
+ : '-51%';
716
+ if (this.align.indexOf('%') > -1) {
717
+ return {
718
+ left: this.align,
719
+ top: '50%',
720
+ transform: `translateY(${translate})`
721
+ };
722
+ }
723
+ if (this.align === 'left') {
724
+ return {
725
+ left: '30%',
726
+ top: '50%',
727
+ transform: `translateY(${translate})`
728
+ };
729
+ }
730
+ if (this.align === 'right') {
731
+ return {
732
+ left: '70%',
733
+ top: '50%',
734
+ transform: `translateY(${translate})`
735
+ };
736
+ }
737
+ return {
738
+ left: '50%',
739
+ top: '50%',
740
+ transform: `translate(${translate})`
741
+ };
742
+ },
743
+ redirectUri() {
744
+ if (this.redirect_uri) {
745
+ return this.redirect_uri;
746
+ } else {
747
+ return window.location.href || window.href;
748
+ }
749
+ },
750
+ warnInfo() {
751
+ if (this.warning === false && !this.warningText) {
752
+ return false;
753
+ }
754
+ if (
755
+ this.warningText &&
756
+ this.warningText !== 'true' &&
757
+ this.warningText !== true
758
+ ) {
759
+ return this.warningText;
760
+ }
761
+ if (this.warning && typeof this.warning === 'string') {
762
+ return this.warning;
763
+ }
764
+ return '本系统为非涉密系统,禁止上传和处理任何涉密文件';
765
+ },
766
+ modelLength() {
767
+ return Array.isArray(this.loginModel)
768
+ ? this.loginModel.length
769
+ : this.loginModel.split(',').length;
770
+ },
771
+ iconfonts() {
772
+ const types = this.loginModel.split(',');
773
+ return types.length > 2
774
+ ? {
775
+ 0: {
776
+ type: '0',
777
+ icon: 'es-icon-shuru',
778
+ icon2: '',
779
+ name: '账号登录'
780
+ },
781
+ 1: { type: '1', icon: 'es-icon-usb-key', name: '证书登录' },
782
+ 3: {
783
+ type: '3',
784
+ icon: 'es-icon-saoma',
785
+ icon2: '',
786
+ name: '扫码登录'
787
+ },
788
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
789
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
790
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
791
+ 11: { type: '11', icon: 'es-icon-youxiang', name: '邮箱登录' },
792
+ 12: { type: '12', icon: 'es-icon-shuru', name: '账号登录' } //双因素
793
+ }
794
+ : {
795
+ 0: { type: '0', icon: 'es-icon-zhanghaodenglu', name: '账号登录' },
796
+ 1: { type: '1', icon: 'es-icon-ca', name: '证书登录' },
797
+ 3: { type: '3', icon: 'es-icon-saomadenglu', name: '扫码登录' },
798
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
799
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
800
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
801
+ 11: { type: '11', icon: 'es-icon-wodeyouxiang', name: '邮箱登录' },
802
+ 12: { type: '12', icon: 'es-icon-zhanghaodenglu', name: '账号登录' } //双因素
803
+ };
804
+ },
805
+ icons() {
806
+ let icon = [];
807
+ const types = this.loginModel.split(',');
808
+ types.forEach((item) => {
809
+ icon.push(this.iconfonts[item]);
810
+ });
811
+ return icon;
812
+ },
813
+ _copyrightStyle() {
814
+ let style = {};
815
+ this.copyrightBgColor &&
816
+ (style['background-color'] = this.copyrightBgColor);
817
+ this.copyrightColor && (style['color'] = this.copyrightColor);
818
+ return { ...this.copyrightStyle, ...style };
819
+ },
820
+ showVerifyCode() {
821
+ return (
822
+ this.passModifyModel &&
823
+ (this.passModifyModel.indexOf('6') > -1 ||
824
+ this.passModifyModel.indexOf('11') > -1)
825
+ );
826
+ },
827
+ _launchImage() {
828
+ let img = util.isObject(this.launchImages)
829
+ ? this.launchImages[this.launchKey]
830
+ : this.launchImages;
831
+ return { 'background-image': `url(${img})` };
832
+ },
833
+ showForget() {
834
+ return this.forgetUrl && typeof this.forgetUrl === 'string'
835
+ ? true
836
+ : this.forgetUrl === true && this.loginModel.indexOf('0') > -1;
837
+ }
838
+ },
839
+ watch: {
840
+ loginModel: {
841
+ immediate: true,
842
+ handler(val) {
843
+ this.active = val.split(',')[0];
844
+ this.title = this.iconfonts[this.active].name;
845
+ }
846
+ },
847
+ active: {
848
+ immediate: true,
849
+ handler(val) {
850
+ this.loginInfo(val == 3);
851
+ }
852
+ },
853
+ identifyingId(val) {
854
+ if (val) {
855
+ this.loginInfo(this.active == 3);
856
+ }
857
+ },
858
+ appName: {
859
+ immediate: true,
860
+ handler(val) {
861
+ if (val) {
862
+ this.app = val;
863
+ }
864
+ }
865
+ },
866
+ qrImage: {
867
+ immediate: true,
868
+ handler(val) {
869
+ if (val) {
870
+ this.qrimg = val;
871
+ }
872
+ }
873
+ },
874
+ checked(val) {
875
+ if (!val) {
876
+ localStorage.removeItem('unpd');
877
+ //localStorage.removeItem('remember');
878
+ }
879
+ }
880
+ // secret: {
881
+ // immediate: true,
882
+ // handler(val) {
883
+ // if (val) {
884
+ // if (this.storage) {
885
+ // localStorage.setItem('secret', val);
886
+ // } else {
887
+ // sessionStorage.setItem('secret', val);
888
+ // }
889
+ // }
890
+ // }
891
+ // }
892
+ },
893
+ data() {
894
+ return {
895
+ title: '',
896
+ align: this.position,
897
+ loginBackgroundImg: this.loginBackground,
898
+ loginMainImg: this.loginImage,
899
+ loginNameImg: this.loginName,
900
+ loginTitleImg: this.loginTitle,
901
+ loginLogoImg: this.loginLogo,
902
+ loginModel: this.type,
903
+ passModifyModel: null,
904
+ active: 0,
905
+ submit: false,
906
+ checked: false,
907
+ formData: this.model,
908
+ focusShow: false,
909
+ users: [],
910
+ imageCode: '',
911
+ secret: null,
912
+ identifyingId: '',
913
+ download: {},
914
+ setup: '',
915
+ sysName: '',
916
+ icpInfo: '',
917
+ forgetUrl: this.forget,
918
+ actionUrl: this.action,
919
+ downloadSetup: '',
920
+ app: '',
921
+ qrimg: '',
922
+ ios: '',
923
+ android: '',
924
+ pad: '',
925
+ ipad: '',
926
+ interval: null,
927
+ showResetPassword: false,
928
+ operationCheckCode: '',
929
+ showDownLoadApp: false,
930
+ wechatAppid: null,
931
+ wechatScope: null,
932
+ disabled: false,
933
+ btnText: '获取验证码',
934
+ timer: null,
935
+ countdown: 0,
936
+ code: null,
937
+ defaultModel: JSON.parse(JSON.stringify(this.model)),
938
+ copyrightColor: null,
939
+ copyrightBgColor: null,
940
+ checkCode: '',
941
+ showAssistance: false,
942
+ doAssistance: null,
943
+ warningText: '',
944
+ safes: {
945
+ paste: (event) => {
946
+ event.preventDefault();
947
+ return false;
948
+ },
949
+ contextmenu: (event) => {
950
+ event.preventDefault();
951
+ return false;
952
+ },
953
+ copy: (event) => {
954
+ event.preventDefault();
955
+ return false;
956
+ },
957
+ cut: (event) => {
958
+ event.preventDefault();
959
+ return false;
960
+ }
961
+ },
962
+ userName: '',
963
+ launchShow: this.launch,
964
+ showLaunch: false,
965
+ launchImages: this.launchImage,
966
+ launchKey: 'day',
967
+ launchTime: 2000,
968
+ switchActive: this.switchsActive,
969
+ loginDownloadApp: this.loginDownloadApps
970
+ };
971
+ },
972
+ beforeCreate() {
973
+ this.setScale = debounce(300, () => {
974
+ util.setScale();
975
+ });
976
+ util.removeStorage([
977
+ 'remind',
978
+ 'ssId',
979
+ 'token',
980
+ 'Authorization',
981
+ 'deviceUnique',
982
+ 'userId',
983
+ 'userName',
984
+ 'useCaseCodes'
985
+ ]);
986
+ },
987
+ created() {
988
+ this.launchKey = 5 < new Date().getHours() < 18 ? 'day' : 'night';
989
+ if (ceshi == 'true' || ceshi == true) {
990
+ this.loginModel = '0';
991
+ }
992
+ if (this.isScale || util.getParams('scale')) {
993
+ util.setScale();
994
+ window.addEventListener('resize', this.setScale);
995
+ }
996
+ this.code = util.getParams('code');
997
+ if (this.code) {
998
+ this.doWechatLogin(this.code);
999
+ } else {
1000
+ this.getLogin();
1001
+ document.addEventListener('keyup', this.doLogin);
1002
+ document.addEventListener('keydown', this.forbiddenTab);
1003
+ }
1004
+ this.init();
1005
+ },
1006
+ mounted() {
1007
+ this.getRemember();
1008
+ //delete util.win.websocket;
1009
+ },
1010
+ methods: {
1011
+ init() {
1012
+ let loginBoxAlign = localStorage.getItem('loginBoxAlign');
1013
+ loginBoxAlign && (this.align = loginBoxAlign);
1014
+ },
1015
+ doWechatLogin(code) {
1016
+ util
1017
+ .ajax({
1018
+ method: 'post',
1019
+ url: this.doWechatQrLogin,
1020
+ data: { code: code }
1021
+ })
1022
+ .then((res) => {
1023
+ if (res.rCode == 0) {
1024
+ const results = res.results;
1025
+ this.handleResults(results);
1026
+ } else {
1027
+ const msg =
1028
+ res.results && res.results.msg ? res.results.msg : res.msg;
1029
+ this.$message({
1030
+ message: msg || '系统错误,请联系管理员!',
1031
+ type: 'error',
1032
+ duration: 1500,
1033
+ onClose: () => {
1034
+ window.location.href = util.delUrlParam({ key: 'code' });
1035
+ if (window.location.hash) {
1036
+ location.reload();
1037
+ }
1038
+ }
1039
+ });
1040
+ }
1041
+ })
1042
+ .catch((err) => {
1043
+ if (err.message && err.message !== 'canceled') {
1044
+ this.$message.error(err.message);
1045
+ }
1046
+ });
1047
+ },
1048
+ getBackground(res) {
1049
+ let style = {};
1050
+ if (!res || (Array.isArray(res) && !res.length)) {
1051
+ return style;
1052
+ }
1053
+ if (Array.isArray(res)) {
1054
+ let url = [];
1055
+ let image = [];
1056
+ res.forEach((item) => {
1057
+ if (item.indexOf('url(') > -1) {
1058
+ url.push(item);
1059
+ } else {
1060
+ image.push(`url(${item})`);
1061
+ }
1062
+ });
1063
+ if (url.length == res.length) {
1064
+ style = { background: url.join(',') };
1065
+ } else if (image.length == res.length) {
1066
+ style = { 'background-image': image.join(',') };
1067
+ } else {
1068
+ console.error('设置的样式不一致!');
1069
+ }
1070
+ } else if (util.isObject(res)) {
1071
+ style = res;
1072
+ } else if (res.indexOf('url(') > -1) {
1073
+ style = { background: res };
1074
+ } else {
1075
+ style = { 'background-image': `url(${res})` };
1076
+ }
1077
+ return style;
1078
+ },
1079
+ getRemember(user) {
1080
+ let values = localStorage.getItem('unpd');
1081
+ let value = {};
1082
+ if (values) {
1083
+ try {
1084
+ values = JSON.parse(values);
1085
+ let users = [];
1086
+ for (let i in values) {
1087
+ let k = util.esDecode(i);
1088
+ value[k] = util.esDecode(values[i]);
1089
+ users.push({ value: k });
1090
+ }
1091
+ this.users = users;
1092
+ let keys = Object.keys(value);
1093
+ if (keys.length) {
1094
+ this.checked = true;
1095
+ }
1096
+ if (!user && keys.length == 1) {
1097
+ user = keys[0];
1098
+ // user = localStorage.getItem('remember');
1099
+ // if (user) {
1100
+ // user = util.esDecode(user);
1101
+ // } else {
1102
+ // user = keys[0];
1103
+ // }
1104
+ }
1105
+ if (keys.length > 1) {
1106
+ this.focusShow = true;
1107
+ }
1108
+ if (user) {
1109
+ this.$set(this.formData, 'username', user);
1110
+ this.$set(this.formData, 'password', value[user]);
1111
+ }
1112
+ } catch (error) {
1113
+ localStorage.removeItem('unpd');
1114
+ }
1115
+ }
1116
+ },
1117
+ handleBlur(res) {
1118
+ this.getRemember(res.value);
1119
+ },
1120
+ handleRemember() {
1121
+ let values = localStorage.getItem('unpd');
1122
+ let value = {};
1123
+ if (values) {
1124
+ values = JSON.parse(values);
1125
+ for (let i in values) {
1126
+ value[util.esDecode(i)] = util.esDecode(values[i]);
1127
+ }
1128
+ }
1129
+ if (this.checked) {
1130
+ //localStorage.setItem('remember', util.esEncode(this.formData.username));
1131
+ value[this.formData.username] = this.formData.password;
1132
+ let data = {};
1133
+ for (let i in value) {
1134
+ data[util.esEncode(i)] = util.esEncode(value[i]);
1135
+ }
1136
+ localStorage.setItem('unpd', JSON.stringify(data));
1137
+ } else {
1138
+ delete value[this.formData.username];
1139
+ if (Object.keys(value)) {
1140
+ let data = {};
1141
+ for (let i in value) {
1142
+ data[util.esEncode(i)] = util.esEncode(value[i]);
1143
+ }
1144
+ localStorage.setItem('unpd', JSON.stringify(data));
1145
+ } else {
1146
+ localStorage.removeItem('unpd');
1147
+ }
1148
+ //localStorage.removeItem('remember');
1149
+ }
1150
+ },
1151
+ // 下载app的弹窗
1152
+ handleDownLoadApp() {
1153
+ if (this.onDownLoadApp) {
1154
+ if (typeof this.onDownLoadApp === 'function') {
1155
+ this.onDownLoadApp();
1156
+ } else {
1157
+ this.$emit('handleDownLoadApp');
1158
+ this.$emit('handle-down-load-app');
1159
+ }
1160
+ } else {
1161
+ this.showDownLoadApp = true;
1162
+ }
1163
+ },
1164
+ handleDownLoadApps() {
1165
+ if (this.downloadApp) {
1166
+ window.open(this.downloadApp);
1167
+ } else {
1168
+ this.handleDownLoadApp();
1169
+ }
1170
+ },
1171
+ switchLogin(res) {
1172
+ if (res != 1) {
1173
+ this.active = res.type;
1174
+ this.title = res.name;
1175
+ Object.keys(this.defaultModel).length &&
1176
+ (this.formData = JSON.parse(JSON.stringify(this.defaultModel)));
1177
+ }
1178
+ this.countdown = 0;
1179
+ this.$emit('change-type', res, this.identifyingId);
1180
+ this.$nextTick(() => {
1181
+ let ref = 'login' + this.active;
1182
+ this.$refs[ref] && this.$refs[ref].clearValidate();
1183
+ });
1184
+ },
1185
+ switchLoginType(res) {
1186
+ this.countdown = 0;
1187
+ if (res) {
1188
+ this.active = res.type;
1189
+ this.title = res.name || '';
1190
+ this.switchActive = res.type;
1191
+ } else {
1192
+ this.active = this.switchs[0].type;
1193
+ this.title = '';
1194
+ this.switchActive = this.switchs[0].type;
1195
+ }
1196
+ this.$emit('change-type', res, this.identifyingId);
1197
+ this.$nextTick(() => {
1198
+ let ref = 'login' + this.active;
1199
+ this.$refs[ref] && this.$refs[ref].clearValidate();
1200
+ });
1201
+ },
1202
+ isShow(res) {
1203
+ return this.loginModel.indexOf(res) > -1;
1204
+ },
1205
+ async getLogin() {
1206
+ const config = util.getStorage('initLogin');
1207
+ if (config) {
1208
+ this.setConfig(JSON.parse(config));
1209
+ }
1210
+ await util
1211
+ .ajax({ url: this.initLogin })
1212
+ .then((res) => {
1213
+ if (res && res.rCode === 0) {
1214
+ store.set('initLogin', res.results);
1215
+ util.setStorage({
1216
+ type: 'localStorage',
1217
+ key: 'initLogin',
1218
+ value: JSON.stringify(res.results)
1219
+ });
1220
+ this.$emit('initLogin', res.results);
1221
+ this.setConfig(res.results);
1222
+ } else {
1223
+ this.$message({
1224
+ message: res.msg || '系统错误,请联系管理员!',
1225
+ type: 'error',
1226
+ duration: 2000
1227
+ });
1228
+ }
1229
+ })
1230
+ .catch((err) => {
1231
+ if (err.message && err.message !== 'canceled') {
1232
+ this.$message.error(err.message);
1233
+ }
1234
+ });
1235
+ },
1236
+ setConfig(res) {
1237
+ const isLogined = localStorage.getItem('isLogined');
1238
+ this.identifyingId = res.identifyingId || '';
1239
+ this.getImgCode();
1240
+ let downloads = {};
1241
+ if (res.androidDownloadUrl) {
1242
+ downloads['android'] = res.androidDownloadUrl;
1243
+ }
1244
+ if (res.iosDownloadUrl) {
1245
+ downloads['ios'] = res.iosDownloadUrl;
1246
+ }
1247
+ if (res.iosDownloadUrl2) {
1248
+ downloads['pad'] = res.iosDownloadUrl2;
1249
+ }
1250
+ if (res.macDownloadUrl) {
1251
+ downloads['mac'] = res.macDownloadUrl;
1252
+ }
1253
+ if (res.winDownloadUrl) {
1254
+ downloads['win'] = res.winDownloadUrl;
1255
+ }
1256
+ if (res.linuxDownloadUrl) {
1257
+ downloads['linux'] = res.linuxDownloadUrl;
1258
+ }
1259
+ this.sysName = res.subsystemName;
1260
+ this.secret = res.secret;
1261
+ this.setup = res.setup;
1262
+ this.downloadSetup = res.downloadSetup;
1263
+ if (res.subsystemName) {
1264
+ document.title = res.subsystemName;
1265
+ }
1266
+ this.app = res.appName || res.subsystemName;
1267
+ if (res.loginModel && ceshi !== 'true' && ceshi !== true) {
1268
+ this.loginModel =
1269
+ (res.firstLoginModel || this.firstLoginModel) && !isLogined
1270
+ ? res.firstLoginModel || this.firstLoginModel
1271
+ : res.loginModel;
1272
+ }
1273
+ if (res.loginBackgroundUrl) {
1274
+ this.loginBackgroundImg = res.loginBackgroundUrl.split(',');
1275
+ }
1276
+ if (res.loginLogoUrl) {
1277
+ this.loginLogoImg = res.loginLogoUrl;
1278
+ }
1279
+ res.loginPage && sessionStorage.setItem('loginPage', res.loginPage);
1280
+ if (res.subsystemExtend && Object.keys(res.subsystemExtend).length) {
1281
+ this.icpInfo = res.subsystemExtend;
1282
+ if (res.subsystemExtend.qrimg || res.subsystemExtend.qrImg) {
1283
+ this.qrimg = res.subsystemExtend.qrimg || res.subsystemExtend.qrImg;
1284
+ }
1285
+ //忘记密码地址
1286
+ if (
1287
+ res.subsystemExtend.forgetPassUrl ||
1288
+ res.subsystemExtend.look_pass_url
1289
+ ) {
1290
+ this.forgetUrl =
1291
+ res.subsystemExtend.forgetPassUrl ||
1292
+ res.subsystemExtend.look_pass_url;
1293
+ }
1294
+ res.subsystemExtend.loginPage &&
1295
+ sessionStorage.setItem('loginPage', res.subsystemExtend.loginPage);
1296
+ if (res.subsystemExtend.login_url) {
1297
+ this.actionUrl = res.subsystemExtend.login_url;
1298
+ }
1299
+ if (
1300
+ res.subsystemExtend.loginModel &&
1301
+ (ceshi == 'true' || ceshi == true)
1302
+ ) {
1303
+ this.loginModel =
1304
+ (res.firstLoginModel || this.firstLoginModel) && !isLogined
1305
+ ? res.firstLoginModel || this.firstLoginModel
1306
+ : res.subsystemExtend.loginModel;
1307
+ }
1308
+ if (res.subsystemExtend.applicationName) {
1309
+ localStorage.setItem('appcode', res.subsystemExtend.applicationName);
1310
+ }
1311
+ if (res.subsystemExtend.loginBoxBackgroun) {
1312
+ this.loginMainImg = res.subsystemExtend.loginBoxBackground.split(',');
1313
+ }
1314
+ if (res.subsystemExtend.loginBoxTitle) {
1315
+ this.loginTitleImg = res.subsystemExtend.loginBoxTitle;
1316
+ }
1317
+ if (res.subsystemExtend.loginBoxName) {
1318
+ this.loginNameImg = res.subsystemExtend.loginBoxName;
1319
+ }
1320
+ if (res.subsystemExtend.loginBoxAlign && this.useResults) {
1321
+ localStorage.setItem(
1322
+ 'loginBoxAlign',
1323
+ res.subsystemExtend.loginBoxAlign
1324
+ );
1325
+ this.align = res.subsystemExtend.loginBoxAlign;
1326
+ }
1327
+ if (res.subsystemExtend.copyrightColor) {
1328
+ this.copyrightColor = res.subsystemExtend.copyrightColor;
1329
+ }
1330
+ if (res.subsystemExtend.copyrightBackgroundColor) {
1331
+ this.copyrightBgColor = res.subsystemExtend.copyrightBackgroundColor;
1332
+ }
1333
+ if (res.subsystemExtend.themeColor) {
1334
+ util.updateTheme(res.subsystemExtend.themeColor);
1335
+ localStorage.setItem('theme', res.subsystemExtend.themeColor);
1336
+ }
1337
+ if (res.subsystemExtend.macDownloadUrl) {
1338
+ downloads.mac = res.subsystemExtend.macDownloadUrl;
1339
+ }
1340
+ if (res.subsystemExtend.winDownloadUrl) {
1341
+ downloads.win = res.subsystemExtend.winDownloadUrl;
1342
+ }
1343
+ if (res.subsystemExtend.linuxDownloadUrl) {
1344
+ downloads.linux = res.subsystemExtend.linuxDownloadUrl;
1345
+ }
1346
+ if (res.subsystemExtend.uosDownloadUrl) {
1347
+ downloads.uos = res.subsystemExtend.uosDownloadUrl;
1348
+ }
1349
+ if (res.subsystemExtend.warningText) {
1350
+ this.warningText = res.subsystemExtend.warningText;
1351
+ }
1352
+ if (res.subsystemExtend.launchTime) {
1353
+ this.launchTime = parseInt(res.subsystemExtend.launchTime, 10);
1354
+ }
1355
+ if (res.subsystemExtend.launchImage) {
1356
+ if (!this.launchShow) {
1357
+ this.launchShow = true;
1358
+ }
1359
+ if (
1360
+ res.subsystemExtend.launchImage != 'true' &&
1361
+ res.subsystemExtend.launchImage != true
1362
+ ) {
1363
+ this.launchImages =
1364
+ res.subsystemExtend.launchImage.indexOf('{') > -1 &&
1365
+ res.subsystemExtend.launchImage.indexOf('}') > -1
1366
+ ? JSON.parse(res.subsystemExtend.launchImage)
1367
+ : res.subsystemExtend.launchImage;
1368
+ }
1369
+ }
1370
+ if (res.subsystemExtend.loginDownloadApp) {
1371
+ this.loginDownloadApp = res.subsystemExtend.loginDownloadApp;
1372
+ }
1373
+ }
1374
+ this.passModifyModel = res.passModifyModel;
1375
+ this.wechatAppid = res.wechatAppid;
1376
+ this.wechatScope = res.wechatScope;
1377
+ this.download = { ...this.downLoadUrls, ...downloads };
1378
+ if (res.sysLogoIco) {
1379
+ localStorage.setItem('sysLogoIco', res.sysLogoIco);
1380
+ util.setFavicon(res.sysLogoIco);
1381
+ }
1382
+ },
1383
+
1384
+ getImgCode() {
1385
+ if (this.identifyingId === '') {
1386
+ return;
1387
+ }
1388
+ this.imageCode =
1389
+ util.getStorage('host') +
1390
+ this.codeAction +
1391
+ '?identifyingId=' +
1392
+ this.identifyingId +
1393
+ (this.imgCode && typeof this.imgCode == 'object'
1394
+ ? '&' + util.queryParams(this.imgCode)
1395
+ : '') +
1396
+ '&heightflag=' +
1397
+ Math.random().toString().split('.')[1];
1398
+ delete this.formData.identifyingCode;
1399
+ delete this.formData.verificationCode;
1400
+ return this.imageCode;
1401
+ },
1402
+ getCode() {
1403
+ if (this.countdown) {
1404
+ return false;
1405
+ }
1406
+ let data = {};
1407
+ let flag = false;
1408
+ let ref = 'login' + this.active;
1409
+ if (this.active == 12) {
1410
+ if (!this.formData.username) {
1411
+ this.$refs[ref].validateField('username');
1412
+ return false;
1413
+ }
1414
+ this.$refs[ref].validateField('username', (res) => {
1415
+ flag = res != '';
1416
+ });
1417
+ if (flag) {
1418
+ return false;
1419
+ }
1420
+ data = {
1421
+ username: this.formData.username,
1422
+ targetType: this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS'
1423
+ // targetType: 'SMS'
1424
+ };
1425
+ } else {
1426
+ if (!this.formData.target) {
1427
+ this.$refs[ref].validateField('target');
1428
+ return false;
1429
+ }
1430
+ this.$refs[ref].validateField('target', (res) => {
1431
+ flag = res != '';
1432
+ });
1433
+ if (flag) {
1434
+ return false;
1435
+ }
1436
+ data = {
1437
+ target: this.formData.target,
1438
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1439
+ };
1440
+ }
1441
+ this.countdown = 60;
1442
+ this.timer = setInterval(() => {
1443
+ if (this.countdown > 0) {
1444
+ this.countdown--;
1445
+ this.disabled = true;
1446
+ this.btnText = '重新获取' + this.countdown + 's';
1447
+ } else {
1448
+ this.btnText = '重新获取';
1449
+ this.disabled = false;
1450
+ this.submit = false;
1451
+ }
1452
+ }, 1000);
1453
+ util
1454
+ .ajax({
1455
+ method: 'post',
1456
+ url:
1457
+ this.active == 12 ? this.getTwoFactorLoginCode : this.getLoginCode,
1458
+ data: data
1459
+ })
1460
+ .then((res) => {
1461
+ this.$message({
1462
+ message: res.msg,
1463
+ duration: 2000,
1464
+ type: res.rCode == 0 ? 'success' : 'error'
1465
+ });
1466
+
1467
+ if (res.rCode === 2) {
1468
+ this.btnText = '获取验证码';
1469
+ this.disabled = false;
1470
+ this.countdown = 0;
1471
+ clearInterval(this.timer);
1472
+ }
1473
+ })
1474
+ .catch((err) => {
1475
+ if (err.message && err.message !== 'canceled') {
1476
+ this.$message.error(err.message);
1477
+ }
1478
+ });
1479
+ },
1480
+ handleLogin() {
1481
+ if (this.submit) {
1482
+ return false;
1483
+ }
1484
+ let ref = 'login' + this.active;
1485
+ this.$refs[ref].validate((valid) => {
1486
+ if (valid) {
1487
+ this.submit = true;
1488
+ let param = util.getParams() || {};
1489
+ const data =
1490
+ this.active == '0'
1491
+ ? {
1492
+ username: this.formData.username,
1493
+ password:
1494
+ this.secret && this.isEncrypt
1495
+ ? util.esmEncrypt({
1496
+ data: this.formData.password,
1497
+ key: this.secret
1498
+ })
1499
+ : this.formData.password,
1500
+ identifyingCode: this.formData.identifyingCode,
1501
+ identifyingId: this.identifyingId
1502
+ }
1503
+ : this.active == '12'
1504
+ ? {
1505
+ username: this.formData.username,
1506
+ password:
1507
+ this.secret && this.isEncrypt
1508
+ ? util.esmEncrypt({
1509
+ data: this.formData.password,
1510
+ key: this.secret
1511
+ })
1512
+ : this.formData.password,
1513
+ targetType:
1514
+ this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS',
1515
+ verificationCode: this.formData.identifyingCode
1516
+ }
1517
+ : {
1518
+ target: this.formData.target,
1519
+ verificationCode: this.formData.verificationCode,
1520
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1521
+ };
1522
+ if (this.onLogin) {
1523
+ if (this.active == '0') {
1524
+ this.onLogin(
1525
+ { ...param, ...data },
1526
+ this.getImgCode,
1527
+ this.handleRemember
1528
+ );
1529
+ } else {
1530
+ this.onLogin({ ...param, ...data });
1531
+ }
1532
+ } else {
1533
+ this.handleUserLogin({ ...param, ...this.param, ...data });
1534
+ }
1535
+ } else {
1536
+ this.submit = false;
1537
+ return false;
1538
+ }
1539
+ });
1540
+ },
1541
+ doLogin(e) {
1542
+ if (util.win.event == undefined) {
1543
+ var key = e.keyCode;
1544
+ } else {
1545
+ var key = util.win.event.keyCode;
1546
+ }
1547
+ if (key == 13) {
1548
+ this.handleLogin();
1549
+ }
1550
+ },
1551
+ handleUserLogin(data) {
1552
+ let extUserBindHandleId = sessionStorage.getItem('extUserBindHandleId');
1553
+ util
1554
+ .ajax({
1555
+ method: 'post',
1556
+ url:
1557
+ this.active == '0'
1558
+ ? this.actionUrl
1559
+ : this.active == '12'
1560
+ ? this.doTwoFactorLogin
1561
+ : this.doCodeLogin,
1562
+ data: extUserBindHandleId
1563
+ ? { ...data, extUserBindHandleId: extUserBindHandleId }
1564
+ : data
1565
+ })
1566
+ .then((res) => {
1567
+ this.submit = false;
1568
+ if (res.rCode == 0) {
1569
+ util.removeStorage('extUserBindHandleId');
1570
+ this.handleRemember();
1571
+ const results = res.results;
1572
+ this.handleResults(results);
1573
+ if (this.onSuccess) {
1574
+ this.onSuccess(res);
1575
+ }
1576
+ } else {
1577
+ const msg =
1578
+ res.results && res.results.msg ? res.results.msg : res.msg;
1579
+ this.$message({
1580
+ message: msg || '系统错误,请联系管理员!',
1581
+ type: 'error',
1582
+ duration: 1500,
1583
+ onClose: () => {
1584
+ this.btnText = '获取验证码';
1585
+ this.disabled = false;
1586
+ this.countdown = 0;
1587
+ clearInterval(this.timer);
1588
+ this.getImgCode();
1589
+ }
1590
+ });
1591
+ this.onError(res);
1592
+ }
1593
+ })
1594
+ .catch((err) => {
1595
+ this.submit = false;
1596
+ if (err.message && err.message !== 'canceled') {
1597
+ this.$message.error(err.message);
1598
+ }
1599
+ });
1600
+ },
1601
+ caLogin(signedData) {
1602
+ util
1603
+ .ajax({
1604
+ method: 'post',
1605
+ url: this.caAction,
1606
+ data: { identifyingId: this.identifyingId, signedData: signedData }
1607
+ })
1608
+ .then((res) => {
1609
+ this.submit = false;
1610
+ if (res.rCode == 0) {
1611
+ const results = res.results;
1612
+ this.handleResults(results);
1613
+ if (this.onSuccess) {
1614
+ this.onSuccess(res);
1615
+ }
1616
+ } else {
1617
+ const msg =
1618
+ res.results && res.results.msg ? res.results.msg : res.msg;
1619
+ this.$message({
1620
+ message: msg || '系统错误,请联系管理员!',
1621
+ type: 'error',
1622
+ duration: 1500,
1623
+ onClose: () => {
1624
+ this.getImgCode();
1625
+ }
1626
+ });
1627
+ this.onError(res);
1628
+ }
1629
+ })
1630
+ .catch((err) => {
1631
+ if (err.message && err.message !== 'canceled') {
1632
+ this.$message.error(err.message);
1633
+ }
1634
+ });
1635
+ },
1636
+ handleForget() {
1637
+ if (typeof this.forgetUrl === 'string') {
1638
+ util.win.open(this.forgetUrl);
1639
+ } else {
1640
+ this.showResetPassword = true;
1641
+ }
1642
+ },
1643
+ downloadExe() {
1644
+ util.win.open(this.downloadSetup);
1645
+ },
1646
+ //获取app登录信息
1647
+ loginInfo(res) {
1648
+ clearTimeout(this.interval);
1649
+ if (res) {
1650
+ this.interval = setTimeout(() => {
1651
+ this.initRequestLoginInfo();
1652
+ }, this.scanIntervalTime);
1653
+ }
1654
+ },
1655
+ initRequestLoginInfo() {
1656
+ if (this.identifyingId == '') {
1657
+ return false;
1658
+ }
1659
+ util
1660
+ .ajax({
1661
+ method: 'post',
1662
+ url: this.scanAction,
1663
+ data: {
1664
+ identifyingId: this.identifyingId
1665
+ }
1666
+ })
1667
+ .then((res) => {
1668
+ if (res.rCode === 0) {
1669
+ const results = res.results;
1670
+ if (results.statusCode === 0) {
1671
+ clearTimeout(this.interval);
1672
+ this.handleResults(results, 3);
1673
+ } else {
1674
+ this.loginInfo(true);
1675
+ }
1676
+ }
1677
+ })
1678
+ .catch((err) => {
1679
+ clearTimeout(this.interval);
1680
+ if (err.message && err.message !== 'canceled') {
1681
+ this.$message.error(err.message);
1682
+ }
1683
+ });
1684
+ },
1685
+ handleResults(results, type) {
1686
+ switch (results.statusCode) {
1687
+ case 0:
1688
+ this.userName = results.userName;
1689
+ util.setStorage({
1690
+ type: this.storage,
1691
+ key: {
1692
+ ssId: results.ssId,
1693
+ token: results.token,
1694
+ Authorization: results.token,
1695
+ deviceUnique: results.deviceUnique,
1696
+ userId: results.userId,
1697
+ userName: results.userName,
1698
+ useCaseCodes: results.resourceCodes
1699
+ }
1700
+ });
1701
+ if (this.launchShow) {
1702
+ this.$message({
1703
+ message: '登录成功!',
1704
+ type: 'success',
1705
+ duration: 1000
1706
+ });
1707
+ this.showLaunch = true;
1708
+ setTimeout(() => {
1709
+ if (this.toUrl) {
1710
+ window.location.href = this.toUrl;
1711
+ } else if (results.doorIndex && this.doorIndex) {
1712
+ sessionStorage.setItem('doorIndex', results.doorIndex);
1713
+ localStorage.setItem('isLogined', true);
1714
+ window.location.href = results.doorIndex;
1715
+ } else {
1716
+ if (window.location.href.indexOf('login.html') > -1) {
1717
+ window.location.href = './main.html';
1718
+ } else {
1719
+ this.$router.push({ name: 'main' });
1720
+ this.$nextTick(() => {
1721
+ this.showLaunch = false;
1722
+ });
1723
+ }
1724
+ }
1725
+ }, this.launchTime);
1726
+ } else {
1727
+ this.$message({
1728
+ message: '登录成功!',
1729
+ type: 'success',
1730
+ duration: 1500,
1731
+ onClose: () => {
1732
+ if (this.toUrl) {
1733
+ window.location.href = this.toUrl;
1734
+ } else if (results.doorIndex && this.doorIndex) {
1735
+ sessionStorage.setItem('doorIndex', results.doorIndex);
1736
+ localStorage.setItem('isLogined', true);
1737
+ window.location.href = results.doorIndex;
1738
+ } else {
1739
+ if (window.location.href.indexOf('login.html') > -1) {
1740
+ window.location.href = './main.html';
1741
+ } else {
1742
+ this.$router.push({ name: 'main' });
1743
+ }
1744
+ }
1745
+ }
1746
+ });
1747
+ }
1748
+ break;
1749
+ case 2:
1750
+ this.$confirm(
1751
+ results.msg ? results.msg : '密码太简单了, 请修改密码?',
1752
+ '提示',
1753
+ {
1754
+ confirmButtonText: '确定',
1755
+ //cancelButtonText: '取消',
1756
+ type: 'warning'
1757
+ }
1758
+ )
1759
+ .then(() => {
1760
+ this.operationCheckCode = results.checkCode;
1761
+ if (typeof this.forgetUrl === 'string') {
1762
+ util.win.open(this.forgetUrl);
1763
+ } else {
1764
+ this.showResetPassword = true;
1765
+ }
1766
+ })
1767
+ .catch((e) => {});
1768
+ break;
1769
+ case 3:
1770
+ let url =
1771
+ results.doorIndex && this.doorIndex
1772
+ ? results.doorIndex
1773
+ : window.location.href.indexOf('main.html') > -1
1774
+ ? './login.html'
1775
+ : window.location.hash
1776
+ ? window.location.href.replace('login', 'main')
1777
+ : window.location.href;
1778
+ const href = results.authorizeUrl.replace(
1779
+ '{redirectUri}',
1780
+ encodeURIComponent(url)
1781
+ );
1782
+ window.location.href = href;
1783
+ // window.location.href =
1784
+ // results.authorizeUrl.indexOf('?') > -1
1785
+ // ? results.authorizeUrl + '&token=' + results.token
1786
+ // : results.authorizeUrl + '?token=' + results.token;
1787
+ break;
1788
+ case 4:
1789
+ this.$alert(
1790
+ results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1791
+ '提示',
1792
+ {
1793
+ confirmButtonText: '确定',
1794
+ type: 'error'
1795
+ }
1796
+ )
1797
+ .then(() => {
1798
+ sessionStorage.setItem(
1799
+ 'extUserBindHandleId',
1800
+ results.extUserBindHandleId
1801
+ );
1802
+ window.location.href = util.delUrlParam({ key: 'code' });
1803
+ if (window.location.hash) {
1804
+ location.reload();
1805
+ }
1806
+ })
1807
+ .catch((e) => {});
1808
+ break;
1809
+ case 102:
1810
+ this.checkCode = results.checkCode;
1811
+ this.showAssistance = true;
1812
+ let { operationCheckCode } = JSON.parse(results.checkCode);
1813
+ this.handleAssistance({ operationCheckCode });
1814
+ break;
1815
+ default:
1816
+ if (type !== 3) {
1817
+ this.$message({
1818
+ message: results.msg,
1819
+ type: 'error',
1820
+ duration: 1500,
1821
+ onClose: () => {
1822
+ if (this.code) {
1823
+ window.location.href = util.delUrlParam({ key: 'code' });
1824
+ if (window.location.hash) {
1825
+ location.reload();
1826
+ }
1827
+ } else {
1828
+ this.getImgCode();
1829
+ }
1830
+ }
1831
+ });
1832
+ } else if (this.active == 3) {
1833
+ this.loginInfo(true);
1834
+ }
1835
+ }
1836
+ },
1837
+ handleAssistance(data) {
1838
+ clearTimeout(this.doAssistance);
1839
+ this.doAssistance = setTimeout(() => {
1840
+ this.doAssistanceLogin(data);
1841
+ }, this.scanIntervalTime);
1842
+ },
1843
+ doAssistanceLogin(data) {
1844
+ util
1845
+ .ajax({
1846
+ method: 'post',
1847
+ url: doAssistanceQrLogin,
1848
+ data: data
1849
+ })
1850
+ .then((res) => {
1851
+ if (res.rCode === 0) {
1852
+ const results = res.results;
1853
+ if (results.statusCode === 0) {
1854
+ clearTimeout(this.doAssistance);
1855
+ this.handleResults(results, 3);
1856
+ } else {
1857
+ this.handleAssistance(data);
1858
+ }
1859
+ } else {
1860
+ clearTimeout(this.doAssistance);
1861
+ this.$message.error(res.msg);
1862
+ }
1863
+ })
1864
+ .catch((err) => {
1865
+ clearTimeout(this.doAssistance);
1866
+ if (err.message && err.message !== 'canceled') {
1867
+ this.$message.error(err.message);
1868
+ }
1869
+ });
1870
+ },
1871
+ closeAssistance() {
1872
+ clearTimeout(this.doAssistance);
1873
+ },
1874
+ handleSuccess() {
1875
+ this.showResetPassword = false;
1876
+ },
1877
+ forbiddenTab(e) {
1878
+ if (e.keyCode == 9) {
1879
+ return false;
1880
+ }
1881
+ },
1882
+ handlePaste(event) {
1883
+ this.safe && event.preventDefault();
1884
+ }
1885
+ },
1886
+ beforeDestroy() {
1887
+ window.removeEventListener('resize', this.setScale);
1888
+ document.removeEventListener('keyup', this.doLogin);
1889
+ document.removeEventListener('keydown', this.forbiddenTab);
1890
+ }
1891
+ };
1892
+ </script>