wesmiler 6 лет назад
Родитель
Сommit
5ee8e320b4
2 измененных файлов с 3 добавлено и 35 удалено
  1. 1 1
      public/static/weixin/js/papers.js
  2. 2 34
      public/static/weixin/js/photo.js

+ 1 - 1
public/static/weixin/js/papers.js

@@ -573,7 +573,7 @@ var app = new Vue({
                     //生成Blob的图片格式
                     if(e != null){
                         var timestamp = Date.parse(new Date());
-                        e.name=timestamp+".png";
+                        e.name=timestamp+".jpg";
                         url = URL.createObjectURL(e);
                         _this.picList[id].url = url;
                         _this.picList[id].preview = url;

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

@@ -521,20 +521,6 @@ var app = new Vue({
                 viewMode: 1,
                 crop: function (data) {
                     _this.cropParams.data = data;
-                   /* if(data.width<800){
-                        var width = data.width*10;
-                        var height = data.height*10;
-                    }else{
-                        var width = data.width;
-                        var height = data.height;
-                    }*/
-                    /*_this.cropParams.cropData = {
-                        width: iWidth*10,
-                        height: iHeight*10,
-                        rotate: data.rotate,
-                        // imageSmoothingQuality: 'high',
-                        fillColor: '#fff',
-                    };*/
                     var rate = 1;
                     if(data.height >2000 || data.width>2000){
                         rate = 0.8;
@@ -549,15 +535,6 @@ var app = new Vue({
                         imageSmoothingQuality: 'high',
                         fillColor: '#fff',
                     };
-
-                    /*var canvas = $image.cropper('getCroppedCanvas',_this.cropParams.cropData);
-                    var url = canvas.toDataURL('image/jpeg');
-                    alert(url);
-                    canvas.toBlob(function (e) {
-                       alert(44)
-                       alert(JSON.stringify(e))
-                    });*/
-
                 }
             }
 
@@ -633,23 +610,14 @@ var app = new Vue({
         cropSize: function(){
             var _this = this;
             var data = _this.cropParams.data;
-            /*var image = new Image();
-            image.src = _this.cropParams.url;
-            var width = image.width;
-            var height = image.height;*/
-
             if(data.height<data.width){
                 $("#cropImg").cropper("rotate", 90);
                 _this.cropParams.cropData.rotate = 90;
             }
             var cwidth = $(".cropper-canvas").outerWidth();
-
-            // var cheight = $(".cropper-canvas").outerHeight();
             var size = data.height<data.width? data.height: data.width;
             var iWidth = $("body").outerWidth();
             var iHeight = $("body").height()-130;
-            /*var iWidth = $(".cropper-canvas").outerWidth();
-            var iHeight = $(".cropper-canvas").outerHeight();*/
             if(size<iWidth){
                 var rate = iWidth/size;
                 $("#cropImg").cropper("zoom", rate);
@@ -661,7 +629,7 @@ var app = new Vue({
             $("#cropImg").cropper(_this.options);
             $("#cropImg").cropper('setData', {
                 width: iWidth,
-                height: height
+                height: iHeight
             });
         },
         // 确定剪切
@@ -679,7 +647,7 @@ var app = new Vue({
                     //生成Blob的图片格式
                     if (blob != null) {
                         var timestamp = Date.parse(new Date());
-                        blob.name = timestamp + ".png";
+                        blob.name = timestamp + ".jpg";
                         url = URL.createObjectURL(blob);
                         if(_this.cropParams.type && id>=0){
                             _this.picList[id] = _this.cropParams;