Announcement.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="announcement">
  3. <view @click="itemClick(item,index)" v-for="(item,index) in list " :key="index" class="announcement-item">
  4. <view class="announcement-item-title">
  5. <view class="announcement-item-title-left">
  6. {{item.title}}
  7. </view>
  8. <view :style="`color:${item.is_read ? '#05CCA1':'#FDAB45'};`" class="announcement-item-title-right">
  9. <view v-if="!item.is_read" class="announcement-item-title-right-color">
  10. </view>
  11. <uni-icons v-else type="checkmarkempty" color="#05CCA1" size="16"></uni-icons>
  12. {{item.is_read ? '已读' :'未读'}}
  13. </view>
  14. </view>
  15. <view class="announcement-item-content">
  16. {{item.content}}
  17. </view>
  18. <view class="announcement-item-date">
  19. 发布时间 {{item.created_at}}
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: "Announcement",
  27. props: {
  28. list: {
  29. type: Array,
  30. default: () => []
  31. }
  32. },
  33. data() {
  34. return {
  35. };
  36. },
  37. methods: {
  38. itemClick(item) {
  39. this.$emit('itemClick', item)
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .announcement-item-title-left {
  46. width: 500rpx;
  47. }
  48. .announcement {
  49. width: 100%;
  50. box-sizing: border-box;
  51. }
  52. .announcement-item {
  53. width: 100%;
  54. box-sizing: border-box;
  55. padding: 32rpx;
  56. background-color: #fff;
  57. border-radius: 5.33px;
  58. box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.20);
  59. margin-bottom: 32rpx;
  60. .announcement-item-content {
  61. padding: 24rpx 0;
  62. color: #666;
  63. }
  64. .announcement-item-date {
  65. color: #999;
  66. font-size: 24rpx;
  67. }
  68. .announcement-item-title {
  69. display: flex;
  70. justify-content: space-between;
  71. align-items: center;
  72. padding-bottom: 24rpx;
  73. border-bottom: 1px solid #f2f2f2;
  74. .announcement-item-title-right {
  75. display: flex;
  76. align-items: center;
  77. .announcement-item-title-right-color {
  78. width: 16rpx;
  79. height: 16rpx;
  80. border-radius: 50%;
  81. margin-right: 10rpx;
  82. background-color: #FDAB45;
  83. }
  84. }
  85. }
  86. }
  87. </style>