Commit 4c209615 by 莫晓莉

栏目

parent 0e1aa75a
...@@ -752,12 +752,13 @@ ...@@ -752,12 +752,13 @@
class="upload-demo" class="upload-demo"
ref="fileUpload" ref="fileUpload"
multiple multiple
:file-list="fileList" :file-list="fileListEdit"
:auto-upload="false" :auto-upload="false"
action="#" action="#"
name="fileList" name="fileList"
:show-file-list="true" :show-file-list="true"
:on-change="uploadSuccess" :on-change="uploadSuccessEdit"
:on-remove="handleRemoveEdit"
> >
<el-button class="area-btn" > <el-button class="area-btn" >
浏览文件 浏览文件
...@@ -1476,10 +1477,37 @@ export default { ...@@ -1476,10 +1477,37 @@ export default {
this.fileList = list; this.fileList = list;
console.log('fileList----',this.fileList); console.log('fileList----',this.fileList);
}, },
handleRemove(file, list){ handleRemove(file, list){
console.log('fileListHandleRemove----',list); console.log('fileListHandleRemove----',list);
this.fileList = list; this.fileList = list;
}, },
//上传附件--编辑
uploadSuccessEdit(file, list) {
this.fileListEdit = list;
console.log('fileList----',this.fileListEdit);
},
handleRemoveEdit(file, list){
console.log('fileListHandleRemove----',list);
this.fileListEdit = list;
// for (var j = 0; j < this.fileListEdit.length; j++) {
// // 含 status: ready 表示该附件为新增附件
// if (this.fileListEdit[j].status == 'ready') {
// if (this.fileListEdit[j].uid == file.uid) {
// this.fileListEdit.splice(j, 1)
// console.log('-=-==-==-=-=-==-=--删除新增附件', this.fileList)
// break
// }
// } else if (this.fileListEdit[j].status == 'success') {
// if (this.fileListEdit[j].id == file.id) {
// this.fileListEdit.splice(j, 1)
// console.log('-=-==-==-=-=-==-=--删除原附件', this.fileListEdit)
// this.delFileList.push(file.id)
// break
// }
// }
// }
},
// 发布新闻 // 发布新闻
createNewsEvent(num){ createNewsEvent(num){
// params.publish=num;// 然后是publish ,点击发布的话是1,提交审核是4,保存是5 // params.publish=num;// 然后是publish ,点击发布的话是1,提交审核是4,保存是5
...@@ -1502,6 +1530,7 @@ export default { ...@@ -1502,6 +1530,7 @@ export default {
this.fileList.forEach(item=>{ this.fileList.forEach(item=>{
formData.append('fileList', item.raw) formData.append('fileList', item.raw)
}) })
formData.append('publish',num);// 然后是publish ,点击发布的话是1,提交审核是4,保存是5 formData.append('publish',num);// 然后是publish ,点击发布的话是1,提交审核是4,保存是5
...@@ -1533,8 +1562,29 @@ export default { ...@@ -1533,8 +1562,29 @@ export default {
formData.append(key,this.newsFormEdit[key]) formData.append(key,this.newsFormEdit[key])
} }
// formData.append('content', this.htmlContent); // formData.append('content', this.htmlContent);
this.fileList.forEach(item=>{ // this.fileList.forEach(item=>{
formData.append('fileList', item.raw) // formData.append('fileList', item.raw)
// })
// if (this.delFileList.length != 0) {
// for (var i = 0; i < this.delFileList.length; i++) {
// noteFileDelete(this.delFileList[i]).then((res) => {
// if (res.success) {
// console.log('-=-=-=-=-=-=-=-=-==-===-=-=删除附件', res)
// }
// })
// }
// }
console.log('-=-=-=-=-=-=-=--=需提交的附件列表1', this.fileListEdit)
this.fileListEdit = [...new Set(this.fileListEdit)]
this.fileListEdit.forEach((item) => {
if (item.raw) {
formData.append('fileList', item.raw)
console.log(11111)
} else {
formData.append('fileList', item)
console.log(2222)
}
console.log('-=-=-=-=-=-=-=--=需提交的附件列表', formData.get('fileList'))
}) })
formData.append('publish',num);// 然后是publish ,点击发布的话是1,提交审核是4,保存是5 formData.append('publish',num);// 然后是publish ,点击发布的话是1,提交审核是4,保存是5
...@@ -1543,10 +1593,14 @@ export default { ...@@ -1543,10 +1593,14 @@ export default {
updateNews(formData).then(res=>{ updateNews(formData).then(res=>{
if(res.success){ if(res.success){
this.$message({ this.$message({
message: '添加信息成功!', message: '修改信息成功!',
type: 'success' type: 'success'
}); });
} }
//关闭弹窗
this.editVisible=false;
//刷新列表
this.getManageList();
}) })
}, },
// handleClick(tab, event) { // handleClick(tab, event) {
...@@ -1603,11 +1657,13 @@ export default { ...@@ -1603,11 +1657,13 @@ export default {
let{newsDetail,attachList}=res.data; let{newsDetail,attachList}=res.data;
// this.newsListDetail=res.data; // this.newsListDetail=res.data;
this.newsFormEdit=newsDetail; this.newsFormEdit=newsDetail;
this.fileList=attachList;
this.fileListEdit=attachList;
console.log('新闻详情this.fileList===',this.fileListEdit);
if (attachList.length >0) { if (attachList.length >0) {
//显示已上传附件列表 //显示已上传附件列表
for (let i = 0; i < this.fileList.length; i++) { for (let i = 0; i < this.fileListEdit.length; i++) {
this.fileList[i].name = this.fileList[i].attachName this.fileListEdit[i].name = this.fileListEdit[i].attachName
} }
} }
} }
......
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