eoss-ui 0.4.54 → 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 (65) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/lib/button-group.js +137 -104
  3. package/lib/button.js +139 -106
  4. package/lib/cascader.js +2 -2
  5. package/lib/checkbox-group.js +141 -108
  6. package/lib/config/api.js +4 -0
  7. package/lib/data-table-form.js +138 -105
  8. package/lib/data-table.js +140 -107
  9. package/lib/date-picker.js +146 -113
  10. package/lib/dialog.js +141 -108
  11. package/lib/eoss-ui.common.js +790 -296
  12. package/lib/flow-group.js +137 -104
  13. package/lib/flow-list.js +144 -111
  14. package/lib/flow.js +188 -155
  15. package/lib/form.js +138 -105
  16. package/lib/handle-user.js +138 -105
  17. package/lib/handler.js +138 -105
  18. package/lib/index.js +1 -1
  19. package/lib/input-number.js +139 -106
  20. package/lib/input.js +139 -106
  21. package/lib/label.js +2 -2
  22. package/lib/login.js +167 -130
  23. package/lib/main.js +153 -120
  24. package/lib/mainComp.js +153 -120
  25. package/lib/menu.js +2 -2
  26. package/lib/nav.js +137 -104
  27. package/lib/notify.js +109 -101
  28. package/lib/page.js +137 -104
  29. package/lib/player.js +137 -104
  30. package/lib/qr-code.js +137 -104
  31. package/lib/radio-group.js +138 -105
  32. package/lib/retrial-auth.js +3328 -0
  33. package/lib/select-ganged.js +139 -106
  34. package/lib/select.js +140 -107
  35. package/lib/selector-panel.js +155 -122
  36. package/lib/selector.js +140 -107
  37. package/lib/sizer.js +141 -108
  38. package/lib/steps.js +139 -106
  39. package/lib/switch.js +139 -106
  40. package/lib/table-form.js +139 -106
  41. package/lib/tabs-panel.js +2 -2
  42. package/lib/tabs.js +146 -113
  43. package/lib/theme-chalk/index.css +1 -1
  44. package/lib/theme-chalk/retrial-auth.css +1 -0
  45. package/lib/tips.js +140 -107
  46. package/lib/toolbar.js +2 -2
  47. package/lib/tree-group.js +139 -106
  48. package/lib/tree.js +140 -107
  49. package/lib/upload.js +147 -114
  50. package/lib/utils/util.js +33 -8
  51. package/lib/wujie.js +139 -106
  52. package/lib/wxlogin.js +139 -106
  53. package/package.json +2 -2
  54. package/packages/checkbox-group/src/main.vue +7 -7
  55. package/packages/dialog/src/main.vue +2 -2
  56. package/packages/login/src/main.vue +21 -15
  57. package/packages/retrial-auth/index.js +5 -0
  58. package/packages/retrial-auth/src/main.vue +271 -0
  59. package/packages/theme-chalk/lib/index.css +1 -1
  60. package/packages/theme-chalk/lib/retrial-auth.css +1 -0
  61. package/packages/theme-chalk/src/index.scss +1 -0
  62. package/packages/theme-chalk/src/retrial-auth.scss +38 -0
  63. package/src/config/api.js +4 -0
  64. package/src/index.js +4 -1
  65. package/src/utils/util.js +33 -7
@@ -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>