From c4e95050da96b7a83241a7c2128608c12880a634 Mon Sep 17 00:00:00 2001 From: JackPu Date: Fri, 12 May 2017 15:19:03 +0800 Subject: [PATCH] update new doc --- dist/crop.vue | 339 ++++++++++++++++++ dist/index.js | 2 + dist/lib/canvas-helper.js | 1 + dist/lib/drag.js | 1 + dist/lib/helper.js | 1 + dist/lib/loading-gif.js | 1 + dist/lib/resize.js | 1 + dist/lib/xhr.js | 1 + dist/props.js | 93 +++++ dist/resize-bar.vue | 127 +++++++ dist/style/style.css | 110 ++++++ dist/vue-core-image-upload.vue | 273 ++++++++++++++ site/client/components/Header.vue | 17 +- site/client/components/NavList.vue | 12 +- site/client/components/doc/en/CropImage.vue | 2 +- .../client/components/doc/en/MultipleFile.vue | 2 +- site/client/less/modules/m-layout.less | 64 +++- site/src/vue-core-image-upload.vue | 8 +- src/vue-core-image-upload.vue | 8 +- 19 files changed, 1047 insertions(+), 16 deletions(-) create mode 100644 dist/crop.vue create mode 100644 dist/index.js create mode 100644 dist/lib/canvas-helper.js create mode 100644 dist/lib/drag.js create mode 100644 dist/lib/helper.js create mode 100644 dist/lib/loading-gif.js create mode 100644 dist/lib/resize.js create mode 100644 dist/lib/xhr.js create mode 100644 dist/props.js create mode 100644 dist/resize-bar.vue create mode 100644 dist/style/style.css create mode 100644 dist/vue-core-image-upload.vue diff --git a/dist/crop.vue b/dist/crop.vue new file mode 100644 index 0000000..29a54fd --- /dev/null +++ b/dist/crop.vue @@ -0,0 +1,339 @@ + + + + + diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..a8c0731 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,2 @@ +import VueCoreImageUpload from './vue-core-image-upload.vue'; +export default VueCoreImageUpload; diff --git a/dist/lib/canvas-helper.js b/dist/lib/canvas-helper.js new file mode 100644 index 0000000..cc87c9d --- /dev/null +++ b/dist/lib/canvas-helper.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueCoreImageUpload=e():t.VueCoreImageUpload=e()}(this,function(){return function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var o={};return e.m=t,e.c=o,e.i=function(t){return t},e.d=function(t,o,r){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=20)}({20:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={_getImageType:function(t){var e="image/jpeg",o=t.match(/(image\/[\w]+)\.*/)[0];return void 0!==o&&(e=o),e},compress:function(t,e,o){var r=new FileReader,n=this;r.onload=function(r){var a=new Image;a.src=r.target.result,a.onload=function(){var r=n._getImageType(t.type),i=n._getCanvas(a.naturalWidth,a.naturalHeight),g=(i.getContext("2d").drawImage(a,0,0),i.toDataURL(r,e/100));o(g)}},r.readAsDataURL(t)},crop:function(t,e,o){var r=function(t){return"number"==typeof t};if(r(e.toCropImgX)&&r(e.toCropImgY)&&e.toCropImgW>0&&e.toCropImgH>0){var n=e.toCropImgW,a=e.toCropImgH;e.maxWidth&&e.maxWidth0&&e.toCropImgH>0){var n=e.toCropImgW*e.imgChangeRatio,a=e.toCropImgH*e.imgChangeRatio,i=this._getCanvas(n,a),g=(i.getContext("2d").drawImage(t,0,0,e.toCropImgW,e.toCropImgH,0,0,n,a),this._getImageType(t.src));o(i.toDataURL(g,e.compress/100))}},_loadImage:function(t,e){var o=new Image;o.src=t,o.onload=function(){e(o)},o.onerror=function(){console.log("Error: image error!")}},_getCanvas:function(t,e){var o=document.createElement("canvas");return o.width=t,o.height=e,o}}}})}); \ No newline at end of file diff --git a/dist/lib/drag.js b/dist/lib/drag.js new file mode 100644 index 0000000..0f90314 --- /dev/null +++ b/dist/lib/drag.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueCoreImageUpload=t():e.VueCoreImageUpload=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=12)}({0:function(e,t,n){"use strict";e.exports={isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),setCssText:function(e){var t=[];for(var n in e){var o=e[n];"number"==typeof o&&(o+="px"),t.push(n+": "+o+";")}return t.join("")}}},12:function(e,t,n){"use strict";function o(e,t,n){if(t){var o=u?e.changedTouches[0].clientX:e.clientX,r=u?e.changedTouches[0].clientY:e.clientY,i=o-t.parentElement.offsetLeft-n.x,f=r-t.parentElement.offsetTop-document.getElementsByClassName("image-aside")[0].offsetTop-n.y;return i<=0&&(i=0),i>=n.maxLeft&&(i=n.maxLeft),f<=0&&(f=0),f>=n.maxTop&&(f=n.maxTop),{left:i,top:f}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(r),u=i.default.isMobile}})}); \ No newline at end of file diff --git a/dist/lib/helper.js b/dist/lib/helper.js new file mode 100644 index 0000000..7018694 --- /dev/null +++ b/dist/lib/helper.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueCoreImageUpload=t():e.VueCoreImageUpload=t()}(this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";e.exports={isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),setCssText:function(e){var t=[];for(var r in e){var o=e[r];"number"==typeof o&&(o+="px"),t.push(r+": "+o+";")}return t.join("")}}}])}); \ No newline at end of file diff --git a/dist/lib/loading-gif.js b/dist/lib/loading-gif.js new file mode 100644 index 0000000..73a1290 --- /dev/null +++ b/dist/lib/loading-gif.js @@ -0,0 +1 @@ +!function(A,Q){"object"==typeof exports&&"object"==typeof module?module.exports=Q():"function"==typeof define&&define.amd?define([],Q):"object"==typeof exports?exports.VueCoreImageUpload=Q():A.VueCoreImageUpload=Q()}(this,function(){return function(A){function Q(C){if(o[C])return o[C].exports;var g=o[C]={i:C,l:!1,exports:{}};return A[C].call(g.exports,g,g.exports,Q),g.l=!0,g.exports}var o={};return Q.m=A,Q.c=o,Q.i=function(A){return A},Q.d=function(A,o,C){Q.o(A,o)||Object.defineProperty(A,o,{configurable:!1,enumerable:!0,get:C})},Q.n=function(A){var o=A&&A.__esModule?function(){return A.default}:function(){return A};return Q.d(o,"a",o),o},Q.o=function(A,Q){return Object.prototype.hasOwnProperty.call(A,Q)},Q.p="",Q(Q.s=13)}({13:function(A,Q,o){"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.default="data:image/gif;base64,R0lGODlhGAAYAPQAAP///3FxcePj4/v7++3t7dLS0vHx8b+/v+Dg4MfHx+jo6M7Oztvb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OtOpY5PgNlAAykAEUsQ1wzCgWdCIdeArczBQVbDJ0NAqyeBb64nQAGArBTt8R8mLuyPyEAOwAAAAAAAAAAAA=="}})}); \ No newline at end of file diff --git a/dist/lib/resize.js b/dist/lib/resize.js new file mode 100644 index 0000000..e532e60 --- /dev/null +++ b/dist/lib/resize.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueCoreImageUpload=t():e.VueCoreImageUpload=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=21)}({0:function(e,t,i){"use strict";e.exports={isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),setCssText:function(e){var t=[];for(var i in e){var n=e[i];"number"==typeof n&&(n+="px"),t.push(i+": "+n+";")}return t.join("")}}},21:function(e,t,i){"use strict";function n(e,t,i,n,o){if(t){var r=document.body.offsetHeight,d=1/o,s=parseInt(window.getComputedStyle(i).width),f=parseInt(window.getComputedStyle(i).height),c=document.querySelector(".info-aside"),a=(u-s)/2,l=parseInt(window.getComputedStyle(c).height),p=(r-f-l)/2,g=h?e.changedTouches[0].clientX:e.clientX,w=h?e.changedTouches[0].clientY:e.clientY,y=parseInt(t.offsetWidth),b=parseInt(t.offsetHeight),x={};return o>=1&&g<=a+s?(y>=s&&(x.width=s),x.width=n.w+g-n.x,x.height=y*d,s>f?y>f&&(x.height=f,x.width=f*o):ss&&(x.width=s,x.height=s*d):y>=s&&(x.width=s,x.height=s*d)):o<1&&wf?b>f&&(x.height=f,x.width=f*o):y>s&&(x.width=s,x.height=s*d)):"auto"==o&&w<=p+f+l&&g<=p+s?(x.height=n.h+w-n.y,x.width=n.w+g-n.x):g<=a+s&&(x.width=n.w+g-n.x,x.height=t.style.width,s>f?b>f&&(x.height=f,x.width=f):ss&&(x.width=s,x.height=s):y>s&&(x.width=t.style.height=s)),x}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=i(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),h=r.default.isMobile,u=document.body.offsetWidth}})}); \ No newline at end of file diff --git a/dist/lib/xhr.js b/dist/lib/xhr.js new file mode 100644 index 0000000..4abce26 --- /dev/null +++ b/dist/lib/xhr.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueCoreImageUpload=t():e.VueCoreImageUpload=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=22)}({22:function(e,t,o){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};void 0===XMLHttpRequest.prototype.sendAsBinary&&(XMLHttpRequest.prototype.sendAsBinary=function(e){var t=Array.prototype.map.call(e,function(e){return 255&e.charCodeAt(0)});this.send(new Uint8Array(t).buffer)}),e.exports=function(e,t,o,r,s,a,i){function u(e){for(var t={},o=/([a-z\-]+):\s?(.*);?/gi,n=void 0;n=o.exec(e);)t[n[1]]=n[2];return t}var p=new XMLHttpRequest,f=a||function(){console.error("AJAX ERROR!")},c="vuecodeimageupload",l=!1;"blob"===e&&(l=e,e="GET"),console.log(r),e=e.toUpperCase(),p.onload=function(){var t=p.response;try{t=JSON.parse(p.responseText)}catch(e){401===p.status&&(t=f("access_denied",p.statusText))}var o=u(p.getAllResponseHeaders());o.statusCode=p.status,s(t||("GET"===e?f("empty_response","Could not get resource"):{}),o)},p.onerror=function(){var e=p.responseText;try{e=JSON.parse(p.responseText)}catch(e){console.error(e)}s(e||f("access_denied","Could not get resource"))};var d=void 0;if("GET"===e||"DELETE"===e)r=null;else if(i){var y=r,m=r.base64Code.replace("data:"+r.type+";base64,","");r=["--"+c,'Content-Disposition: form-data; name="'+r.filed+'"; filename="'+r.filename+'"',"Content-Type: "+r.type,"",window.atob(m),""].join("\r\n");var b=Object.keys(y);if(b.length>4){var v=!0,x=!1,C=void 0;try{for(var T,g=b[Symbol.iterator]();!(v=(T=g.next()).done);v=!0){var h=T.value;-1==["filed","filename","type","base64Code"].indexOf(h)&&(r+=["--"+c,'Content-Disposition: form-data; name="'+h+'";',"",""].join("\r\n"),r+=["object"===n(y[h])?JSON.stringify(y[h]):y[h],""].join("\r\n"))}}catch(a){x=!0,C=a}finally{try{!v&&g.return&&g.return()}finally{if(x)throw C}}}r+="--"+c+"--"}if(p.open(e,t,!0),l&&("responseType"in p?p.responseType=l:p.overrideMimeType("text/plain; charset=x-user-defined")),o){for(d in o)p.setRequestHeader(d,o[d]);i&&p.setRequestHeader("Content-Type","multipart/form-data; boundary="+c)}return i?p.sendAsBinary(r):(p.withCredentials=!0,p.send(r),p)}}})}); \ No newline at end of file diff --git a/dist/props.js b/dist/props.js new file mode 100644 index 0000000..ebfd035 --- /dev/null +++ b/dist/props.js @@ -0,0 +1,93 @@ +export default { + url: { + type: String, + }, + text: { + type:String, + default: 'Upload Image' + }, + extensions: { + type: String, + default:'png.jpg,jpeg,gif,svg,webp' + }, + inputOfFile: { + type: String, + default: 'files' + }, + crop: { + type: [String, Boolean], + default: '' + }, + cropBtn: { + type: Object, + default: function() { + return { + ok: 'Ok', + cancel: 'Cancel', + } + } + }, + cropRatio: { + type: String, + default: '1:1' + }, + resize: { + type: [String, Boolean], + default: false, + }, + ResizeBtn: { + type: Object, + default: function() { + return { + ok: 'Ok', + cancel: 'Cancel' + } + } + }, + maxFileSize:{ + type: Number, + default: 1024 * 1024 * 100, + }, + maxWidth:{ + type: Number, + }, + maxHeight:{ + type: Number, + }, + inputAccept:{ + type: String, + default: 'image/jpg,image/jpeg,image/png' + }, + isXhr: { + type: Boolean, + default: true + }, + headers: { + type: Object, + default: function() { + return {}; + } + }, + data: { + type: Object, + default: function() { + return {}; + } + }, + multiple: { + type: Boolean, + default: false + }, + multipleSize: { + type: Number, + default: 0 + }, + minWidth: { + type: Number, + default: 50, + }, + compress: { + type: [Number, String], + default: 0, + } +} diff --git a/dist/resize-bar.vue b/dist/resize-bar.vue new file mode 100644 index 0000000..5400341 --- /dev/null +++ b/dist/resize-bar.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/dist/style/style.css b/dist/style/style.css new file mode 100644 index 0000000..f193446 --- /dev/null +++ b/dist/style/style.css @@ -0,0 +1,110 @@ +.g-core-image-upload-btn{ + position: relative; + overflow: hidden; +} +.g-core-image-upload-form{ + position: absolute; + left:0; + right: 0; + top:0; + bottom:0; + opacity: 0; +} +.g-core-image-upload-container{ + position: absolute; + background: #111; + z-index: 900; +} +.g-core-image-upload-modal{ + position: absolute; + left:0; + right:0; + width: 100%; + height: 100%; + border:1px solid #ccc; + z-index: 899; +} +.dropped{ + border:4px solid #ea6153; +} + +.g-core-image-corp-container{ + z-index: 1900; + position:fixed; + left:0; + right:0; + top:0; + bottom: 0; + background: rgba(0,0,0,.9); + color:#f1f1f1; +} +.g-core-image-corp-container .image-aside{ + position: absolute; + right: 30px; + left:30px; + top:60px; + bottom:20px; + text-align: center; +} +.g-core-image-corp-container .image-aside img{ + max-width: 100%; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.g-core-image-corp-container .info-aside{ + position: absolute; + left:0; + right: 0; + top:0; + height: 40px; + padding-left: 10px; + padding-right: 10px; + background: #fefefe; + color:#777; +} +.g-core-image-corp-container .btn-groups{ + text-align: right; + margin: 5px 0 0; +} +.g-core-image-corp-container .btn{ + display: inline-block; + padding: 0 15px; + height: 32px; + margin-left: 15px; + background: #fff; + border:1px solid #ccc; + border-radius: 2px; + font-size: 13px; + color:#222; + line-height: 32px; + transition: all .1s ease-in; +} +.g-core-image-corp-container .btn:hover{ + border:1px solid #777; + box-shadow: 0 1px 3px rgba(0,0,0,.05); +} +.g-core-image-corp-container .btn:active{ + background: #ddd; +} +.g-core-image-corp-container .btn:disabled{ + background: #eee !important; + border-color:#ccc; + cursor: not-allowed; +} +.g-core-image-corp-container .btn-upload{ + background: #27ae60; + border-color:#27ae60; + color:#fff; +} +.g-core-image-corp-container .btn-upload:hover{ + background: #2dc26c; + border-color:#27ae60; + box-shadow: 0 1px 3px rgba(0,0,0,.05); +} +.g-core-image-corp-container .g-crop-image-box,.g-core-image-corp-container .g-crop-image-box .g-crop-image-principal{ + position: relative; +} diff --git a/dist/vue-core-image-upload.vue b/dist/vue-core-image-upload.vue new file mode 100644 index 0000000..06345c0 --- /dev/null +++ b/dist/vue-core-image-upload.vue @@ -0,0 +1,273 @@ + + + + + diff --git a/site/client/components/Header.vue b/site/client/components/Header.vue index 00cbdf3..dfe0c21 100644 --- a/site/client/components/Header.vue +++ b/site/client/components/Header.vue @@ -1,6 +1,9 @@ - -