wesmiler 6 yıl önce
ebeveyn
işleme
984d168f69
1 değiştirilmiş dosya ile 8 ekleme ve 7 silme
  1. 8 7
      public/static/weixin/js/photo.js

+ 8 - 7
public/static/weixin/js/photo.js

@@ -511,11 +511,6 @@ var app = new Vue({
                 maxCanvasWeight: cropWidth,
                 minCanvasHeight: iHeight,*/
                 viewMode: 1,
-                ready: function(data){
-                    // _this.cropParams.data = data;
-                    // $image.cropper('setCropBoxData',{width: iWidth, height: iHeight});
-                    consoel.log(data);
-                },
                 crop: function (data) {
                     _this.cropParams.data = data;
                    /* if(data.width<800){
@@ -532,6 +527,12 @@ var app = new Vue({
                         imageSmoothingQuality: 'high',
                         fillColor: '#fff',
                     };
+
+                    var canvas = $image.cropper('getCroppedCanvas',_this.cropParams.cropData);
+                    var url = canvas.toBlob(function (e) {
+                       alert(44)
+                       alert(JSON.stringify(e))
+                    });
                 }
             }
 
@@ -611,7 +612,7 @@ var app = new Vue({
             image.src = _this.cropParams.url;
             var width = image.width;
             var height = image.height;*/
-     
+
             if(data.height<data.width){
                 $("#cropImg").cropper("rotate", 90);
             }
@@ -632,7 +633,7 @@ var app = new Vue({
                 $("#cropImg").cropper("zoom", rate);
             }
 
-            $("#cropImg").cropper('setCropBoxData',{width: iWidth, height: iHeight,top: 0});
+            $("#cropImg").cropper('setCropBoxData',{width: iWidth, height: iHeight});
 
         },
         // 确定剪切