eoss-ui 0.6.67 → 0.6.68

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