msgWarn.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="container">
  3. <!-- 顶部筛选框区域 -->
  4. <picker @change="bindPickerChange" :value="index" :range="array">
  5. <view class="search">
  6. {{ array[index] }}
  7. <img class="search_icon" src="../../static/images/bottom.png" />
  8. </view>
  9. </picker>
  10. <!-- 每一条信息区域 -->
  11. <view class="box" v-for="item in list" :key="item.id">
  12. <view class="box_time">{{ item.time }}</view>
  13. <view class="box_card">
  14. <view class="card_title">
  15. <view class="title_read" v-if="item.isRead === 0"></view>
  16. {{ item.title }}
  17. </view>
  18. <view class="card_msg">姓名:{{ item.name }}</view>
  19. <view class="card_msg" v-if="item.type">类型:{{ item.type }}</view>
  20. <view class="card_msg" v-if="item.content">内容:{{ item.content }}</view>
  21. <view class="card_msg" v-if="item.warn">{{ item.warn }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script setup>
  27. import { ref } from 'vue'
  28. import { onLoad } from '@dcloudio/uni-app'
  29. onLoad(() => {})
  30. // 筛选框当前索引
  31. const index = ref(0)
  32. // 筛选框类型数组
  33. const array = ref(['全部通知', '预警推送', '课表提醒'])
  34. // 信息列表
  35. const list = ref([
  36. {
  37. id: 1,
  38. title: '预警推送',
  39. name: '张三',
  40. type: '越界',
  41. content: '实验室越界',
  42. isRead: 1,
  43. time: '2023-11-30 14:20:20'
  44. },
  45. {
  46. id: 2,
  47. title: '课表提醒',
  48. name: '李四',
  49. warn: '小宝明天(08月09日,星期五有课,请做好准备)',
  50. isRead: 0,
  51. time: '2023-11-30 12:20:20'
  52. }
  53. ])
  54. // 切换筛选框回调
  55. const bindPickerChange = (e) => {
  56. index.value = e.detail.value
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .container {
  61. display: flex;
  62. flex-direction: column;
  63. padding: 0 20rpx;
  64. min-height: 100vh;
  65. background-color: #f1f6fe;
  66. // 顶部筛选框区域样式
  67. .search {
  68. display: flex;
  69. justify-content: center;
  70. align-items: center;
  71. margin-top: 30rpx;
  72. width: 230rpx;
  73. height: 80rpx;
  74. font-size: 28rpx;
  75. border-radius: 56rpx;
  76. background-color: #fff;
  77. .search_icon {
  78. margin-left: 10rpx;
  79. width: 28rpx;
  80. height: 28rpx;
  81. }
  82. }
  83. .box {
  84. // height: 326rpx;
  85. .box_time {
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. height: 80rpx;
  90. color: #a6a6a6;
  91. font-size: 24rpx;
  92. }
  93. .box_card {
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: space-evenly;
  97. box-sizing: border-box;
  98. padding: 25rpx 30rpx;
  99. line-height: 52rpx;
  100. color: #808080;
  101. font-size: 24rpx;
  102. border-radius: 8rpx;
  103. background-color: #fff;
  104. .card_title {
  105. display: flex;
  106. align-items: center;
  107. font-size: 28rpx;
  108. font-weight: bold;
  109. color: #000;
  110. .title_read {
  111. margin-right: 10rpx;
  112. width: 12rpx;
  113. height: 12rpx;
  114. border-radius: 50%;
  115. background-color: #d43030;
  116. }
  117. }
  118. }
  119. }
  120. }
  121. </style>