|
@@ -470,14 +470,16 @@ var app = new Vue({
|
|
|
$("body").css('overflowY','hidden');
|
|
$("body").css('overflowY','hidden');
|
|
|
// $("#cropImg").remove();
|
|
// $("#cropImg").remove();
|
|
|
$(".crop-img").html('<img id="cropImg" src="" alt="" off="">');
|
|
$(".crop-img").html('<img id="cropImg" src="" alt="" off="">');
|
|
|
- var iWidth = $(".crop-img").outerWidth();
|
|
|
|
|
|
|
+ var iWidth = $("body").outerWidth();
|
|
|
var iHeight = $(".crop-img").outerHeight();
|
|
var iHeight = $(".crop-img").outerHeight();
|
|
|
|
|
+ iHeight = iHeight? iHeight : $("body").outerHeight()-130;
|
|
|
if(id>=0){
|
|
if(id>=0){
|
|
|
$("#cropImg").attr('src', _this.cropParams.old_url);
|
|
$("#cropImg").attr('src', _this.cropParams.old_url);
|
|
|
}else{
|
|
}else{
|
|
|
$("#cropImg").attr('src', _this.cropParams.url);
|
|
$("#cropImg").attr('src', _this.cropParams.url);
|
|
|
}
|
|
}
|
|
|
$image = $("#cropImg");
|
|
$image = $("#cropImg");
|
|
|
|
|
+ console.log(iWidth+'++'+iHeight);
|
|
|
var cropWidth = $('body').width();
|
|
var cropWidth = $('body').width();
|
|
|
$("#cropBox").popup();
|
|
$("#cropBox").popup();
|
|
|
_this.options = {
|
|
_this.options = {
|
|
@@ -524,8 +526,8 @@ var app = new Vue({
|
|
|
var height = data.height;
|
|
var height = data.height;
|
|
|
}
|
|
}
|
|
|
_this.cropParams.cropData = {
|
|
_this.cropParams.cropData = {
|
|
|
- width: iWidth*30,
|
|
|
|
|
- height: iHeight*30,
|
|
|
|
|
|
|
+ width: iWidth*10,
|
|
|
|
|
+ height: iHeight*10,
|
|
|
rotate: data.rotate,
|
|
rotate: data.rotate,
|
|
|
imageSmoothingQuality: 'high',
|
|
imageSmoothingQuality: 'high',
|
|
|
fillColor: '#fff',
|
|
fillColor: '#fff',
|
|
@@ -605,14 +607,22 @@ var app = new Vue({
|
|
|
cropSize: function(){
|
|
cropSize: function(){
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
var data = _this.cropParams.data;
|
|
var data = _this.cropParams.data;
|
|
|
- if(data.height<data.width){
|
|
|
|
|
|
|
+ var image = new Image();
|
|
|
|
|
+ image.src = _this.cropParams.url;
|
|
|
|
|
+ var width = image.width;
|
|
|
|
|
+ var height = image.height;
|
|
|
|
|
+ if(height<width){
|
|
|
$("#cropImg").cropper("rotate", 90);
|
|
$("#cropImg").cropper("rotate", 90);
|
|
|
}
|
|
}
|
|
|
var cwidth = $(".cropper-canvas").outerWidth();
|
|
var cwidth = $(".cropper-canvas").outerWidth();
|
|
|
|
|
+
|
|
|
|
|
+ console.log(data);
|
|
|
// var cheight = $(".cropper-canvas").outerHeight();
|
|
// var cheight = $(".cropper-canvas").outerHeight();
|
|
|
var size = data.height<data.width? data.height: data.width;
|
|
var size = data.height<data.width? data.height: data.width;
|
|
|
- var iWidth = $(".crop-img").outerWidth();
|
|
|
|
|
- var iHeight = $(".crop-img").outerHeight();
|
|
|
|
|
|
|
+ var iWidth = $("body").outerWidth();
|
|
|
|
|
+ var iHeight = $("body").outerHeight()-130;
|
|
|
|
|
+ /*var iWidth = $(".cropper-canvas").outerWidth();
|
|
|
|
|
+ var iHeight = $(".cropper-canvas").outerHeight();*/
|
|
|
if(size<iWidth){
|
|
if(size<iWidth){
|
|
|
var rate = iWidth/size;
|
|
var rate = iWidth/size;
|
|
|
$("#cropImg").cropper("zoom", rate);
|
|
$("#cropImg").cropper("zoom", rate);
|
|
@@ -627,7 +637,7 @@ var app = new Vue({
|
|
|
// 确定剪切
|
|
// 确定剪切
|
|
|
cropConfirm: function () {
|
|
cropConfirm: function () {
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
- $.closePopup();
|
|
|
|
|
|
|
+
|
|
|
$("body").css('overflowY','scroll');
|
|
$("body").css('overflowY','scroll');
|
|
|
$(".crop-img").show();
|
|
$(".crop-img").show();
|
|
|
this.cropPreviewStatus = false;
|
|
this.cropPreviewStatus = false;
|
|
@@ -640,6 +650,7 @@ var app = new Vue({
|
|
|
var canvas = $image.cropper('getCroppedCanvas',_this.cropParams.cropData);
|
|
var canvas = $image.cropper('getCroppedCanvas',_this.cropParams.cropData);
|
|
|
console.log($image);
|
|
console.log($image);
|
|
|
var url = canvas.toBlob(function (e) {
|
|
var url = canvas.toBlob(function (e) {
|
|
|
|
|
+ $.closePopup();
|
|
|
console.log(e); //生成Blob的图片格式
|
|
console.log(e); //生成Blob的图片格式
|
|
|
if (e != null) {
|
|
if (e != null) {
|
|
|
var timestamp = Date.parse(new Date());
|
|
var timestamp = Date.parse(new Date());
|