| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <template>
- <view class="container">
- <!-- 顶部搜索框区域 -->
- <view class="search">
- <uni-search-bar bgColor="#fff" placeholder="请输入打卡规则名称" cancelButton="none" v-model="searchValue"
- @input="input" @clear="clear" @blur="blur">
- </uni-search-bar>
- </view>
- <!-- 规则列表区域 -->
- <view class="list">
- <!-- 每一个规则区域 -->
- <view class="box" v-for="item in list" :key="item.id" @click="handleLook">
- <view class="icon">
- <img src="./imgs/rule.png">
- </view>
- <view class="info">
- <view class="title">
- {{item.title}}
- </view>
- <view class="status">
- <span class="right">全勤:{{item.allPeople}}人</span>
- <span>异常:{{item.errPeople}}人</span>
- </view>
- </view>
- <!-- 右上角图标区域 -->
- <view class="image">
- <img v-if="item.status==1" src="./imgs/unfinished.png">
- <img v-if="item.status==2" src="./imgs/finished.png">
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- searchValue: "",
- list: [{
- id: 1,
- title: "课间操打卡",
- allPeople: 500,
- errPeople: 20,
- status: 1
- },
- {
- id: 2,
- title: "课间操打卡",
- allPeople: 600,
- errPeople: 20,
- status: 1
- },
- {
- id: 3,
- title: "课间操打卡",
- allPeople: 100,
- errPeople: 10,
- status: 2
- },
- {
- id: 4,
- title: "课间操打卡",
- allPeople: 600,
- errPeople: 20,
- status: 1
- },
- ]
- }
- },
- methods: {
- handleLook() {
- uni.navigateTo({
- url: "/pages/rulesDetail/rulesDetail"
- })
- },
- // 搜索框失焦回调
- blur(res) {
- uni.showToast({
- title: '搜索:' + res.value,
- icon: 'none'
- })
- },
- // 搜索框输入时的回调
- input(res) {
- console.log('----input:', res)
- },
- // 清除搜索框内容时的回调
- clear(res) {
- uni.showToast({
- title: 'clear事件,清除值为:' + res.value,
- icon: 'none'
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding-top: 20rpx;
- .search {
- margin: 0 auto;
- width: 690rpx;
- height: 90rpx;
- border-radius: 171rpx;
- background-color: #fff;
- }
- .list {
- margin-top: 20rpx;
- padding-bottom: 30rpx;
- .box {
- display: flex;
- margin: 0 auto;
- margin-bottom: 20rpx;
- width: 690rpx;
- height: 130rpx;
- background-color: #fff;
- .icon {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- img {
- width: 60rpx;
- height: 60rpx;
- }
- }
- .info {
- flex: 6;
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- .title {
- font-size: 30rpx;
- }
- .status {
- font-size: 24rpx;
- font-weight: 500;
- color: #A6A6A6;
- .right {
- margin-right: 20rpx;
- }
- }
- }
- .image {
- margin-top: -5rpx;
- margin-right: -5rpx;
- width: 83rpx;
- height: 83rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- }
- // 解决输入框不居中问题
- ::v-deep .uni-searchbar {
- padding: 10rpx;
- }
- </style>
|