eoss-ui 0.7.27 → 0.7.29

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