eoss-ui 0.7.51 → 0.7.53

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