Commit a78d1e58 authored by 乐宝呗666's avatar 乐宝呗666

修改展板内容

parent 78a5d931
......@@ -38,6 +38,7 @@
class="text-center"
drag
:action="uploadUrl"
:headers ="headers"
:on-success="handleAvatarSuccess"
:before-upload="handleBeforeUpload"
:file-list="fileList"
......@@ -64,6 +65,7 @@ export default {
return {
uploadUrl:'http://192.168.110.67/mall/file/upload/allType',
formVisible: false,
headers:{Authorization: localStorage.getItem('backToken')},
formItem: {},
fileList: [],
rules: {
......
......@@ -14,6 +14,7 @@
action="http://192.168.110.67/mall/file/image/upload"
:on-success="uploadPageImg"
:before-upload="handleBeforeUpload"
:headers ="headers"
:file-list="dirList"
>
<el-button type="default">上传背景图</el-button>
......@@ -45,6 +46,7 @@
action="http://192.168.110.67/mall/file/image/upload"
:on-success="uploadRunImg"
:before-upload="handleBeforeUpload"
:headers ="headers"
:file-list="fileRunList"
>
<el-button type="default">上传背景图</el-button>
......@@ -86,6 +88,7 @@ export default {
components: { Swiper, SwiperSlide },
data() {
return {
headers:{Authorization: localStorage.getItem('backToken')},
radioPage: "", // 选中项
radioRun: "",
dirList: [], // 上传列表
......
......@@ -23,20 +23,25 @@
<script>
export default {
props:{
fileList:{
type:Array,
default:[]
},
},
data() {
return {
filedata:[],
filedata: [],
fileArr: [],
fileList:[],
// fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
};
},
mounted(){
console.log("uploadAudio",this.fileList)
},
methods: {
submitUpload() { // 导入
let tempData = this.filedata
submitUpload() {
this.filedata = new FormData() // 用FormData存放上传文件
this.$refs.upload.submit() // 会循环调用uploadFile方法,多个文件调用多次
let _this = this;
_this
.$https(
......@@ -52,15 +57,13 @@ export default {
console.log(res)
if (resData.resultCode == "200") {
// alert("上传成功");
console.log(resData.data.fileList)
const data = resData.data.fileList
console.log(data)
let newArray = data.map((item) => {
return item.id;
})
this.$emit('audioList', newArray)
let newArray = data.map((item) => item.id)
let editArray =[]
if(this.fileList.length){
editArray = this.fileList.map(item=>item.id)
}
this.$emit('audioList', [...newArray,...editArray])
} else {
_this.$message.error(resData.msg || resData.message);
}
......
<template>
<div>
<!-- accept="application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
<div>
<!-- accept="application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
<!-- :show-file-list="false" -->
<!-- :file-list="fileList" -->
<!-- action="http://192.168.110.67/mall/file/video/content/upload" -->
......@@ -14,28 +14,37 @@
:before-upload="beforeAvatarUpload"
>
<i class="el-icon-plus fileUpload"></i>
</el-upload>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
</div>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>上传到服务器</el-button
>
</div>
</template>
<script>
export default {
props:{
fileList:{
type:Array,
default:[]
},
},
data() {
return {
filedata:[],
filedata: [],
fileArr: [],
fileList:[],
// fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
};
},
mounted(){
},
methods: {
submitUpload() { // 导入
let tempData = this.filedata
this.filedata = new FormData() // 用FormData存放上传文件
this.$refs.upload.submit() // 会循环调用uploadFile方法,多个文件调用多次
submitUpload() {
this.filedata = new FormData(); // 用FormData存放上传文件
this.$refs.upload.submit(); // 会循环调用uploadFile方法,多个文件调用多次
let _this = this;
_this
......@@ -43,37 +52,31 @@ export default {
{
method: "post",
url: "file/datum/upload",
authType: this.backToken
authType: this.backToken,
},
this.filedata
)
.then(res => {
.then((res) => {
let resData = res.data;
console.log(res)
if (resData.resultCode == "200") {
// alert("上传成功");
console.log(resData.data.fileList)
const data = resData.data.fileList
console.log(data)
let newArray = data.map((item) => {
return item.id;
})
this.$emit('datumList', newArray)
const data = resData.data.fileList;
let newArray = data.map((item) => item.id);
let editArray =[]
if(this.fileList.length){
editArray = this.fileList.map(item=>item.id)
}
this.$emit("datumList", [...newArray,...editArray]);
} else {
_this.$message.error(resData.msg || resData.message);
}
})
.catch(err => {
.catch((err) => {
console.log(err);
_this.$message.error(err.msg || err.message);
});
},
uploadFile(file) {
this.filedata.append('file', file.file)
this.filedata.append("file", file.file);
},
beforeAvatarUpload(file) {
const isLt5M = file.size / 1024 / 1024 < 5;
......@@ -81,8 +84,8 @@ export default {
this.$message.error("上传文件大小不能超过 5MB!");
}
return isLt5M;
}
}
},
},
};
</script>
......
......@@ -7,6 +7,9 @@
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:headers="headers"
:file-list="fileList"
:limit="1"
:multiple ="false"
>
<i class="el-icon-plus"></i>
</el-upload>
......@@ -18,6 +21,12 @@
<script>
export default {
props:{
fileList:{
type:Array,
default:[]
},
},
data() {
return {
dialogImageUrl: "",
......@@ -26,18 +35,13 @@ export default {
},
computed: {
headers() {
// return { 'token': this.backToken }
return {Authorization: localStorage.getItem('backToken')}
}
},
methods: {
// 图片上传成功的返回值
handleAvatarSuccess(res, file) {
console.log(res)
console.log(res.data.url)
this.$emit('imgUrl', res.data.url)
// console.log(data.fileList[0].url)
// this.imageUrl = URL.createObjectURL(file.raw);
},
handleRemove(file, fileList) {
console.log(file, fileList);
......
......@@ -7,6 +7,9 @@
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:headers="headers"
:file-list="fileList"
:limit="1"
:multiple ="false"
>
<i class="el-icon-plus"></i>
</el-upload>
......@@ -18,6 +21,12 @@
<script>
export default {
props:{
fileList:{
type:Array,
default:[]
},
},
data() {
return {
dialogImageUrl: "",
......@@ -26,7 +35,7 @@ export default {
},
computed: {
headers() {
// return { 'token': this.backToken }
return {Authorization: localStorage.getItem('backToken')}
}
},
methods: {
......
This diff is collapsed.
This diff is collapsed.
......@@ -272,19 +272,6 @@ export default {
},
reviewFile() {
console.log("点击预览。。。");
// const _this = this;
// this.$confirm("确定要下载该文件?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// center: true,
// })
// .then(() => {
// this.updateVersion(row);
// })
// .catch(() => {
// this.$message("已取消");
// });
},
close() {
this.$router.go(-1);
......
This diff is collapsed.
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