fstarter 2.10.48 → 2.10.49
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.
package/package.json
CHANGED
|
@@ -10,28 +10,26 @@
|
|
|
10
10
|
:clearable="model.clearable"
|
|
11
11
|
:error-message="model.hiddenValidate ? '': model.validateResult.message"
|
|
12
12
|
>
|
|
13
|
-
<van-button slot="button" @click="sendVerCode"
|
|
13
|
+
<van-button slot="button" @click="sendVerCode" :disabled="modelData.disabled">{{ model.sendButtonLabel }}
|
|
14
|
+
</van-button>
|
|
14
15
|
</van-field>
|
|
15
16
|
|
|
16
17
|
</template>
|
|
17
18
|
|
|
18
19
|
<script>
|
|
19
20
|
|
|
20
|
-
import
|
|
21
|
-
import {take} from 'rxjs/operators';
|
|
22
|
-
import { filter } from 'rxjs/operators';
|
|
21
|
+
import Rx from 'rxjs';
|
|
22
|
+
import {filter, take} from 'rxjs/operators';
|
|
23
23
|
import base2 from './base2.js'
|
|
24
24
|
|
|
25
25
|
export default {
|
|
26
26
|
name: "bs-vercode",
|
|
27
27
|
mixins: [base2],
|
|
28
|
-
props: {
|
|
29
|
-
|
|
30
|
-
},
|
|
28
|
+
props: {},
|
|
31
29
|
data() {
|
|
32
30
|
return {
|
|
33
|
-
validateCtl:true,
|
|
34
|
-
sent:false
|
|
31
|
+
validateCtl: true,
|
|
32
|
+
sent: false
|
|
35
33
|
}
|
|
36
34
|
},
|
|
37
35
|
mounted() {
|
|
@@ -41,21 +39,21 @@ export default {
|
|
|
41
39
|
methods: {
|
|
42
40
|
createDefaultModel() {
|
|
43
41
|
return {
|
|
44
|
-
type:'BSVerCode',
|
|
45
|
-
value:'',
|
|
46
|
-
placeholder:'lang.ctl.BSVerCode.placeholder',
|
|
47
|
-
sendButtonLabel:'lang.ctl.BSVerCode.sendButtonLabel',
|
|
48
|
-
expiredTime:60,
|
|
49
|
-
expiredLabel:'{0}s'
|
|
42
|
+
type: 'BSVerCode',
|
|
43
|
+
value: '',
|
|
44
|
+
placeholder: 'lang.ctl.BSVerCode.placeholder',
|
|
45
|
+
sendButtonLabel: 'lang.ctl.BSVerCode.sendButtonLabel',
|
|
46
|
+
expiredTime: 60,
|
|
47
|
+
expiredLabel: '{0}s'
|
|
50
48
|
};
|
|
51
49
|
},
|
|
52
|
-
sendVerCode(){
|
|
53
|
-
if(this.sent){
|
|
50
|
+
sendVerCode() {
|
|
51
|
+
if (this.sent) {
|
|
54
52
|
return
|
|
55
53
|
}
|
|
56
|
-
this.sent=true
|
|
57
54
|
let self = this
|
|
58
|
-
this.$emit('send-verCode',function(){
|
|
55
|
+
this.$emit('send-verCode', function () {
|
|
56
|
+
self.sent = true
|
|
59
57
|
self.model.expiredTime = self.modelData.expiredTime
|
|
60
58
|
|
|
61
59
|
var source = Rx.Observable.timer(0, 1000)
|
|
@@ -63,54 +61,55 @@ export default {
|
|
|
63
61
|
source = source.pipe(take(self.modelData.expiredTime)).pipe(filter(num => self.sent));
|
|
64
62
|
|
|
65
63
|
source.subscribe({
|
|
66
|
-
next: function(value) {
|
|
64
|
+
next: function (value) {
|
|
67
65
|
|
|
68
66
|
self.model.expiredTime = self.model.expiredTime - 1
|
|
69
67
|
self.model.sendButtonLabel = self.modelData.expiredLabel.format(self.model.expiredTime)
|
|
70
68
|
},
|
|
71
|
-
complete: function() {
|
|
69
|
+
complete: function () {
|
|
72
70
|
|
|
73
71
|
self.model.sendButtonLabel = self.modelData.sendButtonLabel
|
|
74
72
|
self.sent = false
|
|
75
73
|
// self.model.value = ''
|
|
76
74
|
},
|
|
77
|
-
error: function(error) {
|
|
75
|
+
error: function (error) {
|
|
78
76
|
console.log('Throw Error: ' + error)
|
|
79
77
|
self.sent = false
|
|
80
78
|
}
|
|
81
79
|
});
|
|
82
80
|
|
|
83
|
-
},this.fullName)
|
|
81
|
+
}, this.fullName)
|
|
82
|
+
|
|
84
83
|
|
|
85
84
|
},
|
|
86
|
-
reset(){
|
|
85
|
+
reset() {
|
|
87
86
|
|
|
88
87
|
this.sent = false
|
|
89
88
|
this.model.label = this.modelData.label
|
|
90
89
|
this.model.disabled = this.modelData.disabled
|
|
91
90
|
this.model.value = this.modelData.value
|
|
92
91
|
this.model.placeholder = this.modelData.placeholder
|
|
93
|
-
this.model.sendButtonLabel= this.modelData.sendButtonLabel
|
|
92
|
+
this.model.sendButtonLabel = this.modelData.sendButtonLabel
|
|
94
93
|
this.model.expiredTime = this.modelData.expiredTime
|
|
95
94
|
this.model.expiredLabel = this.modelData.expiredLabel
|
|
96
95
|
|
|
97
96
|
},
|
|
98
|
-
blur(){
|
|
97
|
+
blur() {
|
|
99
98
|
|
|
100
|
-
if(!this.model.readonly)
|
|
99
|
+
if (!this.model.readonly)
|
|
101
100
|
this.model.validateToken++
|
|
102
101
|
|
|
103
|
-
this.$emit('blur',function(){
|
|
102
|
+
this.$emit('blur', function () {
|
|
104
103
|
|
|
105
|
-
},this.fullName)
|
|
104
|
+
}, this.fullName)
|
|
106
105
|
|
|
107
106
|
}
|
|
108
107
|
},
|
|
109
|
-
watch:{
|
|
110
|
-
'model.value':{
|
|
111
|
-
handler(val,oldval){
|
|
108
|
+
watch: {
|
|
109
|
+
'model.value': {
|
|
110
|
+
handler(val, oldval) {
|
|
112
111
|
|
|
113
|
-
this.setEventString(this.fullName,this.sname,'value',val,oldval)
|
|
112
|
+
this.setEventString(this.fullName, this.sname, 'value', val, oldval)
|
|
114
113
|
},
|
|
115
114
|
deep: false
|
|
116
115
|
}
|
|
@@ -122,8 +121,8 @@ export default {
|
|
|
122
121
|
|
|
123
122
|
<style scoped>
|
|
124
123
|
|
|
125
|
-
.BSVerCode_disabled{
|
|
126
|
-
color
|
|
124
|
+
.BSVerCode_disabled {
|
|
125
|
+
color: #999999;
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
</style>
|
package/src/views/auth.vue
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<!-- send-verCode 发送短信事件 -->
|
|
25
25
|
<bs-vercode
|
|
26
26
|
:mod="submodel.vercode"
|
|
27
|
-
@send-verCode="
|
|
27
|
+
@send-verCode="sendVerCode1"
|
|
28
28
|
cname="vercode"
|
|
29
29
|
:cusValidate="cusValidate_name"
|
|
30
30
|
/>
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
disabled: false, // 禁用
|
|
139
139
|
required: true, // 必填
|
|
140
140
|
sendButtonLabel: '发送短信', // 按钮文字
|
|
141
|
-
expiredTime: 5
|
|
141
|
+
expiredTime: 5 , // 倒计时时长
|
|
142
142
|
expiredLabel: '{0}s', // 倒计时格式
|
|
143
143
|
validateType:'CUS' // 校验类型。见文档校验
|
|
144
144
|
},
|
|
@@ -306,9 +306,12 @@
|
|
|
306
306
|
title:'表单'
|
|
307
307
|
};
|
|
308
308
|
},
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
sendVerCode1(resolve){
|
|
310
|
+
console.log("2")
|
|
311
|
+
console.log(1)
|
|
311
312
|
setTimeout(function() {
|
|
313
|
+
console.log("3")
|
|
314
|
+
|
|
312
315
|
resolve()
|
|
313
316
|
}, 1000)
|
|
314
317
|
|