|
|
|
@ -6,9 +6,11 @@ |
|
|
|
|
<el-container> |
|
|
|
|
<el-aside> |
|
|
|
|
<div class="header-flex-container"> |
|
|
|
|
<div> |
|
|
|
|
<el-button class="button-container_column" @click="editHandle" type="primary" plain round>栏目管理</el-button> |
|
|
|
|
<div class="column-manage"> |
|
|
|
|
<span>栏目</span> |
|
|
|
|
<el-button style="margin-left: 20px;margin-bottom: 8px" @click="editHandle" type="primary" plain round>栏目管理</el-button> |
|
|
|
|
</div> |
|
|
|
|
<el-divider/> |
|
|
|
|
<ul class="header-list"> |
|
|
|
|
<li v-for="item in column"> |
|
|
|
|
<el-dropdown placement="right"> |
|
|
|
@ -32,7 +34,7 @@ |
|
|
|
|
</ul> |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<div class="add-news-button"> |
|
|
|
|
<el-button @click="addNewsButton(item)" type="success" style="margin-bottom: 10px" plain round>添加当前栏目新闻</el-button> |
|
|
|
|
<el-button @click="addNewsButton(item)" type="success" style="margin-bottom: 10px" plain >添加{{item.categoryName}}栏目新闻</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dropdown-menu> |
|
|
|
|
</template> |
|
|
|
@ -46,7 +48,7 @@ |
|
|
|
|
<el-card class="container"> |
|
|
|
|
<template #header> |
|
|
|
|
<div class="card-header"> |
|
|
|
|
<span>添加当前栏目新闻信息</span> |
|
|
|
|
<span>添加新闻信息</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<!-- 栏目内添加新闻--> |
|
|
|
@ -59,7 +61,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章内容" label-width="120px"> |
|
|
|
|
<textarea style="width: 100%; |
|
|
|
|
height:425px; |
|
|
|
|
height:452px; |
|
|
|
|
border: 2px solid #d3d3d3;" |
|
|
|
|
v-model="newsForm.content" |
|
|
|
|
></textarea> |
|
|
|
@ -73,9 +75,9 @@ |
|
|
|
|
<!-- <el-form-item label="所属栏目id" label-width="120px">--> |
|
|
|
|
<!-- <el-input v-model="newsForm.categoryId" autocomplete="off" style="width: 200px" readonly/>--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<el-form-item label="浏览次数" label-width="120px"> |
|
|
|
|
<el-input v-model="newsForm.readingNumber" autocomplete="off" style="width: 200px"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<!-- <el-form-item label="浏览次数" label-width="120px">--> |
|
|
|
|
<!-- <el-input v-model="newsForm.readingNumber" autocomplete="off" style="width: 200px"/>--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<el-form-item label="发布状态" label-width="120px"> |
|
|
|
|
<el-select v-model="newsForm.status" placeholder="请选择发布状态" style="width: 200px"> |
|
|
|
|
<el-option label="直接发布" value="1" /> |
|
|
|
@ -133,7 +135,7 @@ |
|
|
|
|
<!-- <el-form-item label="排序" label-width="140px">--> |
|
|
|
|
<!-- <el-input v-model="form.sort" autocomplete="off" />--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<el-form-item label="发布状态" label-width="140px"> |
|
|
|
|
<el-form-item label="栏目显示状态" label-width="140px"> |
|
|
|
|
<el-select v-model="form.status" placeholder="请选择显示状态" style="width: 200px"> |
|
|
|
|
<el-option label="显示" value="1" /> |
|
|
|
|
<el-option label="不显示" value="0" /> |
|
|
|
@ -167,7 +169,7 @@ |
|
|
|
|
<!-- <el-form-item label="排序" label-width="140px">--> |
|
|
|
|
<!-- <el-input v-model="" autocomplete="off" />--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<el-form-item label="发布状态" label-width="140px"> |
|
|
|
|
<el-form-item label="栏目显示状态" label-width="140px"> |
|
|
|
|
<el-select v-model="editForm.status" placeholder="请选择显示状态" style="width: 200px"> |
|
|
|
|
<el-option label="显示" value="1" /> |
|
|
|
|
<el-option label="不显示" value="0" /> |
|
|
|
@ -273,12 +275,19 @@ const editNewsDialogFormVisible = ref(false) |
|
|
|
|
const addNewsButton = (item)=>{ |
|
|
|
|
nowColumnId.value = item.id |
|
|
|
|
nowCategoryName.value = item.categoryName |
|
|
|
|
resetForm() |
|
|
|
|
} |
|
|
|
|
//重置添加栏目新闻表单 |
|
|
|
|
const resetForm =()=>{ |
|
|
|
|
newsForm.value.title = '' |
|
|
|
|
newsForm.value.content = '' |
|
|
|
|
newsForm.value.status = '' |
|
|
|
|
} |
|
|
|
|
const nowTimeNewsData = ref({}) |
|
|
|
|
//新闻详细信息获取 |
|
|
|
|
const newViews = (listObject)=> { |
|
|
|
|
nowTimeNewsData.value = { ...listObject } |
|
|
|
|
// console.log(nowTimeNewsData,'当前新闻数据') |
|
|
|
|
console.log(nowTimeNewsData,'当前新闻数据') |
|
|
|
|
} |
|
|
|
|
//栏目 |
|
|
|
|
const form = ref({ |
|
|
|
@ -396,28 +405,6 @@ const deleteNewsList = async (id)=>{ |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//修改后新闻提交 |
|
|
|
|
const editNewsContentConfirm = async ()=>{ |
|
|
|
|
editNewsDialogFormVisible.value = false |
|
|
|
|
await editEssay({ |
|
|
|
|
categoryId:nowTimeNewsData.value.categoryId, |
|
|
|
|
content:nowTimeNewsData.value.content, |
|
|
|
|
file:nowTimeNewsData.value.file, |
|
|
|
|
id:nowTimeNewsData.value.id, |
|
|
|
|
pic:nowTimeNewsData.value.pic, |
|
|
|
|
publishTime:nowTimeNewsData.value.publishTime, |
|
|
|
|
readingNumber:nowTimeNewsData.value.readingNumber, |
|
|
|
|
status:nowTimeNewsData.value.status, |
|
|
|
|
title:nowTimeNewsData.value.title, |
|
|
|
|
updateTime:nowTimeNewsData.value.updateTime, |
|
|
|
|
userId:nowTimeNewsData.value.userId |
|
|
|
|
}).then(()=>{ |
|
|
|
|
ElMessage({ |
|
|
|
|
message:'添加成功', |
|
|
|
|
type:'success' |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//新闻 |
|
|
|
|
const newsForm = ref({ |
|
|
|
|
categoryId:nowColumnId, |
|
|
|
@ -436,6 +423,15 @@ const newsForm = ref({ |
|
|
|
|
}) |
|
|
|
|
//新闻文章添加 |
|
|
|
|
const addNewsContentConfirm = async (id)=>{ |
|
|
|
|
// 检查栏目名称是否为空 |
|
|
|
|
if (!newsForm.value.categoryName) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '栏目名不能为空,请从栏目内添加新闻!', |
|
|
|
|
type: 'error' |
|
|
|
|
}); |
|
|
|
|
return; // 阻止进一步执行 |
|
|
|
|
} |
|
|
|
|
// 如果栏目名称不为空,则继续提交表单 |
|
|
|
|
await addEssay({ |
|
|
|
|
categoryId:newsForm.value.categoryId, |
|
|
|
|
content:newsForm.value.content, |
|
|
|
@ -455,13 +451,35 @@ const addNewsContentConfirm = async (id)=>{ |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//修改后新闻提交 |
|
|
|
|
const editNewsContentConfirm = async ()=>{ |
|
|
|
|
editNewsDialogFormVisible.value = false |
|
|
|
|
await editEssay({ |
|
|
|
|
categoryId:nowTimeNewsData.value.categoryId, |
|
|
|
|
content:nowTimeNewsData.value.content, |
|
|
|
|
file:nowTimeNewsData.value.file, |
|
|
|
|
id:nowTimeNewsData.value.id, |
|
|
|
|
pic:nowTimeNewsData.value.pic, |
|
|
|
|
publishTime:nowTimeNewsData.value.publishTime, |
|
|
|
|
readingNumber:nowTimeNewsData.value.readingNumber, |
|
|
|
|
status:nowTimeNewsData.value.status, |
|
|
|
|
title:nowTimeNewsData.value.title, |
|
|
|
|
updateTime:nowTimeNewsData.value.updateTime, |
|
|
|
|
userId:nowTimeNewsData.value.userId |
|
|
|
|
}).then(()=>{ |
|
|
|
|
ElMessage({ |
|
|
|
|
message:'添加成功', |
|
|
|
|
type:'success' |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//关于我们文章 |
|
|
|
|
const aboutEssay = ref('') |
|
|
|
|
const aboutContent = async (essay_id)=>{ |
|
|
|
|
aboutContentDrawer.value = true |
|
|
|
|
const responseEssay = await queryEssayById('1') |
|
|
|
|
aboutEssay.value = responseEssay.data |
|
|
|
|
// console.log(aboutEssay.value,'关于我们文章') |
|
|
|
|
} |
|
|
|
|
//关于我们修改提交 |
|
|
|
|
const editConfirm =async ()=>{ |
|
|
|
@ -490,11 +508,9 @@ const editConfirm =async ()=>{ |
|
|
|
|
overflow-y: auto; /* 当内容超出时显示滚动条 */ |
|
|
|
|
} |
|
|
|
|
.header-flex-container { |
|
|
|
|
display: flex; |
|
|
|
|
/*align-items: center; !* 垂直居中 *!*/ |
|
|
|
|
padding: 20px; |
|
|
|
|
gap: 10px; |
|
|
|
|
background: white; |
|
|
|
|
/*background: powderblue;*/ |
|
|
|
|
margin-top: 20px; |
|
|
|
|
height: 810px; |
|
|
|
|
overflow-y: auto; |
|
|
|
@ -502,10 +518,21 @@ const editConfirm =async ()=>{ |
|
|
|
|
.header-flex-container::-webkit-scrollbar { |
|
|
|
|
width: 0px; /* 滚动条宽度 */ |
|
|
|
|
} |
|
|
|
|
.column-manage{ |
|
|
|
|
/*background: #5ee183;*/ |
|
|
|
|
height: 35px; |
|
|
|
|
} |
|
|
|
|
.column-manage span{ |
|
|
|
|
margin-left: 100px; |
|
|
|
|
font-size: 24px; |
|
|
|
|
line-height: 50px; |
|
|
|
|
color: #4b81d7; |
|
|
|
|
} |
|
|
|
|
.header-list { |
|
|
|
|
flex-wrap: wrap; /* 如果需要换行 */ |
|
|
|
|
margin-left: 40px; /* 移除默认外边距 */ |
|
|
|
|
padding: 0; /* 移除默认内边距 */ |
|
|
|
|
/*background: darkorange;*/ |
|
|
|
|
text-align: center; |
|
|
|
|
} |
|
|
|
|
.header-list span{ |
|
|
|
|
font-size: 17px; |
|
|
|
@ -517,11 +544,13 @@ const editConfirm =async ()=>{ |
|
|
|
|
} |
|
|
|
|
.header-column{ |
|
|
|
|
height:30px; |
|
|
|
|
margin-top: 20px; |
|
|
|
|
margin-right: 80px; |
|
|
|
|
margin-top: 15px; |
|
|
|
|
margin-left: 6px; |
|
|
|
|
padding: 5px; |
|
|
|
|
margin-bottom: 20px; |
|
|
|
|
cursor: pointer; /* 鼠标悬停时显示手指形状,表示可点击 */ |
|
|
|
|
/*background: darkseagreen;*/ |
|
|
|
|
width: 150px; |
|
|
|
|
} |
|
|
|
|
.header-column span{ |
|
|
|
|
color: #222222; |
|
|
|
@ -537,16 +566,11 @@ const editConfirm =async ()=>{ |
|
|
|
|
align-items: center; |
|
|
|
|
flex-direction: row; |
|
|
|
|
} |
|
|
|
|
/* 添加新的类来控制按钮的位置 */ |
|
|
|
|
.button-container { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: flex-end; /* 按钮靠右 */ |
|
|
|
|
align-items: center; /* 垂直居中 */ |
|
|
|
|
} |
|
|
|
|
.button-container_column{ |
|
|
|
|
position:absolute; |
|
|
|
|
margin-left: 180px; |
|
|
|
|
} |
|
|
|
|
.flex-container p { |
|
|
|
|
flex-grow: 1; /* 扩展剩余空间 */ |
|
|
|
|
margin-right: 10px; /* 添加一些右侧间距以避免按钮与文本直接接触 */ |
|
|
|
@ -558,14 +582,16 @@ const editConfirm =async ()=>{ |
|
|
|
|
margin-right: 0; |
|
|
|
|
} |
|
|
|
|
.card-header { |
|
|
|
|
display: flex; /* 使用 Flexbox */ |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; /* 主轴上平均分配剩余空间 */ |
|
|
|
|
align-items: center; /* 交叉轴上居中对齐 */ |
|
|
|
|
height: 42px; |
|
|
|
|
} |
|
|
|
|
.card-header span { |
|
|
|
|
flex: 1; /* 使 span 占用可用空间,实现居中效果 */ |
|
|
|
|
text-align: center; /* 文本居中 */ |
|
|
|
|
font-size: 20px; |
|
|
|
|
text-align: center; |
|
|
|
|
font-size: 25px; |
|
|
|
|
color: #4b81d7; |
|
|
|
|
} |
|
|
|
|
.dialog-footer{ |
|
|
|
|
display: flex; |
|
|
|
|