eoss-ui 0.6.64 → 0.6.65

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