Commit 505c5d82 by keith

客户端七牛上传图片会被裁剪问题,取消压缩后上传

parent 852f759a
......@@ -43,4 +43,4 @@
top:0 !important;
min-height: inherit!important;
left:0 !important; right:0 !important; bottom:0 !important; margin: auto !important;
}</style><link href=css/chunk-5750b049.975722ef.css rel=prefetch><link href=css/chunk-5e6009ff.86cb9867.css rel=prefetch><link href=css/chunk-95ccd994.d241ba9d.css rel=prefetch><link href=css/chunk-bd7efe5c.96f83ab8.css rel=prefetch><link href=js/chunk-5750b049.b7cee639.js rel=prefetch><link href=js/chunk-5e6009ff.cb9acf4c.js rel=prefetch><link href=js/chunk-95ccd994.571b5445.js rel=prefetch><link href=js/chunk-bd7efe5c.3bdd8028.js rel=prefetch><link href=css/app.19de1655.css rel=preload as=style><link href=css/chunk-vendors.5cea36ab.css rel=preload as=style><link href=js/app.4015b26c.js rel=preload as=script><link href=js/chunk-vendors.7ce94627.js rel=preload as=script><link href=css/chunk-vendors.5cea36ab.css rel=stylesheet><link href=css/app.19de1655.css rel=stylesheet></head><body><noscript><strong>We're sorry but m doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.7ce94627.js></script><script src=js/app.4015b26c.js></script></body></html>
\ No newline at end of file
}</style><link href=css/chunk-5750b049.975722ef.css rel=prefetch><link href=css/chunk-5e6009ff.86cb9867.css rel=prefetch><link href=css/chunk-95ccd994.d241ba9d.css rel=prefetch><link href=css/chunk-bd7efe5c.96f83ab8.css rel=prefetch><link href=js/chunk-5750b049.b7cee639.js rel=prefetch><link href=js/chunk-5e6009ff.06ad09b6.js rel=prefetch><link href=js/chunk-95ccd994.571b5445.js rel=prefetch><link href=js/chunk-bd7efe5c.3bdd8028.js rel=prefetch><link href=css/app.19de1655.css rel=preload as=style><link href=css/chunk-vendors.5cea36ab.css rel=preload as=style><link href=js/app.acb8e311.js rel=preload as=script><link href=js/chunk-vendors.8cda8561.js rel=preload as=script><link href=css/chunk-vendors.5cea36ab.css rel=stylesheet><link href=css/app.19de1655.css rel=stylesheet></head><body><noscript><strong>We're sorry but m doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.8cda8561.js></script><script src=js/app.acb8e311.js></script></body></html>
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -53,46 +53,39 @@ Helps.install = function (Vue, options) {
}
// 七牛云
else if (mode == 2) {
let options = {
quality: 0.92,
noCompressIfLarger: true,
maxWidth: 1500
};
qiniu.compressImage(file, options).then(data => {
const observable = qiniu.upload(
data.dist,
fileName,
secret,
{},
{
mimeType: null
}
);
qiniuObservable = observable.subscribe({
next: function (res) {
if (percent) percent(res)
},
error: function () {
// 失败后再次使用FormData上传
var formData = new FormData();
formData.append("fileType", "image");
formData.append("fileName", "file");
formData.append("key", fileName);
formData.append("token", secret);
formData.append("file", file);
axios
.post("https://upload.qiniup.com", formData)
.then(() => {
if (success) success(fileName);
})
.catch((e) => {
if (fail) fail(e);
});
},
complete: function (res) {
if (success) success(res.key);
}
});
const observable = qiniu.upload(
file,
fileName,
secret,
{},
{
mimeType: null
}
);
qiniuObservable = observable.subscribe({
next: function (res) {
if (percent) percent(res)
},
error: function () {
// 失败后再次使用FormData上传
var formData = new FormData();
formData.append("fileType", "image");
formData.append("fileName", "file");
formData.append("key", fileName);
formData.append("token", secret);
formData.append("file", file);
axios
.post("https://upload.qiniup.com", formData)
.then(() => {
if (success) success(fileName);
})
.catch((e) => {
if (fail) fail(e);
});
},
complete: function (res) {
if (success) success(res.key);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment