Commit c5c90ea9 by hank

上传进度

parent 569192ed
......@@ -194,7 +194,7 @@ export default {
var formData = new FormData();
// formData.append('name', flie.name)
formData.append("OSSAccessKeyId", data.accessid);
formData.append("key", data.dir + "/" + data.expire + flie.name);
formData.append("key", data.dir + data.expire + flie.name);
formData.append("policy", data.policy);
formData.append("dir", data.dir);
// formData.append('name', flie)
......@@ -203,11 +203,19 @@ export default {
formData.append("success_action_status", "200");
formData.append("file", flie);
console.log(formData, data);
// Indicator.close()
axios.post(data.host, formData, {
onUploadProgress: (progressEvent) => {
let complete = (progressEvent.loaded / progressEvent.total * 100 | 0) + '%'
console.log(complete, 'progress')
// Indicator.close()
document.querySelector('.mint-indicator-text').innerText = complete
},
headers: {
"Content-Type": "multipart/form-data;"
}
}).then(file => {
Indicator.close()
Indicator.open({
text: '上传成功',
spinnerType: 'fading-circle'
......@@ -216,10 +224,10 @@ export default {
Indicator.close()
}, 500)
resolve({
url: data.host + "/" + data.dir + "/" + data.expire + flie.name
url: 'https://wanda-static.bdideal.com' + "/" + data.dir + data.expire + flie.name
});
console.log(
data.host + "/" + data.dir + "/" + data.expire + flie.name
data.host + "/" + data.dir + data.expire + flie.name
);
}).catch(err => {
Indicator.open({
......@@ -243,12 +251,13 @@ export default {
}
let file = files[0];
this.videoUrl = file;
this.isPhoto = false;
this.isPreivw = true;
// this.videoUrl = file;
console.log(files, "event", files[0].size/1024/1024);
this.upload(file).then(res => {
this.videoUrl = res.url
this.isPhoto = false;
this.isPreivw = true;
})
// this.createImage(files, e);
},
......@@ -343,7 +352,7 @@ export default {
axios
.post("/contest/join", {
image: '',
product_type: 1,
product_type: 2,
title: this.title,
video: this.videoUrl,
desc: this.desc,
......
......@@ -17,7 +17,7 @@ import api from '@/modules/js/api.js';
import VueLazyload from 'vue-lazyload';
axios.defaults.baseURL = api.server;
axios.defaults.timeout = 10000;
axios.defaults.timeout = 1000 * 60 * 10;
// axios.defaults.headers.common['systemtype'] = api.extra;
import '@/modules/js/request.js'
......
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