message-system.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="message-system">
  3. <ul class="list">
  4. <li v-for="(item, index) in messageList" :key="index">
  5. <template
  6. v-if="
  7. item.type === types.MSG_GRP_TIP ||
  8. item.type === types.MSG_GRP_SYS_NOTICE
  9. "
  10. >
  11. <i class="icon icon-system"></i>
  12. <span>{{ translateGroupSystemNotice(item) }}</span>
  13. <div class="btn-box" v-if="item?.payload?.operationType === 1">
  14. <button
  15. class="btn btn-default"
  16. @click="handleApplication('Agree', item)"
  17. >
  18. 接受
  19. </button>
  20. <button
  21. class="btn btn-cancel"
  22. @click="handleApplication('Reject', item)"
  23. >
  24. 拒绝
  25. </button>
  26. </div>
  27. </template>
  28. </li>
  29. </ul>
  30. </div>
  31. </template>
  32. <script lang="ts">
  33. import { defineComponent, watchEffect, reactive, toRefs } from 'vue';
  34. import { translateGroupSystemNotice } from '../utils/utils';
  35. export default defineComponent({
  36. props: {
  37. data: {
  38. type: Array,
  39. default: () => []
  40. },
  41. types: {
  42. type: Object,
  43. default: () => ({})
  44. }
  45. },
  46. setup(props: any, ctx: any) {
  47. const data = reactive({
  48. messageList: [],
  49. types: {}
  50. });
  51. watchEffect(() => {
  52. data.messageList = props.data;
  53. data.types = props.types;
  54. });
  55. const handleApplication = (handleAction: string, message: any) => {
  56. const options: any = {
  57. handleAction,
  58. message
  59. };
  60. ctx.emit('application', options);
  61. };
  62. return {
  63. ...toRefs(data),
  64. translateGroupSystemNotice,
  65. handleApplication
  66. };
  67. }
  68. });
  69. </script>
  70. <style lang="scss" scoped>
  71. @import url('../../../styles/common.scss');
  72. @import url('../../../styles/icon.scss');
  73. .list {
  74. flex: 1;
  75. height: 100%;
  76. overflow-y: auto;
  77. min-width: 600Px;
  78. li {
  79. display: flex;
  80. align-items: center;
  81. position: relative;
  82. padding: 10Px 20Px;
  83. font-weight: 400;
  84. font-size: 14Px;
  85. color: #000000;
  86. letter-spacing: 0;
  87. .icon {
  88. margin-right: 10Px;
  89. }
  90. .message-label {
  91. max-width: 50Px;
  92. }
  93. .btn-box {
  94. padding: 0 12Px;
  95. }
  96. }
  97. }
  98. .icon {
  99. display: inline-block;
  100. width: 16Px;
  101. height: 16Px;
  102. &-warn {
  103. border-radius: 50%;
  104. background: coral;
  105. color: #ffffff;
  106. font-style: normal;
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. }
  111. }
  112. .btn {
  113. padding: 2Px 10Px;
  114. margin-right: 12Px;
  115. border-radius: 4Px;
  116. border: none;
  117. font-weight: 400;
  118. font-size: 14Px;
  119. color: #ffffff;
  120. letter-spacing: 0;
  121. text-align: center;
  122. line-height: 20Px;
  123. &:last-child {
  124. margin-right: 0;
  125. }
  126. &-cancel {
  127. border: 1Px solid #dddddd;
  128. color: #666666;
  129. }
  130. &-default {
  131. background: #006eff;
  132. border: 1Px solid #006eff;
  133. }
  134. &:disabled {
  135. opacity: 0.3;
  136. }
  137. }
  138. </style>