messageSystem.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="message-list">
  3. <!-- 消息提示 -->
  4. <view class="message-item" @click="$navigateTo('/pages/messageList/messageList?type=2')">
  5. <uni-badge class="uni-badge-left-margin" :text="testCount[2]" absolute="rightTop" size="small">
  6. <view class="message-system-icon">
  7. <uni-icons type="icon-jigoukehudaishenheshuliang" custom-prefix="iconfont" size="30" color="#fff">
  8. </uni-icons>
  9. </view>
  10. </uni-badge>
  11. <view class="message-content">
  12. <view class="message-title">项目邀请通知</view>
  13. <view class="message-sub-content">
  14. {{!testCount[2] ?'暂无消息通知' : `您有${testCount[2]}条未读消息,请查看~`}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. getMessageTest
  23. } from '@/request/api/message.js'
  24. export default {
  25. data() {
  26. return {
  27. testCount: {}
  28. }
  29. },
  30. onShow() {
  31. this.init();
  32. },
  33. methods: {
  34. init() {
  35. getMessageTest(3).then(res => {
  36. if (res.code == 200) {
  37. let obj = {};
  38. for (var i = 0; i < res.data.length; i++) {
  39. obj[res.data[i].messageType] = res.data[i].count;
  40. }
  41. this.testCount = obj;
  42. }
  43. })
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="scss">
  49. .message-list {
  50. margin-top: 30rpx;
  51. .message-item {
  52. background: #fff;
  53. display: flex;
  54. padding: 24rpx 30rpx;
  55. position: relative;
  56. &::before {
  57. content: '';
  58. position: absolute;
  59. bottom: 0;
  60. right: 0;
  61. left: 150rpx;
  62. height: 2rpx;
  63. background: $uni-border-1;
  64. }
  65. }
  66. .message-system-icon {
  67. width: 100rpx;
  68. height: 100rpx;
  69. border-radius: 16rpx;
  70. text-align: center;
  71. line-height: 100rpx;
  72. background: $uni-primary;
  73. }
  74. .message-image {
  75. width: 100rpx;
  76. height: 100rpx;
  77. border-radius: 16rpx;
  78. overflow: hidden;
  79. }
  80. .message-content {
  81. flex: 1;
  82. width: 0;
  83. margin-left: 20rpx;
  84. display: flex;
  85. flex-direction: column;
  86. justify-content: center;
  87. }
  88. .message-title {
  89. font-size: 32rpx;
  90. font-weight: 600;
  91. margin-bottom: 10rpx;
  92. }
  93. .message-sub-content {
  94. font-weight: 300;
  95. color: $uni-secondary-color;
  96. }
  97. .message-date {
  98. position: absolute;
  99. top: 34rpx;
  100. right: 30rpx;
  101. font-size: 24rpx;
  102. font-weight: 300;
  103. color: $uni-secondary-color;
  104. }
  105. }
  106. </style>