message1.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="page">
  3. <!-- tab -->
  4. <IconLabelNav :ops="tabOps" @change="changeTab"></IconLabelNav>
  5. <!-- list -->
  6. <view class="list">
  7. <scroll-view scroll-y="true" style="height: calc(100vh - 350rpx);">
  8. <view class="" v-for="(msgCommunity, i) in communityList" :key="i">
  9. <view class="card " v-if="currentTab == 0">
  10. <view class="date">{{ msgCommunity.time }}</view>
  11. <view class="inner community">
  12. <u-avatar size="100" src="../../../static/user/1.png"></u-avatar>
  13. <view class="right">
  14. <view class="info">
  15. <view class="name">{{ msgCommunity.name }}</view>
  16. <view class="time">刚刚</view>
  17. </view>
  18. <view class="content">{{ msgCommunity.content }}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="" v-for="(msgSystem, j) in systemList" :key="j">
  24. <view class="card " v-if="currentTab == 1">
  25. <view class="date">{{ msgSystem.time }}</view>
  26. <view class="inner system">
  27. <view class="title">系统消息</view>
  28. <view class="content">
  29. <text>盛夏来袭全民动起来系统消息系统消息盛夏来袭全民动起来系统消息系统消息盛夏来袭全民动起来系统消</text>
  30. <text>点击查看>></text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import IconLabelNav from '@/components/nav/icon-label-nav.vue';
  41. export default {
  42. components: {
  43. IconLabelNav
  44. },
  45. data() {
  46. return {
  47. // tab 配置
  48. currentTab: 0,
  49. tabOps: [
  50. { label: '社区消息', icon: require('@/pages-mine/static/message-community.png'), iconActive: require('@/pages-mine/static/message-community-active.png') },
  51. { label: '系统消息', icon: require('@/pages-mine/static/message-system.png'), iconActive: require('@/pages-mine/static/message-system-active.png') }
  52. ],
  53. // 假数据
  54. communityList: [
  55. {
  56. time: '2021-07-21',
  57. name: '演示用户2',
  58. content: '点赞了你的帖子“吃好睡好身体的额好'
  59. },
  60. {
  61. time: '2021-07-21',
  62. name: '演示用户3',
  63. content: '点赞了你的帖子“吃好睡好身体的额好'
  64. },
  65. {
  66. time: '2021-07-21',
  67. name: '演示用户4',
  68. content: '点赞了你的帖子“吃好睡好身体的额好'
  69. }
  70. ],
  71. systemList: [
  72. {
  73. time: '2021-07-21'
  74. },
  75. {
  76. time: '2021-07-21'
  77. },
  78. {
  79. time: '2021-07-21'
  80. }
  81. ]
  82. };
  83. },
  84. methods: {
  85. // 切换tab
  86. changeTab(e) {
  87. this.currentTab = e.index;
  88. }
  89. }
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. .list {
  94. .card {
  95. margin-top: 20rpx;
  96. margin-bottom: 20rpx;
  97. .date {
  98. font-size: 14px;
  99. font-family: PingFangSC-Regular, PingFang SC;
  100. font-weight: 400;
  101. color: $app-theme-shop-gray-color;
  102. margin-bottom: 16rpx;
  103. text-align: center;
  104. }
  105. .inner {
  106. margin: 30rpx;
  107. padding: 30rpx;
  108. background-color: $app-theme-bg-color;
  109. box-shadow: $app-theme-shadow;
  110. border-radius: 16rpx;
  111. .right {
  112. width: 80%;
  113. margin-left: 20rpx;
  114. }
  115. .info {
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: flex-end;
  119. margin-bottom: 20rpx;
  120. .name {
  121. font-size: 28rpx;
  122. color: $app-theme-text-black-color;
  123. }
  124. .time {
  125. font-size: 24rpx;
  126. color: $app-theme-shop-gray-color;
  127. }
  128. }
  129. .content {
  130. font-size: 24rpx;
  131. color: $app-theme-shop-gray-color;
  132. }
  133. }
  134. .inner.community {
  135. display: flex;
  136. align-items: center;
  137. .content {
  138. overflow: hidden;
  139. white-space: nowrap;
  140. text-overflow: ellipsis;
  141. }
  142. }
  143. .inner.system {
  144. .title {
  145. font-size: 28rpx;
  146. color: $app-theme-text-black-color;
  147. margin-bottom: 20rpx;
  148. }
  149. .content {
  150. text:nth-child(2) {
  151. font-size: 24rpx;
  152. color: $app-theme-color;
  153. margin-left: 20rpx;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>