Commit 40bd935c authored by 黄奎's avatar 黄奎

上传修改

parent e9cdcaa7
......@@ -1539,7 +1539,6 @@
return uuid.join('');
},
uploadpic(e){
console.log(e)
let that=this;
if(e.target.files.length>0 && e.target.files[0].size>0){
// 压缩图片需要的一些元素和对象
......@@ -1549,8 +1548,8 @@
let newArr = [];
newArr.push(blob);
var fileName = `${that.uuid(10,10)}.png`;
var path = `/newFeature/${fileName}`;
that.uploadBlob(path, newArr, x => {
var path = `/newFeature`;
that.uploadSelfBlob(path, newArr, x => {
let allPath=that.domainManager().ViittoFileUrl+x.name;
let i=e.target.id.split('_')[2];
that.imgUrlChange(allPath)
......
......@@ -144,9 +144,9 @@ export default {
//google地图图片地址
GoogleMapImageUrl: "http://super.oytour.com",
//上传站点
UploadUrl: locationName.indexOf('oytour') !== -1||locationName.indexOf('viitto')!==-1 ? "http://upload.oytour.com" : "http://192.168.2.214:8120",
UploadUrl: locationName.indexOf('oytour') !== -1||locationName.indexOf('viitto')!==-1 ? "http://upload.oytour.com" : "http://127.0.0.1:8120",
//文件站点
ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto')!==-1 ? "http://imgfile.oytour.com" : 'http://192.168.2.214:8130'
ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto')!==-1 ? "http://imgfile.oytour.com" : 'http://127.0.0.1:8130'
};
return obj;
},
......@@ -473,27 +473,15 @@ export default {
}
}
Vue.prototype.uploadBlob = function (path, files, successCall) {
if (files && files.length > 0) {
var oss = new OSS({
region: 'oss-cn-hangzhou',
accessKeyId: 'LTAIwE7l9dImZSa3',
accessKeySecret: 'j47Ajn0d0WzUCIX8Biyj3P2r8QDltI',
bucket: 'reborndev'
})
let that = this
co(function* () {
for (let index = 0; index < files.length; index++) {
var result = yield oss.multipartUpload(path, files[index], {
progress: function* (p) {},
mime: 'application/octet-stream'
})
successCall(result);
}
}).catch(function (err) {
console.log(err);
});
}
Vue.prototype.uploadSelfBlob = function (path, files, successCall) {
let that = this;
var uploadUrl=that.domainManager().UploadUrl+"/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath="+path;
var formData = new FormData();
formData.append("myfile", files[0]);
that.$http.post(uploadUrl, formData,{'Content-Type':'multipart/form-data'})
.then(res => {
successCall(res);
})
},
//验证只能输入2位小数【负数:isMinus传true】
......
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 to comment