newCenter.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="content">
  3. <div class="conBox big-title">
  4. <span>
  5. {{lang===langType.cn?"新闻中心":getAbbrText("新闻中心")}}
  6. </span>
  7. <div class="hr"></div>
  8. </div>
  9. <div class="conBox newView">
  10. <a
  11. v-for="(news,i) in newArr"
  12. :key="news.key"
  13. :href="news.src"
  14. :class="`newChunk chunk${i}`">
  15. <span class="imgBox" v-if="news.img">
  16. <img :src="news.img" alt=""/>
  17. </span>
  18. <p class="newsContext">
  19. <span class="newsType">
  20. <span>{{getNewsTypeStr(news.type)}}</span>
  21. </span>
  22. <span class="title">
  23. {{lang===langType.cn?news.title:getLangText(news.title)}}
  24. </span>
  25. <span class="description">
  26. {{lang===langType.cn?news.description:getLangText(news.description)}}
  27. </span>
  28. <span class="time">
  29. {{news.time}}
  30. </span>
  31. </p>
  32. </a>
  33. </div>
  34. <a class="conBox show-more" :href="hrefs.news">查看更多</a>
  35. </div>
  36. </template>
  37. <script>
  38. import langMap from "@/map/langMap";
  39. import {hrefs} from "@/map/hrefMap";
  40. import {newsType,getNewsTypeStr} from "@/map/newMap";
  41. export default {
  42. name: "newCenter",
  43. props: {
  44. lang:{
  45. default: langMap.lang.cn
  46. },
  47. },
  48. data(){
  49. return {
  50. langType: langMap.lang,
  51. hrefs: hrefs,
  52. newsType: newsType,
  53. newArr:[
  54. {
  55. key: 'one',
  56. title: "智慧能源解决方案",
  57. img: 'image/showing/fire_s.jpg',
  58. type: 2,
  59. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  60. src: '/solution',
  61. time: '2023-04-02',
  62. },
  63. {
  64. key: 'two',
  65. title: "解锁家庭光伏电站监控全姿势",
  66. type: 2,
  67. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  68. src: '/solution',
  69. time: '2022-01-02'
  70. },
  71. {
  72. key: 'three',
  73. title: "解锁家庭光伏电站监控全姿势",
  74. type: 2,
  75. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  76. src: '/solution',
  77. time: '2022-01-02'
  78. },
  79. {
  80. key: 'four',
  81. title: "解锁家庭光伏电站监控全姿势",
  82. type: 2,
  83. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  84. src: '/solution',
  85. time: '2022-01-02'
  86. },{
  87. key: 'five',
  88. title: "解锁家庭光伏电站监控全姿势",
  89. type: 2,
  90. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  91. src: '/solution',
  92. time: '2022-01-02'
  93. }
  94. ]
  95. }
  96. },
  97. methods:{
  98. getLangText(str) {
  99. return langMap.getText(this.lang, str);
  100. },
  101. getAbbrText(str) {
  102. return langMap.getAbbrText(this.lang, str);
  103. },
  104. getNewsTypeStr(ind){
  105. return langMap.getAbbrText(
  106. this.lang,
  107. getNewsTypeStr(ind)
  108. );
  109. }
  110. }
  111. }
  112. </script>
  113. <style scoped>
  114. .newView{
  115. display: grid;
  116. grid-template-columns: repeat(3);
  117. grid-template-rows: repeat(2,260px);
  118. grid-template-areas:
  119. 'a b c'
  120. 'a d e'
  121. ;
  122. margin-bottom: 35px;
  123. }
  124. .newView .newChunk{
  125. box-shadow: 0 0 1px black;
  126. position: relative;
  127. overflow: hidden;
  128. cursor: pointer;
  129. box-sizing: border-box;
  130. padding: 15px 35px;
  131. }
  132. .newView .newChunk:hover{
  133. box-shadow: 2px 2px 6px #484444;
  134. }
  135. .newChunk .imgBox{
  136. width: 100%;
  137. height: 240px;
  138. margin-bottom: 10px;
  139. }
  140. .newView .newChunk:hover .imgBox img{
  141. left: -10px;
  142. top: -10px;
  143. max-width: calc(100% + 20px);
  144. width: calc(100% + 20px);
  145. height: calc(100% + 20px);
  146. }
  147. .newsContext{
  148. display: block;
  149. width: 100%;
  150. height: 240px;
  151. }
  152. .newsContext .newsType{
  153. /*margin: 10px 0;*/
  154. display: flex;
  155. height: 35px;
  156. align-items: center;
  157. }
  158. .newsContext .newsType > span{
  159. color: #ea0000;
  160. background-color: #eecec5;
  161. padding: 1px 15px;
  162. border-radius: 3px;
  163. }
  164. .newsContext .title{
  165. font-size: 1.3em;
  166. display: flex;
  167. height: 55px;
  168. align-items: center;
  169. font-weight: bold;
  170. }
  171. .newsContext .description{
  172. display: block;
  173. width: 100%;
  174. height: calc(100% - 120px);
  175. }
  176. .newsContext .time{
  177. display: flex;
  178. height: 40px;
  179. }
  180. .show-more{
  181. height: 50px;
  182. display: flex;
  183. align-items: center;
  184. justify-content: flex-end;
  185. padding: 0 10px;
  186. box-sizing: border-box;
  187. font-size: 1.4em;
  188. margin-bottom: 35px;
  189. }
  190. .show-more:hover{
  191. color: orangered;
  192. }
  193. .newView .chunk0{
  194. grid-area: a;
  195. }
  196. /*.newView .chunk2{*/
  197. /* grid-area: b;*/
  198. /*}*/
  199. /*.newView .chunk3{*/
  200. /* grid-area: c;*/
  201. /*}*/
  202. /*.newView .chunk4{*/
  203. /* grid-area: d;*/
  204. /*}*/
  205. /*.newView .chunk5{*/
  206. /* grid-area: e;*/
  207. /*}*/
  208. </style>