531 lines
17 KiB
Vue
Raw Normal View History

2025-05-24 09:12:30 +08:00
<template>
<!-- PC端布局 -->
<div class="flex justify-between w-full h-auto">
<!-- 左边导航栏 -->
2025-07-02 17:33:47 +08:00
<AppHeader></AppHeader>
<!-- 右边内容栏 -->
<div class="rightcon" @scroll="hmScroll" id="tjright">
<div class="flex top_search">
2025-07-02 17:33:47 +08:00
<div style="width: 350px;">
<img :src="`/img/index/dlogo.png`" alt="" style="width: 100%; height: 100%; object-fit: cover" />
</div>
2025-07-02 17:33:47 +08:00
<div class="inputform">
<input v-model="inputSearch" class="contactInput w-full md:w-[337px]" type="text"
placeholder="请输入搜索关键字" />
<div class="search_rinput">
<img src="/img/index/hmsearch.png" alt="" />
</div>
2025-07-02 17:33:47 +08:00
</div>
</div>
<div class="top_bar">
<div style="background: #ffffff;width: 100%;display: flex;align-items: center;padding: 18px;">
<div>
<img :src="`/img/key.png`" style="width: 22px;height: 22px;">
</div>
<div style="font-size: 18px;color: #323232;margin-left: 10px;">当前位置首页 > 团务百科 > <span
style="color: #3B90DF;">文章详情</span></div>
</div>
</div>
<div class="News_box h-auto">
2025-07-02 17:33:47 +08:00
<div class="lef_box">
2025-07-02 17:33:47 +08:00
<div class="re_box">
<div class="re_box_item" v-if="Newsdetail != null && Newsdetail.type == 1">
2025-07-02 17:33:47 +08:00
<div class='re_mian' v-if="Newsdetail.cate != null">{{ title_left + ' > ' +
Newsdetail.cate.name + ' > ' + '正文内容' }} </div>
<div class="re_title">{{ Newsdetail.title }}</div>
<div class='flex justify-between re_rouse'>
2025-07-02 17:33:47 +08:00
<span>{{ Newsdetail.release_time_text }}</span>
<span v-if="Newsdetail.source != '' && Newsdetail.source != null">来源{{
Newsdetail.source }}</span>
</div>
<div class="re_slice"></div>
2025-07-02 17:33:47 +08:00
<div class="re_file" v-if="Newsdetail.file != '' && Newsdetail.file != null">
附件
2025-07-02 17:33:47 +08:00
<a :href="Newsdetail.file" target="_blank" rel="noopener noreferrer"
style="color: #0066cc;">
{{ Newsdetail.attachment.filename }}
</a>
</div>
2025-07-02 17:33:47 +08:00
<div class="re_content" v-html="Newsdetail.content"></div>
</div>
<div class="re_box_item" v-if="Newsdetail != null && Newsdetail.type == 2">
2025-07-02 17:33:47 +08:00
<div class="re_title" style="margin-top: 0;font-size: 20px;font-weight: 600;">{{
Newsdetail.title }}</div>
<div class='flex justify-between re_rouse' style="margin-bottom: 20px;">
2025-07-02 17:33:47 +08:00
<span>{{ Newsdetail.release_time_text }}</span>
<span v-if="Newsdetail.source != '' && Newsdetail.source != null">来源{{
Newsdetail.source }}</span>
</div>
<embed type="application/pdf" :src="Newsdetail.file" width="100%" height="580px" alt="">
</div>
</div>
</div>
2025-07-02 17:33:47 +08:00
<div class="rig_box">
<n-tabs :bar-width="0" type="line" class="custom-tabs" pane-style="background-color: #ffffff;">
<n-tab-pane name="oasis" tab="热门推荐" style="padding: 30px;">
2025-07-02 17:33:47 +08:00
<div class="flex flex-row" v-for="item, index in remList" :key="index"
style="padding-bottom:30px;cursor: pointer;"
@click="gotodetail({ id: item.id, type: '1' })">
<div class="number_t" v-if="index == 0 || index == 1 || index == 2">
2025-07-02 17:33:47 +08:00
{{ index + 1 > 10 ? index + 1 : '0' + (index + 1) }}
</div>
<div class="number_t1" v-else>
2025-07-02 17:33:47 +08:00
<span v-if="index + 1 == 6" style="color: #D70E08;">{{ index + 1 > 10 ? index + 1 :
'0' + (index + 1) }}</span>
<span v-else>{{ index + 1 > 10 ? index + 1 : '0' + (index + 1) }}</span>
</div>
<div class="content_t2">
<p class="p1 one-line-ellipsis">{{ item.title }}</p>
<p class="p2 flex justify-between items-center">
<span>{{ item.source }}</span>
<span class="flex items-center">
<img src="/img/views.png" alt="" style="padding-right: 10px;">
{{ item.views }}
</span>
</p>
</div>
</div>
</n-tab-pane>
<n-tab-pane name="jay chou" tab="精选文章" style="padding: 30px;">
2025-07-02 17:33:47 +08:00
<div class="flex flex-row" v-for="item, index in jinxList" :key="index"
style="padding-bottom:30px; cursor: pointer;"
@click="gotodetail({ id: item.id, type: '1' })">
<div class="number_t" v-if="index == 0 || index == 1 || index == 2">
2025-07-02 17:33:47 +08:00
{{ index + 1 > 10 ? index + 1 : '0' + (index + 1) }}
</div>
<div class="number_t1" v-else>
2025-07-02 17:33:47 +08:00
<span v-if="index + 1 == 6" style="color: #D70E08;">{{ index + 1 > 10 ? index + 1 :
'0' + (index + 1) }}</span>
<span v-else>{{ index + 1 > 10 ? index + 1 : '0' + (index + 1) }}</span>
</div>
<div class="content_t2">
<p class="p1 one-line-ellipsis">{{ item.title }}</p>
<p class="p2 flex justify-between items-center">
<span>{{ item.source }}</span>
<span class="flex items-center">
<img src="/img/views.png" alt="" style="padding-right: 10px;">
{{ item.views }}
</span>
</p>
</div>
</div>
</n-tab-pane>
</n-tabs>
2025-07-02 17:33:47 +08:00
</div>
</div>
2025-07-02 17:33:47 +08:00
<AppFooter></AppFooter>
<!-- 右分享 -->
<!-- <div style="position: absolute;top: 300px;right:36px;" class="flex flex-col fiximg">
<img :src="`/img/index/douyin.png`" alt="">
<img :src="`/img/index/wb.png`" alt="">
<img :src="`/img/index/wx.png`" alt="">
<img :src="`/img/index/blbl.png`" alt="">
</div> -->
<!-- 底部鼠标 -->
<!-- <div style="position: absolute; bottom: 30px; right: 30px">
<img :src="`/img/index/hmouse.png`" alt="" />
</div> -->
</div>
</div>
2025-05-24 09:12:30 +08:00
</template>
<script lang="ts" setup>
2025-07-02 17:33:47 +08:00
import { NTabs, NTabPane } from 'naive-ui'
2025-05-24 09:12:30 +08:00
import $api from '@/service/webRequest'
// import emitter from '@/plugins/emitter'
const route = useRoute()
2025-07-02 17:33:47 +08:00
const inputSearch = ref('')
const page = ref(1);
const jinxList = ref([]);
const remList = ref([]);
const topding = ref(false);
const title_left = ref('新闻动态');
const Newsdetail = ref(null);
const ids = ref(route.params.id)
const types = ref(route.query.type)
// emitter.on('detailId', (data) => {
// console.log(data,111111)
// getNewsdetail(data);
// });
//精选
const getjinxList = async () => {
2025-07-02 17:33:47 +08:00
const res = await $api.post('/api/home.news/index',
{
2025-07-02 17:33:47 +08:00
limit: 6,
page: page.value,
fine: 1
}
)
2025-07-02 17:33:47 +08:00
jinxList.value = res.data.data.list;
2025-05-24 09:12:30 +08:00
}
//热门
const getremList = async () => {
2025-07-02 17:33:47 +08:00
const res = await $api.post('/api/home.news/index',
{
2025-07-02 17:33:47 +08:00
limit: 6,
page: page.value,
hot: 1
}
)
2025-07-02 17:33:47 +08:00
remList.value = res.data.data.list;
}
// 新闻/百科/信息公开 详情
const getNewsdetail = async () => {
// 新闻详情
if (types.value == 1) {
title_left.value = '新闻动态';
const res = await $api.post('/api/home.news/detail',
{
2025-07-02 17:33:47 +08:00
id: ids.value
}
)
Newsdetail.value = res.data.data;
2025-07-02 17:33:47 +08:00
} else if (types.value == 2) {
title_left.value = '信息公开';
//信息公开文章详情
const res1 = await $api.post('/api/home.information/detail',
{
2025-07-02 17:33:47 +08:00
id: ids.value
}
)
Newsdetail.value = res1.data.data;
2025-07-02 17:33:47 +08:00
} else {
title_left.value = '团务百科';
// 团务百科文章详情
const res2 = await $api.post('/api/home.encyclopedia/detail',
{
2025-07-02 17:33:47 +08:00
id: ids.value
}
)
Newsdetail.value = res2.data.data;
}
2025-07-02 17:33:47 +08:00
}
//推荐列表跳转
2025-07-02 17:33:47 +08:00
const gotodetail = async (data) => {
// 新闻详情
if (data.type == 1) {
title_left.value = '新闻动态';
const res = await $api.post('/api/home.news/detail',
{
2025-07-02 17:33:47 +08:00
id: data.id
}
)
Newsdetail.value = res.data.data;
2025-07-02 17:33:47 +08:00
} else if (data.type == 2) {
title_left.value = '信息公开';
//信息公开文章详情
const res1 = await $api.post('/api/home.information/detail',
{
2025-07-02 17:33:47 +08:00
id: data.id
}
)
Newsdetail.value = res1.data.data;
2025-07-02 17:33:47 +08:00
} else {
title_left.value = '团务百科';
// 团务百科文章详情
const res2 = await $api.post('/api/home.encyclopedia/detail',
{
2025-07-02 17:33:47 +08:00
id: data.id
}
)
Newsdetail.value = res2.data.data;
}
2025-05-24 09:12:30 +08:00
}
const hmScroll = () => {
let tjright = document.getElementById('tjright');
2025-07-02 17:33:47 +08:00
if (tjright.scrollTop > 159) {
topding.value = true;
2025-07-02 17:33:47 +08:00
} else {
topding.value = false;
}
2025-07-02 17:33:47 +08:00
2025-05-24 09:12:30 +08:00
}
//加载中
2025-07-02 17:33:47 +08:00
onMounted(() => {
getjinxList();
getremList();
2025-07-02 17:33:47 +08:00
getNewsdetail();
window.addEventListener('scroll', hmScroll);
})
2025-05-24 09:12:30 +08:00
</script>
<style lang="scss" scoped>
@import '@/assets/index.scss';
/* pc端样式 */
.rightcon {
2025-07-02 17:33:47 +08:00
width: 100%;
height: 100%;
background-image: url('/img/index/rightcons.png');
background-size: 100% 100%;
overflow-y: auto;
2025-07-02 17:33:47 +08:00
position: absolute;
}
.top_search {
margin-top: 50px;
height: 70px;
justify-content: space-between;
align-items: center;
2025-07-02 17:33:47 +08:00
margin-left: 415px;
width: 1200px;
}
2025-05-24 09:12:30 +08:00
.inputform {
position: relative;
width: 340px;
2025-05-24 09:12:30 +08:00
}
.contactInput {
width: 337px;
height: 50px;
background: #ffffff;
border-radius: 8px;
border: 1px solid #dee4e8;
padding-left: 15px;
2025-05-24 09:12:30 +08:00
}
.contactInput::placeholder {
color: #999999;
2025-05-24 09:12:30 +08:00
}
.contactInput:focus {
outline: none;
2025-05-24 09:12:30 +08:00
}
.search_rinput {
width: 68px;
height: 50px;
2025-07-02 17:33:47 +08:00
background: #338CDE;
border-radius: 0px 8px 8px 0px;
position: absolute;
top: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
}
.News_box {
display: flex;
justify-content: space-between;
width: 1300px;
margin: 0 auto;
.lef_box {
width: 835px;
2025-07-02 17:33:47 +08:00
.re_box {
width: 100%;
height: 100%;
margin: 0 auto;
2025-07-02 17:33:47 +08:00
margin-top: 20px;
padding-left: 100px;
.re_box_item {
width: 100%;
background: #ffffff;
border: 1px solid #eef7ff;
padding: 30px;
box-sizing: border-box;
display: flex;
flex-direction: column;
min-height: 750px;
.re_slice {
width: 100%;
border-bottom: 1px dashed #bbbbbb;
margin-top: 20px;
}
2025-07-02 17:33:47 +08:00
.re_file {
margin-top: 20px;
margin-bottom: 10px;
}
2025-07-02 17:33:47 +08:00
.re_mian {
// width: 248px;
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 16px;
color: #666666;
}
2025-07-02 17:33:47 +08:00
.re_rouse {
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 16px;
color: #999999;
width: 100%;
margin-top: 10px;
}
2025-07-02 17:33:47 +08:00
.re_title {
width: 100%;
font-family: Microsoft YaHei UI;
font-weight: 500;
font-size: 28px;
color: #393939;
margin-top: 10px;
}
.re_content {
width: 100%;
height: 100%;
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 16px;
color: #999999;
padding: 30px 0;
}
2025-07-02 17:33:47 +08:00
}
}
}
.rig_box {
width: 430px;
height: 100%;
2025-07-02 17:33:47 +08:00
margin-top: 20px;
margin-left: 35px;
2025-07-02 17:33:47 +08:00
.custom-tabs {
.number_t {
width: 34px;
height: 34px;
// background: #FFA234;
background: #E40106;
border-radius: 17px;
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 18px;
2025-07-02 17:33:47 +08:00
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
margin-right: 20px;
}
2025-07-02 17:33:47 +08:00
.number_t1 {
width: 34px;
height: 34px;
background: #FFFFFF;
border-radius: 17px;
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 18px;
color: #323232;
display: flex;
justify-content: center;
align-items: end;
margin-right: 20px;
}
.content_t2 {
font-family: Microsoft YaHei UI;
font-weight: 400;
width: 80%;
.p1 {
margin-top: 7px;
font-size: 18px;
color: #393939;
}
.p2 {
margin-top: 15px;
font-size: 16px;
color: #999999;
}
}
2025-07-02 17:33:47 +08:00
}
2025-07-02 17:33:47 +08:00
:deep(.n-tabs .n-tabs-tab-wrapper) {
width: 215px;
height: 72px;
background: #ffffff;
2025-07-02 17:33:47 +08:00
font-size: 18px;
justify-content: center;
}
2025-07-02 17:33:47 +08:00
:deep(.n-tabs .n-tabs-tab .n-tabs-tab__label) {
font-family: Microsoft YaHei UI;
font-weight: 400;
font-size: 18px;
}
2025-07-02 17:33:47 +08:00
:deep(.n-tabs.n-tabs--line-type .n-tabs-tab:hover, .n-tabs.n-tabs--bar-type .n-tabs-tab:hover) {
color: #348CDE;
}
2025-07-02 17:33:47 +08:00
:deep(.n-tabs.n-tabs--line-type .n-tabs-tab.n-tabs-tab--active, .n-tabs.n-tabs--bar-type .n-tabs-tab.n-tabs-tab--active) {
color: #348CDE;
background: #F1F8FF;
width: 100%;
display: flex;
justify-content: center;
2025-07-02 17:33:47 +08:00
border-top: solid 2px #378FDF;
}
2025-07-02 17:33:47 +08:00
:deep(.n-tabs .n-tabs-tab-pad) {
width: 0;
}
2025-07-02 17:33:47 +08:00
}
2025-07-02 17:33:47 +08:00
.topding {
position: fixed;
top: 0;
margin-top: 0;
right: 315px;
width: 430px;
}
}
2025-07-02 17:33:47 +08:00
.top_bar {
margin: 0px auto;
width: 1300px;
padding-left: 100px;
padding-top: 50px;
}
@media (max-width: 1440px) {
.top_search {
width: 920px;
margin-left: 373px;
}
.News_box {
width: 1032px;
margin-left: 270px;
}
.rig_box {
width: 700px;
}
.top_bar {
margin: 0px;
width: 1032px;
margin-left: 270px;
}
}
2025-05-24 09:12:30 +08:00
</style>