@10yun/cv-mobile-ui 0.5.4 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10yun/cv-mobile-ui",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "十云cvjs移动端ui,适用uniapp",
5
5
  "author": "",
6
6
  "license": "Apache-2.0",
@@ -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,19 +27,15 @@
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
33
  default: ''
40
34
  },
41
- modelValue: {},
35
+ modelValue: {
36
+ type: [Number, String],
37
+ default: ''
38
+ },
42
39
  maxlength: {
43
40
  type: [Number, String],
44
41
  default: -1
@@ -51,15 +48,11 @@ export default {
51
48
  type: String,
52
49
  default: 'mobile'
53
50
  },
54
- codeUrl: {
55
- type: String,
56
- default: ''
57
- },
58
51
  codeSign: {
59
52
  type: Boolean,
60
53
  default: false
61
54
  },
62
- codeApiFunc: {
55
+ apiFunc: {
63
56
  type: Function,
64
57
  default: null
65
58
  },
@@ -75,12 +68,15 @@ export default {
75
68
  },
76
69
  value(newVal) {
77
70
  this.localVal = newVal;
71
+ },
72
+ modelValue(newVal) {
73
+ this.localVal = newVal;
78
74
  }
79
75
  },
80
76
  data() {
81
77
  return {
82
78
  // 验证码
83
- localVal: this.value,
79
+ localVal: '',
84
80
  localMobile: '',
85
81
  nextTime: 0,
86
82
  diyPlaceholder: '短信验证码',
@@ -93,9 +89,16 @@ export default {
93
89
  };
94
90
  },
95
91
  created() {
92
+ this.localVal = this.doValueGet();
96
93
  this.localMobile = this.mobile;
94
+ console.log(this.apiFunc);
97
95
  },
98
96
  methods: {
97
+ doValueGet() {
98
+ if (this.value === '') return this.modelValue;
99
+ if (this.modelValue === '') return this.value;
100
+ return this.value;
101
+ },
99
102
  showDiyMsg(msg) {
100
103
  uni.showToast({
101
104
  title: msg,
@@ -115,8 +118,8 @@ export default {
115
118
  return;
116
119
  }
117
120
 
118
- if (!this.codeUrl && !this.codeApiFunc) {
119
- this.showDiyMsg('短信接口地址不能为空');
121
+ if (!this.apiFunc) {
122
+ this.showDiyMsg('短信接口方法不能为空');
120
123
  return;
121
124
  }
122
125
 
@@ -130,9 +133,8 @@ export default {
130
133
 
131
134
  if (this.btnDisabled) {
132
135
  this.btnText = '请稍后...';
133
- if (this.codeApiFunc) {
134
- this.codeApiFunc({
135
- postType: 'sendSms',
136
+ if (this.apiFunc) {
137
+ this.apiFunc({
136
138
  cto_sms_type: 'alterMobile',
137
139
  sendCode: '发送验证码',
138
140
  [this.mobileParam]: this.localMobile
@@ -159,7 +161,7 @@ export default {
159
161
  this.btnText = '获取验证码';
160
162
  });
161
163
  } else {
162
- console.warn('url请求未完善,请使用:codeApiFunc');
164
+ console.warn('url请求未完善,请使用:apiFunc');
163
165
  this.btnDisabled = false;
164
166
  this.btnText = '重新获取验证码';
165
167
  }
@@ -193,6 +195,14 @@ export default {
193
195
  height: 35px;
194
196
  line-height: 35px;
195
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;
196
206
  }
197
207
  .cv-code-input-area {
198
208
  width: calc(100% - 120px - 10px);
@@ -206,14 +216,12 @@ export default {
206
216
  font-size: 14px;
207
217
  }
208
218
  .cv-code-button-area {
209
- width: 120px;
210
219
  float: right;
211
220
  height: 35px;
212
221
  }
213
222
  .cv-code-button-item {
214
223
  height: 35px;
215
224
  line-height: 35px;
216
- font-size: 14px;
217
225
  background-color: #007aff;
218
226
  color: #ffffff;
219
227
  }
@@ -25,7 +25,7 @@
25
25
  @cancel="bindPickerCancel"
26
26
  >
27
27
  <view class="cv-time-base-text" v-if="localVal_time != ''">{{ localVal_time }}</view>
28
- <view class="cv-picker-item-placeholder" v-else>{{ placeholder }}</view>
28
+ <view class="cv-picker-item-placeholder" v-else>{{ placeholder2 }}</view>
29
29
  </picker>
30
30
  </view>
31
31
  </template>
@@ -38,6 +38,10 @@ export default {
38
38
  type: String,
39
39
  default: ''
40
40
  },
41
+ modelValue: {
42
+ type: String,
43
+ default: ''
44
+ },
41
45
  startDate: {
42
46
  type: String,
43
47
  default: ''
@@ -61,7 +65,12 @@ export default {
61
65
  // 占位符
62
66
  placeholder: {
63
67
  type: String,
64
- default: '请选择'
68
+ default: '请选择日期'
69
+ },
70
+ // 占位符
71
+ placeholder2: {
72
+ type: String,
73
+ default: '请选择时间'
65
74
  }
66
75
  },
67
76
  watch: {
@@ -81,11 +90,16 @@ export default {
81
90
  };
82
91
  },
83
92
  created() {
84
- this.localVal = this.value;
93
+ this.localVal = this.doValueGet();
85
94
  this.localVal_date = this.localVal.split(' ')[0] || '';
86
95
  this.localVal_time = this.localVal.split(' ')[1] || '';
87
96
  },
88
97
  methods: {
98
+ doValueGet() {
99
+ if (this.value === '') return this.modelValue;
100
+ if (this.modelValue === '') return this.value;
101
+ return this.value;
102
+ },
89
103
  bindTimeChange: function (e) {
90
104
  let value = e.detail.value;
91
105
  this.localVal_time = value;
@@ -149,28 +149,19 @@ export default {
149
149
  components: {
150
150
  helangCompress
151
151
  },
152
- name: 'cvEditor',
153
- inject: {
154
- cvFormGroup: {
155
- default() {
156
- return null;
157
- }
158
- }
159
- },
152
+ name: 'cvEditorQuill',
160
153
  props: {
161
154
  value: {
162
155
  type: String,
163
156
  default: ''
164
157
  },
165
- tip: {
158
+ modelValue: {
166
159
  type: String,
167
160
  default: ''
168
161
  },
169
162
  placeholder: {
170
163
  type: String,
171
- default() {
172
- return '开始输入...';
173
- }
164
+ default: '开始输入...'
174
165
  },
175
166
  upload: {
176
167
  type: Object,
@@ -196,10 +187,14 @@ export default {
196
187
  value(newVal) {
197
188
  this.localVal = newVal;
198
189
  this.setContents();
190
+ },
191
+ modelValue(newVal) {
192
+ this.localVal = newVal;
193
+ this.setContents();
199
194
  }
200
195
  },
201
196
  created() {
202
- this.localVal = this.value;
197
+ this.localVal = this.doValueGet();
203
198
  /* uni.loadFontFace({
204
199
  family: 'Pacifico',
205
200
  source: 'url("https://sungd.github.io/Pacifico.ttf")'
@@ -207,6 +202,11 @@ export default {
207
202
  // console.log(this.upload)
208
203
  },
209
204
  methods: {
205
+ doValueGet() {
206
+ if (this.value === '') return this.modelValue;
207
+ if (this.modelValue === '') return this.value;
208
+ return this.value;
209
+ },
210
210
  onBlur(e) {
211
211
  this.getContents();
212
212
  },
@@ -26,13 +26,6 @@
26
26
  <script>
27
27
  export default {
28
28
  name: 'cvInputDigit',
29
- inject: {
30
- cvFormGroup: {
31
- default() {
32
- return null;
33
- }
34
- }
35
- },
36
29
  props: {
37
30
  value: {
38
31
  type: [Number, String],
@@ -22,13 +22,6 @@
22
22
  <script>
23
23
  export default {
24
24
  name: 'cvInputIdcard',
25
- inject: {
26
- cvFormGroup: {
27
- default() {
28
- return null;
29
- }
30
- }
31
- },
32
25
  props: {
33
26
  value: {
34
27
  type: [Number, String],
@@ -25,13 +25,6 @@
25
25
  <script>
26
26
  export default {
27
27
  name: 'cvInputNumber',
28
- inject: {
29
- cvFormGroup: {
30
- default() {
31
- return null;
32
- }
33
- }
34
- },
35
28
  props: {
36
29
  value: {
37
30
  type: [Number, String],
@@ -32,13 +32,6 @@
32
32
  <script>
33
33
  export default {
34
34
  name: 'cvInputPassword',
35
- inject: {
36
- cvFormGroup: {
37
- default() {
38
- return null;
39
- }
40
- }
41
- },
42
35
  props: {
43
36
  value: {
44
37
  type: [Number, String],
@@ -4,7 +4,7 @@
4
4
  class="cv-rate-item"
5
5
  v-for="i in parseInt(max)"
6
6
  :key="i"
7
- v-bind:style="i <= locaValue ? starSelected : starStyle"
7
+ :style="i <= locaValue ? starSelected : starStyle"
8
8
  :data-value="i"
9
9
  @tap="click_star"
10
10
  >
@@ -17,22 +17,15 @@
17
17
  <script>
18
18
  export default {
19
19
  name: 'cvRate',
20
- inject: {
21
- cvFormGroup: {
22
- default() {
23
- return null;
24
- }
25
- }
26
- },
27
20
  props: {
28
21
  // 当前评分
29
22
  value: {
30
23
  type: [Number, String],
31
- default: 1
24
+ default: 0
32
25
  },
33
26
  modelValue: {
34
27
  type: [Number, String],
35
- default: 1
28
+ default: 0
36
29
  },
37
30
  isFill: {
38
31
  // 星星的类型,是否镂空
@@ -78,13 +71,24 @@ export default {
78
71
  };
79
72
  },
80
73
  watch: {
81
- value(newVal) {}
74
+ value(newVal) {
75
+ this.locaValue = newVal;
76
+ },
77
+ modelValue(newVal) {
78
+ this.locaValue = newVal;
79
+ }
82
80
  },
83
81
  created() {
84
- this.locaValue = this.value || 1;
82
+ this.locaValue = this.doValueGet();
83
+ console.log(this.locaValue);
85
84
  this._dealStyle();
86
85
  },
87
86
  methods: {
87
+ doValueGet() {
88
+ if (this.value === 0) return this.modelValue;
89
+ if (this.modelValue === 0) return this.value;
90
+ return this.value;
91
+ },
88
92
  _dealStyle() {
89
93
  if (this.color) {
90
94
  let starStyle = 'font-size:' + this.size + 'px;';
@@ -2,7 +2,7 @@
2
2
  <view class="cv-specs">
3
3
  <!-- 规格 -->
4
4
  <view class="cv-specs-area">
5
- <view class="cv-specs-sort-area" v-for="(item, index1) in spu" :key="index1">
5
+ <view class="cv-specs-sort-area" v-for="(item, index1) in localSpu" :key="index1">
6
6
  <!-- 规格类别名称 -->
7
7
  <view class="cv-specs-sort-name">
8
8
  <text>{{ item.name }}</text>
@@ -83,8 +83,8 @@ export default {
83
83
  },
84
84
  data() {
85
85
  return {
86
- spu: [], //spu规格列表
87
- sku: [], //sku列表
86
+ localSpu: [], //spu规格列表
87
+ localSku: [], //sku列表
88
88
  shopItemInfo: {}, //存放要和选中的值进行匹配的数据
89
89
  selectArr: [], //存放被选中的值
90
90
  subIndex: [], //是否选中 因为不确定是多规格还是但规格,所以这里定义数组来判断
@@ -101,14 +101,14 @@ export default {
101
101
  methods: {
102
102
  //初始化数据
103
103
  _dealData() {
104
- this.spu = this.specList.items; //spu规格列表
105
- this.sku = this.skuList.items; //sku列表
104
+ this.localSpu = this.specList.items; // spu规格列表
105
+ this.localSku = this.skuList.items; // sku列表
106
106
  this.shopItemInfo = {}; //存放要和选中的值进行匹配的数据
107
107
  this.selectArr = []; //存放被选中的值
108
108
  this.subIndex = []; //是否选中 因为不确定是多规格还是但规格,所以这里定义数组来判断
109
109
  this.selectshop = {}; //存放最后选中的商品
110
- if (this.spu && this.sku && this.spu.length > 0 && this.sku.length > 0) {
111
- this.spu.map((item) => {
110
+ if (this.localSpu && this.localSku && this.localSpu.length > 0 && this.localSku.length > 0) {
111
+ this.localSpu.map((item) => {
112
112
  this.selectArr.push('');
113
113
  this.subIndex.push(-1);
114
114
  });
@@ -141,29 +141,29 @@ export default {
141
141
  //循环所有属性判断哪些属性可选
142
142
  //当前选中的兄弟节点和已选中属性不需要循环
143
143
 
144
- for (let i = 0, len = this.spu.length; i < len; i++) {
144
+ for (let i = 0, len = this.localSpu.length; i < len; i++) {
145
145
  if (i == clickIndex) {
146
146
  continue;
147
147
  }
148
- let len2 = this.spu[i].items.length;
148
+ let len2 = this.localSpu[i].items.length;
149
149
  for (let j = 0; j < len2; j++) {
150
150
  if (this.subIndex[i] != -1 && j == this.subIndex[i]) {
151
151
  continue;
152
152
  }
153
153
  let choosed_copy = [...this.selectArr];
154
- this.$set(choosed_copy, i, this.spu[i].items[j].name);
154
+ this.$set(choosed_copy, i, this.localSpu[i].items[j].name);
155
155
  let choosed_copy2 = choosed_copy.filter((item) => item !== '' && typeof item !== 'undefined');
156
156
  if (this.shopItemInfo.hasOwnProperty(choosed_copy2)) {
157
- this.$set(this.spu[i].items[j], 'ishow', true);
157
+ this.$set(this.localSpu[i].items[j], 'ishow', true);
158
158
  } else {
159
- this.$set(this.spu[i].items[j], 'ishow', false);
159
+ this.$set(this.localSpu[i].items[j], 'ishow', false);
160
160
  }
161
161
  }
162
162
  }
163
163
  },
164
164
  checkItem() {
165
165
  //计算可选路径
166
- let result = this.sku.reduce(
166
+ let result = this.localSku.reduce(
167
167
  (arrs, items) => {
168
168
  return arrs.concat(
169
169
  items.sku.reduce(
@@ -5,13 +5,6 @@
5
5
  <script>
6
6
  export default {
7
7
  name: 'cvSwitch',
8
- inject: {
9
- cvFormGroup: {
10
- default() {
11
- return null;
12
- }
13
- }
14
- },
15
8
  props: {
16
9
  value: {
17
10
  type: [Number, String, Boolean],
@@ -24,13 +24,6 @@
24
24
  <script>
25
25
  export default {
26
26
  name: 'cvTextArea',
27
- inject: {
28
- cvFormGroup: {
29
- default() {
30
- return null;
31
- }
32
- }
33
- },
34
27
  props: {
35
28
  value: {
36
29
  type: [Number, String],
@@ -136,7 +136,7 @@ export default {
136
136
  return {};
137
137
  }
138
138
  },
139
- upApiFunc: {
139
+ apiFunc: {
140
140
  type: Function,
141
141
  default: null
142
142
  },
@@ -297,7 +297,7 @@ export default {
297
297
  );
298
298
 
299
299
  //将本地资源上传到开发者服务器,客户端发起一个 POST 请求,其中 content-type 为 multipart/form-data。
300
- this.upApiFunc({
300
+ this.apiFunc({
301
301
  //要上传文件资源的路径。
302
302
  filePath: tempFilePaths,
303
303
  //文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
@@ -346,7 +346,7 @@ export default {
346
346
  });
347
347
  },
348
348
  imgChoose() {
349
- if (!this.upApiFunc) {
349
+ if (!this.apiFunc) {
350
350
  this._currShowToast('上传方法错误');
351
351
  return;
352
352
  }