Compare commits

..

No commits in common. '0e3d77019e19b1a606bcf4114267f22814c7c68b' and 'ffaef9724e2bbc869826ecd78198c18af354e014' have entirely different histories.

  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,12 +32,9 @@ export function queryEssay(category_id) {
return request.get(`/api/cms-essay/query?category_id=${category_id}`); return request.get(`/api/cms-essay/query?category_id=${category_id}`);
} }
//添加新闻文章 //添加新闻文章
// export function addEssay(params){ export function addEssay(params){
// const str = parseParams(params) const str = parseParams(params)
// return request.post(`/api/cms-essay/add${str}`) return request.post(`/api/cms-essay/add${str}`)
// }
export function addEssay(params) {
return request.post(`/api/cms-essay/add`, params);
} }
//删除新闻 //删除新闻
export function deleteEssay(ids) { export function deleteEssay(ids) {
@ -46,8 +43,4 @@ export function deleteEssay(ids) {
//修改新闻 //修改新闻
export function editEssay(params) { export function editEssay(params) {
return request.put(`/api/cms-essay/edit`, 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,10 +193,7 @@ const sendContent = ()=>{
// //
const handleClick = (item)=> { const handleClick = (item)=> {
// // console.log(item)
if(!item.isRead){
readMessage(item.id)
}
// //
router.push({ path: '/messageContentList', query: item }) router.push({ path: '/messageContentList', query: item })
} }

@ -89,7 +89,7 @@
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="aboutContent" type="success" style="margin-right: 30px;font-size: 15px" plain>关于我们</el-button> <el-link href="" target="_blank" style="margin-right: 30px;font-size: 19px">关于我们</el-link>
<el-button type="primary" @click="addNewsContentConfirm"> <el-button type="primary" @click="addNewsContentConfirm">
提交 提交
</el-button> </el-button>
@ -202,19 +202,6 @@
</div> </div>
</template> </template>
</el-drawer> </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> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -226,8 +213,7 @@ import {
editStatus, editStatus,
queryEssay, queryEssay,
deleteEssay, deleteEssay,
editEssay, editEssay
queryEssayById
} from "@/api/user/news.js" } from "@/api/user/news.js"
import {ref,onMounted} from 'vue'; import {ref,onMounted} from 'vue';
import {ElButton,ElDrawer, ElMessageBox, ElMessage} from 'element-plus' import {ElButton,ElDrawer, ElMessageBox, ElMessage} from 'element-plus'
@ -240,7 +226,6 @@ const drawer = ref(false)
const nowColumnId = ref() const nowColumnId = ref()
const nowCategoryName = ref('') const nowCategoryName = ref('')
const addFormVisible = ref(false) const addFormVisible = ref(false)
const aboutContentDrawer = ref(false)
// //
const column =ref([]) const column =ref([])
// //
@ -256,7 +241,7 @@ const nowTimeNewsData = ref({})
// //
const newViews = (listObject)=> { const newViews = (listObject)=> {
nowTimeNewsData.value = { ...listObject } nowTimeNewsData.value = { ...listObject }
// console.log(nowTimeNewsData,'') console.log(nowTimeNewsData,'当前新闻数据')
} }
// //
const form = ref({ const form = ref({
@ -327,7 +312,7 @@ const EssayList = async (id)=>{
if (essay.value.length > 0) { if (essay.value.length > 0) {
newViews(essay.value[0]); // newViews(essay.value[0]); //
} }
// console.log(essay.value,'') console.log(essay.value,'essay')
} }
// //
const deleteNewsList = async (id)=>{ const deleteNewsList = async (id)=>{
@ -398,26 +383,6 @@ 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> </script>
<style scoped> <style scoped>
@ -531,6 +496,7 @@ const editConfirm =async ()=>{
justify-content: space-between; /* 主轴上平均分配剩余空间 */ justify-content: space-between; /* 主轴上平均分配剩余空间 */
align-items: center; /* 交叉轴上居中对齐 */ align-items: center; /* 交叉轴上居中对齐 */
} }
.card-header span { .card-header span {
flex: 1; /* 使 span 占用可用空间,实现居中效果 */ flex: 1; /* 使 span 占用可用空间,实现居中效果 */
text-align: center; /* 文本居中 */ text-align: center; /* 文本居中 */
@ -538,6 +504,6 @@ const editConfirm =async ()=>{
} }
.dialog-footer{ .dialog-footer{
display: flex; display: flex;
justify-content: space-between; justify-content: flex-end;
} }
</style> </style>

@ -10,7 +10,7 @@
<li v-for="item in column"> <li v-for="item in column">
<el-dropdown placement="right"> <el-dropdown placement="right">
<div class="header-column" type="primary"> <div class="header-column" type="primary">
<span @mouseenter="EssayList(item.id)">{{ item.categoryName }}</span> <span @mouseenter="EssayList(item.id)">{{ item.categoryName }}</span> <!-- 使用span代替p -->
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
@ -49,8 +49,7 @@
</div> </div>
<div style="text-align: center"> <div style="text-align: center">
<el-scrollbar class="scrollbarContent"> <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> </el-scrollbar>
</div> </div>
</el-main> </el-main>

Loading…
Cancel
Save