|
|
@ -32,7 +32,6 @@ |
|
|
|
</el-aside> |
|
|
|
</el-aside> |
|
|
|
<!-- 新闻内容--> |
|
|
|
<!-- 新闻内容--> |
|
|
|
<el-main> |
|
|
|
<el-main> |
|
|
|
<div class="mainContainer"> |
|
|
|
|
|
|
|
<div class="card-header"> |
|
|
|
<div class="card-header"> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<div style="height:33px"> |
|
|
|
<div style="height:33px"> |
|
|
@ -53,7 +52,6 @@ |
|
|
|
<span>{{ nowTimeNewsData.content }}</span> |
|
|
|
<span>{{ nowTimeNewsData.content }}</span> |
|
|
|
</el-scrollbar> |
|
|
|
</el-scrollbar> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</el-main> |
|
|
|
</el-main> |
|
|
|
</el-container> |
|
|
|
</el-container> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -65,6 +63,7 @@ import { |
|
|
|
queryEssay, |
|
|
|
queryEssay, |
|
|
|
} from "@/api/user/news.js" |
|
|
|
} from "@/api/user/news.js" |
|
|
|
import {ref,onMounted} from 'vue'; |
|
|
|
import {ref,onMounted} from 'vue'; |
|
|
|
|
|
|
|
import {ElMessage} from 'element-plus' |
|
|
|
import useUserStore from "@/store/modules/user"; |
|
|
|
import useUserStore from "@/store/modules/user"; |
|
|
|
import {useRouter} from "vue-router"; |
|
|
|
import {useRouter} from "vue-router"; |
|
|
|
const router = useRouter(); |
|
|
|
const router = useRouter(); |
|
|
@ -74,6 +73,13 @@ const column =ref([]) |
|
|
|
const CategoryList = async () => { |
|
|
|
const CategoryList = async () => { |
|
|
|
const res = await queryCategory() |
|
|
|
const res = await queryCategory() |
|
|
|
column.value = res.data |
|
|
|
column.value = res.data |
|
|
|
|
|
|
|
console.log('栏目数组长度:',column.value.length) |
|
|
|
|
|
|
|
// 初始化时加载第一个栏目的第一条新闻 |
|
|
|
|
|
|
|
if (column.value.length > 0) { |
|
|
|
|
|
|
|
await EssayList(column.value[0].id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await ElMessage.warning('没有找到任何栏目!'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 渲染 |
|
|
|
// 渲染 |
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
@ -81,10 +87,7 @@ onMounted(() => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
const essay = ref([]) |
|
|
|
const essay = ref([]) |
|
|
|
const nowTimeNewsData = ref({}) |
|
|
|
const nowTimeNewsData = ref({}) |
|
|
|
//新闻详细信息获取 |
|
|
|
|
|
|
|
const newViews = (listObject)=> { |
|
|
|
|
|
|
|
nowTimeNewsData.value = { ...listObject } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//新闻文章查询 |
|
|
|
//新闻文章查询 |
|
|
|
const EssayList = async (id)=>{ |
|
|
|
const EssayList = async (id)=>{ |
|
|
|
const response = await queryEssay(id) |
|
|
|
const response = await queryEssay(id) |
|
|
@ -93,8 +96,11 @@ const EssayList = async (id)=>{ |
|
|
|
newViews(essay.value[0]); // 显示第一条新闻 |
|
|
|
newViews(essay.value[0]); // 显示第一条新闻 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//新闻详细信息获取 |
|
|
|
|
|
|
|
const newViews = (listObject)=> { |
|
|
|
|
|
|
|
nowTimeNewsData.value = { ...listObject } |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
<style scoped> |
|
|
|
.header_title{ |
|
|
|
.header_title{ |
|
|
|
font-size: 30px; |
|
|
|
font-size: 30px; |
|
|
@ -103,10 +109,7 @@ const EssayList = async (id)=>{ |
|
|
|
margin: auto; |
|
|
|
margin: auto; |
|
|
|
background-image: linear-gradient(60deg,honeydew,powderblue,honeydew); |
|
|
|
background-image: linear-gradient(60deg,honeydew,powderblue,honeydew); |
|
|
|
} |
|
|
|
} |
|
|
|
.el-aside { |
|
|
|
/*侧边*/ |
|
|
|
height: 100vh; /* 设置高度为视窗高度 */ |
|
|
|
|
|
|
|
overflow-y: auto; /* 当内容超出时显示滚动条 */ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.header-flex-container { |
|
|
|
.header-flex-container { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
/*align-items: center; !* 垂直居中 *!*/ |
|
|
|
/*align-items: center; !* 垂直居中 *!*/ |
|
|
@ -114,18 +117,16 @@ const EssayList = async (id)=>{ |
|
|
|
gap: 10px; |
|
|
|
gap: 10px; |
|
|
|
background: white; |
|
|
|
background: white; |
|
|
|
margin-top: 20px; |
|
|
|
margin-top: 20px; |
|
|
|
height: 81vh; |
|
|
|
height: 810px; |
|
|
|
overflow-y: auto; |
|
|
|
overflow-y: auto; |
|
|
|
} |
|
|
|
} |
|
|
|
.header-flex-container::-webkit-scrollbar { |
|
|
|
.header-flex-container::-webkit-scrollbar { |
|
|
|
width: 0px; /* 滚动条宽度 */ |
|
|
|
width: 0px; /* 滚动条宽度 */ |
|
|
|
} |
|
|
|
} |
|
|
|
.header-list { |
|
|
|
.header-list { |
|
|
|
/*display: flex; !* 使li元素水平排列 *!*/ |
|
|
|
flex-wrap: wrap; |
|
|
|
flex-wrap: wrap; /* 如果需要换行 */ |
|
|
|
margin-left: 50px; |
|
|
|
/*align-items: center; !* 如果需要,也可以使li元素垂直居中 *!*/ |
|
|
|
padding: 0; |
|
|
|
margin: 0; /* 移除默认外边距 */ |
|
|
|
|
|
|
|
padding: 0; /* 移除默认内边距 */ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.header-list span{ |
|
|
|
.header-list span{ |
|
|
|
font-size: 17px; |
|
|
|
font-size: 17px; |
|
|
@ -146,6 +147,17 @@ const EssayList = async (id)=>{ |
|
|
|
.header-column span{ |
|
|
|
.header-column span{ |
|
|
|
color: #222222; |
|
|
|
color: #222222; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*内容*/ |
|
|
|
|
|
|
|
.scrollbarContent{ |
|
|
|
|
|
|
|
height:680px; |
|
|
|
|
|
|
|
border: 1px; |
|
|
|
|
|
|
|
background: white; |
|
|
|
|
|
|
|
border-radius: 1%; |
|
|
|
|
|
|
|
font-size: 20px; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
|
line-height: 2.0; |
|
|
|
|
|
|
|
} |
|
|
|
.contentTitle{ |
|
|
|
.contentTitle{ |
|
|
|
color: firebrick; |
|
|
|
color: firebrick; |
|
|
|
font-size: 30px; |
|
|
|
font-size: 30px; |
|
|
@ -178,14 +190,5 @@ const EssayList = async (id)=>{ |
|
|
|
.flex-container p:last-child { |
|
|
|
.flex-container p:last-child { |
|
|
|
margin-right: 0; |
|
|
|
margin-right: 0; |
|
|
|
} |
|
|
|
} |
|
|
|
.scrollbarContent{ |
|
|
|
|
|
|
|
height:68vh; |
|
|
|
|
|
|
|
border: 1px; |
|
|
|
|
|
|
|
background: white; |
|
|
|
|
|
|
|
border-radius: 1%; |
|
|
|
|
|
|
|
font-size: 20px; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
|
line-height: 2.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |