diff --git a/backend/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java b/backend/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java index aeea607..5fbb48c 100644 --- a/backend/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java +++ b/backend/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java @@ -27,6 +27,9 @@ public class CmsEssayServiceImpl extends ServiceImpl i public BaseResponse addEssay(CmsEssay cmsEssay) { //设置文章发布时间 cmsEssay.setPublishTime(LocalDate.now()); + //设置发布人姓名 +// String nickName = userService.getById(cmsEssay.getUserId()).getNickName(); +// cmsEssay.setUsername(nickName); //如果数据库里没有文章,文章id设为2 Long count = query().count(); if (count == 0){ diff --git a/teaching_integration_platform_admin_template/.env.development b/teaching_integration_platform_admin_template/.env.development index 98dfa78..9eff337 100644 --- a/teaching_integration_platform_admin_template/.env.development +++ b/teaching_integration_platform_admin_template/.env.development @@ -1,5 +1,5 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 NODE_ENV = 'development' VITE_APP_TITLE = '无糖运营平台' -# VITE_APP_BASE_API = 'http://127.0.0.1:8080' -VITE_APP_BASE_API = 'http://39.106.16.162:8080' \ No newline at end of file +VITE_APP_BASE_API = 'http://127.0.0.1:8080' +# VITE_APP_BASE_API = 'http://39.106.16.162:8080' \ No newline at end of file diff --git a/teaching_integration_platform_admin_template/src/api/user/news.js b/teaching_integration_platform_admin_template/src/api/user/news.js index 5c8a527..9d00b05 100644 --- a/teaching_integration_platform_admin_template/src/api/user/news.js +++ b/teaching_integration_platform_admin_template/src/api/user/news.js @@ -9,7 +9,7 @@ export function deleteCategory(ids) { } //编辑栏目 export function editStatus(params) { - return request.put(`/api/cms-category/edit/status`, params); + return request.put(`/api/cms-category/edit/status`, {},{params}); } //添加栏目 function parseParams(params){ @@ -26,6 +26,7 @@ function parseParams(params){ export function addCategory(params) { const str = parseParams(params) return request.post(`/api/cms-category/add${str}`); + // return request.post(`/api/cms-category/add`,{},{params}); } //查询新闻文章 export function queryEssay(category_id) { diff --git a/teaching_integration_platform_admin_template/src/views/message/index.vue b/teaching_integration_platform_admin_template/src/views/message/index.vue index 393c3c9..aa9b714 100644 --- a/teaching_integration_platform_admin_template/src/views/message/index.vue +++ b/teaching_integration_platform_admin_template/src/views/message/index.vue @@ -158,15 +158,7 @@ const deleteMessage = async (id: any) => { await getMessageList() } -//一键已读 -const readMessage = async (id:any) =>{ - // console.log(id,userStore.data.id,'dddddd') - await readMessagesBatch({ - messageIds:id, - userId:userStore.data.id - }) - await getMessageList() -} + // 分页 const handleSizeChange = (size: any) => { // loading.value = true @@ -191,8 +183,15 @@ const editContent =()=>{ const sendContent = ()=>{ router.push('/messageManagement/sendMessage') } - -// 消息事件点击 +//已读 +const readMessage = async (id:any) =>{ + await readMessagesBatch({ + messageIds:id, + userId:userStore.data.id + }) + await getMessageList() +} +// 消息事件点击已读 const handleClick = (item)=> { //查看消息切换已读状态 if(!item.isRead){ diff --git a/teaching_integration_platform_admin_template/src/views/myMessage/index.vue b/teaching_integration_platform_admin_template/src/views/myMessage/index.vue index ef746e7..b1b51ab 100644 --- a/teaching_integration_platform_admin_template/src/views/myMessage/index.vue +++ b/teaching_integration_platform_admin_template/src/views/myMessage/index.vue @@ -70,14 +70,14 @@ const userStore = useUserStore() const params = ref({ userId: userStore.data.id, // userId: 4, - isAsc:true, + isAsc:false, isDelete:0, isRead:'', isSend:1, // messageId:false, pageNo:1, pageSize:5, - sortBy:false,//排序字段 + //sortBy:false,排序字段 }) const total = ref(0) const Message = ref([]) diff --git a/teaching_integration_platform_admin_template/src/views/news/components/newsContentManage.vue b/teaching_integration_platform_admin_template/src/views/news/components/newsContentManage.vue index efab5f0..7484686 100644 --- a/teaching_integration_platform_admin_template/src/views/news/components/newsContentManage.vue +++ b/teaching_integration_platform_admin_template/src/views/news/components/newsContentManage.vue @@ -5,7 +5,6 @@
-
栏目管理 @@ -60,7 +59,7 @@ @@ -79,8 +78,8 @@ - - + + @@ -102,17 +101,18 @@ 栏目编辑
- 添加新闻栏目 + 添加新闻栏目
- - - + + + @@ -130,11 +130,14 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -171,7 +208,7 @@ - + @@ -225,6 +262,7 @@ const drawer = ref(false) const nowColumnId = ref() const nowCategoryName = ref('') const addFormVisible = ref(false) +const editStatusVisible = ref(false) const aboutContentDrawer = ref(false) //存取栏目信息 const column =ref([]) @@ -237,11 +275,10 @@ const addNewsButton = (item)=>{ nowCategoryName.value = item.categoryName } const nowTimeNewsData = ref({}) -console.log(userStore.data,'当前用户数据') //新闻详细信息获取 const newViews = (listObject)=> { nowTimeNewsData.value = { ...listObject } - console.log(nowTimeNewsData,'当前新闻数据') + // console.log(nowTimeNewsData,'当前新闻数据') } //栏目 const form = ref({ @@ -254,7 +291,14 @@ const form = ref({ status:'', updateTime:'' }) - +//编辑栏目信息 +const editForm = ref({ + id: '', + categoryName: '', + categoryPid: '', + creatorId: '', + status: '' +}); //获取栏目信息 const CategoryList = async () => { const res = await queryCategory() @@ -304,6 +348,33 @@ const deleteHandle = async (id)=>{ }) await CategoryList() } +//栏目状态编辑 +const editStatusHandle = (row) => { + editForm.value = { + id: row.id, + categoryName: row.categoryName, + categoryPid: row.categoryPid, + creatorId: row.creatorId, + status: row.status + }; + editStatusVisible.value = true; +}; +//栏目内容编辑后提交 +const confirmEdit = async ()=>{ + await editStatus({ + id:editForm.value.id, + categoryName:editForm.value.categoryName, + categoryPid: editForm.value.categoryPid, + creatorId: editForm.value.creatorId, + status: editForm.value.status + }).then(()=>{ + CategoryList() + ElMessage({ + message:'修改成功', + type:'success' + }) + }) +} //新闻文章查询 const EssayList = async (id)=>{ const response = await queryEssay(id) diff --git a/teaching_integration_platform_admin_template/src/views/news/index.vue b/teaching_integration_platform_admin_template/src/views/news/index.vue index e791d7d..d4f6361 100644 --- a/teaching_integration_platform_admin_template/src/views/news/index.vue +++ b/teaching_integration_platform_admin_template/src/views/news/index.vue @@ -49,7 +49,6 @@
-
@@ -73,7 +72,9 @@ const column =ref([]) //获取栏目信息 const CategoryList = async () => { const res = await queryCategory() - column.value = res.data + // 过滤状态为 1 的栏目 + const showColumns = res.data.filter(column => column.status === 1); + column.value = showColumns; // 初始化时加载第一个栏目的第一条新闻 if (column.value.length > 0) { await EssayList(column.value[0].id); @@ -93,12 +94,21 @@ const newViews = (listObject)=> { nowTimeNewsData.value = { ...listObject } console.log(nowTimeNewsData,'当前点击新闻详细内容') } -//新闻文章查询 -const EssayList = async (id)=>{ - const response = await queryEssay(id) - essay.value = response.data - if (essay.value.length > 0) { - newViews(essay.value[0]); // 显示第一条新闻 +// 新闻文章查询 +const EssayList = async (id) => { + try { + const response = await queryEssay(id); + // 过滤状态为1的新闻条目 + const filteredEssays = response.data.filter((item) => item.status === 1); + essay.value = filteredEssays; + // 如果过滤后的列表有内容,则显示第一条新闻 + if (essay.value.length > 0) { + newViews(essay.value[0]); // 显示第一条新闻 + } else { + ElMessage.warning('此栏目下没有可用的新闻!'); + } + } catch (error) { + ElMessage.error('获取新闻列表失败,请稍后再试!'); } } diff --git a/teaching_integration_platform_template/src/views/pedagogicalReform/index.vue b/teaching_integration_platform_template/src/views/pedagogicalReform/index.vue index 6cc5eed..a7df07d 100644 --- a/teaching_integration_platform_template/src/views/pedagogicalReform/index.vue +++ b/teaching_integration_platform_template/src/views/pedagogicalReform/index.vue @@ -30,36 +30,27 @@ diff --git a/teaching_integration_platform_template/src/views/scientificResearch/index.vue b/teaching_integration_platform_template/src/views/scientificResearch/index.vue index b6ecef6..51f839f 100644 --- a/teaching_integration_platform_template/src/views/scientificResearch/index.vue +++ b/teaching_integration_platform_template/src/views/scientificResearch/index.vue @@ -7,12 +7,8 @@
-
- - -