newCenter.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="w-screen pad:w-full">
  3. <big-title>{{lang===langType.cn?"新闻中心":getAbbrText("新闻中心")}}</big-title>
  4. <div class="container mx-auto newView">
  5. <a
  6. v-for="(news,i) in newArr"
  7. :key="news.key"
  8. :href="news.src"
  9. :class="`newChunk chunk${i}`">
  10. <span class="imgBox" v-if="news.img">
  11. <img :src="news.img" alt=""/>
  12. </span>
  13. <p class="newsContext">
  14. <span class="newsType">
  15. <span>{{getNewsTypeStr(news.type)}}</span>
  16. </span>
  17. <span class="title">
  18. {{lang===langType.cn?news.title:getLangText(news.title)}}
  19. </span>
  20. <span class="description">
  21. {{lang===langType.cn?news.description:getLangText(news.description)}}
  22. </span>
  23. <span class="time">
  24. {{news.time}}
  25. </span>
  26. </p>
  27. </a>
  28. </div>
  29. <div class="container mx-auto">
  30. <a class=" show-more" :href="hrefs.news">查看更多</a>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import langMap from "@/map/langMap";
  36. import {hrefs} from "@/map/hrefMap";
  37. import {newsType,getNewsTypeStr} from "@/map/newMap";
  38. export default {
  39. name: "newCenter",
  40. props: {
  41. lang:{
  42. default: langMap.lang.cn
  43. },
  44. },
  45. data(){
  46. return {
  47. langType: langMap.lang,
  48. hrefs: hrefs,
  49. newsType: newsType,
  50. newArr:[
  51. {
  52. key: 'one',
  53. title: "智慧能源解决方案",
  54. img: 'image/showing/fire_s.jpg',
  55. type: 2,
  56. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  57. src: '/solution',
  58. time: '2023-04-02',
  59. },
  60. {
  61. key: 'two',
  62. title: "解锁家庭光伏电站监控全姿势",
  63. type: 2,
  64. description: "目前家庭光伏电站的运行维护主要基于对逆变器的监控,那么主流监控模式有哪些呢?小编带你逐一分解",
  65. src: '/solution',
  66. time: '2022-01-02'
  67. },
  68. {
  69. key: 'three',
  70. title: "G8100 4G低功耗LTE无线模块简介",
  71. type: 2,
  72. description: "工业级高性能、高通平台,超低功耗,多种无线通信方式,丰富的I/O接口",
  73. src: '/solution',
  74. time: '2021-11-30'
  75. },
  76. {
  77. key: 'four',
  78. title: "ETC停车场的发展前景",
  79. type: 3,
  80. description: "1.无需人值守降低人工成本;2.非现金支付,杜绝跑冒滴漏;3.集中式管理,财务一目了然;4.无缝对接各类基于ETC的应用系统;5.兼容全国高速公路,ETC收费系统;6.不停车通行,提升通行效率;",
  81. src: '/news/item/pa?id=47',
  82. time: '2022-09-20'
  83. },{
  84. key: 'five',
  85. title: "森林防火4G摄像机视频监控解决方案",
  86. type: 1,
  87. description: "采用4G摄像机4G高清网络摄像机或4G高清视频服务器+摄像头组合,将监控点附近的相关视频实时回传至监控中心,林区负责人或监管部门可实时了解林区状态,如有隐患或火灾,可第一时间发现并采取相应措施。\n" ,
  88. src: '/solution/item/sol?id=49',
  89. time: '2022-01-02'
  90. }
  91. ]
  92. }
  93. },
  94. methods:{
  95. getLangText(str) {
  96. return langMap.getText(this.lang, str);
  97. },
  98. getAbbrText(str) {
  99. return langMap.getAbbrText(this.lang, str);
  100. },
  101. getNewsTypeStr(ind){
  102. return langMap.getAbbrText(
  103. this.lang,
  104. getNewsTypeStr(ind)
  105. );
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped>
  111. .newView{
  112. display: flex;
  113. align-items: center;
  114. flex-direction: column;
  115. }
  116. .newView .newChunk{
  117. box-shadow: 0 0 1px black;
  118. position: relative;
  119. overflow: hidden;
  120. cursor: pointer;
  121. box-sizing: border-box;
  122. padding: 15px 35px;
  123. width: 96%;
  124. }
  125. @media screen and (min-width: 1024px) {
  126. .newView{
  127. display: grid;
  128. grid-template-columns: repeat(3);
  129. grid-template-rows: repeat(2,260px);
  130. grid-template-areas:
  131. 'a b c'
  132. 'a d e';
  133. margin-bottom: 35px;
  134. }
  135. .newView .newChunk{
  136. width: 100%;
  137. }
  138. }
  139. .newView .newChunk:hover{
  140. box-shadow: 2px 2px 6px #484444;
  141. }
  142. .newChunk .imgBox{
  143. width: 100%;
  144. height: 240px;
  145. margin-bottom: 10px;
  146. }
  147. .newView .newChunk:hover .imgBox img{
  148. left: -10px;
  149. top: -10px;
  150. max-width: calc(100% + 20px);
  151. width: calc(100% + 20px);
  152. height: calc(100% + 20px);
  153. }
  154. .newsContext{
  155. display: block;
  156. width: 100%;
  157. height: 240px;
  158. }
  159. .newsContext .newsType{
  160. /*margin: 10px 0;*/
  161. display: flex;
  162. height: 35px;
  163. align-items: center;
  164. }
  165. .newsContext .newsType > span{
  166. color: #ea0000;
  167. background-color: #eecec5;
  168. padding: 1px 15px;
  169. border-radius: 3px;
  170. }
  171. .newsContext .title{
  172. font-size: 1.3em;
  173. display: flex;
  174. height: 55px;
  175. align-items: center;
  176. font-weight: bold;
  177. }
  178. .newsContext .description{
  179. display: block;
  180. width: 100%;
  181. height: calc(100% - 120px);
  182. }
  183. .newsContext .time{
  184. display: flex;
  185. height: 40px;
  186. }
  187. .show-more{
  188. height: 50px;
  189. display: flex;
  190. align-items: center;
  191. justify-content: flex-end;
  192. padding: 0 10px;
  193. box-sizing: border-box;
  194. font-size: 1.4em;
  195. margin-bottom: 35px;
  196. }
  197. .show-more:hover{
  198. color: orangered;
  199. }
  200. .newView .chunk0{
  201. grid-area: a;
  202. }
  203. /*.newView .chunk2{*/
  204. /* grid-area: b;*/
  205. /*}*/
  206. /*.newView .chunk3{*/
  207. /* grid-area: c;*/
  208. /*}*/
  209. /*.newView .chunk4{*/
  210. /* grid-area: d;*/
  211. /*}*/
  212. /*.newView .chunk5{*/
  213. /* grid-area: e;*/
  214. /*}*/
  215. </style>