Compare commits
2 Commits
f071a4c7ee
...
99336d1128
Author | SHA1 | Date |
---|---|---|
|
99336d1128 | |
|
7e60c279d2 |
|
@ -15,7 +15,7 @@
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<view @click="toggle()">
|
<view @click="toggle()">
|
||||||
<jp-cropper-watermark :watermarkType="1" mode="ratio" :width="300" :height="500" :maxWidth="1080" :maxHeight="1920" :url="url" @cancel="oncancel" @ok="onok"></jp-cropper-watermark>
|
<jp-cropper-watermark :watermarkType="1" mode="ratio" :width="530" :height="750" :handleWH="false" :maxWidth="1080" :maxHeight="1920" :url="url" @cancel="oncancel" @ok="onok"></jp-cropper-watermark>
|
||||||
<image src="../../static/logo.png" v-if="avatar==null" mode=""
|
<image src="../../static/logo.png" v-if="avatar==null" mode=""
|
||||||
style="width: 111rpx;height: 111rpx;border-radius: 50%;"></image>
|
style="width: 111rpx;height: 111rpx;border-radius: 50%;"></image>
|
||||||
<image v-else :src="avatar" mode="" style="width: 111rpx;height: 111rpx;border-radius: 50%;">
|
<image v-else :src="avatar" mode="" style="width: 111rpx;height: 111rpx;border-radius: 50%;">
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
* @property {String} url 图片路径
|
* @property {String} url 图片路径
|
||||||
* @property {Number} width 宽度
|
* @property {Number} width 宽度
|
||||||
* @property {Number} height 高度
|
* @property {Number} height 高度
|
||||||
|
* @property {boolean} handleWH 是否对宽高进行逻辑处理 false:宽高传多少用多少
|
||||||
* @property {Number} maxWidth 最大宽带
|
* @property {Number} maxWidth 最大宽带
|
||||||
* @property {Number} minHeight 最大高度
|
* @property {Number} minHeight 最大高度
|
||||||
*/
|
*/
|
||||||
|
@ -66,6 +67,10 @@ export default {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 200
|
default: 200
|
||||||
},
|
},
|
||||||
|
handleWH: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
maxWidth: {
|
maxWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1024
|
default: 1024
|
||||||
|
@ -351,6 +356,7 @@ export default {
|
||||||
destWidth: mx.tw,
|
destWidth: mx.tw,
|
||||||
destHeight: mx.th,
|
destHeight: mx.th,
|
||||||
success: (rst) => {
|
success: (rst) => {
|
||||||
|
console.log(rst)
|
||||||
var path = rst.tempFilePath;
|
var path = rst.tempFilePath;
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
var base64 = path;
|
var base64 = path;
|
||||||
|
@ -470,16 +476,16 @@ export default {
|
||||||
if (this.rotate % 180 != 0) {
|
if (this.rotate % 180 != 0) {
|
||||||
mul = this.image.height / this.real.width;
|
mul = this.image.height / this.real.width;
|
||||||
}
|
}
|
||||||
if (this.mode != "fixed") {
|
if (this.mode != "fixed" && this.handleWH) {
|
||||||
width = this.frame.width / mul;
|
width = this.frame.width / mul;
|
||||||
height = this.frame.height / mul;
|
height = this.frame.height / mul;
|
||||||
}
|
}
|
||||||
var rate = width / height;
|
var rate = width / height;
|
||||||
if (width > this.maxWidth) {
|
if (width > this.maxWidth && this.handleWH) {
|
||||||
width = this.maxWidth;
|
width = this.maxWidth;
|
||||||
height = width / rate;
|
height = width / rate;
|
||||||
}
|
}
|
||||||
if (height > this.maxHeight) {
|
if (height > this.maxHeight && this.handleWH) {
|
||||||
height = this.maxHeight;
|
height = this.maxHeight;
|
||||||
width = height * rate;
|
width = height * rate;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue