123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <template>
- <div class="hotNews">
- <div class="hotNews_title">
- 热点精选
- <em></em>
- </div>
- <div class="top_top">
- <div class="hotNews_photo_text">
- <div class="photo_left" v-for="(item, index) in hotNewsListImg">
- <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">
- <img :src="item.imgurl" alt="">
- <div class="hotNews_text">{{ item.title }}</div>
- </NuxtLink>
- <NuxtLink :to="`/${item.pinyin}/${item.id}.html`">
- <img :src="item.imgurl" alt="">
- <div class="hotNews_text">{{ item.title }}</div>
- </NuxtLink>
- </div>
- </div>
- </div>
- <ul class="hotNews_message">
- <li class="hotNews_messageList" v-for="(item, index) in hotNewsList" :key="index">
- <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">
- {{ item.title }}
- </NuxtLink>
- <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
- {{ item.title }}
- </NuxtLink>
- </li>
- </ul>
- </div>
- </template>
- <script setup>
- const hotNewsListImg = ref([])
- const hotNewsList = ref([])
- async function getPageData() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'pageSize': 7,
- 'level': 5,
- 'placeid': 0,
- 'id': 0
- },
- });
- 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 ---------->")
- }
- }
- getPageData();
- async function getPageData1() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'pageSize': 30,
- 'level': 5,
- 'placeid': 1,
- 'id': 0
- },
- });
- if (mkdata.code == 200) {
- for (let item of mkdata.data) {
- if (item.imgurl) {
- if (hotNewsListImg.value.length < 2) {
- hotNewsListImg.value.push(item)
- }
- }
- }
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:获取热点精选")
- console.log("后端错误反馈:", mkdata.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- getPageData1();
- </script>
- <style lang="less" scoped>
- .hotNews {
- width: 350px;
- //标题
- .hotNews_title {
- width: 100px;
- height: 40px;
- line-height: 40px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- margin: 20px 0;
- font-size: 20px;
- color: #333333;
- position: relative;
- em {
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 4px;
- background-color: #a01c0e;
- position: absolute;
- top: 6px;
- right: 8px;
- }
- }
- //图片文字
- .top_top {
- width: 350px;
- height: 165px;
- position: relative;
- .hotNews_photo_text {
- display: flex;
- justify-content: space-between;
- margin-top: 10px;
- img {
- width: 165px;
- height: 96px;
- }
- .hotNews_text {
- width: 165px;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 18px;
- color: #333333;
- margin-top: 15px;
- }
- .hotNews_text:hover {
- color: #a01c0e;
- }
- }
- }
- //新闻列表
- .hotNews_message {
- width: 350px;
- margin-top: 25px;
- .hotNews_messageList {
- width: 350px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 18px;
- color: #333333;
- margin-bottom: 30px;
- a {
- color: #333333;
- }
- }
- .hotNews_messageList:hover {
- color: #a01c0e;
- a {
- color: #a01c0e;
- }
- }
- }
- }
- </style>
|