index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="message-container">
  3. <view class="top-tabs">
  4. <view class="tab-item" :class="{ active: currentTab === 'system' }" @click="switchTab('system')">
  5. <text class="tab-text">系统消息</text>
  6. </view>
  7. <view class="tab-item" :class="{ active: currentTab === 'business' }" @click="switchTab('business')">
  8. <text class="tab-text">业务消息</text>
  9. </view>
  10. </view>
  11. <scroll-view class="message-list" scroll-y>
  12. <view class="message-item" v-for="(item, index) in messageList" :key="index" @click="viewDetail">
  13. <view class="message-icon">
  14. <uni-icons type="bell" size="24" color="#1890ff"></uni-icons>
  15. </view>
  16. <view class="message-content">
  17. <view class="message-header">
  18. <text class="message-title">{{ item.title }}</text>
  19. <text class="message-time">{{ item.time }}</text>
  20. </view>
  21. <text class="message-desc">{{ item.content }}</text>
  22. </view>
  23. </view>
  24. </scroll-view>
  25. </view>
  26. </template>
  27. <script setup>
  28. import {
  29. ref,
  30. reactive
  31. } from 'vue'
  32. const currentTab = ref('system')
  33. const messageList = reactive([{
  34. title: '撒东方大厦发多少',
  35. time: '2025/12/20 13:28:10',
  36. content: '按时分秒,电脑风扇,啊没法弄收到,麻烦你什么,能否打撒,你吗,收到能否,的描述'
  37. },
  38. ])
  39. const switchTab = (tab) => {
  40. currentTab.value = tab
  41. }
  42. const viewDetail = () => {
  43. uni.showToast({
  44. title: '阿斯顿发的是',
  45. icon: 'none'
  46. })
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .message-container {
  51. background: #f5f6f8;
  52. }
  53. .top-tabs {
  54. display: flex;
  55. align-items: center;
  56. padding: 20rpx 32rpx;
  57. margin-bottom: 20rpx;
  58. .tab-item {
  59. width: 182rpx;
  60. height: 72rpx;
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. border-radius: 20rpx;
  65. background: #ffffff;
  66. .tab-text {
  67. font-size: 28rpx;
  68. color: #666666;
  69. }
  70. &.active {
  71. background: linear-gradient(90deg, #5B86F5 0%, #36D1DC 100%);
  72. .tab-text {
  73. color: #ffffff;
  74. font-weight: 600;
  75. }
  76. }
  77. &:not(:last-child) {
  78. margin-right: 24rpx;
  79. }
  80. }
  81. }
  82. .message-list {
  83. padding: 0 20rpx;
  84. .message-item {
  85. display: flex;
  86. background: #ffffff;
  87. border-radius: 16rpx;
  88. padding: 28rpx;
  89. margin-bottom: 20rpx;
  90. .message-icon {
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. width: 60rpx;
  95. height: 60rpx;
  96. background: #e6f7ff;
  97. border-radius: 50%;
  98. margin-right: 20rpx;
  99. flex-shrink: 0;
  100. }
  101. .message-content {
  102. flex: 1;
  103. .message-header {
  104. display: flex;
  105. justify-content: space-between;
  106. align-items: center;
  107. margin-bottom: 12rpx;
  108. .message-title {
  109. font-size: 30rpx;
  110. font-weight: 600;
  111. color: #333333;
  112. }
  113. .message-time {
  114. font-size: 22rpx;
  115. color: #999999;
  116. flex-shrink: 0;
  117. margin-left: 16rpx;
  118. }
  119. }
  120. .message-desc {
  121. display: block;
  122. font-size: 26rpx;
  123. color: #666666;
  124. line-height: 1.6;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. }
  128. }
  129. }
  130. }
  131. </style>