@10yun/cv-mobile-ui 0.5.3 → 0.5.5
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 +1 -1
- package/ui-cv/{cv-button/cv-button.vue → cv-btn-base/cv-btn-base.vue} +19 -14
- package/ui-cv/cv-checkbox-group/cv-checkbox-group.vue +89 -56
- package/ui-cv/cv-checkbox-opt-base/cv-checkbox-opt-base.vue +43 -3
- package/ui-cv/cv-checkbox-opt-tag/cv-checkbox-opt-tag.vue +6 -2
- package/ui-cv/cv-code-sms/cv-code-sms.vue +34 -24
- package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
- package/ui-cv/cv-datetime-base/cv-datetime-base.vue +31 -7
- package/ui-cv/cv-datetime5-base/cv-datetime5-base.vue +24 -7
- package/ui-cv/cv-dialog-share/cv-dialog-share.vue +2 -0
- package/ui-cv/cv-editor-quill/cv-editor-quill.vue +14 -13
- package/ui-cv/cv-form-base/cv-form-base.vue +1 -1
- package/ui-cv/cv-form-item/cv-form-item.vue +5 -2
- package/ui-cv/cv-geo-local/cv-geo-local.vue +118 -27
- package/ui-cv/{cv-picker-region/cv-picker-region.vue → cv-geo-region/cv-geo-region.vue} +30 -8
- package/ui-cv/cv-input-digit/cv-input-digit.vue +69 -13
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -14
- package/ui-cv/cv-input-number/cv-input-number.vue +56 -13
- package/ui-cv/cv-input-password/cv-input-password.vue +66 -12
- package/ui-cv/cv-input-text/cv-input-text.vue +74 -7
- package/ui-cv/cv-picker1/cv-picker1.vue +28 -4
- package/ui-cv/cv-picker2/cv-picker2.vue +34 -11
- package/ui-cv/cv-picker3/cv-picker3.vue +41 -16
- package/ui-cv/cv-radio-group/cv-radio-group.vue +35 -13
- package/ui-cv/cv-radio-opt-base/cv-radio-opt-base.vue +37 -3
- package/ui-cv/cv-radio-opt-tag/cv-radio-opt-tag.vue +1 -1
- package/ui-cv/cv-rate/cv-rate.vue +24 -15
- package/ui-cv/cv-search/cv-search.vue +7 -1
- package/ui-cv/cv-specs/cv-specs.vue +13 -13
- package/ui-cv/cv-switch/cv-switch.vue +24 -16
- package/ui-cv/cv-textarea/cv-textarea.vue +18 -12
- package/ui-cv/cv-time-base/cv-time-base.vue +30 -3
- package/ui-cv/cv-treaty/cv-treaty.vue +18 -13
- package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +12 -5
- package/ui-cv/cv-upload-image/cv-upload-image.vue +21 -10
- package/ui-cv/cv-input-btn/cv-input-btn.vue +0 -124
- package/ui-cv/mixins/mixins-input.js +0 -75
- package/ui-cv/mixins/mixins-picker.js +0 -34
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<button class="cv-button-item" :type="type" :form-type="formType" @click="parentClick"><slot /></button>
|
|
4
|
-
</view>
|
|
2
|
+
<button class="cv-button-wrap" :type="type" :form-type="formType" :size="size" @click="parentClick"><slot /></button>
|
|
5
3
|
</template>
|
|
6
|
-
|
|
7
4
|
<script>
|
|
8
5
|
export default {
|
|
9
|
-
name: '
|
|
6
|
+
name: 'cvBtnBase',
|
|
10
7
|
props: {
|
|
11
8
|
size: {
|
|
12
9
|
type: [String],
|
|
@@ -14,7 +11,7 @@ export default {
|
|
|
14
11
|
},
|
|
15
12
|
type: {
|
|
16
13
|
type: [String],
|
|
17
|
-
default: '
|
|
14
|
+
default: 'primary'
|
|
18
15
|
},
|
|
19
16
|
formType: {
|
|
20
17
|
type: [String],
|
|
@@ -22,6 +19,10 @@ export default {
|
|
|
22
19
|
},
|
|
23
20
|
click: {
|
|
24
21
|
type: [Function]
|
|
22
|
+
},
|
|
23
|
+
autoLoading: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
28
|
data() {
|
|
@@ -36,6 +37,12 @@ export default {
|
|
|
36
37
|
},
|
|
37
38
|
parentClick(evt) {
|
|
38
39
|
this.$emit('click', evt);
|
|
40
|
+
if (this.autoLoading) {
|
|
41
|
+
this.loadingStatus = true;
|
|
42
|
+
}
|
|
43
|
+
this.$emit('click', () => {
|
|
44
|
+
this.loadingStatus = false;
|
|
45
|
+
});
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
};
|
|
@@ -44,15 +51,13 @@ export default {
|
|
|
44
51
|
<style>
|
|
45
52
|
.cv-button-wrap {
|
|
46
53
|
padding: 0 10px;
|
|
47
|
-
margin-top: 10px;
|
|
48
|
-
}
|
|
49
|
-
.cv-button-item {
|
|
50
|
-
letter-spacing: 2px;
|
|
54
|
+
/* margin-top: 10px;
|
|
51
55
|
font-size: 14px;
|
|
52
|
-
margin: 0px 15px;
|
|
53
|
-
line-height: 100%;
|
|
54
|
-
padding:
|
|
55
|
-
|
|
56
|
+
margin: 0px 15px; */
|
|
57
|
+
/* line-height: 100%; */
|
|
58
|
+
/* padding: 6px 5px; */
|
|
59
|
+
/* margin-bottom: 5px; */
|
|
60
|
+
margin: 0 10px;
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
.cv-button-item2 {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-checkbox-group-wrap">
|
|
3
|
-
<checkbox-group @change="checkboxChange" class="cv-
|
|
3
|
+
<checkbox-group @change="checkboxChange" class="cv-checkbox-group__box" :style="localStyle">
|
|
4
4
|
<slot>
|
|
5
5
|
<cv-checkbox-opt-base
|
|
6
6
|
v-if="type == 'base'"
|
|
7
|
-
v-for="item in
|
|
7
|
+
v-for="item in localList"
|
|
8
8
|
:key="item.value"
|
|
9
|
+
:label="item.text"
|
|
9
10
|
:value="item.value"
|
|
10
11
|
:checked="item.checked"
|
|
11
12
|
>
|
|
@@ -13,14 +14,15 @@
|
|
|
13
14
|
</cv-checkbox-opt-base>
|
|
14
15
|
<cv-checkbox-opt-tag
|
|
15
16
|
v-if="type == 'tag'"
|
|
16
|
-
v-for="item in
|
|
17
|
+
v-for="item in localList"
|
|
17
18
|
:key="item.value"
|
|
19
|
+
:label="item.text"
|
|
18
20
|
:value="item.value"
|
|
19
21
|
:checked="item.checked"
|
|
20
22
|
>
|
|
21
23
|
{{ item.text }}
|
|
22
24
|
</cv-checkbox-opt-tag>
|
|
23
|
-
<!-- <label class="cv-checkbox-group__label" v-for="item in
|
|
25
|
+
<!-- <label class="cv-checkbox-group__label" v-for="item in localList" :value="value" :key="item.value">
|
|
24
26
|
<view class="">
|
|
25
27
|
<checkbox :value="item.value" :checked="item.checked" style="transform: scale(0.7)" />
|
|
26
28
|
</view>
|
|
@@ -40,14 +42,21 @@ export default {
|
|
|
40
42
|
cvCheckboxOptTag
|
|
41
43
|
},
|
|
42
44
|
props: {
|
|
45
|
+
value: {
|
|
46
|
+
type: [Array, String, Number],
|
|
47
|
+
default: []
|
|
48
|
+
},
|
|
49
|
+
modelValue: {
|
|
50
|
+
type: [Array, String, Number],
|
|
51
|
+
default: []
|
|
52
|
+
},
|
|
43
53
|
type: {
|
|
44
54
|
type: [String],
|
|
45
55
|
default: 'base'
|
|
46
56
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
default: []
|
|
57
|
+
align: {
|
|
58
|
+
type: [String],
|
|
59
|
+
default: 'left'
|
|
51
60
|
},
|
|
52
61
|
dataType: {
|
|
53
62
|
type: String,
|
|
@@ -82,29 +91,45 @@ export default {
|
|
|
82
91
|
data() {
|
|
83
92
|
return {
|
|
84
93
|
localVal: [],
|
|
85
|
-
|
|
94
|
+
localList: [],
|
|
95
|
+
localStyle: ''
|
|
86
96
|
};
|
|
87
97
|
},
|
|
88
98
|
watch: {
|
|
89
99
|
value(newVal) {
|
|
90
|
-
this.
|
|
100
|
+
this.dealValue(newVal);
|
|
101
|
+
},
|
|
102
|
+
modelValue(newVal) {
|
|
103
|
+
this.dealValue(newVal);
|
|
91
104
|
},
|
|
92
105
|
dataLists(newVal) {
|
|
93
|
-
this.
|
|
94
|
-
this.items = this.itemsSortOut();
|
|
95
|
-
// this._dealValue();
|
|
106
|
+
this.localList = this.dealDataList(newVal || []);
|
|
96
107
|
}
|
|
97
108
|
},
|
|
98
109
|
created() {
|
|
99
|
-
this.
|
|
110
|
+
this.dealValue(this.doValueGet());
|
|
100
111
|
if (this.maxNumber > 0) {
|
|
101
112
|
this.message = '最多只能选择' + this.maxNumber + '个';
|
|
102
113
|
}
|
|
103
|
-
this.
|
|
114
|
+
this.localList = this.dealDataList(this.dataLists) || [];
|
|
115
|
+
this._dealStyle();
|
|
104
116
|
},
|
|
105
117
|
methods: {
|
|
118
|
+
doValueGet() {
|
|
119
|
+
if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
|
|
120
|
+
return this.modelValue;
|
|
121
|
+
}
|
|
122
|
+
if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
|
|
123
|
+
return this.value;
|
|
124
|
+
}
|
|
125
|
+
return this.value;
|
|
126
|
+
},
|
|
127
|
+
_dealStyle() {
|
|
128
|
+
let alignStyle = this.align == 'right' ? 'flex-end' : 'flex-start';
|
|
129
|
+
this.localStyle = `justify-content:${alignStyle};`;
|
|
130
|
+
},
|
|
106
131
|
// 处理传递的内容问题,全部转成数组
|
|
107
|
-
|
|
132
|
+
dealValue(oldVal) {
|
|
108
133
|
let newVal = [];
|
|
109
134
|
if (Object.prototype.toString.call(oldVal) == '[object String]') {
|
|
110
135
|
if (oldVal != '') {
|
|
@@ -115,17 +140,19 @@ export default {
|
|
|
115
140
|
newVal = oldVal;
|
|
116
141
|
}
|
|
117
142
|
}
|
|
143
|
+
for (let i in newVal) {
|
|
144
|
+
if (typeof newVal[i] == 'number') {
|
|
145
|
+
newVal[i] = newVal[i].toString();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
118
148
|
this.localVal = newVal;
|
|
119
|
-
console.log(this.localVal);
|
|
120
149
|
},
|
|
121
|
-
|
|
150
|
+
dealDataList(oldList) {
|
|
122
151
|
let original = [];
|
|
123
|
-
original =
|
|
124
|
-
|
|
152
|
+
original = oldList || [];
|
|
125
153
|
if (typeof original == 'string') {
|
|
126
154
|
original = JSON.parse(original);
|
|
127
155
|
}
|
|
128
|
-
|
|
129
156
|
//整理数据
|
|
130
157
|
let items = [];
|
|
131
158
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
@@ -133,62 +160,67 @@ export default {
|
|
|
133
160
|
let dataChecked = this.dataChecked ? this.dataChecked : 'checked';
|
|
134
161
|
let i = 0;
|
|
135
162
|
for (i in original) {
|
|
136
|
-
let
|
|
137
|
-
let
|
|
138
|
-
let
|
|
139
|
-
let
|
|
140
|
-
if (typeof
|
|
141
|
-
|
|
163
|
+
let itemData = original[i];
|
|
164
|
+
let itemChecked = false;
|
|
165
|
+
let itemText = itemData[dataText];
|
|
166
|
+
let itemValue = itemData[dataValue];
|
|
167
|
+
if (typeof itemValue == 'number') {
|
|
168
|
+
itemValue = itemValue.toString();
|
|
142
169
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
170
|
+
if (itemData[dataChecked] == true) {
|
|
171
|
+
itemChecked = true;
|
|
145
172
|
}
|
|
146
173
|
let localVal = this.localVal || [];
|
|
147
174
|
// let tempLocalVal = localVal.split(',');
|
|
148
175
|
//写入已选选项
|
|
149
176
|
for (const ii in localVal) {
|
|
150
177
|
if (this.dataType == 'text') {
|
|
151
|
-
if (localVal[ii] ==
|
|
152
|
-
|
|
178
|
+
if (localVal[ii] == itemText) {
|
|
179
|
+
itemChecked = true;
|
|
153
180
|
}
|
|
154
181
|
} else {
|
|
155
|
-
if (localVal[ii] ==
|
|
156
|
-
|
|
182
|
+
if (localVal[ii] == itemValue) {
|
|
183
|
+
itemChecked = true;
|
|
157
184
|
}
|
|
158
185
|
}
|
|
159
186
|
}
|
|
160
187
|
items.push({
|
|
161
|
-
value:
|
|
162
|
-
text:
|
|
163
|
-
checked:
|
|
188
|
+
value: itemValue,
|
|
189
|
+
text: itemText,
|
|
190
|
+
checked: itemChecked
|
|
164
191
|
});
|
|
165
192
|
}
|
|
166
193
|
return items;
|
|
167
194
|
},
|
|
168
195
|
checkboxChange(e) {
|
|
169
|
-
let items = this.
|
|
196
|
+
let items = this.localList;
|
|
170
197
|
let values = e.detail.value;
|
|
171
|
-
this.$emit('input', values);
|
|
172
|
-
console.log(values);
|
|
173
|
-
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
|
174
|
-
const item = items[i];
|
|
175
|
-
if (values.includes(item.value)) {
|
|
176
|
-
this.$set(item, 'checked', true);
|
|
177
|
-
} else {
|
|
178
|
-
this.$set(item, 'checked', false);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// console.log(items);
|
|
182
|
-
|
|
183
198
|
let localVal = [];
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
if (items && Array.prototype.isPrototypeOf(items) && items.length > 0) {
|
|
200
|
+
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
|
201
|
+
const item = items[i];
|
|
202
|
+
if (values.includes(item.value)) {
|
|
203
|
+
this.$set(item, 'checked', true);
|
|
188
204
|
} else {
|
|
189
|
-
|
|
205
|
+
this.$set(item, 'checked', false);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (let i in items) {
|
|
209
|
+
if (items[i].checked) {
|
|
210
|
+
if (this.dataType == 'text') {
|
|
211
|
+
localVal.push(items[i].text);
|
|
212
|
+
} else {
|
|
213
|
+
localVal.push(items[i].value);
|
|
214
|
+
}
|
|
190
215
|
}
|
|
191
216
|
}
|
|
217
|
+
} else {
|
|
218
|
+
localVal = values;
|
|
219
|
+
}
|
|
220
|
+
for (let i in localVal) {
|
|
221
|
+
if (typeof localVal[i] == 'number') {
|
|
222
|
+
localVal[i] = localVal[i].toString();
|
|
223
|
+
}
|
|
192
224
|
}
|
|
193
225
|
if (this.maxNumber !== 0 && localVal.length > this.maxNumber) {
|
|
194
226
|
this.messageDisplay = true;
|
|
@@ -196,8 +228,9 @@ export default {
|
|
|
196
228
|
this.messageDisplay = false;
|
|
197
229
|
}
|
|
198
230
|
// this.localVal = localVal;
|
|
199
|
-
//
|
|
200
|
-
|
|
231
|
+
// console.log('--checkboxChange--', items, values, this.localVal);
|
|
232
|
+
this.$emit('input', localVal);
|
|
233
|
+
this.$emit('update:modelValue', localVal);
|
|
201
234
|
}
|
|
202
235
|
}
|
|
203
236
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-checkbox-opt-base">
|
|
3
3
|
<label class="cv-checkbox-opt__label">
|
|
4
|
-
<checkbox :value="localVal" :checked="
|
|
4
|
+
<checkbox :value="localVal" :checked="localChecked" style="transform: scale(0.7)" />
|
|
5
5
|
<view>
|
|
6
6
|
<slot>{{ label }}</slot>
|
|
7
7
|
</view>
|
|
@@ -27,18 +27,58 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
data() {
|
|
29
29
|
return {
|
|
30
|
-
localVal: ''
|
|
30
|
+
localVal: '',
|
|
31
|
+
localChecked: false,
|
|
32
|
+
parentObj: null
|
|
31
33
|
};
|
|
32
34
|
},
|
|
33
35
|
watch: {
|
|
34
36
|
value(newVal) {
|
|
35
37
|
this.localVal = String(newVal);
|
|
38
|
+
},
|
|
39
|
+
checked(newVal) {
|
|
40
|
+
this.localChecked = newVal;
|
|
41
|
+
},
|
|
42
|
+
'parentObj.localVal'(newVal) {
|
|
43
|
+
if (Object.prototype.toString.call(newVal) == '[object Array]') {
|
|
44
|
+
if (this.parentObj && this.parentObj.dataType == 'text') {
|
|
45
|
+
this.localChecked = newVal.includes(this.label) ? true : false;
|
|
46
|
+
} else if (this.parentObj && this.parentObj.dataType == 'value') {
|
|
47
|
+
this.localChecked = newVal.includes(this.localVal) ? true : false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
},
|
|
38
52
|
created() {
|
|
39
53
|
this.localVal = String(this.value);
|
|
54
|
+
this.localChecked = this.checked;
|
|
55
|
+
console.log('---', this.localVal, this.localChecked);
|
|
56
|
+
},
|
|
57
|
+
mounted() {
|
|
58
|
+
this.parentObj = this.getParent();
|
|
40
59
|
},
|
|
41
|
-
methods: {
|
|
60
|
+
methods: {
|
|
61
|
+
funcOnClick() {
|
|
62
|
+
// let parentObj = this.getParent();
|
|
63
|
+
// console.log(parentObj.$children);
|
|
64
|
+
// let { value } = parentObj;
|
|
65
|
+
// console.log(value, this.localVal);
|
|
66
|
+
// this.localChecked = newVal == this.value ? true : false;
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* 获取父元素实例
|
|
70
|
+
*/
|
|
71
|
+
getParent(name = 'cvCheckboxGroup') {
|
|
72
|
+
let parent = this.$parent;
|
|
73
|
+
let parentName = parent.$options.name;
|
|
74
|
+
while (parentName !== name) {
|
|
75
|
+
parent = parent.$parent;
|
|
76
|
+
if (!parent) return false;
|
|
77
|
+
parentName = parent.$options.name;
|
|
78
|
+
}
|
|
79
|
+
return parent;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
42
82
|
};
|
|
43
83
|
</script>
|
|
44
84
|
<style>
|
|
@@ -39,9 +39,13 @@ export default {
|
|
|
39
39
|
checked(newVal) {
|
|
40
40
|
this.localChecked = newVal;
|
|
41
41
|
},
|
|
42
|
-
'parentObj.
|
|
42
|
+
'parentObj.localVal'(newVal) {
|
|
43
43
|
if (Object.prototype.toString.call(newVal) == '[object Array]') {
|
|
44
|
-
this.
|
|
44
|
+
if (this.parentObj && this.parentObj.dataType == 'text') {
|
|
45
|
+
this.localChecked = newVal.includes(this.label) ? true : false;
|
|
46
|
+
} else if (this.parentObj && this.parentObj.dataType == 'value') {
|
|
47
|
+
this.localChecked = newVal.includes(this.localVal) ? true : false;
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
},
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
<view class="cv-code-button-area">
|
|
15
15
|
<button
|
|
16
|
+
size="mini"
|
|
16
17
|
class="cv-code-button-item"
|
|
17
18
|
:class="btnDisabled ? 'cv-code-button-wait' : ''"
|
|
18
19
|
:disabled="btnDisabled"
|
|
@@ -26,22 +27,19 @@
|
|
|
26
27
|
<script>
|
|
27
28
|
export default {
|
|
28
29
|
name: 'cvCodeSms',
|
|
29
|
-
inject: {
|
|
30
|
-
cvFormGroup: {
|
|
31
|
-
default() {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
30
|
props: {
|
|
37
|
-
|
|
31
|
+
value: {
|
|
38
32
|
type: [Number, String],
|
|
39
|
-
default:
|
|
33
|
+
default: ''
|
|
40
34
|
},
|
|
41
|
-
|
|
35
|
+
modelValue: {
|
|
42
36
|
type: [Number, String],
|
|
43
37
|
default: ''
|
|
44
38
|
},
|
|
39
|
+
maxlength: {
|
|
40
|
+
type: [Number, String],
|
|
41
|
+
default: -1
|
|
42
|
+
},
|
|
45
43
|
mobile: {
|
|
46
44
|
type: [Number, String],
|
|
47
45
|
default: ''
|
|
@@ -50,15 +48,11 @@ export default {
|
|
|
50
48
|
type: String,
|
|
51
49
|
default: 'mobile'
|
|
52
50
|
},
|
|
53
|
-
codeUrl: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: ''
|
|
56
|
-
},
|
|
57
51
|
codeSign: {
|
|
58
52
|
type: Boolean,
|
|
59
53
|
default: false
|
|
60
54
|
},
|
|
61
|
-
|
|
55
|
+
apiFunc: {
|
|
62
56
|
type: Function,
|
|
63
57
|
default: null
|
|
64
58
|
},
|
|
@@ -74,12 +68,15 @@ export default {
|
|
|
74
68
|
},
|
|
75
69
|
value(newVal) {
|
|
76
70
|
this.localVal = newVal;
|
|
71
|
+
},
|
|
72
|
+
modelValue(newVal) {
|
|
73
|
+
this.localVal = newVal;
|
|
77
74
|
}
|
|
78
75
|
},
|
|
79
76
|
data() {
|
|
80
77
|
return {
|
|
81
78
|
// 验证码
|
|
82
|
-
localVal:
|
|
79
|
+
localVal: '',
|
|
83
80
|
localMobile: '',
|
|
84
81
|
nextTime: 0,
|
|
85
82
|
diyPlaceholder: '短信验证码',
|
|
@@ -92,9 +89,16 @@ export default {
|
|
|
92
89
|
};
|
|
93
90
|
},
|
|
94
91
|
created() {
|
|
92
|
+
this.localVal = this.doValueGet();
|
|
95
93
|
this.localMobile = this.mobile;
|
|
94
|
+
console.log(this.apiFunc);
|
|
96
95
|
},
|
|
97
96
|
methods: {
|
|
97
|
+
doValueGet() {
|
|
98
|
+
if (this.value === '') return this.modelValue;
|
|
99
|
+
if (this.modelValue === '') return this.value;
|
|
100
|
+
return this.value;
|
|
101
|
+
},
|
|
98
102
|
showDiyMsg(msg) {
|
|
99
103
|
uni.showToast({
|
|
100
104
|
title: msg,
|
|
@@ -114,8 +118,8 @@ export default {
|
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
if (!this.
|
|
118
|
-
this.showDiyMsg('
|
|
121
|
+
if (!this.apiFunc) {
|
|
122
|
+
this.showDiyMsg('短信接口方法不能为空');
|
|
119
123
|
return;
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -129,9 +133,8 @@ export default {
|
|
|
129
133
|
|
|
130
134
|
if (this.btnDisabled) {
|
|
131
135
|
this.btnText = '请稍后...';
|
|
132
|
-
if (this.
|
|
133
|
-
this.
|
|
134
|
-
postType: 'sendSms',
|
|
136
|
+
if (this.apiFunc) {
|
|
137
|
+
this.apiFunc({
|
|
135
138
|
cto_sms_type: 'alterMobile',
|
|
136
139
|
sendCode: '发送验证码',
|
|
137
140
|
[this.mobileParam]: this.localMobile
|
|
@@ -158,7 +161,7 @@ export default {
|
|
|
158
161
|
this.btnText = '获取验证码';
|
|
159
162
|
});
|
|
160
163
|
} else {
|
|
161
|
-
console.warn('url请求未完善,请使用:
|
|
164
|
+
console.warn('url请求未完善,请使用:apiFunc');
|
|
162
165
|
this.btnDisabled = false;
|
|
163
166
|
this.btnText = '重新获取验证码';
|
|
164
167
|
}
|
|
@@ -181,6 +184,7 @@ export default {
|
|
|
181
184
|
},
|
|
182
185
|
funcOnInput(e) {
|
|
183
186
|
this.$emit('input', this.localVal);
|
|
187
|
+
this.$emit('update:modelValue', this.localVal);
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
};
|
|
@@ -191,6 +195,14 @@ export default {
|
|
|
191
195
|
height: 35px;
|
|
192
196
|
line-height: 35px;
|
|
193
197
|
font-size: 14px;
|
|
198
|
+
width: 100%;
|
|
199
|
+
padding-right: 10px;
|
|
200
|
+
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: row;
|
|
203
|
+
justify-content: space-between;
|
|
204
|
+
width: 100%;
|
|
205
|
+
padding-right: 10px;
|
|
194
206
|
}
|
|
195
207
|
.cv-code-input-area {
|
|
196
208
|
width: calc(100% - 120px - 10px);
|
|
@@ -204,14 +216,12 @@ export default {
|
|
|
204
216
|
font-size: 14px;
|
|
205
217
|
}
|
|
206
218
|
.cv-code-button-area {
|
|
207
|
-
width: 120px;
|
|
208
219
|
float: right;
|
|
209
220
|
height: 35px;
|
|
210
221
|
}
|
|
211
222
|
.cv-code-button-item {
|
|
212
223
|
height: 35px;
|
|
213
224
|
line-height: 35px;
|
|
214
|
-
font-size: 14px;
|
|
215
225
|
background-color: #007aff;
|
|
216
226
|
color: #ffffff;
|
|
217
227
|
}
|
|
@@ -16,11 +16,8 @@
|
|
|
16
16
|
</picker>
|
|
17
17
|
</view>
|
|
18
18
|
</template>
|
|
19
|
-
|
|
20
19
|
<script>
|
|
21
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
22
20
|
export default {
|
|
23
|
-
mixins: [MixinsPicker],
|
|
24
21
|
name: 'cvPickerDate',
|
|
25
22
|
props: {
|
|
26
23
|
//默认输入框
|
|
@@ -28,6 +25,10 @@ export default {
|
|
|
28
25
|
type: String,
|
|
29
26
|
default: ''
|
|
30
27
|
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
31
32
|
startDate: {
|
|
32
33
|
type: String,
|
|
33
34
|
default: ''
|
|
@@ -39,11 +40,19 @@ export default {
|
|
|
39
40
|
fields: {
|
|
40
41
|
type: String,
|
|
41
42
|
default: 'day'
|
|
43
|
+
},
|
|
44
|
+
// 占位符
|
|
45
|
+
placeholder: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '请选择'
|
|
42
48
|
}
|
|
43
49
|
},
|
|
44
50
|
watch: {
|
|
45
|
-
value(
|
|
46
|
-
this.localVal =
|
|
51
|
+
value(newVal) {
|
|
52
|
+
this.localVal = newVal;
|
|
53
|
+
},
|
|
54
|
+
modelValue(newVal) {
|
|
55
|
+
this.localVal = newVal;
|
|
47
56
|
}
|
|
48
57
|
},
|
|
49
58
|
data() {
|
|
@@ -53,13 +62,25 @@ export default {
|
|
|
53
62
|
};
|
|
54
63
|
},
|
|
55
64
|
created() {
|
|
56
|
-
this.localVal = this.
|
|
65
|
+
this.localVal = this.doValueGet();
|
|
57
66
|
},
|
|
58
67
|
methods: {
|
|
68
|
+
doValueGet() {
|
|
69
|
+
if (this.value === '') return this.modelValue;
|
|
70
|
+
if (this.modelValue === '') return this.value;
|
|
71
|
+
return this.value;
|
|
72
|
+
},
|
|
59
73
|
bindDateChange: function (e) {
|
|
74
|
+
this.iconTop = false;
|
|
60
75
|
this.localVal = e.detail.value;
|
|
61
76
|
this.$emit('input', this.localVal);
|
|
77
|
+
this.$emit('update:modelValue', this.localVal);
|
|
78
|
+
},
|
|
79
|
+
bindPickerCancel() {
|
|
62
80
|
this.iconTop = false;
|
|
81
|
+
},
|
|
82
|
+
changeIconTop() {
|
|
83
|
+
this.iconTop = true;
|
|
63
84
|
}
|
|
64
85
|
}
|
|
65
86
|
};
|