123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <!-- 资讯 -->
- <template>
- <div class="message">
- <div class="inner">
- <!-- 大标题 -->
- <div class="bigTitle">
- <div class="inner" v-for="(item,index) in headlinelist" :key="index">
- <img :src="item.imgurl" alt="" class="left">
- <h1 class="left">{{ item.title }}</h1>
- </div>
- </div>
- <!-- 大标题下的列表 -->
- <HomeBigTitleList></HomeBigTitleList>
- <div class="messageLeft">
- <!-- 轮播图 -->
- <HomeBigSwiper></HomeBigSwiper>
- <!-- 小图列表 -->
- <ul class="smallList">
- <li v-for="(item, index) in recommendImage" :key="index">
- <img :src="item.imgurl" alt="">
- <p>{{ item.title }}</p>
- </li>
- </ul>
- </div>
- <div class="messageRight">
- <!-- 列表 -->
- <div class="hotTop">
- <h3>
- 热点资讯
- <span>查看更多</span>
- </h3>
- <ul>
- <li v-for="(item, index) in hotNewsList" :key="index">
- <strong>{{ index + 1 }}</strong>
- <span>{{ item.title }}</span>
- </li>
- </ul>
- </div>
- <div class="suggest">
- <h3>
- 资讯推荐
- <span>查看更多</span>
- </h3>
- <ul>
- <li v-for="(item, index) in messageList" :key="index">
- <em></em>
- <span>{{ item.title }}</span>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, onMounted } from "vue"
- const nuxtApp = useNuxtApp();
- const axios = nuxtApp.$axios;
- //头条
- const headlinelist = useState("headlinelist", () => "");
- const headline = async () => {
- try {
- const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${1}&level=${1}&placeid=${0}`);
- // console.log(response.data);
- headlinelist.value = response.data;
- } catch (error) {
- console.error(error);
- }
- }
- //获取推荐图
- const recommendImage = useState("recommendImage", () => "");
- const recommendList = async () => {
- try {
- const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${3}&level=${3}&placeid=${0}`);
- // console.log(response.data);
- recommendImage.value = response.data;
- } catch (error) {
- console.error(error);
- }
- }
- //热点资讯
- const hotNewsList = useState("hotNews", () => "");
- const hotNews = async () => {
- try {
- const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${6}&level=${4}&placeid=${0}`);
- // console.log(response.data);
- hotNewsList.value = response.data;
- } catch (error) {
- console.error(error);
- }
- }
- //资讯推荐
- const messageList = useState("messagelist", () => "");
- const message = async () => {
- try {
- const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${6}&level=${5}&placeid=${0}`);
- // console.log(response.data);
- messageList.value = response.data;
- } catch (error) {
- console.error(error);
- }
- }
- onMounted(() => {
- // 头条
- headline()
- //推荐图
- recommendList()
- // 热点资讯
- hotNews()
- //资讯推荐
- message()
- })
- </script>
- <style lang="less" scoped>
- // 大标题
- .bigTitle {
- width: 100%;
- height: 70px;
- margin-top: 38px;
- img {
- width: 57px;
- height: 52px;
- margin: 6px 17px 9px 97px;
- vertical-align: middle;
- }
- h1 {
- // width: 860px;
- height: 70px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 50px;
- color: #028E21;
- line-height: 59px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- // 资讯
- .message {
- width: 100%;
- height: 750px;
- .messageLeft,
- .messageRight {
- float: left;
- }
- // 左侧
- .messageLeft {
- // 轮播图
- >img {
- width: 790px;
- height: 440px;
- }
- // 轮播图下小图列表
- .smallList {
- width: 790px;
- height: 140px;
- margin-top: 16px;
- img {
- width: 250px;
- height: 140px;
- }
- >li {
- width: 250px;
- height: 140px;
- float: left;
- padding-right: 20px;
- position: relative;
- >p {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 250px;
- height: 30px;
- 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: 380px;
- height: 600px;
- margin-left: 30px;
- .hotTop,
- .suggest {
- width: 380px;
- height: 283px;
- >h3 {
- height: 36px;
- 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: 16px;
- >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;
- }
- &: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: 10px;
- height: 10px;
- border-radius: 10px;
- border: 2px solid #8CBA86;
- }
- >span {
- width: 320px;
- 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;
- }
- >span:hover {
- color: #139609;
- }
- }
- }
- }
- .suggest {
- margin-top: 32px;
- }
- }
- }
- </style>
|