uview-plus 3.8.18 → 3.8.32
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/changelog.md +92 -0
- package/components/u-cropper/u-cropper.vue +409 -387
- package/components/u-poster/u-poster.vue +12 -10
- package/components/u-qrcode/qrcode.js +35 -29
- package/components/u-qrcode/u-qrcode.vue +17 -12
- package/components/u-toast/u-toast.vue +5 -1
- package/components/u-tooltip/u-tooltip.vue +1 -0
- package/libs/config/config.js +2 -0
- package/libs/css/theme-vars-core.scss +4 -0
- package/libs/root/index.js +5 -29
- package/libs/root/root.js +6 -2
- package/libs/theme/runtime.js +1 -0
- package/libs/theme/theme.js +6 -8
- package/package.json +1 -1
- package/types/comps/qrcode.d.ts +6 -0
- package/types/index.d.ts +6 -0
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-cropper">
|
|
3
3
|
<!-- <image :src="imgSrc.imgSrc" @click="select" :style="[ imgStyle ]" class="my-avatar"></image> -->
|
|
4
|
-
<canvas :canvas-id="'avatar-canvas-' + instanceId" :id="'avatar-canvas-' + instanceId" class="my-canvas"
|
|
5
|
-
|
|
6
|
-
<canvas :canvas-id="'
|
|
7
|
-
|
|
8
|
-
disable-scroll="false" @touchstart="start" @touchmove="move" @touchend="end"></canvas>
|
|
9
|
-
<canvas :canvas-id="'prv-canvas-' + instanceId" :id="'prv-canvas-' + instanceId" class="prv-canvas"
|
|
10
|
-
disable-scroll="false" @touchstart="hideImg" :style="{ height: cvsStyleHeight, top: prvTop }"></canvas>
|
|
11
|
-
<view class="oper-wrapper" :style="{display: styleDisplay}">
|
|
4
|
+
<canvas :canvas-id="'avatar-canvas-' + instanceId" :id="'avatar-canvas-' + instanceId" class="my-canvas" :style="{ top: styleTop, height: cvsStyleHeight }" disable-scroll="false"></canvas>
|
|
5
|
+
<canvas :canvas-id="'oper-canvas-' + instanceId" :id="'oper-canvas-' + instanceId" class="oper-canvas" :style="{ top: styleTop, height: cvsStyleHeight }" disable-scroll="false" @touchstart="start" @touchmove="move" @touchend="end"></canvas>
|
|
6
|
+
<canvas :canvas-id="'prv-canvas-' + instanceId" :id="'prv-canvas-' + instanceId" class="prv-canvas" disable-scroll="false" @touchstart="hideImg" :style="{ height: cvsStyleHeight, top: prvTop }"></canvas>
|
|
7
|
+
<view class="oper-wrapper" :style="{ display: styleDisplay }">
|
|
12
8
|
<view class="oper">
|
|
13
9
|
<view class="btn-wrapper" v-if="showOper">
|
|
14
|
-
<view @click="select"
|
|
10
|
+
<view @click="select" hover-class="hover" :style="{ width: btnWidth }">
|
|
15
11
|
<text>{{ t("up.common.re-select") }}</text>
|
|
16
12
|
</view>
|
|
17
|
-
<view @click="close"
|
|
13
|
+
<view @click="close" hover-class="hover" :style="{ width: btnWidth }">
|
|
18
14
|
<text>{{ t("up.common.close") }}</text>
|
|
19
15
|
</view>
|
|
20
|
-
<view @click="rotate"
|
|
16
|
+
<view @click="rotate" hover-class="hover" :style="{ width: btnWidth, display: btnDsp }">
|
|
21
17
|
<text>{{ t("up.common.rotate") }}</text>
|
|
22
18
|
</view>
|
|
23
|
-
<view @click="preview" hover-class="hover" :style="{width: btnWidth}">
|
|
19
|
+
<view @click="preview" hover-class="hover" :style="{ width: btnWidth }">
|
|
24
20
|
<text>{{ t("up.common.preview") }}</text>
|
|
25
21
|
</view>
|
|
26
|
-
<view @click="confirm"
|
|
22
|
+
<view @click="confirm" hover-class="hover" :style="{ width: btnWidth }">
|
|
27
23
|
<text>{{ t("up.common.confirm") }}</text>
|
|
28
24
|
</view>
|
|
29
25
|
</view>
|
|
30
26
|
<view class="clr-wrapper" v-else>
|
|
31
|
-
<slider class="my-slider" @change="colorChange"
|
|
32
|
-
|
|
33
|
-
backgroundColor="green" block-color="grey" show-value></slider>
|
|
34
|
-
<view @click="prvUpload" hover-class="hover" :style="{width: btnWidth}">
|
|
27
|
+
<slider class="my-slider" @change="colorChange" block-size="25" value="0" min="-100" max="100" activeColor="red" backgroundColor="green" block-color="grey" show-value></slider>
|
|
28
|
+
<view @click="prvUpload" hover-class="hover" :style="{ width: btnWidth }">
|
|
35
29
|
<text>{{ t("up.common.confirm") }}</text>
|
|
36
30
|
</view>
|
|
37
31
|
</view>
|
|
@@ -39,7 +33,7 @@
|
|
|
39
33
|
</view>
|
|
40
34
|
<view @click="chooseImage(0, {})" v-if="styleDisplay == 'none'">
|
|
41
35
|
<slot>
|
|
42
|
-
|
|
36
|
+
|
|
43
37
|
</slot>
|
|
44
38
|
</view>
|
|
45
39
|
</view>
|
|
@@ -86,7 +80,7 @@
|
|
|
86
80
|
}
|
|
87
81
|
},
|
|
88
82
|
emits: ['avtinit', 'confirm'],
|
|
89
|
-
props:{
|
|
83
|
+
props: {
|
|
90
84
|
minScale: '',
|
|
91
85
|
maxScale: '',
|
|
92
86
|
canScale: true,
|
|
@@ -107,6 +101,11 @@
|
|
|
107
101
|
exportWidth: '260rpx',
|
|
108
102
|
// 导出图片高度,用于设置最终导出图片的高度
|
|
109
103
|
exportHeight: '260rpx',
|
|
104
|
+
// 画布填充色,默认透明,可传 'black'、'#ffffff' 等
|
|
105
|
+
fillColor: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'transparent'
|
|
108
|
+
},
|
|
110
109
|
},
|
|
111
110
|
created() {
|
|
112
111
|
this.ctxCanvas = uni.createCanvasContext('avatar-canvas-' + this.instanceId, this);
|
|
@@ -125,7 +124,7 @@
|
|
|
125
124
|
this.noBar = this.noTab === true ? 1 : 0;
|
|
126
125
|
this.stc = this.stretch;
|
|
127
126
|
this.lck = this.lock;
|
|
128
|
-
if(this.isin) {
|
|
127
|
+
if (this.isin) {
|
|
129
128
|
this.btnWidth = '24%';
|
|
130
129
|
this.btnDsp = 'none';
|
|
131
130
|
} else {
|
|
@@ -133,12 +132,12 @@
|
|
|
133
132
|
this.btnDsp = 'flex';
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
if(this.noBar) {
|
|
135
|
+
if (this.noBar) {
|
|
137
136
|
this.moreHeight = 0;
|
|
138
137
|
this.windowResize();
|
|
139
138
|
} else {
|
|
140
139
|
uni.showTabBar({
|
|
141
|
-
complete:(res) => {
|
|
140
|
+
complete: (res) => {
|
|
142
141
|
this.moreHeight = (res.errMsg === 'showTabBar:ok') ? 50 : 0;
|
|
143
142
|
this.windowResize();
|
|
144
143
|
}
|
|
@@ -159,7 +158,7 @@
|
|
|
159
158
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
160
159
|
// #endif
|
|
161
160
|
// #ifdef APP-PLUS
|
|
162
|
-
if(this.platform === 'android') {
|
|
161
|
+
if (this.platform === 'android') {
|
|
163
162
|
this.windowHeight = sysInfo.screenHeight + sysInfo.statusBarHeight;
|
|
164
163
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
165
164
|
} else {
|
|
@@ -171,20 +170,20 @@
|
|
|
171
170
|
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
172
171
|
this.cvsStyleHeight = this.windowHeight - tabHeight - this.safeAreaInsetsBottom - 2 + 'px';
|
|
173
172
|
// #endif
|
|
174
|
-
this.pxRatio = this.windowWidth/750;
|
|
173
|
+
this.pxRatio = this.windowWidth / 750;
|
|
175
174
|
|
|
176
175
|
let style = this.avatarStyle;
|
|
177
|
-
if(style && style !== true && (style=style.trim())
|
|
176
|
+
if (style && style !== true && (style = style.trim())) {
|
|
178
177
|
style = style.split(';');
|
|
179
178
|
let obj = {};
|
|
180
|
-
for(
|
|
181
|
-
if(!v) continue;
|
|
179
|
+
for (let v of style) {
|
|
180
|
+
if (!v) continue;
|
|
182
181
|
v = v.trim().split(':');
|
|
183
|
-
if(v[1].indexOf('rpx') >= 0) {
|
|
182
|
+
if (v[1].indexOf('rpx') >= 0) {
|
|
184
183
|
let arr = v[1].trim().split(' ');
|
|
185
|
-
for(
|
|
186
|
-
if(!arr[k]) continue;
|
|
187
|
-
if(arr[k].indexOf('rpx') >= 0) {
|
|
184
|
+
for (let k in arr) {
|
|
185
|
+
if (!arr[k]) continue;
|
|
186
|
+
if (arr[k].indexOf('rpx') >= 0) {
|
|
188
187
|
arr[k] = parseFloat(arr[k]) * this.pxRatio + 'px';
|
|
189
188
|
}
|
|
190
189
|
}
|
|
@@ -195,24 +194,24 @@
|
|
|
195
194
|
this.imgStyle = obj;
|
|
196
195
|
}
|
|
197
196
|
|
|
198
|
-
this.expWidth && (this.expWidth = this.expWidth.indexOf('rpx') >= 0 ? parseInt(this.expWidth)*this.pxRatio : parseInt(this.expWidth));
|
|
199
|
-
this.expHeight && (this.expHeight = this.expHeight.indexOf('rpx') >= 0 ? parseInt(this.expHeight)*this.pxRatio : parseInt(this.expHeight));
|
|
197
|
+
this.expWidth && (this.expWidth = this.expWidth.indexOf('rpx') >= 0 ? parseInt(this.expWidth) * this.pxRatio : parseInt(this.expWidth));
|
|
198
|
+
this.expHeight && (this.expHeight = this.expHeight.indexOf('rpx') >= 0 ? parseInt(this.expHeight) * this.pxRatio : parseInt(this.expHeight));
|
|
200
199
|
|
|
201
|
-
if(this.styleDisplay === 'flex') {
|
|
200
|
+
if (this.styleDisplay === 'flex') {
|
|
202
201
|
this.drawInit(true);
|
|
203
202
|
}
|
|
204
203
|
this.hideImg();
|
|
205
204
|
},
|
|
206
205
|
select() {
|
|
207
|
-
if(this.fSelecting) return;
|
|
206
|
+
if (this.fSelecting) return;
|
|
208
207
|
this.fSelecting = true;
|
|
209
|
-
setTimeout(()=>{ this.fSelecting = false; }, 500);
|
|
210
|
-
|
|
208
|
+
setTimeout(() => { this.fSelecting = false; }, 500);
|
|
209
|
+
const self = this
|
|
211
210
|
uni.chooseImage({
|
|
212
211
|
count: 1,
|
|
213
212
|
sizeType: ['original', 'compressed'],
|
|
214
213
|
sourceType: ['album', 'camera'],
|
|
215
|
-
success: (r)=>{
|
|
214
|
+
success: (r) => {
|
|
216
215
|
uni.showLoading({ mask: true });
|
|
217
216
|
let path = this.imgPath = r.tempFilePaths[0];
|
|
218
217
|
uni.getImageInfo({
|
|
@@ -221,15 +220,15 @@
|
|
|
221
220
|
this.imgWidth = r.width;
|
|
222
221
|
this.imgHeight = r.height;
|
|
223
222
|
this.path = path;
|
|
224
|
-
if(
|
|
223
|
+
if (!this.hasSel) {
|
|
225
224
|
let style = this.selStyle || {};
|
|
226
|
-
if(
|
|
227
|
-
let areaWidth
|
|
228
|
-
areaHeight = this.arHeight.indexOf('rpx') >= 0 ? parseInt(this.arHeight) * this.pxRatio: parseInt(this.arHeight);
|
|
225
|
+
if (this.arWidth && this.arHeight) {
|
|
226
|
+
let areaWidth = this.arWidth.indexOf('rpx') >= 0 ? parseInt(this.arWidth) * this.pxRatio : parseInt(this.arWidth),
|
|
227
|
+
areaHeight = this.arHeight.indexOf('rpx') >= 0 ? parseInt(this.arHeight) * this.pxRatio : parseInt(this.arHeight);
|
|
229
228
|
style.width = areaWidth + 'px';
|
|
230
229
|
style.height = areaHeight + 'px';
|
|
231
|
-
style.top = (this.windowHeight - areaHeight - tabHeight)/2 + 'px';
|
|
232
|
-
style.left = (this.windowWidth - areaWidth)/2 + 'px';
|
|
230
|
+
style.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
231
|
+
style.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
233
232
|
} else {
|
|
234
233
|
uni.showModal({
|
|
235
234
|
title: t("up.cropper.emptyWidhtOrHeight"),
|
|
@@ -240,7 +239,7 @@
|
|
|
240
239
|
this.selStyle = style;
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
if(
|
|
242
|
+
if (this.noBar) {
|
|
244
243
|
this.drawInit(true);
|
|
245
244
|
} else {
|
|
246
245
|
uni.hideTabBar({
|
|
@@ -250,7 +249,7 @@
|
|
|
250
249
|
});
|
|
251
250
|
}
|
|
252
251
|
},
|
|
253
|
-
fail: ()=>{
|
|
252
|
+
fail: () => {
|
|
254
253
|
uni.showToast({
|
|
255
254
|
title: "error3",
|
|
256
255
|
duration: 2000,
|
|
@@ -260,13 +259,15 @@
|
|
|
260
259
|
uni.hideLoading();
|
|
261
260
|
}
|
|
262
261
|
});
|
|
262
|
+
}, fail(err) {
|
|
263
|
+
self.$emit('cancel')
|
|
263
264
|
}
|
|
264
265
|
})
|
|
265
266
|
},
|
|
266
267
|
confirm() {
|
|
267
|
-
if(this.fUploading)
|
|
268
|
+
if (this.fUploading) return;
|
|
268
269
|
this.fUploading = true;
|
|
269
|
-
setTimeout(()=>{ this.fUploading = false; }, 1000)
|
|
270
|
+
setTimeout(() => { this.fUploading = false; }, 1000)
|
|
270
271
|
|
|
271
272
|
let style = this.selStyle,
|
|
272
273
|
x = parseInt(style.left),
|
|
@@ -298,17 +299,17 @@
|
|
|
298
299
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
299
300
|
fileType: 'png',
|
|
300
301
|
quality: this.qlty,
|
|
301
|
-
success: (r)=>{
|
|
302
|
+
success: (r) => {
|
|
302
303
|
r = r.tempFilePath;
|
|
303
304
|
// #ifdef H5
|
|
304
|
-
this.btop(r).then((r)=> {
|
|
305
|
-
if(this.expWidth && this.expHeight) {
|
|
305
|
+
this.btop(r).then((r) => {
|
|
306
|
+
if (this.expWidth && this.expHeight) {
|
|
306
307
|
let ctxCanvas = this.ctxCanvas;
|
|
307
308
|
expWidth = this.expWidth,
|
|
308
|
-
|
|
309
|
+
expHeight = this.expHeight;
|
|
309
310
|
|
|
310
311
|
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
311
|
-
ctxCanvas.draw(false,()=>{
|
|
312
|
+
ctxCanvas.draw(false, () => {
|
|
312
313
|
uni.canvasToTempFilePath({
|
|
313
314
|
x: 0,
|
|
314
315
|
y: 0,
|
|
@@ -319,13 +320,13 @@
|
|
|
319
320
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
320
321
|
fileType: 'png',
|
|
321
322
|
quality: this.qlty,
|
|
322
|
-
success: (r)=>{
|
|
323
|
+
success: (r) => {
|
|
323
324
|
r = r.tempFilePath;
|
|
324
|
-
this.btop(r).then((r)=> {
|
|
325
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
325
|
+
this.btop(r).then((r) => {
|
|
326
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
326
327
|
});
|
|
327
328
|
},
|
|
328
|
-
fail: ()=>{
|
|
329
|
+
fail: () => {
|
|
329
330
|
uni.showToast({
|
|
330
331
|
title: "error0",
|
|
331
332
|
duration: 2000,
|
|
@@ -334,15 +335,15 @@
|
|
|
334
335
|
});
|
|
335
336
|
});
|
|
336
337
|
} else {
|
|
337
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
338
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
338
339
|
}
|
|
339
340
|
})
|
|
340
341
|
// #endif
|
|
341
342
|
// #ifndef H5
|
|
342
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
343
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
343
344
|
// #endif
|
|
344
345
|
},
|
|
345
|
-
fail: (res)=>{
|
|
346
|
+
fail: (res) => {
|
|
346
347
|
uni.showToast({
|
|
347
348
|
title: "error1",
|
|
348
349
|
duration: 2000,
|
|
@@ -356,9 +357,9 @@
|
|
|
356
357
|
},
|
|
357
358
|
// 用户点击"预览"模式下的"确认"按钮时被调用,用于将预览的裁剪结果上传
|
|
358
359
|
prvUpload() {
|
|
359
|
-
if(this.fPrvUploading)
|
|
360
|
+
if (this.fPrvUploading) return;
|
|
360
361
|
this.fPrvUploading = true;
|
|
361
|
-
setTimeout(()=>{ this.fPrvUploading = false; }, 1000)
|
|
362
|
+
setTimeout(() => { this.fPrvUploading = false; }, 1000)
|
|
362
363
|
|
|
363
364
|
let style = this.selStyle,
|
|
364
365
|
destWidth = parseInt(style.width),
|
|
@@ -393,17 +394,17 @@
|
|
|
393
394
|
canvasId: 'prv-canvas-' + this.instanceId,
|
|
394
395
|
fileType: 'png',
|
|
395
396
|
quality: this.qlty,
|
|
396
|
-
success: (r)=>{
|
|
397
|
+
success: (r) => {
|
|
397
398
|
r = r.tempFilePath;
|
|
398
399
|
// #ifdef H5
|
|
399
|
-
this.btop(r).then((r)=> {
|
|
400
|
-
if(this.expWidth && this.expHeight) {
|
|
400
|
+
this.btop(r).then((r) => {
|
|
401
|
+
if (this.expWidth && this.expHeight) {
|
|
401
402
|
let ctxCanvas = this.ctxCanvas;
|
|
402
403
|
expWidth = this.expWidth,
|
|
403
|
-
|
|
404
|
+
expHeight = this.expHeight;
|
|
404
405
|
|
|
405
406
|
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
406
|
-
ctxCanvas.draw(false, ()=>{
|
|
407
|
+
ctxCanvas.draw(false, () => {
|
|
407
408
|
uni.canvasToTempFilePath({
|
|
408
409
|
x: 0,
|
|
409
410
|
y: 0,
|
|
@@ -414,13 +415,13 @@
|
|
|
414
415
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
415
416
|
fileType: 'png',
|
|
416
417
|
quality: this.qlty,
|
|
417
|
-
success: (r)=>{
|
|
418
|
+
success: (r) => {
|
|
418
419
|
r = r.tempFilePath;
|
|
419
|
-
this.btop(r).then((r)=> {
|
|
420
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
420
|
+
this.btop(r).then((r) => {
|
|
421
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
421
422
|
});
|
|
422
423
|
},
|
|
423
|
-
fail: ()=>{
|
|
424
|
+
fail: () => {
|
|
424
425
|
uni.showToast({
|
|
425
426
|
title: "error0",
|
|
426
427
|
duration: 2000,
|
|
@@ -429,15 +430,15 @@
|
|
|
429
430
|
});
|
|
430
431
|
});
|
|
431
432
|
} else {
|
|
432
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
433
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
433
434
|
}
|
|
434
435
|
})
|
|
435
436
|
// #endif
|
|
436
437
|
// #ifndef H5
|
|
437
|
-
this.$emit("confirm", {avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn});
|
|
438
|
+
this.$emit("confirm", { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
438
439
|
// #endif
|
|
439
440
|
},
|
|
440
|
-
fail: ()=>{
|
|
441
|
+
fail: () => {
|
|
441
442
|
uni.showToast({
|
|
442
443
|
title: "error_prv",
|
|
443
444
|
duration: 2000,
|
|
@@ -449,12 +450,12 @@
|
|
|
449
450
|
}
|
|
450
451
|
}, this);
|
|
451
452
|
},
|
|
452
|
-
drawInit(ini=false) {
|
|
453
|
+
drawInit(ini = false) {
|
|
453
454
|
let allWidth = this.windowWidth,
|
|
454
455
|
allHeight = this.windowHeight,
|
|
455
456
|
imgWidth = this.imgWidth,
|
|
456
457
|
imgHeight = this.imgHeight,
|
|
457
|
-
imgRadio = imgWidth/imgHeight,
|
|
458
|
+
imgRadio = imgWidth / imgHeight,
|
|
458
459
|
useWidth = allWidth - 40,
|
|
459
460
|
useHeight = allHeight - tabHeight - 80,
|
|
460
461
|
pixelRatio = this.pixelRatio,
|
|
@@ -465,13 +466,13 @@
|
|
|
465
466
|
this.fixHeight = 0;
|
|
466
467
|
this.lckWidth = 0;
|
|
467
468
|
this.lckHeight = 0;
|
|
468
|
-
switch(this.stc) {
|
|
469
|
+
switch (this.stc) {
|
|
469
470
|
case 'x': this.fixWidth = 1; break;
|
|
470
471
|
case 'y': this.fixHeight = 1; break;
|
|
471
|
-
case 'long': if(imgRadio > 1) this.fixWidth = 1; else this.fixHeight = 1; break;
|
|
472
|
-
case 'short': if(imgRadio > 1) this.fixHeight = 1; else this.fixWidth = 1; break;
|
|
473
|
-
case 'longSel': if(selWidth > selHeight) this.fixWidth = 1; else this.fixHeight = 1; break;
|
|
474
|
-
case 'shortSel': if(selWidth > selHeight) this.fixHeight = 1; else this.fixWidth = 1; break;
|
|
472
|
+
case 'long': if (imgRadio > 1) this.fixWidth = 1; else this.fixHeight = 1; break;
|
|
473
|
+
case 'short': if (imgRadio > 1) this.fixHeight = 1; else this.fixWidth = 1; break;
|
|
474
|
+
case 'longSel': if (selWidth > selHeight) this.fixWidth = 1; else this.fixHeight = 1; break;
|
|
475
|
+
case 'shortSel': if (selWidth > selHeight) this.fixHeight = 1; else this.fixWidth = 1; break;
|
|
475
476
|
}
|
|
476
477
|
// lck 用于控制裁剪框的宽度和高度锁定行为
|
|
477
478
|
// 'x': 锁定宽度,不允许水平方向调整
|
|
@@ -480,56 +481,56 @@
|
|
|
480
481
|
// 'short': 根据图片短边锁定,如果图片横向较长则锁定高度,否则锁定宽度
|
|
481
482
|
// 'longSel': 根据选择框的长边锁定,如果选择框宽度大于高度则锁定宽度,否则锁定高度
|
|
482
483
|
// 'shortSel': 根据选择框的短边锁定,如果选择框宽度大于高度则锁定高度,否则锁定宽度
|
|
483
|
-
switch(this.lck) {
|
|
484
|
+
switch (this.lck) {
|
|
484
485
|
case 'x': this.lckWidth = 1; break;
|
|
485
486
|
case 'y': this.lckHeight = 1; break;
|
|
486
|
-
case 'long': if(imgRadio > 1) this.lckWidth = 1; else this.lckHeight = 1; break;
|
|
487
|
-
case 'short': if(imgRadio > 1) this.lckHeight = 1; else this.lckWidth = 1; break;
|
|
488
|
-
case 'longSel': if(selWidth > selHeight) this.lckWidth = 1; else this.lckHeight = 1; break;
|
|
489
|
-
case 'shortSel': if(selWidth > selHeight) this.lckHeight = 1; else this.lckWidth = 1; break;
|
|
487
|
+
case 'long': if (imgRadio > 1) this.lckWidth = 1; else this.lckHeight = 1; break;
|
|
488
|
+
case 'short': if (imgRadio > 1) this.lckHeight = 1; else this.lckWidth = 1; break;
|
|
489
|
+
case 'longSel': if (selWidth > selHeight) this.lckWidth = 1; else this.lckHeight = 1; break;
|
|
490
|
+
case 'shortSel': if (selWidth > selHeight) this.lckHeight = 1; else this.lckWidth = 1; break;
|
|
490
491
|
}
|
|
491
|
-
if(
|
|
492
|
+
if (this.fixWidth) {
|
|
492
493
|
useWidth = selWidth;
|
|
493
|
-
useHeight = useWidth/imgRadio;
|
|
494
|
-
} else if(
|
|
494
|
+
useHeight = useWidth / imgRadio;
|
|
495
|
+
} else if (this.fixHeight) {
|
|
495
496
|
useHeight = selHeight;
|
|
496
|
-
useWidth = useHeight*imgRadio;
|
|
497
|
-
} else if(
|
|
498
|
-
if(
|
|
497
|
+
useWidth = useHeight * imgRadio;
|
|
498
|
+
} else if (imgRadio < 1) {
|
|
499
|
+
if (imgHeight < useHeight) {
|
|
499
500
|
useWidth = imgWidth;
|
|
500
501
|
useHeight = imgHeight;
|
|
501
502
|
} else {
|
|
502
503
|
useHeight = useHeight;
|
|
503
|
-
useWidth = useHeight*imgRadio;
|
|
504
|
+
useWidth = useHeight * imgRadio;
|
|
504
505
|
}
|
|
505
506
|
} else {
|
|
506
|
-
if(
|
|
507
|
+
if (imgWidth < useWidth) {
|
|
507
508
|
useWidth = imgWidth;
|
|
508
509
|
useHeight = imgHeight;
|
|
509
510
|
} else {
|
|
510
511
|
useWidth = useWidth;
|
|
511
|
-
useHeight = useWidth/imgRadio;
|
|
512
|
+
useHeight = useWidth / imgRadio;
|
|
512
513
|
}
|
|
513
514
|
}
|
|
514
|
-
if(
|
|
515
|
+
if (this.isin) {
|
|
515
516
|
this.scaleWidth = 0;
|
|
516
517
|
this.scaleHeight = 0;
|
|
517
|
-
if(useWidth < selWidth) {
|
|
518
|
+
if (useWidth < selWidth) {
|
|
518
519
|
useWidth = selWidth;
|
|
519
|
-
useHeight = useWidth/imgRadio;
|
|
520
|
+
useHeight = useWidth / imgRadio;
|
|
520
521
|
this.lckHeight = 0;
|
|
521
522
|
}
|
|
522
|
-
if(useHeight < selHeight) {
|
|
523
|
+
if (useHeight < selHeight) {
|
|
523
524
|
useHeight = selHeight;
|
|
524
|
-
useWidth = useHeight*imgRadio;
|
|
525
|
+
useWidth = useHeight * imgRadio;
|
|
525
526
|
this.lckWidth = 0;
|
|
526
527
|
}
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
this.scaleSize = 1;
|
|
530
531
|
this.rotateDeg = 0;
|
|
531
|
-
this.posWidth = (allWidth-useWidth)/2;
|
|
532
|
-
this.posHeight = (allHeight-useHeight-tabHeight)/2;
|
|
532
|
+
this.posWidth = (allWidth - useWidth) / 2;
|
|
533
|
+
this.posHeight = (allHeight - useHeight - tabHeight) / 2;
|
|
533
534
|
this.useWidth = useWidth;
|
|
534
535
|
this.useHeight = useHeight;
|
|
535
536
|
|
|
@@ -547,39 +548,39 @@
|
|
|
547
548
|
ctxCanvasOper.setStrokeStyle('grey');
|
|
548
549
|
ctxCanvasOper.setGlobalAlpha(0.4);
|
|
549
550
|
ctxCanvasOper.setFillStyle('black');
|
|
550
|
-
ctxCanvasOper.strokeRect(
|
|
551
|
+
ctxCanvasOper.strokeRect(left, top, width, height);
|
|
551
552
|
ctxCanvasOper.fillRect(0, 0, this.windowWidth, top);
|
|
552
553
|
ctxCanvasOper.fillRect(0, top, left, height);
|
|
553
|
-
ctxCanvasOper.fillRect(0, top+height, this.windowWidth, this.windowHeight-height-top-tabHeight);
|
|
554
|
-
ctxCanvasOper.fillRect(left+width, top,this.windowWidth-width-left, height);
|
|
554
|
+
ctxCanvasOper.fillRect(0, top + height, this.windowWidth, this.windowHeight - height - top - tabHeight);
|
|
555
|
+
ctxCanvasOper.fillRect(left + width, top, this.windowWidth - width - left, height);
|
|
555
556
|
ctxCanvasOper.setStrokeStyle('red');
|
|
556
|
-
ctxCanvasOper.moveTo(left+20, top);ctxCanvasOper.lineTo(left, top);ctxCanvasOper.lineTo(left, top+20);
|
|
557
|
-
ctxCanvasOper.moveTo(left+width-20, top);ctxCanvasOper.lineTo(left+width, top);ctxCanvasOper.lineTo(left+width, top+20);
|
|
558
|
-
ctxCanvasOper.moveTo(left+20, top+height);ctxCanvasOper.lineTo(left, top+height);ctxCanvasOper.lineTo(left, top+height-20);
|
|
559
|
-
ctxCanvasOper.moveTo(left+width-20, top+height);ctxCanvasOper.lineTo(left+width, top+height);ctxCanvasOper.lineTo(left+width, top+height-20);
|
|
560
|
-
|
|
557
|
+
ctxCanvasOper.moveTo(left + 20, top); ctxCanvasOper.lineTo(left, top); ctxCanvasOper.lineTo(left, top + 20);
|
|
558
|
+
ctxCanvasOper.moveTo(left + width - 20, top); ctxCanvasOper.lineTo(left + width, top); ctxCanvasOper.lineTo(left + width, top + 20);
|
|
559
|
+
ctxCanvasOper.moveTo(left + 20, top + height); ctxCanvasOper.lineTo(left, top + height); ctxCanvasOper.lineTo(left, top + height - 20);
|
|
560
|
+
ctxCanvasOper.moveTo(left + width - 20, top + height); ctxCanvasOper.lineTo(left + width, top + height); ctxCanvasOper.lineTo(left + width, top + height - 20);
|
|
561
|
+
|
|
561
562
|
// 绘制控制点(四个角)
|
|
562
563
|
const controlPointSize = 10;
|
|
563
564
|
ctxCanvasOper.setFillStyle('white');
|
|
564
565
|
ctxCanvasOper.setStrokeStyle('grey');
|
|
565
566
|
ctxCanvasOper.setLineWidth(1);
|
|
566
567
|
// 左上角
|
|
567
|
-
ctxCanvasOper.fillRect(left - controlPointSize/2, top - controlPointSize/2, controlPointSize, controlPointSize);
|
|
568
|
-
ctxCanvasOper.strokeRect(left - controlPointSize/2, top - controlPointSize/2, controlPointSize, controlPointSize);
|
|
568
|
+
ctxCanvasOper.fillRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
569
|
+
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
569
570
|
// 右上角
|
|
570
|
-
ctxCanvasOper.fillRect(left + width - controlPointSize/2, top - controlPointSize/2, controlPointSize, controlPointSize);
|
|
571
|
-
ctxCanvasOper.strokeRect(left + width - controlPointSize/2, top - controlPointSize/2, controlPointSize, controlPointSize);
|
|
571
|
+
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
572
|
+
ctxCanvasOper.strokeRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
572
573
|
// 左下角
|
|
573
|
-
ctxCanvasOper.fillRect(left - controlPointSize/2, top + height - controlPointSize/2, controlPointSize, controlPointSize);
|
|
574
|
-
ctxCanvasOper.strokeRect(left - controlPointSize/2, top + height - controlPointSize/2, controlPointSize, controlPointSize);
|
|
574
|
+
ctxCanvasOper.fillRect(left - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
575
|
+
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
575
576
|
// 右下角
|
|
576
|
-
ctxCanvasOper.fillRect(left + width - controlPointSize/2, top + height - controlPointSize/2, controlPointSize, controlPointSize);
|
|
577
|
-
ctxCanvasOper.strokeRect(left + width - controlPointSize/2, top + height - controlPointSize/2, controlPointSize, controlPointSize);
|
|
578
|
-
|
|
577
|
+
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
578
|
+
ctxCanvasOper.strokeRect(left + width - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
579
|
+
|
|
579
580
|
ctxCanvasOper.stroke();
|
|
580
581
|
|
|
581
|
-
ctxCanvasOper.draw(false, ()=>{
|
|
582
|
-
if(
|
|
582
|
+
ctxCanvasOper.draw(false, () => {
|
|
583
|
+
if (ini) {
|
|
583
584
|
this.styleDisplay = 'flex';
|
|
584
585
|
// #ifdef H5
|
|
585
586
|
this.styleTop = this.drawTop + 'px';
|
|
@@ -587,7 +588,9 @@
|
|
|
587
588
|
// #ifndef H5
|
|
588
589
|
this.styleTop = '0';
|
|
589
590
|
// #endif
|
|
590
|
-
|
|
591
|
+
if (this.fillColor && this.fillColor !== 'transparent') {
|
|
592
|
+
ctxCanvas.setFillStyle(this.fillColor);
|
|
593
|
+
}
|
|
591
594
|
this.drawImage();
|
|
592
595
|
}
|
|
593
596
|
});
|
|
@@ -596,14 +599,16 @@
|
|
|
596
599
|
},
|
|
597
600
|
drawImage() {
|
|
598
601
|
let tm_now = Date.now();
|
|
599
|
-
if(tm_now - this.drawTm < 20) return;
|
|
602
|
+
if (tm_now - this.drawTm < 20) return;
|
|
600
603
|
this.drawTm = tm_now;
|
|
601
604
|
let ctxCanvas = this.ctxCanvas;
|
|
602
|
-
|
|
603
|
-
|
|
605
|
+
if (this.fillColor && this.fillColor !== 'transparent') {
|
|
606
|
+
ctxCanvas.fillRect(0, 0, this.windowWidth, this.windowHeight - tabHeight);
|
|
607
|
+
}
|
|
608
|
+
ctxCanvas.translate(this.posWidth + this.useWidth / 2, this.posHeight + this.useHeight / 2);
|
|
604
609
|
ctxCanvas.scale(this.scaleSize, this.scaleSize);
|
|
605
|
-
ctxCanvas.rotate(this.rotateDeg * Math.PI/180);
|
|
606
|
-
ctxCanvas.drawImage(this.imgPath, -this.useWidth/2, -this.useHeight/2, this.useWidth, this.useHeight);
|
|
610
|
+
ctxCanvas.rotate(this.rotateDeg * Math.PI / 180);
|
|
611
|
+
ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
|
|
607
612
|
ctxCanvas.draw(false);
|
|
608
613
|
},
|
|
609
614
|
hideImg() {
|
|
@@ -614,16 +619,19 @@
|
|
|
614
619
|
this.target = null;
|
|
615
620
|
},
|
|
616
621
|
close() {
|
|
622
|
+
console.log('up-cropper close');
|
|
623
|
+
|
|
617
624
|
this.styleDisplay = 'none';
|
|
618
625
|
this.styleTop = '-10000px';
|
|
619
626
|
this.hasSel = false;
|
|
620
627
|
this.hideImg();
|
|
621
628
|
this.noBar || uni.showTabBar();
|
|
629
|
+
this.$emit('cancel');
|
|
622
630
|
},
|
|
623
631
|
preview() {
|
|
624
|
-
if(this.fPreviewing) return;
|
|
632
|
+
if (this.fPreviewing) return;
|
|
625
633
|
this.fPreviewing = true;
|
|
626
|
-
setTimeout(()=>{ this.fPreviewing = false; }, 1000);
|
|
634
|
+
setTimeout(() => { this.fPreviewing = false; }, 1000);
|
|
627
635
|
let style = this.selStyle,
|
|
628
636
|
x = parseInt(style.left),
|
|
629
637
|
y = parseInt(style.top),
|
|
@@ -640,7 +648,7 @@
|
|
|
640
648
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
641
649
|
fileType: 'png',
|
|
642
650
|
quality: this.qlty,
|
|
643
|
-
success: (r)=>{
|
|
651
|
+
success: (r) => {
|
|
644
652
|
// console.log(r)
|
|
645
653
|
this.prvImgTmp = r = r.tempFilePath;
|
|
646
654
|
|
|
@@ -651,40 +659,42 @@
|
|
|
651
659
|
prvHeight = parseInt(this.selStyle.height),
|
|
652
660
|
useWidth = prvX - 40,
|
|
653
661
|
useHeight = prvY - 80,
|
|
654
|
-
radio = useWidth/prvWidth,
|
|
655
|
-
rHeight = prvHeight*radio;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
662
|
+
radio = useWidth / prvWidth,
|
|
663
|
+
rHeight = prvHeight * radio;
|
|
664
|
+
if (rHeight < useHeight) {
|
|
665
|
+
prvWidth = useWidth;
|
|
666
|
+
prvHeight = rHeight;
|
|
667
|
+
} else {
|
|
668
|
+
radio = useHeight / prvHeight;
|
|
669
|
+
prvWidth *= radio;
|
|
670
|
+
prvHeight = useHeight;
|
|
671
|
+
}
|
|
672
|
+
if (this.fillColor && this.fillColor !== 'transparent') {
|
|
673
|
+
ctxCanvasPrv.setFillStyle(this.fillColor);
|
|
674
|
+
ctxCanvasPrv.fillRect(0, 0, prvX, prvY);
|
|
675
|
+
ctxCanvasPrv.fillRect(x, y, width, height);
|
|
676
|
+
}
|
|
677
|
+
this.prvX = prvX = (prvX - prvWidth) / 2;
|
|
678
|
+
this.prvY = prvY = (prvY - prvHeight) / 2;
|
|
669
679
|
this.prvWidth = prvWidth;
|
|
670
680
|
this.prvHeight = prvHeight;
|
|
671
681
|
ctxCanvasPrv.drawImage(r, prvX, prvY, prvWidth, prvHeight);
|
|
672
682
|
ctxCanvasPrv.draw(false, () => {
|
|
673
683
|
// #ifdef H5
|
|
674
|
-
this.btop(this.prvImgTmp).then((r)=> {
|
|
684
|
+
this.btop(this.prvImgTmp).then((r) => {
|
|
675
685
|
this.showOper = false;
|
|
676
686
|
this.prvTop = this.drawTop + 'px';
|
|
677
687
|
})
|
|
678
688
|
// #endif
|
|
679
689
|
// #ifndef H5
|
|
680
|
-
if(
|
|
690
|
+
if (this.platform != 'android') {
|
|
681
691
|
this.showOper = false;
|
|
682
692
|
}
|
|
683
693
|
this.prvTop = '0';
|
|
684
694
|
// #endif
|
|
685
695
|
});
|
|
686
696
|
},
|
|
687
|
-
fail: ()=>{
|
|
697
|
+
fail: () => {
|
|
688
698
|
uni.showToast({
|
|
689
699
|
title: "error2",
|
|
690
700
|
duration: 2000,
|
|
@@ -695,8 +705,8 @@
|
|
|
695
705
|
}
|
|
696
706
|
}, this);
|
|
697
707
|
},
|
|
698
|
-
chooseImage(index=undefined, params=undefined, data=undefined) {
|
|
699
|
-
if(params) {
|
|
708
|
+
chooseImage(index = undefined, params = undefined, data = undefined) {
|
|
709
|
+
if (params) {
|
|
700
710
|
console.log(params)
|
|
701
711
|
let areaWidth = params.areaWidth || this.areaWidth,
|
|
702
712
|
areaHeight = params.areaHeight || this.areaHeight,
|
|
@@ -711,10 +721,10 @@
|
|
|
711
721
|
stretch = params.stretch,
|
|
712
722
|
inner = params.inner,
|
|
713
723
|
lock = params.lock;
|
|
714
|
-
|
|
724
|
+
console.log('areaWidth', this.areaWidth)
|
|
715
725
|
|
|
716
|
-
expWidth && (this.expWidth = expWidth.indexOf('rpx') >= 0 ? parseInt(expWidth)*this.pxRatio : parseInt(expWidth));
|
|
717
|
-
expHeight && (this.expHeight = expHeight.indexOf('rpx') >= 0 ? parseInt(expHeight)*this.pxRatio : parseInt(expHeight));
|
|
726
|
+
expWidth && (this.expWidth = expWidth.indexOf('rpx') >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt(expWidth));
|
|
727
|
+
expHeight && (this.expHeight = expHeight.indexOf('rpx') >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt(expHeight));
|
|
718
728
|
this.letRotate = canRotate === false ? 0 : 1;
|
|
719
729
|
this.letScale = canScale === false ? 0 : 1;
|
|
720
730
|
// 设置是否允许调整裁剪框大小
|
|
@@ -725,7 +735,7 @@
|
|
|
725
735
|
this.stc = stretch;
|
|
726
736
|
this.isin = inner === true ? 1 : 0;
|
|
727
737
|
this.lck = lock;
|
|
728
|
-
if(this.isin) {
|
|
738
|
+
if (this.isin) {
|
|
729
739
|
this.btnWidth = '24%';
|
|
730
740
|
this.btnDsp = 'none';
|
|
731
741
|
} else {
|
|
@@ -733,13 +743,13 @@
|
|
|
733
743
|
this.btnDsp = 'flex';
|
|
734
744
|
}
|
|
735
745
|
|
|
736
|
-
if(
|
|
737
|
-
areaWidth
|
|
738
|
-
areaHeight = areaHeight.indexOf('rpx') >= 0 ? parseInt(areaHeight) * this.pxRatio: parseInt(areaHeight);
|
|
746
|
+
if (areaWidth && areaHeight) {
|
|
747
|
+
areaWidth = areaWidth.indexOf('rpx') >= 0 ? parseInt(areaWidth) * this.pxRatio : parseInt(areaWidth);
|
|
748
|
+
areaHeight = areaHeight.indexOf('rpx') >= 0 ? parseInt(areaHeight) * this.pxRatio : parseInt(areaHeight);
|
|
739
749
|
this.selStyle.width = areaWidth + 'px';
|
|
740
750
|
this.selStyle.height = areaHeight + 'px';
|
|
741
|
-
this.selStyle.top = (this.windowHeight - areaHeight - tabHeight)/2 + 'px';
|
|
742
|
-
this.selStyle.left = (this.windowWidth - areaWidth)/2 + 'px';
|
|
751
|
+
this.selStyle.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
752
|
+
this.selStyle.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
743
753
|
// console.log(this.selStyle);
|
|
744
754
|
this.hasSel = true;
|
|
745
755
|
}
|
|
@@ -750,27 +760,27 @@
|
|
|
750
760
|
},
|
|
751
761
|
rotate() {
|
|
752
762
|
// #ifdef APP-PLUS
|
|
753
|
-
if(this.platform === 'android') {
|
|
754
|
-
if(this.fRotateing) return;
|
|
763
|
+
if (this.platform === 'android') {
|
|
764
|
+
if (this.fRotateing) return;
|
|
755
765
|
this.fRotateing = true;
|
|
756
|
-
setTimeout(()=>{ this.fRotateing = false; }, 500);
|
|
766
|
+
setTimeout(() => { this.fRotateing = false; }, 500);
|
|
757
767
|
}
|
|
758
768
|
// #endif
|
|
759
769
|
|
|
760
770
|
// if(this.letRotate) {
|
|
761
|
-
|
|
762
|
-
|
|
771
|
+
this.rotateDeg += 90 - this.rotateDeg % 90;
|
|
772
|
+
this.drawImage();
|
|
763
773
|
// }
|
|
764
774
|
},
|
|
765
775
|
start(e) {
|
|
766
776
|
let touches = e.touches,
|
|
767
|
-
|
|
768
|
-
|
|
777
|
+
touch0 = touches[0],
|
|
778
|
+
touch1 = touches[1];
|
|
769
779
|
|
|
770
780
|
this.touch0 = touch0;
|
|
771
781
|
this.touch1 = touch1;
|
|
772
782
|
|
|
773
|
-
if(
|
|
783
|
+
if (touch1) {
|
|
774
784
|
let x = touch1.x - touch0.x,
|
|
775
785
|
y = touch1.y - touch0.y;
|
|
776
786
|
this.fgDistance = Math.sqrt(x * x + y * y);
|
|
@@ -786,7 +796,7 @@
|
|
|
786
796
|
const top = parseInt(style.top);
|
|
787
797
|
const width = parseInt(style.width);
|
|
788
798
|
const height = parseInt(style.height);
|
|
789
|
-
|
|
799
|
+
|
|
790
800
|
// 检查四个控制点
|
|
791
801
|
if (Math.abs(x - left) < controlPointSize && Math.abs(y - top) < controlPointSize) {
|
|
792
802
|
this.resizeHandle = 'top-left';
|
|
@@ -809,57 +819,57 @@
|
|
|
809
819
|
touch0 = touches[0],
|
|
810
820
|
touch1 = touches[1];
|
|
811
821
|
|
|
812
|
-
if(
|
|
822
|
+
if (touch1) {
|
|
813
823
|
let x = touch1.x - touch0.x,
|
|
814
824
|
y = touch1.y - touch0.y,
|
|
815
825
|
fgDistance = Math.sqrt(x * x + y * y),
|
|
816
826
|
scaleSize = 0.005 * (fgDistance - this.fgDistance),
|
|
817
827
|
beScaleSize = this.scaleSize + scaleSize;
|
|
818
828
|
|
|
819
|
-
do
|
|
820
|
-
if(
|
|
821
|
-
if(
|
|
822
|
-
if(
|
|
823
|
-
if(this.isin) {
|
|
824
|
-
let
|
|
825
|
-
imgHeight = this.useHeight*beScaleSize,
|
|
826
|
-
rx0 = this.posWidth+this.useWidth/2,
|
|
827
|
-
ry0 = this.posHeight+this.useHeight/2,
|
|
828
|
-
l = rx0-imgWidth/2, t = ry0-imgHeight/2,
|
|
829
|
-
r = l+imgWidth,
|
|
829
|
+
do {
|
|
830
|
+
if (!this.letScale) break;
|
|
831
|
+
if (beScaleSize < this.mnScale) break;
|
|
832
|
+
if (beScaleSize > this.mxScale) break;
|
|
833
|
+
if (this.isin) {
|
|
834
|
+
let imgWidth = this.useWidth * beScaleSize,
|
|
835
|
+
imgHeight = this.useHeight * beScaleSize,
|
|
836
|
+
rx0 = this.posWidth + this.useWidth / 2,
|
|
837
|
+
ry0 = this.posHeight + this.useHeight / 2,
|
|
838
|
+
l = rx0 - imgWidth / 2, t = ry0 - imgHeight / 2,
|
|
839
|
+
r = l + imgWidth, b = t + imgHeight,
|
|
830
840
|
left = parseInt(this.selStyle.left),
|
|
831
841
|
top = parseInt(this.selStyle.top),
|
|
832
842
|
width = parseInt(this.selStyle.width),
|
|
833
843
|
height = parseInt(this.selStyle.height);
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
844
|
+
if (left < l || left + width > r || top < t || top + height > b) break;
|
|
845
|
+
this.scaleWidth = (this.useWidth - imgWidth) / 2;
|
|
846
|
+
this.scaleHeight = (this.useHeight - imgHeight) / 2;
|
|
837
847
|
}
|
|
838
848
|
|
|
839
849
|
this.scaleSize = beScaleSize;
|
|
840
|
-
} while(0);
|
|
850
|
+
} while (0);
|
|
841
851
|
this.fgDistance = fgDistance;
|
|
842
852
|
|
|
843
|
-
if(touch1.x !== touch0.x && this.letRotate) {
|
|
844
|
-
x = (this.touch1.y - this.touch0.y)/(this.touch1.x - this.touch0.x);
|
|
845
|
-
y = (touch1.y - touch0.y)/(touch1.x - touch0.x);
|
|
846
|
-
this.rotateDeg += Math.atan((y-x)/(1+x*y)) * 180/Math.PI;
|
|
853
|
+
if (touch1.x !== touch0.x && this.letRotate) {
|
|
854
|
+
x = (this.touch1.y - this.touch0.y) / (this.touch1.x - this.touch0.x);
|
|
855
|
+
y = (touch1.y - touch0.y) / (touch1.x - touch0.x);
|
|
856
|
+
this.rotateDeg += Math.atan((y - x) / (1 + x * y)) * 180 / Math.PI;
|
|
847
857
|
this.touch0 = touch0;
|
|
848
858
|
this.touch1 = touch1;
|
|
849
859
|
}
|
|
850
860
|
|
|
851
861
|
this.drawImage();
|
|
852
|
-
} else if(
|
|
862
|
+
} else if (this.touch0) {
|
|
853
863
|
// 只有在允许调整大小时才处理裁剪框大小调整
|
|
854
864
|
if (this.resizeHandle && this.letChangeSize) {
|
|
855
|
-
const style = {...this.selStyle};
|
|
865
|
+
const style = { ...this.selStyle };
|
|
856
866
|
const left = parseInt(style.left);
|
|
857
867
|
const top = parseInt(style.top);
|
|
858
868
|
const width = parseInt(style.width);
|
|
859
869
|
const height = parseInt(style.height);
|
|
860
870
|
const minWidth = 50;
|
|
861
871
|
const minHeight = 50;
|
|
862
|
-
|
|
872
|
+
|
|
863
873
|
switch (this.resizeHandle) {
|
|
864
874
|
case 'top-left':
|
|
865
875
|
style.left = touch0.x + 'px';
|
|
@@ -882,11 +892,11 @@
|
|
|
882
892
|
style.height = (touch0.y - top) + 'px';
|
|
883
893
|
break;
|
|
884
894
|
}
|
|
885
|
-
|
|
895
|
+
|
|
886
896
|
// 确保最小尺寸
|
|
887
897
|
if (parseInt(style.width) >= minWidth && parseInt(style.height) >= minHeight) {
|
|
888
898
|
// 确保裁剪框不超出屏幕边界
|
|
889
|
-
if (parseInt(style.left) >= 0 &&
|
|
899
|
+
if (parseInt(style.left) >= 0 &&
|
|
890
900
|
parseInt(style.top) >= 0 &&
|
|
891
901
|
(parseInt(style.left) + parseInt(style.width)) <= this.windowWidth &&
|
|
892
902
|
(parseInt(style.top) + parseInt(style.height)) <= (this.windowHeight - tabHeight)) {
|
|
@@ -901,38 +911,38 @@
|
|
|
901
911
|
y = touch0.y - this.touch0.y,
|
|
902
912
|
beX = this.posWidth + x,
|
|
903
913
|
beY = this.posHeight + y;
|
|
904
|
-
if(this.isin) {
|
|
905
|
-
let
|
|
906
|
-
imgHeight = this.useHeight*this.scaleSize,
|
|
907
|
-
rx0 = beX+this.useWidth/2,
|
|
908
|
-
ry0 = beY+this.useHeight/2,
|
|
909
|
-
l = rx0-imgWidth/2, t = ry0-imgHeight/2,
|
|
910
|
-
r = l+imgWidth,
|
|
914
|
+
if (this.isin) {
|
|
915
|
+
let imgWidth = this.useWidth * this.scaleSize,
|
|
916
|
+
imgHeight = this.useHeight * this.scaleSize,
|
|
917
|
+
rx0 = beX + this.useWidth / 2,
|
|
918
|
+
ry0 = beY + this.useHeight / 2,
|
|
919
|
+
l = rx0 - imgWidth / 2, t = ry0 - imgHeight / 2,
|
|
920
|
+
r = l + imgWidth, b = t + imgHeight,
|
|
911
921
|
left = parseInt(this.selStyle.left),
|
|
912
922
|
top = parseInt(this.selStyle.top),
|
|
913
923
|
width = parseInt(this.selStyle.width),
|
|
914
924
|
height = parseInt(this.selStyle.height);
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
925
|
+
if (!this.lckWidth && Math.abs(x) < 100) {
|
|
926
|
+
if (left >= l && left + width <= r) {
|
|
927
|
+
this.posWidth = beX;
|
|
928
|
+
} else if (left < l) {
|
|
929
|
+
this.posWidth = left - this.scaleWidth;
|
|
930
|
+
} else if (left + width > r) {
|
|
931
|
+
this.posWidth = left - (imgWidth - width) - this.scaleWidth;
|
|
923
932
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
933
|
+
}
|
|
934
|
+
if (!this.lckHeight && Math.abs(y) < 100) {
|
|
935
|
+
if (top >= t && top + height <= b) {
|
|
936
|
+
this.posHeight = beY;
|
|
937
|
+
} else if (top < t) {
|
|
938
|
+
this.posHeight = top - this.scaleHeight;
|
|
939
|
+
} else if (top + height > b) {
|
|
940
|
+
this.posHeight = top - (imgHeight - height) - this.scaleHeight;
|
|
932
941
|
}
|
|
942
|
+
}
|
|
933
943
|
} else {
|
|
934
|
-
if(
|
|
935
|
-
if(
|
|
944
|
+
if (Math.abs(x) < 100 && !this.lckWidth) this.posWidth = beX;
|
|
945
|
+
if (Math.abs(y) < 100 && !this.lckHeight) this.posHeight = beY;
|
|
936
946
|
}
|
|
937
947
|
|
|
938
948
|
this.touch0 = touch0;
|
|
@@ -944,7 +954,7 @@
|
|
|
944
954
|
let touches = e.touches,
|
|
945
955
|
touch0 = touches && touches[0],
|
|
946
956
|
touch1 = touches && touches[1];
|
|
947
|
-
if(touch0) {
|
|
957
|
+
if (touch0) {
|
|
948
958
|
this.touch0 = touch0;
|
|
949
959
|
} else {
|
|
950
960
|
this.touch0 = null;
|
|
@@ -953,7 +963,7 @@
|
|
|
953
963
|
}
|
|
954
964
|
},
|
|
955
965
|
getImgData() {
|
|
956
|
-
return new Promise((resolve, reject)=>{
|
|
966
|
+
return new Promise((resolve, reject) => {
|
|
957
967
|
let prvX = this.prvX,
|
|
958
968
|
prvY = this.prvY,
|
|
959
969
|
prvWidth = this.prvWidth,
|
|
@@ -981,13 +991,13 @@
|
|
|
981
991
|
},
|
|
982
992
|
async colorChange(e) {
|
|
983
993
|
let tm_now = Date.now();
|
|
984
|
-
if(tm_now - this.prvTm < 100) return;
|
|
994
|
+
if (tm_now - this.prvTm < 100) return;
|
|
985
995
|
this.prvTm = tm_now;
|
|
986
996
|
|
|
987
997
|
uni.showLoading({ mask: true });
|
|
988
998
|
|
|
989
|
-
if(
|
|
990
|
-
if(
|
|
999
|
+
if (!this.prvImgData) {
|
|
1000
|
+
if (!(this.prvImgData = await this.getImgData().catch((res) => {
|
|
991
1001
|
uni.showToast({
|
|
992
1002
|
title: "error_read",
|
|
993
1003
|
duration: 2000,
|
|
@@ -999,88 +1009,88 @@
|
|
|
999
1009
|
let data = this.prvImgData,
|
|
1000
1010
|
target = this.target,
|
|
1001
1011
|
i = e.detail.value,
|
|
1002
|
-
r,g,b,a,h,s,l,d,p,q,t,min,max,hK,tR,tG,tB;
|
|
1012
|
+
r, g, b, a, h, s, l, d, p, q, t, min, max, hK, tR, tG, tB;
|
|
1003
1013
|
|
|
1004
|
-
if(
|
|
1014
|
+
if (i === 0) {
|
|
1005
1015
|
target = data;
|
|
1006
1016
|
} else {
|
|
1007
|
-
i = (i+100)/200;
|
|
1008
|
-
if(
|
|
1009
|
-
if(
|
|
1010
|
-
for(
|
|
1011
|
-
r = data[n-3] / 255;
|
|
1012
|
-
g = data[n-2] / 255;
|
|
1013
|
-
b = data[n-1] / 255;
|
|
1014
|
-
max = Math.max(r,g,b);
|
|
1015
|
-
min = Math.min(r,g,b);
|
|
1016
|
-
d = max-min;
|
|
1017
|
-
if (
|
|
1018
|
-
h = 0
|
|
1019
|
-
}else if(
|
|
1020
|
-
h = 60*
|
|
1021
|
-
}else if(
|
|
1022
|
-
h = 60*
|
|
1023
|
-
}else if(
|
|
1024
|
-
h = 60*
|
|
1025
|
-
}else if(
|
|
1026
|
-
h = 60*
|
|
1017
|
+
i = (i + 100) / 200;
|
|
1018
|
+
if (i < 0.005) i = 0;
|
|
1019
|
+
if (i > 0.995) i = 1;
|
|
1020
|
+
for (let n = data.length - 1; n >= 0; n -= 4) {
|
|
1021
|
+
r = data[n - 3] / 255;
|
|
1022
|
+
g = data[n - 2] / 255;
|
|
1023
|
+
b = data[n - 1] / 255;
|
|
1024
|
+
max = Math.max(r, g, b);
|
|
1025
|
+
min = Math.min(r, g, b);
|
|
1026
|
+
d = max - min;
|
|
1027
|
+
if (max === min) {
|
|
1028
|
+
h = 0;
|
|
1029
|
+
} else if (max === r && g >= b) {
|
|
1030
|
+
h = 60 * ((g - b) / d);
|
|
1031
|
+
} else if (max === r && g < b) {
|
|
1032
|
+
h = 60 * ((g - b) / d) + 360;
|
|
1033
|
+
} else if (max === g) {
|
|
1034
|
+
h = 60 * ((b - r) / d) + 120;
|
|
1035
|
+
} else if (max === b) {
|
|
1036
|
+
h = 60 * ((r - g) / d) + 240;
|
|
1027
1037
|
}
|
|
1028
|
-
l = (max+min)/2
|
|
1029
|
-
if (
|
|
1030
|
-
s = 0
|
|
1031
|
-
}else if(
|
|
1032
|
-
s = d/(2*l)
|
|
1033
|
-
}else if(
|
|
1034
|
-
s = d/(2-2*l)
|
|
1038
|
+
l = (max + min) / 2;
|
|
1039
|
+
if (l === 0 || max === min) {
|
|
1040
|
+
s = 0;
|
|
1041
|
+
} else if (0 < l && l <= 0.5) {
|
|
1042
|
+
s = d / (2 * l);
|
|
1043
|
+
} else if (l > 0.5) {
|
|
1044
|
+
s = d / (2 - 2 * l);
|
|
1035
1045
|
}
|
|
1036
1046
|
data[n] && (a = data[n]);
|
|
1037
1047
|
|
|
1038
|
-
if (
|
|
1039
|
-
s = s*i/0.5
|
|
1040
|
-
}else if (
|
|
1041
|
-
s = 2*s + 2*i - (s*i/0.5) - 1
|
|
1048
|
+
if (i < 0.5) {
|
|
1049
|
+
s = s * i / 0.5;
|
|
1050
|
+
} else if (i > 0.5) {
|
|
1051
|
+
s = 2 * s + 2 * i - (s * i / 0.5) - 1;
|
|
1042
1052
|
}
|
|
1043
1053
|
|
|
1044
|
-
if (
|
|
1045
|
-
r = g = b = Math.round(
|
|
1046
|
-
}else{
|
|
1047
|
-
if (
|
|
1048
|
-
q = l * (
|
|
1049
|
-
}else if(
|
|
1050
|
-
q = l + s - (
|
|
1054
|
+
if (s === 0) {
|
|
1055
|
+
r = g = b = Math.round(l * 255);
|
|
1056
|
+
} else {
|
|
1057
|
+
if (l < 0.5) {
|
|
1058
|
+
q = l * (1 + s);
|
|
1059
|
+
} else if (l >= 0.5) {
|
|
1060
|
+
q = l + s - (l * s);
|
|
1051
1061
|
}
|
|
1052
|
-
p = 2*l-q
|
|
1053
|
-
hK = h/360
|
|
1054
|
-
tR = hK + 1/3
|
|
1055
|
-
tG = hK
|
|
1056
|
-
tB = hK - 1/3
|
|
1057
|
-
let correctRGB = (t)=>{
|
|
1058
|
-
if(
|
|
1059
|
-
return t + 1.0
|
|
1062
|
+
p = 2 * l - q;
|
|
1063
|
+
hK = h / 360;
|
|
1064
|
+
tR = hK + 1 / 3;
|
|
1065
|
+
tG = hK;
|
|
1066
|
+
tB = hK - 1 / 3;
|
|
1067
|
+
let correctRGB = (t) => {
|
|
1068
|
+
if (t < 0) {
|
|
1069
|
+
return t + 1.0;
|
|
1060
1070
|
}
|
|
1061
|
-
if(
|
|
1062
|
-
return t - 1.0
|
|
1071
|
+
if (t > 1) {
|
|
1072
|
+
return t - 1.0;
|
|
1063
1073
|
}
|
|
1064
|
-
return t
|
|
1065
|
-
}
|
|
1066
|
-
let createRGB = (t)=>{
|
|
1067
|
-
if (
|
|
1068
|
-
return p+((q-p)*6*t)
|
|
1069
|
-
}else if(
|
|
1070
|
-
return q
|
|
1071
|
-
}else if(
|
|
1072
|
-
return p+((q-p)*6*((2/3)-t))
|
|
1074
|
+
return t;
|
|
1075
|
+
};
|
|
1076
|
+
let createRGB = (t) => {
|
|
1077
|
+
if (t < (1 / 6)) {
|
|
1078
|
+
return p + ((q - p) * 6 * t);
|
|
1079
|
+
} else if (t >= (1 / 6) && t < (1 / 2)) {
|
|
1080
|
+
return q;
|
|
1081
|
+
} else if (t >= (1 / 2) && t < (2 / 3)) {
|
|
1082
|
+
return p + ((q - p) * 6 * ((2 / 3) - t));
|
|
1073
1083
|
}
|
|
1074
|
-
return p
|
|
1075
|
-
}
|
|
1076
|
-
r = tR = Math.round(
|
|
1077
|
-
g = tG = Math.round(
|
|
1078
|
-
b = tB = Math.round(
|
|
1084
|
+
return p;
|
|
1085
|
+
};
|
|
1086
|
+
r = tR = Math.round(createRGB(correctRGB(tR)) * 255);
|
|
1087
|
+
g = tG = Math.round(createRGB(correctRGB(tG)) * 255);
|
|
1088
|
+
b = tB = Math.round(createRGB(correctRGB(tB)) * 255);
|
|
1079
1089
|
}
|
|
1080
|
-
a && (
|
|
1081
|
-
target[n-3] = r;
|
|
1082
|
-
target[n-2] = g;
|
|
1083
|
-
target[n-1] = b;
|
|
1090
|
+
a && (target[n] = a);
|
|
1091
|
+
target[n - 3] = r;
|
|
1092
|
+
target[n - 2] = g;
|
|
1093
|
+
target[n - 1] = b;
|
|
1084
1094
|
}
|
|
1085
1095
|
}
|
|
1086
1096
|
let prvX = this.prvX,
|
|
@@ -1088,8 +1098,10 @@
|
|
|
1088
1098
|
prvWidth = this.prvWidth,
|
|
1089
1099
|
prvHeight = this.prvHeight;
|
|
1090
1100
|
|
|
1091
|
-
this.
|
|
1092
|
-
|
|
1101
|
+
if (this.fillColor && this.fillColor !== 'transparent') {
|
|
1102
|
+
this.ctxCanvasPrv.setFillStyle(this.fillColor);
|
|
1103
|
+
this.ctxCanvasPrv.fillRect(prvX, prvY, prvWidth, prvHeight);
|
|
1104
|
+
}
|
|
1093
1105
|
this.ctxCanvasPrv.draw(true);
|
|
1094
1106
|
|
|
1095
1107
|
// #ifdef APP-PLUS||H5
|
|
@@ -1117,7 +1129,7 @@
|
|
|
1117
1129
|
}, this);
|
|
1118
1130
|
},
|
|
1119
1131
|
btop(base64) {
|
|
1120
|
-
return new Promise(function(resolve, reject) {
|
|
1132
|
+
return new Promise(function (resolve, reject) {
|
|
1121
1133
|
var arr = base64.split(','),
|
|
1122
1134
|
mime = arr[0].match(/:(.*?);/)[1],
|
|
1123
1135
|
bstr = atob(arr[1]),
|
|
@@ -1134,98 +1146,108 @@
|
|
|
1134
1146
|
</script>
|
|
1135
1147
|
|
|
1136
1148
|
<style lang="scss" scoped>
|
|
1137
|
-
.u-cropper {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1149
|
+
.u-cropper {
|
|
1150
|
+
.my-canvas {
|
|
1151
|
+
display: flex;
|
|
1152
|
+
position: fixed !important;
|
|
1153
|
+
background: #000000;
|
|
1154
|
+
left: 0;
|
|
1155
|
+
z-index: 100000;
|
|
1156
|
+
width: 100%;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
.my-avatar {
|
|
1160
|
+
width: 150rpx;
|
|
1161
|
+
height: 150rpx;
|
|
1162
|
+
border-radius: 100%;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
.oper-canvas {
|
|
1166
|
+
display: flex;
|
|
1167
|
+
position: fixed !important;
|
|
1168
|
+
left: 0;
|
|
1169
|
+
z-index: 100001;
|
|
1170
|
+
width: 100%;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
.prv-canvas {
|
|
1174
|
+
display: flex;
|
|
1175
|
+
position: fixed !important;
|
|
1176
|
+
background: #000000;
|
|
1177
|
+
left: 0;
|
|
1178
|
+
z-index: 200000;
|
|
1179
|
+
width: 100%;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
.oper-wrapper {
|
|
1183
|
+
height: 50px;
|
|
1184
|
+
position: fixed !important;
|
|
1185
|
+
box-sizing: border-box;
|
|
1186
|
+
border: 1px solid #F1F1F1;
|
|
1187
|
+
background: #ffffff;
|
|
1188
|
+
width: 100%;
|
|
1189
|
+
left: 0;
|
|
1190
|
+
bottom: 0;
|
|
1191
|
+
z-index: 100009;
|
|
1192
|
+
flex-direction: row;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
.oper {
|
|
1196
|
+
display: flex;
|
|
1197
|
+
flex-direction: column;
|
|
1198
|
+
justify-content: center;
|
|
1199
|
+
padding: 10rpx 20rpx;
|
|
1200
|
+
width: 100%;
|
|
1201
|
+
height: 100%;
|
|
1202
|
+
box-sizing: border-box;
|
|
1203
|
+
align-self: center;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.btn-wrapper {
|
|
1207
|
+
display: flex;
|
|
1208
|
+
flex-direction: row;
|
|
1209
|
+
/* #ifndef H5 */
|
|
1210
|
+
flex-grow: 1;
|
|
1211
|
+
/* #endif */
|
|
1212
|
+
/* #ifdef H5 */
|
|
1213
|
+
height: 50px;
|
|
1214
|
+
/* #endif */
|
|
1215
|
+
justify-content: space-between;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
.btn-wrapper view {
|
|
1219
|
+
display: flex;
|
|
1220
|
+
align-items: center;
|
|
1221
|
+
justify-content: center;
|
|
1222
|
+
font-size: 16px;
|
|
1223
|
+
color: #333;
|
|
1224
|
+
border: 1px solid #f1f1f1;
|
|
1225
|
+
border-radius: 6%;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
.hover {
|
|
1229
|
+
background: #f1f1f1;
|
|
1230
|
+
border-radius: 6%;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
.clr-wrapper {
|
|
1234
|
+
display: flex;
|
|
1235
|
+
flex-direction: row;
|
|
1236
|
+
flex-grow: 1;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
.clr-wrapper view {
|
|
1240
|
+
display: flex;
|
|
1241
|
+
align-items: center;
|
|
1242
|
+
justify-content: center;
|
|
1243
|
+
font-size: 16px;
|
|
1244
|
+
color: #333;
|
|
1245
|
+
border: 1px solid #f1f1f1;
|
|
1246
|
+
border-radius: 6%;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.my-slider {
|
|
1250
|
+
flex-grow: 1;
|
|
1251
|
+
}
|
|
1228
1252
|
}
|
|
1229
|
-
}
|
|
1230
1253
|
</style>
|
|
1231
|
-
|