eoss-ui 0.6.63 → 0.6.64

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