@10yun/cv-mobile-ui 0.3.24 → 0.3.25
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 +5 -2
- package/plugins/request.js +14 -1
- package/ui-cv/cv-banner/cv-banner.vue +23 -14
- package/ui-cv/cv-banner-card/cv-banner-card.vue +24 -16
- package/ui-cv/cv-block/cv-block.vue +6 -6
- package/ui-cv/cv-box/cv-box.vue +6 -7
- package/ui-cv/cv-button/cv-button.vue +32 -13
- package/ui-cv/cv-cell/cv-cell.vue +21 -25
- package/ui-cv/cv-checkbox/cv-checkbox.vue +22 -22
- package/ui-cv/cv-checkbox-tag/cv-checkbox-tag.vue +30 -25
- package/ui-cv/cv-code-sms/cv-code-sms.vue +60 -38
- package/ui-cv/cv-dialog-bottom/cv-dialog-bottom.vue +14 -18
- package/ui-cv/cv-dialog-full/cv-dialog-full.vue +14 -18
- package/ui-cv/cv-dialog-loading/cv-dialog-loading.vue +10 -17
- package/ui-cv/cv-dialog-share/cv-dialog-share.vue +4 -5
- package/ui-cv/cv-draw-barcode/cv-draw-barcode.vue +54 -51
- package/ui-cv/cv-draw-posters/cv-draw-posters.vue +53 -71
- package/ui-cv/cv-draw-progress/cv-draw-progress.vue +44 -39
- package/ui-cv/cv-draw-qrcode/cv-draw-qrcode.vue +48 -45
- package/ui-cv/cv-editor/compressImage.vue +47 -40
- package/ui-cv/cv-editor/cv-editor.vue +234 -124
- package/ui-cv/cv-editor-parse/cv-editor-parse.vue +21 -30
- package/ui-cv/cv-editor-parse/u-parse.vue +21 -30
- package/ui-cv/cv-filter-hm/cv-filter-hm.vue +140 -74
- package/ui-cv/cv-form-group/cv-form-group.vue +11 -13
- package/ui-cv/cv-form-item/cv-form-item.vue +35 -20
- package/ui-cv/cv-form-merge/cv-form-merge.vue +5 -10
- package/ui-cv/cv-geo-local/cv-geo-local.vue +50 -27
- package/ui-cv/cv-icons/cv-icons.vue +24 -19
- package/ui-cv/cv-info/cv-info.vue +9 -11
- package/ui-cv/cv-input-btn/cv-input-btn.vue +34 -13
- package/ui-cv/cv-input-digit/cv-input-digit.vue +31 -18
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +31 -21
- package/ui-cv/cv-input-number/cv-input-number.vue +29 -14
- package/ui-cv/cv-input-password/cv-input-password.vue +31 -20
- package/ui-cv/cv-input-text/cv-input-text.vue +32 -17
- package/ui-cv/cv-link/cv-link.vue +7 -7
- package/ui-cv/cv-lists-base/cv-lists-base.vue +148 -114
- package/ui-cv/cv-lists-swiper/cv-lists-swipe2r.vue +24 -15
- package/ui-cv/cv-lists-swiper/cv-lists-swiper.vue +85 -63
- package/ui-cv/cv-load-more/cv-load-more.vue +60 -28
- package/ui-cv/cv-message/cv-message.vue +5 -6
- package/ui-cv/cv-nav-col/cv-nav-col.vue +9 -13
- package/ui-cv/cv-nav-group/cv-nav-group.vue +6 -8
- package/ui-cv/cv-nav-row/cv-nav-row.vue +21 -25
- package/ui-cv/cv-picker-date/cv-picker-date.vue +28 -12
- package/ui-cv/cv-picker-datetime/cv-picker-datetime.vue +43 -21
- package/ui-cv/cv-picker-datetime5/cv-picker-datetime5.vue +108 -60
- package/ui-cv/cv-picker-region/cv-picker-region.vue +46 -32
- package/ui-cv/cv-picker-time/cv-picker-time.vue +26 -11
- package/ui-cv/cv-picker1/cv-picker1.vue +32 -17
- package/ui-cv/cv-picker2/cv-picker2.vue +46 -28
- package/ui-cv/cv-picker3/cv-picker3.vue +77 -44
- package/ui-cv/cv-radio/cv-radio.vue +17 -10
- package/ui-cv/cv-radio-sex/cv-radio-sex.vue +20 -21
- package/ui-cv/cv-radio-tag/cv-radio-tag.vue +22 -11
- package/ui-cv/cv-rate/cv-rate.vue +17 -13
- package/ui-cv/cv-search/cv-search.vue +17 -12
- package/ui-cv/cv-skeleton/cv-skeleton.vue +32 -27
- package/ui-cv/cv-skeleton/cv-skeleton2.vue +56 -33
- package/ui-cv/cv-skeleton-group/cv-skeleton-group.vue +4 -6
- package/ui-cv/cv-specs/cv-specs.vue +31 -30
- package/ui-cv/cv-switch/cv-switch.vue +4 -5
- package/ui-cv/cv-tab-lists/cv-tab-lists.vue +189 -128
- package/ui-cv/cv-textarea/cv-textarea.vue +31 -13
- package/ui-cv/cv-treaty/cv-treaty.vue +8 -8
- package/ui-cv/cv-update-app/cv-update-app.vue +68 -53
- package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +33 -31
- package/ui-cv/cv-upload-img/cv-upload-img.vue +97 -70
- package/ui-cv/dict/area-city.js +612 -612
- package/ui-cv/dict/area-county.js +3392 -3392
- package/ui-cv/dict/area-province.js +35 -35
- package/ui-cv/mixins/mixins-checkbox.js +9 -15
- package/ui-cv/mixins/mixins-common.js +7 -7
- package/ui-cv/mixins/mixins-input.js +11 -12
- package/ui-cv/mixins/mixins-picker.js +9 -13
- package/ui-cv/mixins/mixins-radio.js +10 -14
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-draw-qrcode">
|
|
3
3
|
<!-- #ifndef MP-ALIPAY -->
|
|
4
|
-
<canvas class="cv-draw-qrcode_canvas
|
|
4
|
+
<canvas class="cv-draw-qrcode_canvas" :canvas-id="cid" :style="{ width: cpSize + 'px', height: cpSize + 'px' }" />
|
|
5
5
|
<!-- #endif -->
|
|
6
6
|
<!-- #ifdef MP-ALIPAY -->
|
|
7
|
-
<canvas :id="cid" :width="cpSize" :height="cpSize" class="cv-draw-qrcode_canvas
|
|
7
|
+
<canvas :id="cid" :width="cpSize" :height="cpSize" class="cv-draw-qrcode_canvas" />
|
|
8
8
|
<!-- #endif -->
|
|
9
|
-
<image v-show="show" :src="result" :style="{width:cpSize+'px',height:cpSize+'px'}" />
|
|
9
|
+
<image v-show="show" :src="result" :style="{ width: cpSize + 'px', height: cpSize + 'px' }" />
|
|
10
10
|
<!-- <image class="image" v-if="img" :src="img" :style="{width: sizeSync + 'px', height: sizeSync + 'px'}" /> -->
|
|
11
11
|
</view>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
15
|
import QRCode from './qrcode.js';
|
|
16
|
-
let qrcode
|
|
16
|
+
let qrcode;
|
|
17
17
|
export default {
|
|
18
18
|
name: 'cvDrawQrcode',
|
|
19
19
|
props: {
|
|
@@ -80,15 +80,15 @@ export default {
|
|
|
80
80
|
loadingText: {
|
|
81
81
|
type: String,
|
|
82
82
|
default: '二维码生成中'
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
84
|
},
|
|
85
85
|
data() {
|
|
86
86
|
return {
|
|
87
87
|
result: '',
|
|
88
88
|
img: '',
|
|
89
89
|
sizeSync: 100,
|
|
90
|
-
localIcon: ''
|
|
91
|
-
}
|
|
90
|
+
localIcon: ''
|
|
91
|
+
};
|
|
92
92
|
},
|
|
93
93
|
|
|
94
94
|
watch: {
|
|
@@ -112,10 +112,10 @@ export default {
|
|
|
112
112
|
},
|
|
113
113
|
computed: {
|
|
114
114
|
cpSize() {
|
|
115
|
-
if (this.unit ==
|
|
116
|
-
return uni.upx2px(this.size)
|
|
115
|
+
if (this.unit == 'upx') {
|
|
116
|
+
return uni.upx2px(this.size);
|
|
117
117
|
} else {
|
|
118
|
-
return this.size
|
|
118
|
+
return this.size;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
},
|
|
@@ -123,7 +123,7 @@ export default {
|
|
|
123
123
|
if (this.loadMake) {
|
|
124
124
|
if (!this._empty(this.val)) {
|
|
125
125
|
setTimeout(() => {
|
|
126
|
-
this._makeCodeBefore()
|
|
126
|
+
this._makeCodeBefore();
|
|
127
127
|
}, 30);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
163
163
|
this.urlTobase64(this.icon, (e) => {
|
|
164
164
|
this.localIcon = e;
|
|
165
165
|
this._makeCode();
|
|
166
|
-
})
|
|
166
|
+
});
|
|
167
167
|
}
|
|
168
168
|
} else {
|
|
169
169
|
this.localIcon = this.icon;
|
|
@@ -190,10 +190,11 @@ export default {
|
|
|
190
190
|
pdground: this.pdground, // 定位角点颜色
|
|
191
191
|
correctLevel: this.lv, // 容错级别
|
|
192
192
|
image: this.localIcon, // 二维码图标
|
|
193
|
-
imageSize: this.iconSize
|
|
194
|
-
cbResult: (res) => {
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
imageSize: this.iconSize, // 二维码图标大小
|
|
194
|
+
cbResult: (res) => {
|
|
195
|
+
// 生成二维码的回调
|
|
196
|
+
this._result(res);
|
|
197
|
+
}
|
|
197
198
|
});
|
|
198
199
|
} else {
|
|
199
200
|
uni.showToast({
|
|
@@ -204,12 +205,12 @@ export default {
|
|
|
204
205
|
}
|
|
205
206
|
},
|
|
206
207
|
_clearCode() {
|
|
207
|
-
this._result('')
|
|
208
|
-
qrcode.clear()
|
|
208
|
+
this._result('');
|
|
209
|
+
qrcode.clear();
|
|
209
210
|
},
|
|
210
211
|
_saveCode() {
|
|
211
212
|
let that = this;
|
|
212
|
-
if (this.result !=
|
|
213
|
+
if (this.result != '') {
|
|
213
214
|
uni.saveImageToPhotosAlbum({
|
|
214
215
|
filePath: that.result,
|
|
215
216
|
success: function () {
|
|
@@ -224,23 +225,23 @@ export default {
|
|
|
224
225
|
},
|
|
225
226
|
_result(res) {
|
|
226
227
|
this.result = res;
|
|
227
|
-
this.$emit('result', res)
|
|
228
|
+
this.$emit('result', res);
|
|
228
229
|
},
|
|
229
230
|
_empty(v) {
|
|
230
231
|
let tp = typeof v,
|
|
231
232
|
rt = false;
|
|
232
|
-
if (tp ==
|
|
233
|
-
rt = true
|
|
234
|
-
} else if (tp ==
|
|
235
|
-
rt = true
|
|
236
|
-
} else if (tp ==
|
|
237
|
-
if (JSON.stringify(v) ==
|
|
238
|
-
} else if (tp ==
|
|
239
|
-
if (v ==
|
|
240
|
-
} else if (tp ==
|
|
241
|
-
rt = false
|
|
233
|
+
if (tp == 'number' && String(v) == '') {
|
|
234
|
+
rt = true;
|
|
235
|
+
} else if (tp == 'undefined') {
|
|
236
|
+
rt = true;
|
|
237
|
+
} else if (tp == 'object') {
|
|
238
|
+
if (JSON.stringify(v) == '{}' || JSON.stringify(v) == '[]' || v == null) rt = true;
|
|
239
|
+
} else if (tp == 'string') {
|
|
240
|
+
if (v == '' || v == 'undefined' || v == 'null' || v == '{}' || v == '[]') rt = true;
|
|
241
|
+
} else if (tp == 'function') {
|
|
242
|
+
rt = false;
|
|
242
243
|
}
|
|
243
|
-
return rt
|
|
244
|
+
return rt;
|
|
244
245
|
},
|
|
245
246
|
//图片转base64
|
|
246
247
|
urlTobase64(url, func) {
|
|
@@ -248,18 +249,20 @@ export default {
|
|
|
248
249
|
uni.getFileSystemManager().readFile({
|
|
249
250
|
filePath: url, //选择图片返回的相对路径
|
|
250
251
|
encoding: 'base64', //编码格式
|
|
251
|
-
success: res => {
|
|
252
|
+
success: (res) => {
|
|
253
|
+
//成功的回调
|
|
252
254
|
console.log(res);
|
|
253
|
-
let base64 = 'data:image/jpeg;base64,' + res.data //不加上这串字符,在页面无法显示的哦
|
|
255
|
+
let base64 = 'data:image/jpeg;base64,' + res.data; //不加上这串字符,在页面无法显示的哦
|
|
254
256
|
func(base64);
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
+
},
|
|
258
|
+
fail: (e) => {
|
|
259
|
+
console.log('图片转换失败');
|
|
257
260
|
uni.showToast({
|
|
258
261
|
title: '图片转换失败',
|
|
259
262
|
duration: 1000
|
|
260
263
|
});
|
|
261
264
|
}
|
|
262
|
-
})
|
|
265
|
+
});
|
|
263
266
|
// #endif
|
|
264
267
|
|
|
265
268
|
// #ifndef MP-WEIXIN
|
|
@@ -267,23 +270,23 @@ export default {
|
|
|
267
270
|
url: url,
|
|
268
271
|
method: 'GET',
|
|
269
272
|
responseType: 'arraybuffer',
|
|
270
|
-
success: ress => {
|
|
271
|
-
let base64 = wx.arrayBufferToBase64(ress.data); //把arraybuffer转成base64
|
|
272
|
-
base64 = 'data:image/jpeg;base64,' + base64 //不加上这串字符,在页面无法显示的哦
|
|
273
|
+
success: (ress) => {
|
|
274
|
+
let base64 = wx.arrayBufferToBase64(ress.data); //把arraybuffer转成base64
|
|
275
|
+
base64 = 'data:image/jpeg;base64,' + base64; //不加上这串字符,在页面无法显示的哦
|
|
273
276
|
func(base64);
|
|
274
|
-
},
|
|
277
|
+
},
|
|
278
|
+
fail: (e) => {
|
|
275
279
|
uni.showToast({
|
|
276
280
|
title: '图片转换失败',
|
|
277
281
|
duration: 1000
|
|
278
282
|
});
|
|
279
|
-
console.log(
|
|
283
|
+
console.log('图片转换失败');
|
|
280
284
|
}
|
|
281
|
-
})
|
|
285
|
+
});
|
|
282
286
|
// #endif
|
|
283
|
-
|
|
284
287
|
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
288
|
+
}
|
|
289
|
+
};
|
|
287
290
|
</script>
|
|
288
291
|
|
|
289
292
|
<style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="compress">
|
|
3
|
-
<canvas :style="{ width: canvasSize.width,height: canvasSize.height}" canvas-id="myCanvas"></canvas>
|
|
3
|
+
<canvas :style="{ width: canvasSize.width, height: canvasSize.height }" canvas-id="myCanvas"></canvas>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import { base64ToPath } from './index.js'
|
|
8
|
+
import { base64ToPath } from './index.js';
|
|
9
9
|
export default {
|
|
10
10
|
data() {
|
|
11
11
|
return {
|
|
@@ -14,12 +14,15 @@ export default {
|
|
|
14
14
|
width: 0,
|
|
15
15
|
height: 0
|
|
16
16
|
}
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
},
|
|
19
19
|
methods: {
|
|
20
20
|
dataURLtoBlob(dataurl) {
|
|
21
|
-
let arr = dataurl.split(','),
|
|
22
|
-
|
|
21
|
+
let arr = dataurl.split(','),
|
|
22
|
+
mime = arr[0].match(/:(.*?);/)[1],
|
|
23
|
+
bstr = atob(arr[1]),
|
|
24
|
+
n = bstr.length,
|
|
25
|
+
u8arr = new Uint8Array(n);
|
|
23
26
|
while (n--) {
|
|
24
27
|
u8arr[n] = bstr.charCodeAt(n);
|
|
25
28
|
}
|
|
@@ -28,7 +31,9 @@ export default {
|
|
|
28
31
|
// 压缩
|
|
29
32
|
compress(params) {
|
|
30
33
|
return new Promise(async (resolve, reject) => {
|
|
31
|
-
let info = await this.getImageInfo(params.src)
|
|
34
|
+
let info = await this.getImageInfo(params.src)
|
|
35
|
+
.then((info) => info)
|
|
36
|
+
.catch((err) => err);
|
|
32
37
|
|
|
33
38
|
if (!info) {
|
|
34
39
|
reject('获取图片信息异常');
|
|
@@ -58,47 +63,49 @@ export default {
|
|
|
58
63
|
this.canvasSize = {
|
|
59
64
|
width: `${width}rpx`,
|
|
60
65
|
height: `${height}rpx`
|
|
61
|
-
}
|
|
66
|
+
};
|
|
62
67
|
|
|
63
68
|
this.$nextTick(() => {
|
|
64
69
|
setTimeout(() => {
|
|
65
70
|
const ctx = uni.createCanvasContext('myCanvas', this);
|
|
66
71
|
ctx.drawImage(info.path, 0, 0, uni.upx2px(width), uni.upx2px(height));
|
|
67
72
|
ctx.draw(false, () => {
|
|
68
|
-
uni.canvasToTempFilePath(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
73
|
+
uni.canvasToTempFilePath(
|
|
74
|
+
{
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0,
|
|
77
|
+
width: uni.upx2px(width),
|
|
78
|
+
height: uni.upx2px(height),
|
|
79
|
+
destWidth: width,
|
|
80
|
+
destHeight: height,
|
|
81
|
+
canvasId: 'myCanvas',
|
|
82
|
+
fileType: params.fileType || 'jpg',
|
|
83
|
+
quality: params.quality || 0.9,
|
|
84
|
+
success: (res) => {
|
|
85
|
+
// 在H5平台下,tempFilePath 为 base64
|
|
86
|
+
// #ifdef H5
|
|
87
|
+
base64ToPath(res.tempFilePath)
|
|
88
|
+
.then((path) => {
|
|
89
|
+
resolve(path);
|
|
90
|
+
})
|
|
91
|
+
.catch((error) => {
|
|
92
|
+
console.error(error);
|
|
93
|
+
reject(error);
|
|
94
|
+
});
|
|
95
|
+
// #endif
|
|
96
|
+
// #ifndef H5
|
|
97
|
+
resolve(res.tempFilePath);
|
|
98
|
+
// #endif
|
|
99
|
+
},
|
|
100
|
+
fail: (err) => {
|
|
101
|
+
reject(err);
|
|
102
|
+
}
|
|
93
103
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}, this);
|
|
98
|
-
|
|
104
|
+
this
|
|
105
|
+
);
|
|
99
106
|
});
|
|
100
107
|
}, 500);
|
|
101
|
-
})
|
|
108
|
+
});
|
|
102
109
|
});
|
|
103
110
|
},
|
|
104
111
|
// 获取图片信息
|
|
@@ -116,10 +123,10 @@ export default {
|
|
|
116
123
|
});
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
|
-
}
|
|
126
|
+
};
|
|
120
127
|
</script>
|
|
121
128
|
|
|
122
|
-
<style
|
|
129
|
+
<style>
|
|
123
130
|
.compress {
|
|
124
131
|
position: fixed;
|
|
125
132
|
width: 12px;
|