Compare commits

..

2 Commits

  1. 13
      src/api/user/news.js
  2. 5
      src/views/message/index.vue
  3. 46
      src/views/news/components/newsContentManage.vue
  4. 5
      src/views/news/index.vue

@ -32,9 +32,12 @@ export function queryEssay(category_id) {
return request.get(`/api/cms-essay/query?category_id=${category_id}`);
}
//添加新闻文章
export function addEssay(params){
const str = parseParams(params)
return request.post(`/api/cms-essay/add${str}`)
// export function addEssay(params){
// const str = parseParams(params)
// return request.post(`/api/cms-essay/add${str}`)
// }
export function addEssay(params) {
return request.post(`/api/cms-essay/add`, params);
}
//删除新闻
export function deleteEssay(ids) {
@ -44,3 +47,7 @@ export function deleteEssay(ids) {
export function editEssay(params) {
return request.put(`/api/cms-essay/edit`, params);
}
//根据id查询关于我们文章
export function queryEssayById(essay_id) {
return request.get(`/api/cms-essay/queryessaybyid?essay_id=${essay_id}`);
}

@ -193,7 +193,10 @@ const sendContent = ()=>{
//
const handleClick = (item)=> {
// console.log(item)
//
if(!item.isRead){
readMessage(item.id)
}
//
router.push({ path: '/messageContentList', query: item })
}

@ -89,7 +89,7 @@
</el-form>
<template #footer>
<div class="dialog-footer">
<el-link href="" target="_blank" style="margin-right: 30px;font-size: 19px">关于我们</el-link>
<el-button @click="aboutContent" type="success" style="margin-right: 30px;font-size: 15px" plain>关于我们</el-button>
<el-button type="primary" @click="addNewsContentConfirm">
提交
</el-button>
@ -202,6 +202,19 @@
</div>
</template>
</el-drawer>
<!-- 关于我们文章-->
<el-drawer v-model="aboutContentDrawer" title="I am the title" :with-header="false">
<span>关于我们</span>
<el-divider/>
<el-form-item label="发布时间" label-width="100px">
<el-input v-model="aboutEssay.updateTime" autocomplete="off" readonly disabled/>
</el-form-item>
<el-form-item label="文章内容" label-width="100px">
<textarea v-model="aboutEssay.content" style="width: 100%;height: 75vh"></textarea>
<!-- <el-input class="brief_text" type="textarea" /> -->
</el-form-item>
<el-button @click="editConfirm" style="margin-left:45vh" type="primary" round>提交修改</el-button>
</el-drawer>
</template>
<script setup lang="ts">
@ -213,7 +226,8 @@ import {
editStatus,
queryEssay,
deleteEssay,
editEssay
editEssay,
queryEssayById
} from "@/api/user/news.js"
import {ref,onMounted} from 'vue';
import {ElButton,ElDrawer, ElMessageBox, ElMessage} from 'element-plus'
@ -226,6 +240,7 @@ const drawer = ref(false)
const nowColumnId = ref()
const nowCategoryName = ref('')
const addFormVisible = ref(false)
const aboutContentDrawer = ref(false)
//
const column =ref([])
//
@ -241,7 +256,7 @@ const nowTimeNewsData = ref({})
//
const newViews = (listObject)=> {
nowTimeNewsData.value = { ...listObject }
console.log(nowTimeNewsData,'当前新闻数据')
// console.log(nowTimeNewsData,'')
}
//
const form = ref({
@ -312,7 +327,7 @@ const EssayList = async (id)=>{
if (essay.value.length > 0) {
newViews(essay.value[0]); //
}
console.log(essay.value,'essay')
// console.log(essay.value,'')
}
//
const deleteNewsList = async (id)=>{
@ -383,6 +398,26 @@ const addNewsContentConfirm = async (id)=>{
});
})
}
//
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 ()=>{
await editEssay({
id:aboutEssay.value.id,
content:aboutEssay.value.content
}).then(()=>{
ElMessage({
message:'添加成功',
type:'success'
});
})
}
</script>
<style scoped>
@ -496,7 +531,6 @@ const addNewsContentConfirm = async (id)=>{
justify-content: space-between; /* 主轴上平均分配剩余空间 */
align-items: center; /* 交叉轴上居中对齐 */
}
.card-header span {
flex: 1; /* 使 span 占用可用空间,实现居中效果 */
text-align: center; /* 文本居中 */
@ -504,6 +538,6 @@ const addNewsContentConfirm = async (id)=>{
}
.dialog-footer{
display: flex;
justify-content: flex-end;
justify-content: space-between;
}
</style>

@ -10,7 +10,7 @@
<li v-for="item in column">
<el-dropdown placement="right">
<div class="header-column" type="primary">
<span @mouseenter="EssayList(item.id)">{{ item.categoryName }}</span> <!-- 使用span代替p -->
<span @mouseenter="EssayList(item.id)">{{ item.categoryName }}</span>
</div>
<template #dropdown>
<el-dropdown-menu>
@ -49,7 +49,8 @@
</div>
<div style="text-align: center">
<el-scrollbar class="scrollbarContent">
<span>{{ nowTimeNewsData.content }}</span>
<!-- <span>{{ nowTimeNewsData.content }}</span>-->
<textarea v-model="nowTimeNewsData.content" style="width: 100%;height: 65vh;border: none;"></textarea>
</el-scrollbar>
</div>
</el-main>

Loading…
Cancel
Save