late.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="container">
  3. <!-- 背景图片区域 -->
  4. <img class="img_bg" src="../../static/images/center-bg.png" />
  5. <!-- 时间筛选区域 -->
  6. <view class="time">
  7. 迟到时间
  8. <view class="time_rang">
  9. <uni-datetime-picker v-model="timeRang" type="daterange" @change="changeTime" />
  10. </view>
  11. </view>
  12. <!-- 迟到列表区域 -->
  13. <view class="list">
  14. <uni-swipe-action>
  15. <view v-for="(item, index) in list" :key="index">
  16. <uni-swipe-action-item :right-options="options" @click="onClickItem(item)">
  17. <!-- 每一个迟到记录区域 -->
  18. <view class="item_box">
  19. <view class="box_info">
  20. <image class="info_img" src="/static/images/header.png" mode="aspectFill"></image>
  21. <view class="info_msg">
  22. <view class="msg_name">
  23. {{ item.name }}
  24. </view>
  25. <view class="msg_no">
  26. {{ item.cardNo }}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="box_time">{{ item.timeGroup }}</view>
  31. </view>
  32. </uni-swipe-action-item>
  33. <view style="height: 20rpx"></view>
  34. </view>
  35. </uni-swipe-action>
  36. </view>
  37. </view>
  38. </template>
  39. <script setup>
  40. import { ref } from 'vue'
  41. const options = [
  42. {
  43. text: '删除',
  44. style: {
  45. backgroundColor: '#D43030'
  46. }
  47. }
  48. ]
  49. const timeRang = ref([])
  50. const list = ref([
  51. {
  52. cardNo: '132',
  53. name: '小明',
  54. timeGroup: '时间组'
  55. },
  56. {
  57. cardNo: '132',
  58. name: '小明',
  59. timeGroup: '时间组'
  60. },
  61. {
  62. cardNo: '132',
  63. name: '小明',
  64. timeGroup: '时间组'
  65. },
  66. {
  67. cardNo: '132',
  68. name: '小明',
  69. timeGroup: '时间组'
  70. },
  71. {
  72. cardNo: '132',
  73. name: '小明',
  74. timeGroup: '时间组'
  75. }
  76. ])
  77. // 点击每一项删除回调
  78. const onClickItem = (item) => {
  79. uni.showModal({
  80. title: '提示',
  81. content: `确定把${item.name}移除吗?`,
  82. success: (res) => {
  83. if (res.confirm) {
  84. // handleDeleteReq([item.id])
  85. }
  86. }
  87. })
  88. }
  89. // 切换时间回调
  90. const changeTime = (e) => {
  91. timeRang.value = e
  92. console.log(timeRang.value)
  93. if (timeRang.value.length) {
  94. console.log(1)
  95. } else {
  96. console.log(2)
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .container {
  102. box-sizing: border-box;
  103. padding: 30rpx 20rpx;
  104. height: 100vh;
  105. background: linear-gradient(180deg, rgba(242, 247, 255, 1) 0%, rgba(242, 247, 255, 0) 100%);
  106. // 背景图片区域样式
  107. .img_bg {
  108. position: absolute;
  109. top: -70rpx;
  110. right: 0;
  111. width: 589rpx;
  112. height: 320rpx;
  113. pointer-events: none;
  114. }
  115. .time {
  116. display: flex;
  117. align-items: center;
  118. margin-bottom: 30rpx;
  119. height: 70rpx;
  120. font-size: 28rpx;
  121. .time_rang {
  122. margin-left: 20rpx;
  123. width: 500rpx;
  124. }
  125. }
  126. .list {
  127. height: calc(100vh - 160rpx);
  128. overflow-y: auto;
  129. .item_box {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. padding: 0 20rpx;
  134. height: 167rpx;
  135. font-size: 28rpx;
  136. border-radius: 8rpx;
  137. background-color: #fff;
  138. .box_info {
  139. display: flex;
  140. .info_img {
  141. width: 100rpx;
  142. height: 100rpx;
  143. border-radius: 50%;
  144. }
  145. .info_msg {
  146. display: flex;
  147. flex-direction: column;
  148. justify-content: space-between;
  149. margin-left: 28rpx;
  150. .msg_name {
  151. font-size: 32rpx;
  152. }
  153. .msg_no {
  154. color: #808080;
  155. }
  156. }
  157. }
  158. .box_time {
  159. }
  160. }
  161. }
  162. }
  163. </style>