123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <div class="hotList">
- <div class="title">
- 最新资讯
- <em></em>
- </div>
- <div class="top111">
- <div class="hotList_photo_text" v-for="(item, index) in hotNewsListImg" :key="index">
- <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">
- <img :src="item.imgurl" alt="">
- <span class="jingxuan">精选</span>
- <div class="hotlist_text">{{ item.title }}</div>
- </NuxtLink>
- <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
- <img :src="item.imgurl" alt="">
- <span class="jingxuan">精选</span>
- <div class="hotlist_text">{{ item.title }}</div>
- </NuxtLink>
- </div>
- </div>
- <ul class="message">
- <li class="messageList" v-for="(item, index) in hotNewsList" :key="index">
- <NuxtLink :to="item.linkurl" v-if="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 hotNewsList = ref([])
- async function getPageData() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'pageSize': 5,
- 'level': 4,
- 'id': 0,
- },
- });
- if (mkdata.code == 200) {
- hotNewsList.value = mkdata.data;
- console.log("11111111111111111111111111", hotNewsList.value);
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:获取最新资讯")
- console.log("后端错误反馈:", mkdata.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- getPageData();
- const hotNewsListImg = ref([])
- async function getPageData1() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'pageSize': 5,
- 'level': 4,
- 'id': 0,
- },
- });
- if (mkdata.code == 200) {
- for (let item of mkdata.data) {
- if (item.imgurl) {
- if (hotNewsListImg.value.length < 1) {
- hotNewsListImg.value.push(item)
- }
- }
- }
- // hotNewsListImg.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 ---------->")
- }
- }
- getPageData1();
- </script>
- <style lang="less" scoped>
- .title {
- width: 100px;
- height: 40px;
- line-height: 40px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- margin: 10px 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;
- }
- }
- .top111 {
- width: 350px;
- height: 280px;
- position: relative;
- .hotList_photo_text {
- width: 350px;
- height: 280px;
- position: relative;
- img {
- width: 350px;
- height: 230px;
- }
- .jingxuan {
- display: inline-block;
- width: 50px;
- height: 26px;
- background-color: #a01c0e;
- color: #fff;
- text-align: center;
- line-height: 26px;
- position: absolute;
- top: 0px;
- right: 10px;
- }
- .hotlist_text {
- width: 350px;
- height: 40px;
- line-height: 40px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 18px;
- color: #333333;
- margin-top: 8px;
- }
- }
- }
- .message {
- width: 350px;
- margin-top: 30px;
- .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: 25px;
- a {
- color: #333333;
- }
- }
- .messageList:first-child {
- font-weight: bold;
- }
- >li:hover>a {
- color: #a01c0e;
- }
- }
- </style>
|