123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div class="title">
- <h4>
- 热点精选
- </h4>
- </div>
- <!-- 列表 -->
- <ul class="rightList">
- <li v-for="item in hotNewsList">
- <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">
- <img class="hotNewsImg" :src="item.imgurl">
- <p>{{ item.title }}</p>
- </NuxtLink>
- <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
- <img class="hotNewsImg" :src="item.imgurl">
- <p>{{ item.title }}</p>
- </NuxtLink>
- </li>
- </ul>
- </template>
- <script setup>
- const hotNewsList = ref([])
- async function getPageData() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'pageSize': 30,
- 'level': 5,
- 'placeid': 0,
- 'id': 0
- },
- });
- if (mkdata.code == 200) {
- for(let item of mkdata.data){
- if(item.imgurl){
- hotNewsList.value.push(item)
- if(hotNewsList.value.length == 5){
- break;
- }
- }
- }
- // 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();
- </script>
- <style lang="less" scoped>
- .title {
- width: 380px;
- height: 40px;
- line-height: 40px;
- border-top: 1px solid #139602;
- border-bottom: 1px solid #e7e7e7;
- background-color: #fbfbfb;
- >h4 {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- margin-left: 20px;
- font-size: 20px;
- color: #000000;
- text-align: left;
- font-style: normal;
- text-transform: none;
- >span {
- float: right;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 14px;
- margin-right: 10px;
- color: #999999;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- }
- .rightList {
- height: 556px;
- padding-top: 20px;
- background-color: #fbfbfb;
- >li {
- width: 380px;
- height: 100px;
- margin-bottom: 10px;
- margin-left: 15px;
- // background-color: #a5caa0;
- a {
- display: block;
- }
- >img {
- width: 150px;
- height: 100px;
- border-radius: 4px;
- }
- p {
- float: left;
- width: 220px;
- height: 100px;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 29px;
- // border-bottom: 1px solid #e7e7e7;
- padding-left: 12px;
- padding-right: 10px;
- padding-bottom: 10px;
- padding-top: 8px;
- box-sizing: border-box;
- }
- }
- >li:hover {
- p {
- //box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
- color: #139602;
- }
- }
- }
- .hotNewsImg {
- float: left;
- width: 150px;
- height: 100px;
- border-radius: 4px;
- }
- </style>
|