wesmiler 6 tahun lalu
induk
melakukan
88416c3ebd
1 mengubah file dengan 5 tambahan dan 8 penghapusan
  1. 5 8
      public/static/weixin/js/papers.js

+ 5 - 8
public/static/weixin/js/papers.js

@@ -407,6 +407,10 @@ var app = new Vue({
             }
             return new File([u8arr], filename, {type: mime});
         },
+        // base转文件
+        dataBlobtoFile: function (dataurl, filename) {//将base64转换为文件
+            return new File([dataurl], filename, {type: 'image/jpeg'});
+        },
         // 删除图片
         picDel: function (id) {
             this.picList[id] = {url: '', preview: ''};
@@ -440,14 +444,7 @@ var app = new Vue({
             var imgWidth = 243;
             var imgHeight = 153;
             var options = {
-                // aspectRatio: parseFloat(16/9),
                 aspectRatio: parseFloat(243/153),
-                // movable: false,
-                //resizable: false,
-                //touchDragZoom: true,
-                //zoomable: true,
-                // autoCropArea: 0.8,
-                // zoomOnTouch: false,
                 zoomOnWheel: false,
                 scalable: false,
                 // touchDragZoom: false,
@@ -577,7 +574,7 @@ var app = new Vue({
                         url = URL.createObjectURL(e);
                         _this.picList[id].url = url;
                         _this.picList[id].preview = url;
-                        _this.picList[id].fileData = _this.dataURLtoFile(e, e.name);
+                        _this.picList[id].fileData = _this.dataBlobtoFile(e, e.name);
 
                         setTimeout(function(){
                             $.hideLoading();