noticeContent.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="notice-content">
  3. <aside>
  4. <a-list item-layout="horizontal"
  5. :data-source="noticeList">
  6. <template #renderItem="{ item }">
  7. <a-list-item @click="choose(item)">
  8. <a-list-item-meta :description="item.createtime">
  9. <template #title>
  10. <a :style="{color: item.readed ? '#88A0AE' : '#E5E5E5'}"
  11. href="javascript:;">{{ item.title }}</a>
  12. </template>
  13. <template #avatar>
  14. <a-badge :color="item.readed ? '#88A0AE' : 'orange'" />
  15. </template>
  16. </a-list-item-meta>
  17. </a-list-item>
  18. </template>
  19. </a-list>
  20. </aside>
  21. <main>
  22. <h4>{{chooseItemNotice.title}}</h4>
  23. <p>{{chooseItemNotice.createtime}}</p>
  24. <div>
  25. {{chooseItemNotice.content}}
  26. </div>
  27. </main>
  28. </div>
  29. </template>
  30. <script lang="ts">
  31. import { defineComponent, PropType, reactive, computed } from 'vue';
  32. import { QueryNoticeRsp } from '@/goServiceAPI/commonService/interface';
  33. import { mergeObjSameProperty } from '@/utils/tool/set';
  34. function chooseNotice() {
  35. interface ItemNotice {
  36. title: string;
  37. content: string; //内容
  38. createtime: string; //创建时间
  39. }
  40. const chooseItemNotice = reactive<ItemNotice>({
  41. title: '',
  42. content: '',
  43. createtime: '',
  44. });
  45. function choose(item: QueryNoticeRsp) {
  46. mergeObjSameProperty(chooseItemNotice, item);
  47. }
  48. return { chooseItemNotice, choose };
  49. }
  50. export default defineComponent({
  51. name: 'notice',
  52. props: {
  53. noticeList: {
  54. type: Object as PropType<QueryNoticeRsp[]>,
  55. default: [],
  56. },
  57. },
  58. setup(props) {
  59. const { chooseItemNotice, choose } = chooseNotice();
  60. computed(() => {
  61. props.noticeList.length && mergeObjSameProperty(chooseItemNotice, props.noticeList[0]);
  62. });
  63. return {
  64. choose,
  65. chooseItemNotice,
  66. };
  67. },
  68. });
  69. </script>
  70. <style lang="less">
  71. .notice-content {
  72. .flex;
  73. aside {
  74. cursor: pointer;
  75. padding: 10px;
  76. width: 202px;
  77. height: 619px;
  78. .ant-list-split {
  79. .ant-list-item-meta-description {
  80. text-align: right;
  81. font-size: 13px;
  82. color: #3b444a;
  83. }
  84. .ant-list-item-meta-avatar {
  85. margin-right: 0;
  86. }
  87. .ant-list-item {
  88. padding: 5px 0;
  89. border-bottom: none;
  90. a {
  91. width: 160px;
  92. // color: #88A0AE;
  93. font-size: 15px;
  94. display: inline-block;
  95. .ellipse;
  96. }
  97. }
  98. }
  99. }
  100. main {
  101. flex: 1;
  102. background: #1d2327;
  103. padding: 20px;
  104. h4 {
  105. font-size: 17px;
  106. color: #e5e5e5;
  107. }
  108. p {
  109. font-size: 13px;
  110. color: #3b444a;
  111. }
  112. div {
  113. font-size: 15px;
  114. color: #88a0ae;
  115. text-indent: 2em;
  116. }
  117. }
  118. }
  119. </style>;