HotNews2.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="title">
  3. <h4>
  4. 热点精选
  5. </h4>
  6. </div>
  7. <!-- 列表 -->
  8. <ul class="rightList">
  9. <li v-for="item in hotNewsList">
  10. <NuxtLink :to="item.linkurl" target="_blank" v-show="item.islink == 1">
  11. <img class="left hotNewsImg" :src="item.imgurl">
  12. <p class="left">{{ item.title }}</p>
  13. </NuxtLink>
  14. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank" v-if="item.islink == 0">
  15. <img class="left hotNewsImg" :src="item.imgurl">
  16. <p class="left">{{ item.title }}</p>
  17. </NuxtLink>
  18. </li>
  19. </ul>
  20. </template>
  21. <script setup>
  22. const hotNewsList = ref([])
  23. async function getPageData() {
  24. const { data: mkdata, error: mkdataError } = requestData('/web/getWebsiteArticlett', {
  25. method: 'GET',
  26. query: {
  27. 'pageSize': 5,
  28. 'level': 4,
  29. 'placeid': 15
  30. },
  31. });
  32. if (mkdataError.value) {
  33. //console.error('模块1数据上部分请求失败!', mkdataError.value);
  34. } else {
  35. if (mkdata.value) {
  36. //console.log('模块1数据上部分请求成功!', mkdata.value.data);
  37. hotNewsList.value = mkdata.value.data;
  38. }
  39. }
  40. }
  41. getPageData();
  42. </script>
  43. <style lang="less" scoped>
  44. .title {
  45. width: 380px;
  46. height: 40px;
  47. line-height: 40px;
  48. border-top: 1px solid #139602;
  49. border-bottom: 1px solid #e7e7e7;
  50. background-color: #fbfbfb;
  51. >h4 {
  52. font-family: Microsoft YaHei, Microsoft YaHei;
  53. font-weight: 400;
  54. margin-left: 20px;
  55. font-size: 20px;
  56. color: #000000;
  57. text-align: left;
  58. font-style: normal;
  59. text-transform: none;
  60. >span {
  61. float: right;
  62. font-family: Microsoft YaHei, Microsoft YaHei;
  63. font-weight: 400;
  64. font-size: 14px;
  65. margin-right: 10px;
  66. color: #999999;
  67. text-align: left;
  68. font-style: normal;
  69. text-transform: none;
  70. }
  71. }
  72. }
  73. .rightList {
  74. height: 540px;
  75. padding-top: 20px;
  76. background-color: #fbfbfb;
  77. >li {
  78. height: 100px;
  79. margin-bottom: 10px;
  80. margin-left: 15px;
  81. a {
  82. display: block;
  83. }
  84. >img {
  85. width: 150px;
  86. height: 100px;
  87. border-radius: 4px;
  88. }
  89. p {
  90. width: 216px;
  91. height: 100px;
  92. padding-left: 12px;
  93. padding-right: 10px;
  94. box-sizing: border-box;
  95. font-family: PingFang SC, PingFang SC;
  96. font-weight: 400;
  97. font-size: 16px;
  98. color: #333333;
  99. line-height: 22px;
  100. text-align: left;
  101. font-style: normal;
  102. text-transform: none;
  103. }
  104. }
  105. >li:hover {
  106. p {
  107. box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
  108. color: #139602;
  109. }
  110. }
  111. }
  112. .hotNewsImg {
  113. width: 150px;
  114. height: 100px;
  115. border-radius: 4px;
  116. }
  117. </style>