Commit 4cbf4509 authored by 黄奎's avatar 黄奎

文件上传修改

parent be8e13eb
...@@ -550,15 +550,7 @@ ...@@ -550,15 +550,7 @@
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
// this.UploadSelfFile(this.FileType().Video, file.file, res => {
// if (res.resultCode == 1) {
// that.addpageMsg.Image = res.VideoCoverImg;
// that.addpageMsg.Path = res.FileUrl;
// that.addpageMsg.Name = res.FileName;
// that.addPageList();
// that.$forceUpdate();
// }
// })
this.UploadFileToTencent(this.FileType().Video, file.file, res => { this.UploadFileToTencent(this.FileType().Video, file.file, res => {
if (res.resultCode == 1) { if (res.resultCode == 1) {
if (that.addpageMsg.Type == 2) { if (that.addpageMsg.Type == 2) {
......
...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
<div class="orderList"> <div class="orderList">
<div class="head-title"> <div class="head-title">
订单列表 订单列表
<!-- <el-upload class="upload-demo" ref="upload" :action="importFileUrl" :multiple="true" :on-success="successUpload"
:show-file-list="false" accept=".csv">
<el-button :loading="btnLoad" size="small" type="primary">
赞羊导入</el-button>
</el-upload> -->
<el-button @click="dialogVisible = true" style="float: right; margin-top: -5px" size="small" type="primary">批量导出 <el-button @click="dialogVisible = true" style="float: right; margin-top: -5px" size="small" type="primary">批量导出
</el-button> </el-button>
<el-button @click="ClearHsz" style="float: right; margin-top: -5px; margin-right: 20px" size="small" <el-button @click="ClearHsz" style="float: right; margin-top: -5px; margin-right: 20px" size="small"
...@@ -19,21 +15,7 @@ ...@@ -19,21 +15,7 @@
<el-date-picker v-model="dateList" @change="(msg.pageIndex = 1), getList()" size="small" type="datetimerange" <el-date-picker v-model="dateList" @change="(msg.pageIndex = 1), getList()" size="small" type="datetimerange"
range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期"> range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
<!-- <span style="margin-left: 15px;font-size:14px">所属平台:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.OrderSource" size="small"
placeholder="请选择">
<el-option label="全部平台" :value="0"></el-option>
<el-option v-for="item in platList" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select> -->
<!-- <span style="margin-left: 15px;font-size:14px">订单类型:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.OrderType" size="small"
placeholder="请选择">
<el-option label="全部订单" :value="0"></el-option>
<el-option v-for="item in orderTypeList" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select> -->
<span style="margin-left: 15px;font-size:14px">配送方式:</span> <span style="margin-left: 15px;font-size:14px">配送方式:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.DeliveryMethod" size="small" <el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.DeliveryMethod" size="small"
placeholder="请选择"> placeholder="请选择">
......
...@@ -262,15 +262,6 @@ ...@@ -262,15 +262,6 @@
//上传视频 //上传视频
UploadVideo(file) { UploadVideo(file) {
var that = this; var that = this;
// this.UploadSelfFile(this.FileType().Video, file.file, res => {
// if (res.resultCode == 1) {
// that.addpageMsg.Image = res.VideoCoverImg;
// that.addpageMsg.Path = res.FileUrl;
// that.addpageMsg.Name = res.FileName;
// that.addPageList();
// that.$forceUpdate();
// }
// })
that.uploadLoadingObj = this.$loading({ that.uploadLoadingObj = this.$loading({
lock: true, lock: true,
text: '正在上传视频,请稍后...', text: '正在上传视频,请稍后...',
...@@ -285,7 +276,6 @@ ...@@ -285,7 +276,6 @@
that.addpageMsg.Path = res.FileUrl; that.addpageMsg.Path = res.FileUrl;
that.addpageMsg.Name = res.FileName; that.addpageMsg.Name = res.FileName;
that.cutPicture(res.FileUrl); that.cutPicture(res.FileUrl);
//that.addPageList();
} }
}) })
}, },
......
This diff is collapsed.
...@@ -200,11 +200,10 @@ export default { ...@@ -200,11 +200,10 @@ export default {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
var cachaInfo = that.getLocalStorage(); var cachaInfo = that.getLocalStorage();
if (cachaInfo && cachaInfo.TenantId == 29) { if (cachaInfo && cachaInfo.TenantId == 29) {
that.uploadStart(path, fileObj, callback) that.RealUploadToTencent(path, fileObj, callback)
} else { } else {
that.uploadStart(path, newFile, callback) that.RealUploadToTencent(path, newFile, callback)
} }
console.log("cachaInfo", cachaInfo)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
that.uploadToAli(path, newFile, callback) that.uploadToAli(path, newFile, callback)
...@@ -215,7 +214,7 @@ export default { ...@@ -215,7 +214,7 @@ export default {
}).catch(function (error) { }).catch(function (error) {
if (upInfo && upInfo.IsDefault == 1) { if (upInfo && upInfo.IsDefault == 1) {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
that.uploadStart(path, fileObj, callback) that.RealUploadToTencent(path, fileObj, callback)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
that.uploadToAli(path, fileObj, callback) that.uploadToAli(path, fileObj, callback)
...@@ -229,7 +228,7 @@ export default { ...@@ -229,7 +228,7 @@ export default {
} else { } else {
if (upInfo && upInfo.IsDefault == 1) { if (upInfo && upInfo.IsDefault == 1) {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
this.uploadStart(path, fileObj, callback) this.RealUploadToTencent(path, fileObj, callback)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
this.uploadToAli(path, fileObj, callback) this.uploadToAli(path, fileObj, callback)
...@@ -239,66 +238,46 @@ export default { ...@@ -239,66 +238,46 @@ export default {
} }
} }
}, },
Vue.prototype.uploadStart = function (path, fileObj, callback) { Vue.prototype.RealUploadToTencent = function (path, fileObj, callback) {
var upInfo = JSON.parse(localStorage.uploadInfo); var that = this;
//获取文件扩展名
var filename = fileObj.name;
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index);
var timestamp1 = Date.parse(new Date()) + "_" + (Math.ceil(Math.random() * 1000));
let str = ''; let str = '';
if (this.isOnline()) { if (!this.isOnline()) {
str = "/Test" str = "/2024"
} }
var newFileName = str + '/Upload/' + path + "/" + timestamp1 + "" + suffix; var newFileName = str + '/Upload/' + path;
var uploadMsg = { var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToTecent?isDomain=1&filePath=" + newFileName;
Bucket: upInfo.Bucket, var formData = new FormData();
Region: upInfo.Region, formData.append("myfile", fileObj);
SecretId: upInfo.SecretId, that.$http.post(uploadUrl, formData, {})
SecretKey: upInfo.SecretKey, .then(res => {
}; if (res && res.data.StatusCode == 1 && res.data.FilePath) {
var COS = require('cos-js-sdk-v5'); var uploadResult = {
var cos = new COS({ resultCode: 1,
SecretId: uploadMsg.SecretId, FileName: fileObj.name,
SecretKey: uploadMsg.SecretKey, FileUrl:res.data.FilePath,
}); VideoCoverImg: that.domainManager().VTViewUrl + res.data.VideoCoverImg
cos.putObject({ }
Bucket: uploadMsg.Bucket, if (callback) {
Region: uploadMsg.Region, //存储桶所在地域,必须字段 callback(uploadResult);
Key: newFileName, //文件名 }
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) {}
}, function (err, data) {
if (data && data.statusCode == 200) {
var uploadResult = {
resultCode: 1,
FileName: fileObj.name,
FileUrl: "https://" + data.Location
}
if (callback) {
callback(uploadResult);
} }
} else { }).catch(function (reason) {
/*上传文件异常*/ console.log(reason)
console.log(err || data); });
}
});
}, },
//上传至阿里云【2024-05-20转为后台上传】 //上传至阿里云【2024-05-20转为后台上传】
Vue.prototype.uploadToAli = function (path, fileObj, successCall) { Vue.prototype.uploadToAli = function (path, fileObj, successCall) {
var that = this; var that = this;
let str = ''; let str = '';
if (this.isOnline()) { if (!this.isOnline()) {
str = "/2024" str = "/2024"
} }
var newFileName = str + '/Upload/' + path + "/"; var newFileName = str + '/Upload/' + path;
var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToALiOSS?filePath=" + newFileName; var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToALiOSS?isDomain=1&filePath=" + newFileName;
var formData = new FormData(); var formData = new FormData();
formData.append("myfile", fileObj); formData.append("myfile", fileObj);
that.$http.post(uploadUrl, formData, {}) that.$http.post(uploadUrl, formData, {})
.then(res => { .then(res => {
console.log("ali_res", res);
if (res && res.data.StatusCode == 1 && res.data.FilePath) { if (res && res.data.StatusCode == 1 && res.data.FilePath) {
var uploadResult = { var uploadResult = {
resultCode: 1, resultCode: 1,
......
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