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

修改展板内容

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