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

1

parent d2cc104d
...@@ -47,12 +47,12 @@ export function UploadSelfFile(path, file, callback, configObj) { ...@@ -47,12 +47,12 @@ export function UploadSelfFile(path, file, callback, configObj) {
newPath += "/" + timestamp1 + "" + suffix; newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback); UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
break; break;
//上传文件到阿里云 //上传文件到阿里云
case 2: case 2:
newPath += "/" + timestamp1 + "" + suffix; newPath += "/" + timestamp1 + "" + suffix;
UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback); UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback);
break; break;
//上传文件到自己文件服务器 //上传文件到自己文件服务器
case 3: case 3:
UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj); UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj);
break; break;
...@@ -91,6 +91,82 @@ export function UploadViittoFile(path, file, callback) { ...@@ -91,6 +91,82 @@ export function UploadViittoFile(path, file, callback) {
UploadFileToSystem(UploadConfig, path, file, uploadLoadding, callback, configObj) 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 ...@@ -156,7 +232,8 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
xhr.onload = function () { xhr.onload = function () {
uploadLoadding.hide(); uploadLoadding.hide();
var jsonObj = JSON.parse(xhr.responseText); var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode == 1 && successCall) { console.log(206, jsonObj, successCall)
if (jsonObj.StatusCode === 1 && successCall) {
var tempArray = []; var tempArray = [];
if (jsonObj.OtherFile && jsonObj.OtherFile.length > 0) { if (jsonObj.OtherFile && jsonObj.OtherFile.length > 0) {
jsonObj.OtherFile.forEach(item => { jsonObj.OtherFile.forEach(item => {
...@@ -171,6 +248,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo ...@@ -171,6 +248,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
ExtFile: tempArray ExtFile: tempArray
} }
if (successCall) { if (successCall) {
successCall(uploadResult); successCall(uploadResult);
} }
} }
...@@ -179,6 +257,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo ...@@ -179,6 +257,7 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
xhr.send(formData) xhr.send(formData)
} }
/** /**
* 上传文件到阿里云 * 上传文件到阿里云
*/ */
...@@ -191,7 +270,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd ...@@ -191,7 +270,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd
bucket: uploadConfig.Bucket bucket: uploadConfig.Bucket
}) })
var result = oss.multipartUpload(fileFullPath, fileObj, { var result = oss.multipartUpload(fileFullPath, fileObj, {
progress: function* (p) {} progress: function* (p) { }
}).then(res => { }).then(res => {
uploadLoadding.hide(); uploadLoadding.hide();
var uploadResult = { var uploadResult = {
...@@ -220,7 +299,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL ...@@ -220,7 +299,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
Key: fileFullPath, //文件名 Key: fileFullPath, //文件名
StorageClass: 'STANDARD', StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象 Body: fileObj, // 上传文件对象
onProgress: function (progressData) {} onProgress: function (progressData) { }
}, function (err, data) { }, function (err, data) {
uploadLoadding.hide(); uploadLoadding.hide();
if (data && data.statusCode == 200) { if (data && data.statusCode == 200) {
......
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
// import Canvas2Image from 'Canvas2Image' // import Canvas2Image from 'Canvas2Image'
import {getAdvertisingList,saveMakeAd,getMyAdDetail} from '../../api/AD/index.js' import {getAdvertisingList,saveMakeAd,getMyAdDetail} from '../../api/AD/index.js'
import {UploadViittoFile} from '../../api/common/common' import {UploadViittoBlobFile} from '../../api/common/common'
export default { export default {
components: { components: {
VueDraggableResizable, VueDraggableResizable,
...@@ -577,35 +577,6 @@ ...@@ -577,35 +577,6 @@
}, },
methods: { methods: {
loadObj() { 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=>{ getMyAdDetail({ID:this.dataId}).then(res=>{
console.log('tag', res) console.log('tag', res)
this.isLoading = false this.isLoading = false
...@@ -665,14 +636,13 @@ ...@@ -665,14 +636,13 @@
// var fileName = `${that.uuid(10,10)}.png` // var fileName = `${that.uuid(10,10)}.png`
// // var path = `/Adv/user/${that.user.EmployeeId}/${fileName}`; // // var path = `/Adv/user/${that.user.EmployeeId}/${fileName}`;
// var path = `/Adv/user/template/${fileName}`; // var path = `/Adv/user/template/${fileName}`;
UploadViittoBlobFile ("Edu",blob,(res)=>{
UploadViittoFile ("Edu",blob,(res)=>{
this.isLoading = false; this.isLoading = false;
if(res.Code===1){ console.log(671,res);
console.log(644,res); if(res.Code===1){
// msg.AdvertisingPicUrl = path
msg.AdvertisingPicUrl = res.FileUrl
new browserMD5File(blob, function (err, md5) { new browserMD5File(blob, function (err, md5) {
msg.SecretKey = md5; msg.SecretKey = md5;
saveMakeAd(msg).then(res=>{ saveMakeAd(msg).then(res=>{
console.log(res) console.log(res)
...@@ -695,11 +665,11 @@ ...@@ -695,11 +665,11 @@
// that.$message.success(x.data.message) // that.$message.success(x.data.message)
// }, err => {}) // }, err => {})
}) })
} }
}) },'ad')
...@@ -886,14 +856,13 @@ ...@@ -886,14 +856,13 @@
}); });
}, },
uploadImage(name, file) { uploadImage(name, file) {
console.log(856,name);
// let newArr = []; // let newArr = [];
// newArr.push(file); // newArr.push(file);
// var path = `/Adv/user/${this.user.EmployeeId}/${name}`; // var path = `/Adv/user/${this.user.EmployeeId}/${name}`;
// this.uploadSelfBlob(path, newArr, x => { // this.uploadSelfBlob(path, newArr, x => {
// console.log(848,x) // console.log(848,x)
// }); // });
// UploadViittoFile ("ad",file,(res)=>{ // UploadViittoBlobFile ("ad",file,(res)=>{
// console.log(864,res); // console.log(864,res);
// }) // })
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<span class="free"><i class="el-icon-share"></i> 0</span> <span class="free"><i class="el-icon-share"></i> 0</span>
<div class="zezhao"> <div class="zezhao">
<a :href='`/#/activity/makeAd?id=${props.value.ID}`'><i class="el-icon-edit" title="修改"></i></a> <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> <i class="el-icon-delete" title="删除" @click="deleteItem(props.value)"></i>
</div> </div>
</template> </template>
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
getMyAd(msg).then(res=>{ getMyAd(msg).then(res=>{
if(res.Code===1){ if(res.Code===1){
res.Data.PageData.forEach(x=>{ 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){ if(res.Data.PageData.length==0){
this.$refs.waterfall.waterfallOver() 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