eoss-mobiles 0.2.13 → 0.2.15

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 (38) hide show
  1. package/lib/checkbox.js +260 -199
  2. package/lib/config/api.js +4 -1
  3. package/lib/date.js +3 -3
  4. package/lib/eoss-mobile.common.js +746 -249
  5. package/lib/flow.js +362 -277
  6. package/lib/index.js +1 -1
  7. package/lib/notice-bar.js +2 -2
  8. package/lib/picker.js +260 -199
  9. package/lib/pull-refresh.js +2 -2
  10. package/lib/radio.js +260 -199
  11. package/lib/retrial-auth.js +2457 -0
  12. package/lib/selector.js +294 -233
  13. package/lib/table-column.js +260 -199
  14. package/lib/table.js +227 -172
  15. package/lib/theme-chalk/index.css +1 -1
  16. package/lib/theme-chalk/retrial-auth.css +1 -0
  17. package/lib/utils/axios.js +140 -154
  18. package/lib/utils/http.js +5 -5
  19. package/lib/utils/util.js +71 -2
  20. package/package.json +1 -1
  21. package/packages/date/src/main.vue +1 -1
  22. package/packages/flow/src/components/Handle.vue +4 -1
  23. package/packages/flow/src/components/Opinion.vue +39 -3
  24. package/packages/flow/src/components/StartFlow.vue +3 -3
  25. package/packages/flow/src/main.vue +6 -0
  26. package/packages/retrial-auth/index.js +5 -0
  27. package/packages/retrial-auth/src/main.vue +257 -0
  28. package/packages/selector/src/selector-tree.vue +1 -1
  29. package/packages/selector/src/tree.vue +1 -1
  30. package/packages/theme-chalk/lib/index.css +1 -1
  31. package/packages/theme-chalk/lib/retrial-auth.css +1 -0
  32. package/packages/theme-chalk/src/index.scss +1 -0
  33. package/packages/theme-chalk/src/retrial-auth.scss +28 -0
  34. package/src/config/api.js +3 -0
  35. package/src/index.js +4 -1
  36. package/src/utils/axios.js +156 -174
  37. package/src/utils/http.js +15 -5
  38. package/src/utils/util.js +164 -84
