eoss-ui 0.7.18 → 0.7.19

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