eoss-ui 0.6.94 → 0.6.96

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