You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
4.8 KiB
170 lines
4.8 KiB
4 years ago
|
<template>
|
||
|
<view class="uni-calendar-item__weeks-box" :class="{
|
||
|
'uni-calendar-item--disable':weeks.disable,
|
||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||
|
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
|
||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||
|
}" @click="choiceDate(weeks)">
|
||
|
<view class="uni-calendar-item__weeks-box-item">
|
||
|
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
|
||
|
<text class="uni-calendar-item__weeks-box-text" :class="{
|
||
|
'uni-calendar-item--isDay-text': weeks.isDay,
|
||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||
|
'uni-calendar-item--disable':weeks.disable,
|
||
|
}">{{weeks.date}}</text>
|
||
|
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||
|
}">今天</text>
|
||
|
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||
|
'uni-calendar-item--disable':weeks.disable,
|
||
|
}">{{weeks.isDay?'今天': (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
|
||
|
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||
|
'uni-calendar-item--extra':weeks.extraInfo.info,
|
||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||
|
'uni-calendar-item--disable':weeks.disable,
|
||
|
}">{{weeks.extraInfo.info}}</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
props: {
|
||
|
weeks: {
|
||
|
type: Object,
|
||
|
default () {
|
||
|
return {}
|
||
|
}
|
||
|
},
|
||
|
calendar: {
|
||
|
type: Object,
|
||
|
default: () => {
|
||
|
return {}
|
||
|
}
|
||
|
},
|
||
|
selected: {
|
||
|
type: Array,
|
||
|
default: () => {
|
||
|
return []
|
||
|
}
|
||
|
},
|
||
|
lunar: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
choiceDate(weeks) {
|
||
|
this.$emit('change', weeks)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
.uni-calendar-item__weeks-box {
|
||
|
flex: 1;
|
||
|
/* #ifndef APP-NVUE */
|
||
|
display: flex;
|
||
|
/* #endif */
|
||
|
flex-direction: column;
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item__weeks-box-text {
|
||
|
font-size: 14px;
|
||
|
color: #333;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item__weeks-lunar-text {
|
||
|
font-size: 12px;
|
||
|
color: #333;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item__weeks-box-item {
|
||
|
position: relative;
|
||
|
/* #ifndef APP-NVUE */
|
||
|
display: flex;
|
||
|
/* #endif */
|
||
|
flex-direction: column;
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
width: 100rpx;
|
||
|
height: 100rpx;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item__weeks-box-circle {
|
||
|
position: absolute;
|
||
|
top: 5px;
|
||
|
right: 5px;
|
||
|
width: 8px;
|
||
|
height: 8px;
|
||
|
border-radius: 8px;
|
||
|
background-color: #dd524d;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--disable {
|
||
|
background-color: rgba(249, 249, 249, 0.3);
|
||
|
color: #c0c0c0;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--isDay-text {
|
||
|
color: #007aff;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--isDay {
|
||
|
background-color: #007aff;
|
||
|
opacity: 0.8;
|
||
|
color: #fff;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--extra {
|
||
|
color: #dd524d;
|
||
|
opacity: 0.8;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--checked {
|
||
|
background-color: #007aff;
|
||
|
color: #fff;
|
||
|
opacity: 0.8;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--multiple {
|
||
|
background-color: #007aff;
|
||
|
color: #fff;
|
||
|
opacity: 0.8;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--before-checked {
|
||
|
background-color: #ff5a5f;
|
||
|
color: #fff;
|
||
|
}
|
||
|
|
||
|
.uni-calendar-item--after-checked {
|
||
|
background-color: #ff5a5f;
|
||
|
color: #fff;
|
||
|
}
|
||
|
</style>
|