eoss-ui 0.6.39 → 0.6.41

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