particulars.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="container">
  3. <!-- 顶部搜索框区域 -->
  4. <view class="search">
  5. <uni-search-bar bgColor="#fff" placeholder="请输入打卡规则名称" cancelButton="none" v-model="searchValue"
  6. @input="input" @clear="clear" @blur="blur">
  7. </uni-search-bar>
  8. </view>
  9. <!-- 规则列表区域 -->
  10. <view class="list">
  11. <!-- 每一个规则区域 -->
  12. <view class="box" v-for="item in list" :key="item.id" @click="handleLook">
  13. <view class="icon">
  14. <img src="./imgs/rule.png">
  15. </view>
  16. <view class="info">
  17. <view class="title">
  18. {{item.title}}
  19. </view>
  20. <view class="status">
  21. <span class="right">全勤:{{item.allPeople}}人</span>
  22. <span>异常:{{item.errPeople}}人</span>
  23. </view>
  24. </view>
  25. <!-- 右上角图标区域 -->
  26. <view class="image">
  27. <img v-if="item.status==1" src="./imgs/unfinished.png">
  28. <img v-if="item.status==2" src="./imgs/finished.png">
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. searchValue: "",
  39. list: [{
  40. id: 1,
  41. title: "课间操打卡",
  42. allPeople: 500,
  43. errPeople: 20,
  44. status: 1
  45. },
  46. {
  47. id: 2,
  48. title: "课间操打卡",
  49. allPeople: 600,
  50. errPeople: 20,
  51. status: 1
  52. },
  53. {
  54. id: 3,
  55. title: "课间操打卡",
  56. allPeople: 100,
  57. errPeople: 10,
  58. status: 2
  59. },
  60. {
  61. id: 4,
  62. title: "课间操打卡",
  63. allPeople: 600,
  64. errPeople: 20,
  65. status: 1
  66. },
  67. ]
  68. }
  69. },
  70. methods: {
  71. handleLook() {
  72. uni.navigateTo({
  73. url: "/pages/rulesDetail/rulesDetail"
  74. })
  75. },
  76. // 搜索框失焦回调
  77. blur(res) {
  78. uni.showToast({
  79. title: '搜索:' + res.value,
  80. icon: 'none'
  81. })
  82. },
  83. // 搜索框输入时的回调
  84. input(res) {
  85. console.log('----input:', res)
  86. },
  87. // 清除搜索框内容时的回调
  88. clear(res) {
  89. uni.showToast({
  90. title: 'clear事件,清除值为:' + res.value,
  91. icon: 'none'
  92. })
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .container {
  99. padding-top: 20rpx;
  100. .search {
  101. margin: 0 auto;
  102. width: 690rpx;
  103. height: 90rpx;
  104. border-radius: 171rpx;
  105. background-color: #fff;
  106. }
  107. .list {
  108. margin-top: 20rpx;
  109. padding-bottom: 30rpx;
  110. .box {
  111. display: flex;
  112. margin: 0 auto;
  113. margin-bottom: 20rpx;
  114. width: 690rpx;
  115. height: 130rpx;
  116. background-color: #fff;
  117. .icon {
  118. flex: 1;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. img {
  123. width: 60rpx;
  124. height: 60rpx;
  125. }
  126. }
  127. .info {
  128. flex: 6;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: space-evenly;
  132. .title {
  133. font-size: 30rpx;
  134. }
  135. .status {
  136. font-size: 24rpx;
  137. font-weight: 500;
  138. color: #A6A6A6;
  139. .right {
  140. margin-right: 20rpx;
  141. }
  142. }
  143. }
  144. .image {
  145. margin-top: -5rpx;
  146. margin-right: -5rpx;
  147. width: 83rpx;
  148. height: 83rpx;
  149. img {
  150. width: 100%;
  151. height: 100%;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. // 解决输入框不居中问题
  158. ::v-deep .uni-searchbar {
  159. padding: 10rpx;
  160. }
  161. </style>