wesmiler před 6 roky
rodič
revize
37e0177755
1 změnil soubory, kde provedl 23 přidání a 2 odebrání
  1. 23 2
      public/static/weixin/js/photo.js

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

@@ -658,7 +658,28 @@ var app = new Vue({
                 $.closePopup();
                 // var canvas = $image.cropper('getCroppedCanvas');
                 var canvas = $image.cropper('getCroppedCanvas',_this.cropParams.cropData);
-                var url = canvas.toBlob(function (e) {
+                var url = canvas.toDataURL('image/jepg');
+                if(_this.cropParams.type && id>=0){
+                    _this.picList[id] = _this.cropParams;
+                    _this.picList[id].url = url;
+                    _this.picList[id].preview = url;
+                    _this.picList[id].fileData = _this.dataBlobtoFile(e, e.name);
+                }else{
+                    var data = _this.cropParams;
+                    data.url = url;
+                    data.preview = url;
+                    data.fileData = _this.dataBlobtoFile(e, e.name);
+                    _this.picList.push(data);
+                }
+
+                setTimeout(function () {
+
+                    $.hideLoading();
+                    _this.cropParams = {};
+                    $("#cropImg").cropper('destroy');
+                    _this.jc = null;
+                }, 200);
+                /*canvas.toBlob(function (e) {
                     console.log(e||event);  //生成Blob的图片格式
                     if (e != null) {
                         var timestamp = Date.parse(new Date());
@@ -694,7 +715,7 @@ var app = new Vue({
                             $.hideLoading();
                         }, 1000);
                     }
-                }, "image/jpeg");
+                }, "image/jpeg");*/
 
             }