@@ -0,0 +1,257 @@
1
+ <template>
2
+ <div class="em-retrial-auth" v-if="show">
3
+ <div class="em-retrial-auth-box">
4
+ 验证码将发送至{{
5
+ active == 'WEB_SMS' ? `手机号:${phoneText}` : `邮箱:${emailText}`
6
+ }}
7
+ <em-input
8
+ style="margin:10px 0px"
9
+ v-model="formData.verificationCode"
10
+ center
11
+ clearable
12
+ hide-label
13
+ placeholder="请输入验证码"
14
+ >
15
+ <template slot="button">
16
+ <em-button
17
+ size="small"
18
+ type="primary"
19
+ :disabled="disabled"
20
+ @click.stop="getCode"
21
+ >{{ btnText }}</em-button
22
+ >
23
+ </template>
24
+ </em-input>
25
+ <em-button style="width:100%" type="primary" @click="handleAuth"
26
+ >提交验证</em-button
27
+ >
28
+ <div class="em-retrial-auth-icon-box" v-if="newType.length > 1">
29
+ <div
30
+ class="em-retrial-auth-icon-box-item"
31
+ :class="{ active: active === item }"
32
+ v-for="item in newType"
33
+ :key="item"
34
+ @click="active = item"
35
+ >
36
+ <van-icon
37
+ :name="item === 'WEB_SMS' ? 'phone-o' : 'envelop-o'"
38
+ color="#fff"
39
+ />
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ import request from '../../../src/utils/http.js';
48
+ import utils from '../../../src/utils/util';
49
+ import {
50
+ initRetrialAuth,
51
+ getRetrialAuthCode,
52
+ codeRetrialAuth
53
+ } from '../../../src/config/api';
54
+
55
+ export default {
56
+ name: 'EmRetrialAuth',
57
+ props: {
58
+ reload: {
59
+ type: String,
60
+ default: ''
61
+ },
62
+ group: {
63
+ type: String,
64
+ default: ''
65
+ },
66
+ type: {
67
+ type: [String, Array],
68
+ default: () => []
69
+ },
70
+ url: {
71
+ type: String,
72
+ default: ''
73
+ },
74
+ params: {
75
+ type: Object,
76
+ default: () => {}
77
+ },
78
+ method: {
79
+ type: String,
80
+ default: 'get'
81
+ }
82
+ },
83
+ data() {
84
+ return {
85
+ active: 0,
86
+ newReload: '',
87
+ newData: '',
88
+ show: false,
89
+ newGroup: '',
90
+ newType: '',
91
+ emailText: '',
92
+ retrialAuthGroupId: utils.generateUUID(),
93
+ formData: {
94
+ verificationCode: ''
95
+ },
96
+ phoneText: '',
97
+ btnText: '获取验证码',
98
+ disabled: false,
99
+ countdown: 0,
100
+ submit: false,
101
+ uuid: null,
102
+ timer:null
103
+ };
104
+ },
105
+ mounted() {
106
+ if (this.url) {
107
+ this.reqUrl();
108
+ } else {
109
+ this.newGroup = this.group;
110
+ this.newReload = this.reload;
111
+ this.newType = this.type.filter(item => item != 'SCANCODE');
112
+ if (this.newType.length > 0) {
113
+ this.active = this.newType[0];
114
+ }
115
+ }
116
+ },
117
+ methods: {
118
+ handleAuth() {
119
+ if (this.submit) {
120
+ return false;
121
+ }
122
+ if (!this.formData.verificationCode) return this.$toast('请输入验证码');
123
+ this.submit = true;
124
+ let params = {
125
+ retrialAuthGroupIds: this.newGroup,
126
+ targetType: this.active === 'WEB_SMS' ? 'SMS' : 'EMAIL',
127
+ verificationCode: this.formData.verificationCode
128
+ };
129
+ this.$toast.loading({
130
+ message: '加载中...',
131
+ forbidClick: true,
132
+ loadingType: 'spinner',
133
+ overlay: true,
134
+ duration: 0
135
+ });
136
+ request({
137
+ url: codeRetrialAuth,
138
+ type: 'post',
139
+ params: params
140
+ })
141
+ .then(res => {
142
+ let { rCode, msg } = res;
143
+ this.$toast.clear();
144
+ if (rCode == 0) {
145
+ this.$toast('认证成功');
146
+ this.$emit('success',this.retrialAuthGroupId);
147
+ } else {
148
+ this.$toast(msg);
149
+ this.$emit('error');
150
+ this.submit = false;
151
+ }
152
+ })
153
+ .catch();
154
+ },
155
+ getCode() {
156
+ if (this.countdown) {
157
+ return false;
158
+ }
159
+ let params = { targetType: this.active === 'WEB_SMS' ? 'SMS' : 'EMAIL' };
160
+ this.countdown = 60;
161
+ this.timer = setInterval(() => {
162
+ if (this.countdown > 0) {
163
+ this.countdown--;
164
+ this.disabled = true;
165
+ this.btnText = '重新获取' + this.countdown + 's';
166
+ } else {
167
+ this.btnText = '重新获取';
168
+ this.disabled = false;
169
+ this.submit = false;
170
+ clearInterval(this.timer);
171
+ }
172
+ }, 1000);
173
+ this.$toast.loading({
174
+ message: '加载中...',
175
+ forbidClick: true,
176
+ loadingType: 'spinner',
177
+ overlay: true,
178
+ duration: 0
179
+ });
180
+ request({
181
+ url: getRetrialAuthCode,
182
+ type: 'post',
183
+ params: params
184
+ })
185
+ .then(res => {
186
+ let { rCode, msg } = res;
187
+ this.$toast.clear();
188
+ if (rCode == 0) {
189
+ this.$toast(
190
+ '验证码已发送至' +
191
+ (this.active === 'WEB_SMS' ? '手机' : '邮箱') +
192
+ ',请注意查收!'
193
+ );
194
+ } else {
195
+ this.$toast(msg);
196
+ this.$emit('error');
197
+ }
198
+ })
199
+ .catch();
200
+ },
201
+ init() {
202
+ request({
203
+ url: initRetrialAuth
204
+ })
205
+ .then(res => {
206
+ let { rCode, results } = res;
207
+ this.$toast.clear();
208
+ if (rCode == 0) {
209
+ this.uuid = results.uuid;
210
+ // this.qrImg = results.qrImg;
211
+ this.emailText = results.emailText;
212
+ this.phoneText = results.phoneText;
213
+ // if (this.active === 'SCANCODE') {
214
+ // this.handleScanCodeRetrialAuth();
215
+ // }
216
+ }
217
+ })
218
+ .catch();
219
+ },
220
+ reqUrl() {
221
+ this.$toast.loading({
222
+ message: '加载中...',
223
+ forbidClick: true,
224
+ loadingType: 'spinner',
225
+ overlay: true,
226
+ duration: 0
227
+ });
228
+ request({
229
+ url: this.url,
230
+ params: { ...this.params, retrialAuthGroupId: this.retrialAuthGroupId },
231
+ type: this.method
232
+ }).then(res => {
233
+ const { rCode, results, msg } = res;
234
+ if (rCode == 61) {
235
+ if (results) {
236
+ this.newReload = results.reload || results.refresh;
237
+ this.newGroup = results.retrialAuthGroupIds;
238
+ this.newType = results.retrialAuthType.filter(
239
+ item => item != 'SCANCODE'
240
+ );
241
+ this.init();
242
+ if (this.newType.length > 0) {
243
+ this.active = this.newType[0];
244
+ }
245
+ }
246
+ this.show = true;
247
+ } else {
248
+ this.$toast(msg);
249
+ this.$emit('error');
250
+ }
251
+ });
252
+ }
253
+ }
254
+ };
255
+ </script>
256
+
257
+ <style></style>
@@ -202,7 +202,7 @@ export default {
202
202
  },
203
203
  labelKey: {
204
204
  type: String,
205
- default: 'showname'
205
+ default: 'showshortname'
206
206
  },
207
207
  paddingTop: {
208
208
  type: [String, Number],
@@ -200,7 +200,7 @@ export default {
200
200
  },
201
201
  labelKey: {
202
202
  type: String,
203
- default: 'showname'
203
+ default: 'showshortname'
204
204
  },
205
205
  oldIsSearch: Boolean,
206
206
  isSearch: Boolean