|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="header_title"> |
|
|
|
<div class="header_title" > |
|
|
|
<span>资讯新闻</span> |
|
|
|
<span>资讯新闻</span> |
|
|
|
<el-divider style="width: 800px"/> |
|
|
|
<el-divider style="margin: 30px auto;"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
|
<div class="container"> |
|
|
|
<div class="left"> |
|
|
|
<div class="left"> |
|
|
@ -9,27 +9,27 @@ |
|
|
|
<li v-for="category in column" :key="category.id"> |
|
|
|
<li v-for="category in column" :key="category.id"> |
|
|
|
<div class="box"> |
|
|
|
<div class="box"> |
|
|
|
<div class="categorySty"> |
|
|
|
<div class="categorySty"> |
|
|
|
<span>· {{category.categoryName}}</span> |
|
|
|
<span>· {{ category.categoryName }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<ul v-if="category.essays"> |
|
|
|
<ul v-if="category.essays"> |
|
|
|
<li class="essaySty" v-for="essay in category.essays" :key="essay.id" @click="selectEssay(essay)"> |
|
|
|
<li class="essaySty" v-for="essay in category.essays" :key="essay.id" @click="selectEssay(essay)"> |
|
|
|
<span>{{essay.title}}</span> |
|
|
|
<span>{{ essay.title }}</span> |
|
|
|
<span>{{essay.publishTime}}</span> |
|
|
|
<span>{{ essay.publishTime }}</span> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
<el-divider/> |
|
|
|
<el-divider /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script lang='ts' setup> |
|
|
|
<script lang='ts' setup> |
|
|
|
import { onMounted, reactive, ref, toRefs, watch } from 'vue' |
|
|
|
import { onMounted, reactive, ref, toRefs, watch } from 'vue' |
|
|
|
import {queryCategory,queryEssay} from '@/api/news' |
|
|
|
import { queryCategory, queryEssay } from '@/api/news' |
|
|
|
const column = ref([]) |
|
|
|
const column = ref([]) |
|
|
|
const essayContent = ref({}) |
|
|
|
const essayContent = ref({}) |
|
|
|
//获取栏目信息 |
|
|
|
//获取栏目信息 |
|
|
@ -38,7 +38,7 @@ const CategoryList = async () => { |
|
|
|
column.value = res.data |
|
|
|
column.value = res.data |
|
|
|
// console.log(column.value,'栏目信息') |
|
|
|
// console.log(column.value,'栏目信息') |
|
|
|
} |
|
|
|
} |
|
|
|
const selectEssay =async (essay)=>{ |
|
|
|
const selectEssay = async (essay) => { |
|
|
|
essayContent.value = essay |
|
|
|
essayContent.value = essay |
|
|
|
// console.log(essayContent,'所选文章') |
|
|
|
// console.log(essayContent,'所选文章') |
|
|
|
}; |
|
|
|
}; |
|
|
@ -51,7 +51,7 @@ const fetchCategoriesAndEssays = async () => { |
|
|
|
for (const category of column.value) { |
|
|
|
for (const category of column.value) { |
|
|
|
const essaysResponse = await queryEssay(category.id); |
|
|
|
const essaysResponse = await queryEssay(category.id); |
|
|
|
category.essays = essaysResponse.data || []; |
|
|
|
category.essays = essaysResponse.data || []; |
|
|
|
console.log(category.essays,'s') |
|
|
|
console.log(category.essays, 's') |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
console.error('查找信息失败', error); |
|
|
|
console.error('查找信息失败', error); |
|
|
@ -64,52 +64,64 @@ onMounted(() => { |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
<style scoped> |
|
|
|
.header_title{ |
|
|
|
.header_title { |
|
|
|
font-size: 20px; |
|
|
|
font-size: 25px; |
|
|
|
color: dodgerblue; |
|
|
|
color: #293352; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
font-weight: bold; |
|
|
|
font-weight: bold; |
|
|
|
margin-left:490px; |
|
|
|
|
|
|
|
margin-top: 30px; |
|
|
|
margin-top: 30px; |
|
|
|
} |
|
|
|
} |
|
|
|
.left{ |
|
|
|
|
|
|
|
margin-left: 600px; |
|
|
|
/* .left { |
|
|
|
margin-top: 10px; |
|
|
|
/* margin-left: 600px; |
|
|
|
height: 85vh; |
|
|
|
margin-top: 10px; */ |
|
|
|
overflow-y: auto; |
|
|
|
/* height: 85vh; */ |
|
|
|
} |
|
|
|
/* overflow-y: auto; */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.left::-webkit-scrollbar { |
|
|
|
.left::-webkit-scrollbar { |
|
|
|
width: 0px; |
|
|
|
width: 0px; |
|
|
|
} |
|
|
|
} |
|
|
|
.box{ |
|
|
|
|
|
|
|
width: 502px; |
|
|
|
.box { |
|
|
|
margin-bottom: 5px; |
|
|
|
margin: 0 auto; |
|
|
|
|
|
|
|
width: 900px; |
|
|
|
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
|
|
|
/* border: 1px solid pink; */ |
|
|
|
} |
|
|
|
} |
|
|
|
.categorySty{ |
|
|
|
|
|
|
|
|
|
|
|
.categorySty { |
|
|
|
margin-bottom: 10px; |
|
|
|
margin-bottom: 10px; |
|
|
|
font-size: 25px; |
|
|
|
font-size: 25px; |
|
|
|
font-weight: 550; |
|
|
|
font-weight: 550; |
|
|
|
width: 560px; |
|
|
|
width: 560px; |
|
|
|
height: 50px; |
|
|
|
height: 60px; |
|
|
|
line-height: 50px; |
|
|
|
line-height: 50px; |
|
|
|
/*background: #FFB21E;*/ |
|
|
|
/*background: #FFB21E;*/ |
|
|
|
} |
|
|
|
} |
|
|
|
.categorySty:hover{ |
|
|
|
|
|
|
|
|
|
|
|
.categorySty:hover { |
|
|
|
background: gainsboro; |
|
|
|
background: gainsboro; |
|
|
|
cursor: pointer; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
} |
|
|
|
.essaySty{ |
|
|
|
|
|
|
|
display: flex; /* 启用Flexbox布局 */ |
|
|
|
.essaySty { |
|
|
|
justify-content: space-between; /* 水平方向两端对齐 */ |
|
|
|
display: flex; |
|
|
|
align-items: center; /* 垂直居中对齐 */ |
|
|
|
/* 启用Flexbox布局 */ |
|
|
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
|
|
/* 水平方向两端对齐 */ |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
/* 垂直居中对齐 */ |
|
|
|
height: 40px; |
|
|
|
height: 40px; |
|
|
|
line-height: 40px; |
|
|
|
line-height: 40px; |
|
|
|
margin-bottom: 5px; |
|
|
|
margin-bottom: 10px; |
|
|
|
width:520px; |
|
|
|
width: 800px; |
|
|
|
font-size: 20px; |
|
|
|
font-size: 20px; |
|
|
|
margin-left: 30px; |
|
|
|
margin-left: 30px; |
|
|
|
/*background: #FFB21E;*/ |
|
|
|
/*background: #FFB21E;*/ |
|
|
|
} |
|
|
|
} |
|
|
|
.essaySty:hover{ |
|
|
|
|
|
|
|
|
|
|
|
.essaySty:hover { |
|
|
|
background: gainsboro; |
|
|
|
background: gainsboro; |
|
|
|
cursor: pointer; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
} |
|
|
|