<template> <view class="schedule"> <view class="schedule-title"> <view class="schedule-title-item"> 周一 </view> <view class="schedule-title-item"> 周二 </view> <view class="schedule-title-item"> 周三 </view> <view class="schedule-title-item"> 周四 </view> <view class="schedule-title-item"> 周五 </view> </view> <view v-if="list.length == 0" class="null"> 暂无数据 </view> <view v-else v-for="(item,index) in list" :key="index" class="schedule-content"> <view @click="openPop(item1)" :style="`background-color: ${bgcColor(item1)};`" v-for="(item1,index1) in item" :key="index1" class="schedule-content-item"> <view class="schedule-content-item-name"> {{item1.classroom}} </view> <!-- <view v-if="item1.show" class="schedule-content-item-text"> 调 </view> --> </view> </view> </view> </template> <script> export default { props: { list: { type: Array, default: () => [] } }, data() { return { }; }, methods: { bgcColor(item1) { if (item1.current) { return '#FCE9D0' } else if (item1.name !== '') { return '#cef1e9' } }, openPop(item1) { this.$emit('openPop', item1) } } } </script> <style lang="scss" scoped> .null { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color: #999; font-size: 18px; margin-top: 16px; } .schedule { width: 100%; box-sizing: border-box; background-color: #fff; padding-bottom: 32rpx; .schedule-title { height: 70rpx; width: 100%; background: #cef1e9; border-radius: 10rpx; display: flex; margin-bottom: 16rpx; box-sizing: border-box; .schedule-title-item { flex: 1; display: flex; align-items: center; justify-content: center; } } .schedule-content { width: 100%; display: flex; justify-content: space-between; font-size: 20rpx; margin-bottom: 16rpx; box-sizing: border-box; .schedule-content-item { width: 126rpx; height: 140rpx; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; .schedule-content-item-text { position: absolute; top: 2rpx; left: 10rpx; font-size: 24rpx; color: #FDAD45; } .schedule-content-item-name { width: 80rpx; text-align: center; line-height: 36rpx; font-size: 24rpx; } } } } </style>