123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <template>
- <div class="message">
- <div class="inner">
- <div class="bigTitle">
- <div class="inner" v-for="(item, index) in headlinelist" :key="index">
- <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/mainTitleicon.png" alt="" class="left">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title" :target="item.islink == 1 ? '_blank' : '_self'">
- <h1 class="left">{{ item.title }}</h1>
- </NuxtLink>
- </div>
- </div>
- <HomeBigTitleList :headlinelist1="headlinelist1"></HomeBigTitleList>
- <div class="messageLeft">
- <HomeBigSwiper></HomeBigSwiper>
- </div>
- <div class="messageRight">
- <div class="hotTop">
- <h3>今日热点</h3>
- <ul>
- <li v-for="(item, index) in hotNewsList" :key="index">
- <strong>{{ index + 1 }}</strong>
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title" :target="item.islink == 1 ? '_blank' : '_self'">
- {{ item.title }}
- </NuxtLink>
- </li>
- </ul>
- </div>
- </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: {
- 'pageSize': 3,
- 'level': 1,
- 'placeid': 0,
- 'id':''
- },
- });
- if(mkdata.code == 200){
- //填充大标题
- headlinelist.value.push(mkdata.data[0])
- //剩余的两条放到大标题下面
- headlinelist1.value.push(mkdata.data[1])
- headlinelist1.value.push(mkdata.data[2])
- }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: {
- 'pageSize': 8,
- 'level': 6,
- 'placeid': 0,
- 'id':''
- },
- });
- if(mkdata.code == 200){
- hotNewsList.value = mkdata.data;
- }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>
- // 大标题
- .bigTitle {
- width: 100%;
- height: 50px;
- margin-top: 20px;
- img {
- width: 57px;
- height: 52px;
- margin: 6px 17px 9px 97px;
- vertical-align: middle;
- }
- h1 {
- width: 960px;
- height: 70px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 30px;
- // font-size: 38px;
- //margin-bottom: 25px;
- white-space: nowrap;
- /* 防止文本换行 */
- overflow: hidden;
- /* 隐藏溢出的内容 */
- text-overflow: ellipsis;
- color: #49A769;
- line-height: 59px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- // 资讯
- .message {
- width: 100%;
- height: 520px;
- .messageLeft,
- .messageRight {
- float: left;
- }
- // 左侧
- .messageLeft {
- // 轮播图
- >img {
- width: 790px;
- height: 440px;
- }
- // 轮播图下小图列表
- .smallList {
- width: 790px;
- height: 140px;
- margin-top: 16px;
- >li {
- width: 250px;
- height: 140px;
- float: left;
- padding-right: 20px;
- position: relative;
- // background-color: #f5f5f5;
- img {
- width: 250px;
- height: 140px;
- }
- p {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 250px;
- height: 30px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- line-height: 30px;
- padding-left: 4px;
- box-sizing: border-box;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 16px;
- color: #FFFFFF;
- text-align: left;
- font-style: normal;
- text-transform: none;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 0px 0px 2px 2px;
- }
- }
- >li:nth-child(3) {
- padding-right: 0px;
- }
- }
- }
- // 右侧
- .messageRight {
- width: 450px;
- height: 405px;
- margin-left: 30px;
- .hotTop,
- .suggest {
- width: 450px;
- height: 283px;
- >h3 {
- height: 40px;
- line-height: 40px;
- font-family: Source Han Sans, Source Han Sans;
- font-weight: bold;
- font-size: 24px;
- color: #000000;
- line-height: 28px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- border-bottom: 1px solid #139602;
- >span {
- float: right;
- width: 56px;
- height: 20px;
- line-height: 24px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- color: #999999;
- font-style: normal;
- text-transform: none;
- }
- }
- ul {
- >li {
- height: 25px;
- padding-top: 20px;
- >strong {
- display: inline-block;
- width: 24px;
- height: 24px;
- line-height: 24px;
- background-color: #cecece;
- padding-left: 6px;
- box-sizing: border-box;
- font-family: Source Han Sans, Source Han Sans;
- font-weight: 500;
- font-size: 18px;
- color: #FFFFFF;
- font-style: normal;
- text-transform: none;
- vertical-align: -2px;
- }
- &:nth-child(1)>strong {
- background-color: #00C524;
- }
- &:nth-child(2)>strong {
- background-color: #FFDF27;
- }
- &:nth-child(3)>strong {
- background-color: #F3C57F;
- }
- >em {
- display: inline-block;
- width: 6px;
- height: 6px;
- border-radius: 10px;
- border: 2px solid #8CBA86;
- vertical-align: -1px;
- }
- >a,
- >span {
- display: inline-block;
- width: 416px;
- height: 25px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 18px;
- color: #333333;
- line-height: 21px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- padding-left: 9px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- vertical-align: middle;
- }
- >a:hover,
- >span:hover {
- color: #139609;
- }
- }
- }
- }
- .hotTop {
- width: 450px;
- }
- .suggest {
- margin-top: 32px;
- }
- }
- }
- </style>
|