1.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="newsBox">
  3. <div class="listNewsTitle" v-if="skinId==1">
  4. 最新资讯
  5. </div>
  6. <div class="listNewsTitle_skin2" v-if="skinId==2">
  7. <span>最新资讯</span>
  8. </div>
  9. <div class="newsContent">
  10. <div v-for="item in component_style1_News1Array" class="newsContentImg">
  11. <NuxtLink
  12. :href="getLinkPathDetail(item)"
  13. :title="item.title"
  14. :target="item.islink == 1 ? '_blank' : '_self'"
  15. >
  16. <img :src="item.imgurl" />
  17. <div>{{ item.title }}</div>
  18. </NuxtLink>
  19. </div>
  20. <div v-for="item in component_style1_News2Array" class="newsContentText">
  21. <NuxtLink
  22. :href="getLinkPathDetail(item)"
  23. :title="item.title"
  24. :target="item.islink == 1 ? '_blank' : '_self'"
  25. >
  26. {{ item.title }}
  27. </NuxtLink>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. //引入vue
  34. import {ref} from 'vue';
  35. //获得新闻数据
  36. const props = defineProps({
  37. //templateData:Array,//新闻数据
  38. skinId:String,//皮肤id
  39. });
  40. const component_style1_News1Array = ref([]);
  41. const component_style1_News2Array = ref([]);
  42. // component_style1_News1Array.value = props.templateData.img.slice(0,2);
  43. // component_style1_News2Array.value = props.templateData.text.slice(0,4);
  44. //最新资讯数据 start ---------------------------------------->
  45. async function getPageData() {
  46. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  47. method: 'GET',
  48. query: {
  49. 'imgnum': 4,
  50. 'textnum': 4,
  51. 'level': 4,
  52. 'id': 0,
  53. 'placeid': 0,
  54. },
  55. });
  56. if(mkdata.code == 200){
  57. component_style1_News1Array.value = mkdata.data.img.slice(0, 2);
  58. component_style1_News2Array.value = mkdata.data.text.slice(0, 4);
  59. }
  60. }
  61. getPageData();
  62. //最新资讯数据 end ---------------------------------------->
  63. </script>
  64. <style lang="less" scoped>
  65. .newsBox {
  66. .listNewsTitle {
  67. font-size:22px;
  68. font-weight:bold;
  69. height: 40px;
  70. line-height: 25px;
  71. border-bottom: 2px solid #004564;
  72. color:#004564;
  73. margin-bottom: 20px;
  74. box-sizing: border-box;
  75. }
  76. .listNewsTitle_skin2 {
  77. font-size:22px;
  78. font-weight:bold;
  79. height: 40px;
  80. line-height: 25px;
  81. border-bottom: 2px solid #A91B33;
  82. color:#A91B33;
  83. margin-bottom: 20px;
  84. box-sizing: border-box;
  85. span {
  86. color:#A91B33;
  87. height: 30px;
  88. line-height: 30px;
  89. border-left: 3px solid #A91B33;
  90. padding-left: 12px;
  91. }
  92. }
  93. .newsContent {
  94. .newsContentImg {
  95. a {
  96. display: block;
  97. display: flex;
  98. align-items: center;
  99. justify-content: center;
  100. margin-bottom: 20px;
  101. font-size:18px;
  102. div {
  103. overflow: hidden;
  104. display: -webkit-box;
  105. -webkit-line-clamp: 3;
  106. -webkit-box-orient: vertical;
  107. text-overflow: ellipsis;
  108. color:#333333;
  109. }
  110. }
  111. img {
  112. display: block;
  113. margin-right: 10px;
  114. width: 120px;
  115. height: 80px;
  116. }
  117. }
  118. .newsContentText {
  119. font-size:18px;
  120. color:#333333;
  121. margin-bottom: 20px;
  122. overflow: hidden;
  123. white-space: nowrap;
  124. text-overflow: ellipsis;
  125. a {
  126. color:#333333;
  127. }
  128. }
  129. }
  130. }
  131. </style>