wesmiler 6 роки тому
батько
коміт
c1660078e7
1 змінених файлів з 8 додано та 2 видалено
  1. 8 2
      public/static/weixin/js/photo.js

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

@@ -473,7 +473,11 @@ var app = new Vue({
             $(".crop-img").html('<img id="cropImg" src="" alt="" off="">');
             var iWidth = $(".crop-img").outerWidth();
             var iHeight = $(".crop-img").outerHeight();
-            $("#cropImg").attr('src', _this.cropParams.url);
+            if(id>=0){
+                $("#cropImg").attr('src', _this.cropParams.url);
+            }else{
+                $("#cropImg").attr('src', _this.cropParams.url);
+            }
             $image = $("#cropImg");
             var cropWidth = $('body').width();
             $("#cropBox").popup();
@@ -517,6 +521,8 @@ var app = new Vue({
                         width: iWidth * 10,
                         height: iHeight * 10,
                         rotate: data.rotate,
+                        top: 0,
+                        left: 0,
                         fillColor: '#fff',
                     };
                 }
@@ -612,7 +618,7 @@ var app = new Vue({
             }
 
             var continerData = $("#cropImg").cropper('getContainerData');
-            $("#cropImg").cropper('setCropBoxData',{width: iWidth, height: iHeight,top: 0, left: 0});
+            $("#cropImg").cropper('setCropBoxData',{width: continerData.width, height: continerData.height});
 
         },
         // 确定剪切