| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- <template>
- <!-- 页面头部 -->
- <HomePageHead></HomePageHead>
- <!-- 导航栏 -->
- <HomePageNavigation></HomePageNavigation>
- <!-- 列表页广告一 -->
- <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
- <!-- 资讯列表 -->
- <div class="newsDetail">
- <div class="inner">
- <div class="innerLeft">
- <!-- 面包屑导航 -->
- <div class="breadcrumb breadcrumb_phone_none">
- <div class="inner">
- <span class="location">当前位置:</span>
- <el-breadcrumb :separator-icon="ArrowRight">
- <el-breadcrumb-item>
- <NuxtLink to="/">首页</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item v-if="parent_name != ''">
- <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item>
- <NuxtLink :to="`list-1.html`"> {{ routLevelTitle }}</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- </div>
- <div class="breadcrumb_box breadcrumb_pc_none">
-
- <span class=" ">当前位置:</span>
-
- <NuxtLink to="/">首页</NuxtLink>
- <span class=" ">></span>
- <NuxtLink :to="`/${parent_pinyin}/index.html`" v-if="parent_name != ''"> {{ parent_name }}</NuxtLink>
- <span class=" " v-if="parent_name != ''">></span>
-
- <NuxtLink :to="`list-1.html`"> {{ routLevelTitle }}</NuxtLink>
- <span class=" " >></span>
-
- <span class=" ">
-
- {{ routeNewsTtitle }}
- </span>
-
- </div>
- <div class="LeftTop">
- <h1>{{ newsDetail.title }}</h1>
- <p class="phone_none">
- 来源: <span>{{ newsDetail.copyfrom }}</span>
- 作者: <span>{{ newsDetail.author }}</span>
- 发布时间: <span>{{ time }}</span>
- </p>
-
- <p class="pc_none">
- <span>{{ newsDetail.copyfrom }}</span>
- <span>{{ newsDetail.author }}</span>
- <span>{{ time }}</span>
- </p>
- </div>
- <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
- </div>
- <div v-if="previewVisible" class="preview-modal" @click="closePreview">
- <img :src="selectedImage" alt="Preview">
- </div>
- <!-- 免责声明: -->
- <div class="disclaimer" v-if="newsDetail.copyfrom != '本网'">
- <p>原文链接:{{ newsDetail.fromurl }}</p>
- <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
- </div>
- <div v-if="articleChoice">
- <HomeSurveyvote></HomeSurveyvote>
- </div>
- <!-- 推荐阅读 -->
- <div class="recommendRead" v-if="newsDetail.commendArticle != false">
- <div class="recommendReadTitle phone_none">
- 推荐阅读
- </div>
- <div class="phone_box_1_head pc_none">
- <a class="" title="">推荐阅读</a>
- </div>
- <div class="recommendReadList">
- <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
- :key="item.id">
- <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
- {{ item.title }}
- </a>
- <span v-if="index < 3">{{ getTime(item.created_at,"month",1) }}</span>
- </div>
- </div>
- </div>
- </div>
- <div class="innerRight">
- <!-- 热点资讯1 -->
- <div class="hotList1">
- <DetailHotNews></DetailHotNews>
- </div>
- <!-- 热点资讯2 -->
- <div class="hotList2">
- <DetailHotNews2></DetailHotNews2>
- </div>
- </div>
- </div>
- </div>
- <!-- 列表页广告二 -->
- <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
- <!-- 页面底部 -->
- <HomeFoot1></HomeFoot1>
- </template>
- <script setup>
- //1.页面依赖 start ---------------------------------------->
- import { onMounted } from 'vue'
- import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
- import { ArrowRight } from '@element-plus/icons-vue'
- //1.页面依赖 end ---------------------------------------->
- //2.页面路径 start ---------------------------------------->
- const route = useRoute();
- const articleId = parseInt(route.params.id);
- const targetSegment = getRoutePath(1);
- let routeId;
- //通过导航路径反向查询导航id
- const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
- method: 'GET',
- query: {
- 'pinyin': targetSegment,
- },
- });
- if (getRouteId.code == 200) {
- routeId = getRouteId.data.category_id
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:通过url路径查询导航池id")
- console.log("后端错误反馈:", getRouteId.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- //2.页面路径 end ---------------------------------------->
- //3.面包屑 start ---------------------------------------->
- const parent_name = ref("");
- const parent_id = ref("");
- const parent_pinyin = ref("");
- let getParentNav = async () => {
- const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
- method: 'GET',
- query: {
- 'catid': routeId
- },
- });
- if (listData.code == 200) {
- parent_name.value = listData.data.alias;
- parent_id.value = listData.data.parent_id;
- parent_pinyin.value = listData.data.aLIas_pinyin;
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:获取面包屑导航")
- console.log("后端错误反馈:", listData.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- //获得父级栏目详情
- getParentNav();
- //3.面包屑 end ---------------------------------------->
- //4.新闻详情 start ---------------------------------------->
- //4.1 资讯详情
- const newsDetail = ref({})
- const routeNewsTtitle = ref("");
- //4.2 发布日期
- const time = ref("");
- //4.3 路径
- const routLevelTitle = ref("");
- const routLevelId = ref("");
- //4.4 是否展示投票
- const articleChoice = ref(false);
- //4.5 获取详情
- async function getPageData() {
- const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
- method: 'GET',
- query: {
- 'articleid': articleId
- },
- });
- if (mkdata.code == 200) {
- //判断是否显示投票
- if (mkdata.data.is_survey == 1) {
- console.log("本篇文章含有投票!")
- articleChoice.value = true;
- }
- //获取内容
- newsDetail.value = mkdata.data;
- //获取路径
- routLevelTitle.value = newsDetail.value.cat_name;
- routLevelId.value = newsDetail.value.category_id;
- //获取发布时间
- time.value = newsDetail.value.updated_at.split(' ')[0];
- //修正标题长度
- if (newsDetail.value.title.length >= 20) {
- routeNewsTtitle.value = newsDetail.value.title.substr(0, 20) + "...";
- } else {
- routeNewsTtitle.value = newsDetail.value.title
- }
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:获取详情内容")
- // console.log("后端错误反馈:", mkdata.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- getPageData();
- //4.新闻详情 end ---------------------------------------->
- //5.广告 start ---------------------------------------->
- let adImg1 = ref([]);
- let adImg2 = ref([]);
- onMounted(async () => {
- const { $webUrl, $CwebUrl } = useNuxtApp();
- //广告1
- let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nfcpgxw_detail_0001`
- const responseAd1 = await fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd1 = await responseAd1.json();
- adImg1.value = resultAd1.data[0];
- //广告2
- let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nfcpgxw_detail_0002`
- const responseAd2 = await fetch(url2, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd2 = await responseAd2.json();
- adImg2.value = resultAd2.data[0];
- })
- //5.广告 end ---------------------------------------->
- //6.设置seo信息 start---------------------------------------->
- const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
- method: 'GET',
- query: {
- 'articleid': articleId
- },
- });
- if (setData.code == 200) {
- let seoTitle = setData.data.title;
- let seoDescription = setData.data.introduce;
- let seoKeywords = setData.data.keyword;
- let seoSuffix = setData.data.suffix;
- let seoName = setData.data.website_name;
- useSeoMeta({
- title: seoTitle + "_" + seoName + "_" + seoSuffix,
- meta: [
- { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
- { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
- { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
- ]
- });
- } else {
- console.log("获取广告数据失败!", setData.message)
- }
- //6.设置seo信息 end---------------------------------------->
- //8.页面图片放大 start---------------------------------------->
- const previewVisible = ref(false)
- const selectedImage = ref(' ')
- const openPreview = (event) => {
- if (event.target.tagName === 'IMG') {
- selectedImage.value = event.target.src;
- previewVisible.value = true;
- }
- }
- const closePreview = () => {
- previewVisible.value = false;
- }
- //8.页面图片放大 end---------------------------------------->
- </script>
- <style lang="less" scoped>
- @import url('@/assets/css/detail.less');
- </style>
- <style lang="less" scoped>
-
- @media screen and (min-width:801px){/*pc*/
-
-
- .breadcrumb_pc_none{display:none!important;}
- .pc_none{display:none;}
- }
- @media screen and (max-width:800px){/*ipad_phone*/
-
-
- .index_3_box_vote{overflow:hidden;margin-top:39px;}
- .index_3_box_vote .inquire{margin-top:15px;height:auto;}
- .index_3_box_vote .inquire p{height:auto;padding:0;font-size:14px;
- margin:0px 0px 5px 18px;}
-
- .index_3_box_vote .inquire .radio .el-radio.el-radio--large .el-radio__label span{font-size:14px;}
- .index_3_box_vote .voteTitle{font-size:14px;}
- .index_3_box_vote .inquire .btn{padding-left:22px;}
- .index_3_box_vote .inquire .radio .el-radio.el-radio--large{margin-bottom:3px;}
- .index_3_box_vote .inquire .radioBox{height:auto;
- padding:0px 0px 12px 18px;}
- .index_3_box_vote .inquire .radio .el-radio-group{width:100%;}
- .index_3_box_vote .inquire .btn button{width:auto;padding:0px 10px;line-height:33px;height:33px;font-size:14px;margin-bottom:14px;}
-
- .newsDetail .inner{width:92%;}
- .newsDetail .inner .innerLeft{width:100%;margin:0;float:none; }
- .newsDetail .inner .innerLeft .LeftTop{margin-top:9px;border-top:solid 1px #004564;}
- .newsDetail .inner .innerLeft .LeftTop > h1{font-size:20px;line-height:28px;margin:15px auto 15px;}
- .newsDetail .inner .innerLeft .leftBottom{width:100%;margin-top:20px;}
- .newsDetail .inner .innerLeft .leftBottom *,
- .newsDetail .inner .innerLeft .leftBottom{ font-size:16px!important;line-height:24px!important;}
- .newsDetail .inner .innerLeft .leftBottom /deep/img{max-width:100%;height:auto; }
-
- .newsDetail .inner .innerLeft .LeftTop > p{height:auto;}
- .breadcrumb_box{
- height:22px;width:100%;margin:16px auto 9px;
- word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
-
- font-size:14px;
- color:#666;
-
- *{
- font-size:14px;
-
- display:inline ;
- color:#666;
- line-height:22px;height:22px;
- margin-right:5px;
- }
- }
-
- .newsDetail .inner .innerLeft .disclaimer{width:100%; }
- .newsDetail .inner .innerLeft .disclaimer *{word-wrap: break-word;width:100%!important;display:block!important;
- overflow-wrap: break-word;font-size:16px;
- white-space: pre-wrap;
- word-break: break-all;
- }
-
- // 推荐阅读
-
- .phone_box_1_head{
- height:33px;line-height:33px;background:#fff;border-bottom:1px solid #004564;
- margin-top:15px;width:100%;
-
- a{
- float:left;height:33px;line-height:33px;margin:0;position:relative;
- color:#004564;font-size:14px; font-weight:bold;box-sizing:border-box;
- }
-
-
- }
-
- .newsDetail .inner .innerLeft .recommendRead .recommendReadList{
- height:auto;margin-top:11px; min-height:auto;padding-bottom:8px;
- }
- .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle{
- margin-top:0px;overflow:hidden;width:100%;
- }
- .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a{
- line-height:33px;height:33px;font-size:14px;float:left;max-width:90%;font-weight:normal;
- word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
- }
- .newsDetail .inner .innerLeft .LeftTop > p span:nth-last-of-type(1){margin-right:0px;}
- .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle span{display:none;}
- .newsDetail .inner .innerRight{display:none;}
- .breadcrumb_phone_none{display:none!important;}
- .phone_none{display:none;}
- }
- </style>
|