news-item.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="news-item" @click="onClickDetail(item)">
  3. <view class="news-title">{{ item.title }}</view>
  4. <view class="news-time">{{ formatDate(item.publish_time || item.pub_date) }}</view>
  5. <view class="news-summary">
  6. <view class="text">{{ item.content || item.description }}</view>
  7. <view class="to-detail"><view>了解详情</view> <view class="arrow iconfont icon-right-s"></view></view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import { link } from '@/utils/request'
  13. export default {
  14. components: {
  15. },
  16. props: {
  17. type: String,
  18. item: Object
  19. },
  20. data() {
  21. return {
  22. websiteUrl: process.env.WEBSITE
  23. }
  24. },
  25. created() {
  26. },
  27. methods: {
  28. formatDate(dateString) {
  29. const date = new Date(dateString);
  30. const year = date.getFullYear();
  31. const month = date.getMonth() + 1; // 月份从 0 开始
  32. const day = date.getDate();
  33. return `${year}年${month}月${day}日`;
  34. },
  35. onClickDetail(item) {
  36. this.navigateTo(this.$store.getters.website_url + '/mini-pro-news?v=' + this.$store.getters.version)
  37. /*if (this.type === 'exhibitor') {
  38. this.navigateTo('https://mp-test-onlinecatelogue.matchexpo.cn/Selis-responds-to-Guangzhou-s-inquiry-on-M7-accident-identification-the-owner-does-not-recognize-the-analysis-conclusion-that-the-case-has-entered-the-judicial-procedure')
  39. } else {
  40. this.navigateTo('https://www.productronicachina.com.cn/2025%E6%85%95%E5%B0%BC%E9%BB%91%E4%B8%8A%E6%B5%B7%E7%94%B5%E5%AD%90%E7%94%9F%E4%BA%A7%E8%AE%BE%E5%A4%87%E5%B1%953%E6%9C%88%E5%A5%8F%E5%93%8D%E6%96%B0%E7%AF%87%E7%AB%A0-%E6%8E%A2%E7%B4%A2%E7%94%B5%E5%AD%90%E5%88%B6%E9%80%A0%E7%9A%84%E6%97%A0%E9%99%90%E5%8F%AF%E8%83%BD')
  41. }*/
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .news-item{
  48. display: flex;
  49. flex-direction: column;
  50. height: 210rpx;
  51. background-color: #F6F6F6;
  52. border-radius: 10rpx;
  53. padding: 24rpx 30rpx;
  54. }
  55. .news-summary{
  56. display: flex;
  57. align-items: center;
  58. }
  59. .news-title{
  60. @include text-ellipsis-line;
  61. font-family: Arial, Arial;
  62. font-weight: bold;
  63. font-size: $fontSize3;
  64. line-height: 35rpx;
  65. }
  66. .news-time{
  67. font-size: $fontSize0;
  68. color: #555555;
  69. margin: 12rpx 0;
  70. }
  71. .news-summary{
  72. font-size: $fontSize1;
  73. line-height: 25rpx;
  74. .text{
  75. padding-right: 30rpx;
  76. color: #555555;
  77. @include text-ellipsis-line;
  78. -webkit-line-clamp: 2;
  79. }
  80. .to-detail{
  81. display: flex;
  82. align-items: center;
  83. flex-shrink: 0;
  84. color: $buttonPrimaryColor;
  85. font-size: 16rpx;
  86. font-weight: bold;
  87. padding: 0 24rpx;
  88. }
  89. .arrow{
  90. margin-left: 12rpx;
  91. font-size: $fontSize0;
  92. }
  93. }
  94. </style>