eoss-ui 0.4.55 → 0.4.56

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 (63) hide show
  1. package/lib/button-group.js +136 -100
  2. package/lib/button.js +138 -102
  3. package/lib/cascader.js +2 -2
  4. package/lib/checkbox-group.js +140 -104
  5. package/lib/config/api.js +4 -0
  6. package/lib/data-table-form.js +137 -101
  7. package/lib/data-table.js +139 -103
  8. package/lib/date-picker.js +145 -109
  9. package/lib/dialog.js +136 -100
  10. package/lib/eoss-ui.common.js +785 -285
  11. package/lib/flow-group.js +136 -100
  12. package/lib/flow-list.js +143 -107
  13. package/lib/flow.js +187 -151
  14. package/lib/form.js +137 -101
  15. package/lib/handle-user.js +137 -101
  16. package/lib/handler.js +137 -101
  17. package/lib/index.js +1 -1
  18. package/lib/input-number.js +138 -102
  19. package/lib/input.js +138 -102
  20. package/lib/label.js +2 -2
  21. package/lib/login.js +171 -128
  22. package/lib/main.js +152 -116
  23. package/lib/mainComp.js +152 -116
  24. package/lib/menu.js +2 -2
  25. package/lib/nav.js +136 -100
  26. package/lib/notify.js +109 -101
  27. package/lib/page.js +136 -100
  28. package/lib/player.js +136 -100
  29. package/lib/qr-code.js +136 -100
  30. package/lib/radio-group.js +137 -101
  31. package/lib/retrial-auth.js +3328 -0
  32. package/lib/select-ganged.js +138 -102
  33. package/lib/select.js +139 -103
  34. package/lib/selector-panel.js +154 -118
  35. package/lib/selector.js +139 -103
  36. package/lib/sizer.js +140 -104
  37. package/lib/steps.js +138 -102
  38. package/lib/switch.js +138 -102
  39. package/lib/table-form.js +138 -102
  40. package/lib/tabs-panel.js +2 -2
  41. package/lib/tabs.js +145 -109
  42. package/lib/theme-chalk/index.css +1 -1
  43. package/lib/theme-chalk/retrial-auth.css +1 -0
  44. package/lib/tips.js +139 -103
  45. package/lib/toolbar.js +2 -2
  46. package/lib/tree-group.js +138 -102
  47. package/lib/tree.js +139 -103
  48. package/lib/upload.js +146 -110
  49. package/lib/utils/util.js +32 -4
  50. package/lib/wujie.js +138 -102
  51. package/lib/wxlogin.js +138 -102
  52. package/package.json +2 -2
  53. package/packages/checkbox-group/src/main.vue +7 -7
  54. package/packages/login/src/main.vue +26 -18
  55. package/packages/retrial-auth/index.js +5 -0
  56. package/packages/retrial-auth/src/main.vue +271 -0
  57. package/packages/theme-chalk/lib/index.css +1 -1
  58. package/packages/theme-chalk/lib/retrial-auth.css +1 -0
  59. package/packages/theme-chalk/src/index.scss +1 -0
  60. package/packages/theme-chalk/src/retrial-auth.scss +38 -0
  61. package/src/config/api.js +4 -0
  62. package/src/index.js +4 -1
  63. package/src/utils/util.js +32 -4
@@ -0,0 +1,271 @@
1
+ <template>
2
+ <div class="es-retrial-auth" v-loading.fullscreen.lock="submit">
3
+ <es-qr-code
4
+ :width="200"
5
+ :height="200"
6
+ :content="uuid"
7
+ :logo="qrImg"
8
+ v-if="active === 'SCANCODE'"
9
+ ></es-qr-code>
10
+ <el-form ref="auth" class="es-retrial-auth-form" :model="formData" v-else>
11
+ <el-form-item>
12
+ <div>
13
+ 验证码将发送至{{
14
+ active == 'WEB_SMS' ? `手机号:${phoneText}` : `邮箱:${emailText}`
15
+ }}
16
+ </div>
17
+ </el-form-item>
18
+ <el-form-item
19
+ size="large"
20
+ prop="verificationCode"
21
+ :rules="[
22
+ { required: true, message: '验证码不能为空', trigger: 'change' }
23
+ ]"
24
+ >
25
+ <el-input
26
+ size="large"
27
+ name="verificationCode"
28
+ type="text"
29
+ v-model="formData.verificationCode"
30
+ placeholder="请输入验证码"
31
+ autocomplete="off"
32
+ class="es-label-image-code"
33
+ >
34
+ <template slot="suffix">
35
+ <el-button
36
+ class="es-get-code"
37
+ type="primary"
38
+ :disabled="disabled"
39
+ @click.stop="getCode"
40
+ >{{ btnText }}</el-button
41
+ >
42
+ </template>
43
+ </el-input>
44
+ </el-form-item>
45
+ <el-button class="es-button-submit" type="primary" @click="handleAuth"
46
+ >提交验证</el-button
47
+ >
48
+ </el-form>
49
+ <div v-if="type && type.length > 1" class="es-login-switchs">
50
+ <i
51
+ v-for="(item, index) in icons"
52
+ @click="handleSwitch(index)"
53
+ :key="index"
54
+ :class="[item, 'es-icon', { 'es-active': active == index }]"
55
+ ></i>
56
+ </div>
57
+ </div>
58
+ </template>
59
+ <script>
60
+ import util from 'eoss-ui/src/utils/util';
61
+ import {
62
+ initRetrialAuth,
63
+ getRetrialAuthCode,
64
+ scanCodeRetrialAuth,
65
+ codeRetrialAuth
66
+ } from 'eoss-ui/src/config/api.js';
67
+ export default {
68
+ name: 'EsRetrialAuth',
69
+ inheritAttrs: false,
70
+ props: {
71
+ group: String,
72
+ type: Array,
73
+ msgBox: {}
74
+ },
75
+ computed: {
76
+ icons() {
77
+ let icons = {};
78
+ for (let i in this.fonts) {
79
+ if (this.type.includes(i)) {
80
+ icons[i] = this.fonts[i];
81
+ }
82
+ }
83
+ return icons;
84
+ }
85
+ },
86
+ watch: {
87
+ active: {
88
+ handler(val) {
89
+ if (val === 'SCANCODE' && this.uuid) {
90
+ this.$nextTick(() => {
91
+ this.handleScanCodeRetrialAuth();
92
+ });
93
+ }
94
+ }
95
+ }
96
+ },
97
+ data() {
98
+ return {
99
+ userModel: {},
100
+ active: this.type[0],
101
+ formData: {
102
+ verificationCode: ''
103
+ },
104
+ fonts: {
105
+ SCANCODE: 'es-icon-saoma',
106
+ WEB_SMS: 'es-icon-duanxin',
107
+ WEB_EMAIL: 'es-icon-youxiang'
108
+ },
109
+ uuid: '',
110
+ qrImg: '',
111
+ emailText: null,
112
+ phoneText: null,
113
+ disabled: false,
114
+ btnText: '获取验证码',
115
+ countdown: 0,
116
+ timer: null,
117
+ scanCode: null,
118
+ submit: false
119
+ };
120
+ },
121
+ created() {
122
+ this.init();
123
+ },
124
+ mounted() {},
125
+ methods: {
126
+ init() {
127
+ let mainConfig = util.getStorage('mainConfig');
128
+ mainConfig && (this.userModel = JSON.parse(mainConfig).userModel);
129
+ util
130
+ .ajax({
131
+ url: initRetrialAuth
132
+ })
133
+ .then((res) => {
134
+ let { rCode, results } = res;
135
+ if (rCode == 0) {
136
+ this.uuid = results.uuid;
137
+ this.qrImg = results.qrImg;
138
+ this.emailText = results.emailText;
139
+ this.phoneText = results.phoneText;
140
+ if (this.active === 'SCANCODE') {
141
+ this.handleScanCodeRetrialAuth();
142
+ }
143
+ }
144
+ })
145
+ .catch();
146
+ },
147
+ handleAuth() {
148
+ if (this.submit) {
149
+ return false;
150
+ }
151
+ this.$refs['auth'].validate((valid) => {
152
+ if (valid) {
153
+ this.submit = true;
154
+ let params = {
155
+ retrialAuthGroupIds: this.group,
156
+ targetType: this.active === 'WEB_SMS' ? 'SMS' : 'EMAIL',
157
+ verificationCode: this.formData.verificationCode
158
+ };
159
+ util
160
+ .ajax({
161
+ url: codeRetrialAuth,
162
+ method: 'post',
163
+ data: params
164
+ })
165
+ .then((res) => {
166
+ let { rCode, msg } = res;
167
+ if (rCode == 0) {
168
+ this.$message({
169
+ message: '认证成功',
170
+ type: 'success'
171
+ });
172
+ this.msgBox.handleClose();
173
+ util.win.top.location.reload();
174
+ } else {
175
+ this.$message({
176
+ message: msg,
177
+ type: 'error'
178
+ });
179
+ this.submit = false;
180
+ }
181
+ })
182
+ .catch();
183
+ }
184
+ });
185
+ },
186
+ handleSwitch(res) {
187
+ clearTimeout(this.scanCode);
188
+ this.active = res;
189
+ },
190
+ getCode() {
191
+ if (this.countdown) {
192
+ return false;
193
+ }
194
+ let params = { targetType: this.active === 'WEB_SMS' ? 'SMS' : 'EMAIL' };
195
+ this.countdown = 60;
196
+ this.timer = setInterval(() => {
197
+ if (this.countdown > 0) {
198
+ this.countdown--;
199
+ this.disabled = true;
200
+ this.btnText = '重新获取' + this.countdown + 's';
201
+ } else {
202
+ this.btnText = '重新获取';
203
+ this.disabled = false;
204
+ this.submit = false;
205
+ }
206
+ }, 1000);
207
+ util
208
+ .ajax({
209
+ url: getRetrialAuthCode,
210
+ method: 'post',
211
+ data: params,
212
+ params: params
213
+ })
214
+ .then((res) => {
215
+ let { rCode } = res;
216
+ if (rCode == 0) {
217
+ this.$message({
218
+ message:
219
+ '验证码已发送至' +
220
+ (this.active === 'WEB_SMS' ? '手机' : '邮箱') +
221
+ ',请注意查收!',
222
+ type: 'success'
223
+ });
224
+ }
225
+ })
226
+ .catch();
227
+ },
228
+ handleScanCodeRetrialAuth() {
229
+ clearTimeout(this.scanCode);
230
+ let params = {
231
+ phone: this.userModel.phone,
232
+ retrialAuthGroupIds: this.group,
233
+ uuid: this.uuid
234
+ };
235
+ util
236
+ .ajax({
237
+ url: scanCodeRetrialAuth,
238
+ method: 'post',
239
+ data: params,
240
+ params: params
241
+ })
242
+ .then((res) => {
243
+ let { rCode, results } = res;
244
+ if (rCode == 0) {
245
+ if (results.authPass) {
246
+ this.$message({
247
+ message: '认证成功',
248
+ type: 'success'
249
+ });
250
+ this.msgBox.handleClose();
251
+ util.win.top.location.reload();
252
+ } else {
253
+ this.scanCode = setTimeout(() => {
254
+ this.handleScanCodeRetrialAuth();
255
+ }, 1000);
256
+ }
257
+ }
258
+ })
259
+ .catch();
260
+ },
261
+ clearTimeouts() {
262
+ clearTimeout(this.scanCode);
263
+ clearTimeout(this.timer);
264
+ }
265
+ },
266
+ beforeDestroy() {
267
+ clearTimeout(this.scanCode);
268
+ clearTimeout(this.timer);
269
+ }
270
+ };
271
+ </script>