| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <div class="topNews">
- <div class="newsTitle">今日头条</div>
- <div class="newsContent">
- <div class="newsItem">
- <a href="#">十四届全国人大常委会第十九次会议举行第二次全体会议 审议执法检查报告、专项工作报告等 赵乐际出席会议</a>
- </div>
- <div class="newsItem">
- <a href="#">最高检调研组在四川调研</a>
- </div>
- <div class="newsItem">
- <a href="#">辽宁高院深入学习贯彻中央经济工作会议精神</a>
- </div>
- <div class="newsItem">
- <a href="#">省检察院召开党组(扩大)会议 传达学习中央经济工作会议精神</a>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- //0.加载必备依赖 start ---------------------------------------->
- import { NuxtLink } from "#components";
- import { ref, onMounted } from "vue"
- const nuxtApp = useNuxtApp();
- const axios = nuxtApp.$axios;
- const getLinkPathDetail = (item) => {
- if (item.islink == 1) {
- return `${item.linkurl}`;
- } else {
- return `/${item.pinyin}/${item.id}.html`;
- }
- }
- //0.加载必备依赖 end ---------------------------------------->
- //1.获得板块数据 start ---------------------------------------->
- //大标题
- const headlinelist = ref([])
- //大标题下面的二级内容
- const headlinelist1 = ref([])
- async function getModelData1() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'imgnum': 0,
- 'textnum': 3,
- 'level': 1,
- 'placeid': 0,
- 'id': ''
- },
- });
- if (mkdata.code == 200) {
- for (let index in mkdata.data.text) {
- if (index < 1) {
- headlinelist.value.push(mkdata.data.text[index])
- } else {
- headlinelist1.value.push(mkdata.data.text[index])
- }
- }
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:设置大标题")
- console.log("后端错误反馈:", mkdata.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- getModelData1()
- const hotNewsList = ref("")
- async function getModelData3() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'imgnum': 0,
- 'textnum': 8,
- 'level': 6,
- 'placeid': 0,
- 'id': ''
- },
- });
- if (mkdata.code == 200) {
- hotNewsList.value = mkdata.data.text;
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:获取首页今日热点")
- // console.log("后端错误反馈:", mkdata.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- getModelData3()
- //1.获得板块数据 end ---------------------------------------->
- </script>
- <style lang="less" scoped>
- // >1400px
- @media screen and (min-width: 1401px) {
- .topNews {
- width: 1400PX;
- height: 32PX;
- margin: 20PX auto;
- background-color: #f0f0f0;
- position: relative;
- font-family: "微软雅黑", "microsoft yahei";
- .newsTitle {
- position: absolute;
- top: 0;
- left: -2PX;
- width: 140PX;
- height: 32PX;
- line-height: 32PX;
- background: url("../../public/index/titleIcon.jpg") no-repeat center center;
- color: #fff;
- font-size: 18PX;
- padding-left: 25PX;
- box-sizing: border-box;
- }
- .newsContent {
- width: 1400PX;
- height: 32PX;
- line-height: 32PX;
- padding-left: 180PX;
- box-sizing: border-box;
- font-size: 12PX;
- color: #000;
- display: flex;
- .newsItem {
- width: 305PX;
- text-align: center;
- position: relative;
- a {
- display: inline-block;
- width: 300PX;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #000;
- padding: 0 20PX;
- box-sizing: border-box;
- }
- }
- .newsItem::after {
- content: "";
- position: absolute;
- right: 0;
- /* 贴元素右侧 */
- top: 25%;
- /* 边框顶部距离元素顶部20%,可改固定值如10PX */
- width: 1PX;
- /* 边框宽度 */
- height: 50%;
- /* 边框长度(核心!改数值即可调整长短) */
- background-color: #ccc;
- /* 边框颜色,和原样式一致 */
- }
- .newsItem:last-child::after {
- display: none;
- /* 直接隐藏伪元素 */
- /* 或用 visibility: hidden; 效果一致,按需选 */
- }
- }
- }
- }
- // 801px-1400px
- @media screen and (min-width: 801px) and (max-width: 1400px) {
- .topNews {
- width: 100%;
- height: 32PX;
- margin: 20PX auto;
- background-color: #f0f0f0;
- position: relative;
- font-family: "微软雅黑", "microsoft yahei";
- .newsTitle {
- position: absolute;
- top: 0;
- left: -2PX;
- width: 140PX;
- height: 32PX;
- line-height: 32PX;
- background: url("../../public/index/titleIcon.jpg") no-repeat center center;
- color: #fff;
- font-size: 18PX;
- padding-left: 25PX;
- box-sizing: border-box;
- }
- .newsContent {
- width: 100%;
- height: 32PX;
- line-height: 32PX;
- padding-left: 180PX;
- box-sizing: border-box;
- font-size: 12PX;
- color: #000;
- display: flex;
- .newsItem {
- width: 25%;
- text-align: center;
- position: relative;
- a {
- display: inline-block;
- width: 90%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #000;
- padding: 0 20PX;
- box-sizing: border-box;
- }
- }
- .newsItem::after {
- content: "";
- position: absolute;
- right: 0;
- /* 贴元素右侧 */
- top: 25%;
- /* 边框顶部距离元素顶部20%,可改固定值如10PX */
- width: 1PX;
- /* 边框宽度 */
- height: 50%;
- /* 边框长度(核心!改数值即可调整长短) */
- background-color: #ccc;
- /* 边框颜色,和原样式一致 */
- }
- .newsItem:last-child::after {
- display: none;
- }
- }
- }
- }
- // <=800px
- @media screen and (max-width: 800px) {
- .topNews {
- display: none;
- }
- }
- </style>
|