Commit 7b6bb24f authored by 罗超's avatar 罗超

1

parent d2cc104d
......@@ -47,12 +47,12 @@ export function UploadSelfFile(path, file, callback, configObj) {
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
break;
//上传文件到阿里云
//上传文件到阿里云
case 2:
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback);
break;
//上传文件到自己文件服务器
//上传文件到自己文件服务器
case 3:
UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj);
break;
......@@ -91,6 +91,82 @@ export function UploadViittoFile(path, file, callback) {
UploadFileToSystem(UploadConfig, path, file, uploadLoadding, callback, configObj)
}
// 上传Blob视频文件到本地服务器
export function UploadViittoBlobFile(path, file, callback) {
var uploadLoadding = Loading;
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
let viewFileUrl = 'http://192.168.20.214:8130';
let vtUploadUrl = "http://192.168.20.214:8120/upload/UploadBlob";
let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com";
viewFileUrl = "https://imgfile.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com";
viewFileUrl = "https://imgfile.oytour.com";
}
var UploadConfig = {
Bucket: "系统",
CustomDomain: viewFileUrl,
Region: "成都",
SecretId: "SecreId",
SecretKey: "SecreKey",
StoreType: 3,
UploadDomain: vtUploadUrl,
};
var configObj = {
isCreateCover: 1
}
UploadBolbFileToSystem(UploadConfig, path, file, uploadLoadding, callback, configObj)
}
/**
* 上传bolb文件到本地文件系统
*/
export function UploadBolbFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLoadding, successCall, configObj) {
let url = uploadConfig.UploadDomain + "/Upload?filePath=" + fileFullPath;
if (configObj) {
//是否转换图片
if (configObj.isTrans && configObj.isTrans == 1) {
url += "&isTrans=1"
}
if (configObj.isCreateCover && configObj.isCreateCover == 1) {
url += "&isCreateCover=1"
}
}
let formData = new FormData()
formData.append('myfile', fileObj)
let xhr = new XMLHttpRequest()
xhr.onload = function () {
uploadLoadding.hide();
var jsonObj = JSON.parse(xhr.responseText);
console.log(206, jsonObj, successCall)
if ((jsonObj.StatusCode === 1 || jsonObj.StatusCode === 0) && successCall) {
var tempArray = [];
if (jsonObj.OtherFile && jsonObj.OtherFile.length > 0) {
jsonObj.OtherFile.forEach(item => {
tempArray.push(uploadConfig.CustomDomain + item);
})
}
var uploadResult = {
Code: 1,
FileName: fileObj.name,
FileUrl: uploadConfig.CustomDomain + '/' + jsonObj.FilePath,
VideoCoverImg: uploadConfig.CustomDomain + jsonObj.VideoCoverImg,
ExtFile: tempArray
}
if (successCall) {
successCall(uploadResult);
}
}
}
xhr.open('post', url, true)
xhr.send(formData)
}
/**
* 上传到当前站点
*/
......@@ -156,7 +232,8 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
xhr.onload = function () {
uploadLoadding.hide();
var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode == 1 && successCall) {
console.log(206, jsonObj, successCall)
if (jsonObj.StatusCode === 1 && successCall) {
var tempArray = [];
if (jsonObj.OtherFile && jsonObj.OtherFile.length > 0) {
jsonObj.OtherFile.forEach(item => {
......@@ -171,6 +248,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
ExtFile: tempArray
}
if (successCall) {
successCall(uploadResult);
}
}
......@@ -179,6 +257,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
xhr.send(formData)
}
/**
* 上传文件到阿里云
*/
......@@ -191,7 +270,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd
bucket: uploadConfig.Bucket
})
var result = oss.multipartUpload(fileFullPath, fileObj, {
progress: function* (p) {}
progress: function* (p) { }
}).then(res => {
uploadLoadding.hide();
var uploadResult = {
......@@ -220,7 +299,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
Key: fileFullPath, //文件名
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) {}
onProgress: function (progressData) { }
}, function (err, data) {
uploadLoadding.hide();
if (data && data.statusCode == 200) {
......
......@@ -380,7 +380,7 @@
// import Canvas2Image from 'Canvas2Image'
import {getAdvertisingList,saveMakeAd,getMyAdDetail} from '../../api/AD/index.js'
import {UploadViittoFile} from '../../api/common/common'
import {UploadViittoBlobFile} from '../../api/common/common'
export default {
components: {
VueDraggableResizable,
......@@ -577,35 +577,6 @@
},
methods: {
loadObj() {
// let msg = {
// 'ID': this.dataId
// }
// this.apipost("Advertising_post_Get", msg, x => {
// this.isLoading = false
// if (x.data.resultCode == 1) {
// let data = x.data.data
// this.dataId = data.id,
// this.bg = data.pictureUrl + '?width=470'
// this.st = data.samplePicturesUrl + '?width=470'
// this.templateId = data.baseAdvertisingID
// this.nodes = JSON.parse(data.content)
// this.nodes.forEach(y => {
// this.currentZIndex = y.zindex > this.currentZIndex ? y.zindex : this.currentZIndex
// this.currentMaxId = y.nodeId > this.currentMaxId ? y.nodeId : this.currentMaxId
// })
// let reg = /^http(s)?:\/\/(.*?)\//
// let getBlob = this.getFileBlob(data.pictureUrl.replace(reg, ''), 'aa.jpg')
// let that = this
// getBlob.then(blob => {
// that.blobToDataURL(blob, function (e) {
// that.bg = e
// })
// });
// } else {
// this.dataId = 0
// this.bg = ''
// }
// }, err => {})
getMyAdDetail({ID:this.dataId}).then(res=>{
console.log('tag', res)
this.isLoading = false
......@@ -665,14 +636,13 @@
// var fileName = `${that.uuid(10,10)}.png`
// // var path = `/Adv/user/${that.user.EmployeeId}/${fileName}`;
// var path = `/Adv/user/template/${fileName}`;
UploadViittoFile ("Edu",blob,(res)=>{
UploadViittoBlobFile ("Edu",blob,(res)=>{
this.isLoading = false;
if(res.Code===1){
console.log(644,res);
// msg.AdvertisingPicUrl = path
console.log(671,res);
if(res.Code===1){
msg.AdvertisingPicUrl = res.FileUrl
new browserMD5File(blob, function (err, md5) {
msg.SecretKey = md5;
saveMakeAd(msg).then(res=>{
console.log(res)
......@@ -695,11 +665,11 @@
// that.$message.success(x.data.message)
// }, err => {})
})
})
}
})
},'ad')
......@@ -886,14 +856,13 @@
});
},
uploadImage(name, file) {
console.log(856,name);
// let newArr = [];
// newArr.push(file);
// var path = `/Adv/user/${this.user.EmployeeId}/${name}`;
// this.uploadSelfBlob(path, newArr, x => {
// console.log(848,x)
// });
// UploadViittoFile ("ad",file,(res)=>{
// UploadViittoBlobFile ("ad",file,(res)=>{
// console.log(864,res);
// })
......
......@@ -10,7 +10,7 @@
<span class="free"><i class="el-icon-share"></i> 0</span>
<div class="zezhao">
<a :href='`/#/activity/makeAd?id=${props.value.ID}`'><i class="el-icon-edit" title="修改"></i></a>
<a :href='props.value.advertisingPicUrlStr' download="广告图.png"><i class="el-icon-download" title="下载"></i></a>
<a :href='props.value.AdvertisingPicUrlStr' download="广告图.png"><i class="el-icon-download" title="下载"></i></a>
<i class="el-icon-delete" title="删除" @click="deleteItem(props.value)"></i>
</div>
</template>
......@@ -83,7 +83,7 @@ export default {
getMyAd(msg).then(res=>{
if(res.Code===1){
res.Data.PageData.forEach(x=>{
x.src=`${x.advertisingPicUrlStr}?x-oss-process=image/resize,w_200`
x.src=`${x.AdvertisingPicUrlStr}?x-oss-process=image/resize,w_200`
})
if(res.Data.PageData.length==0){
this.$refs.waterfall.waterfallOver()
......
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