陶杰
2024-08-22 4aa0bd47801606b4d0e0a6a2ed8fe92a7e5f2444
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
    <view class="uni-calendar-item__weeks-box" :class="{
        'uni-calendar-item--disable':weeks.disable,
        'uni-calendar-item--before-checked-x':weeks.beforeMultiple,
        'uni-calendar-item--multiple': weeks.multiple,
        'uni-calendar-item--after-checked-x':weeks.afterMultiple,
        }" @click="choiceDate(weeks)" @mouseenter="handleMousemove(weeks)">
        <view class="uni-calendar-item__weeks-box-item" :class="{
                'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && (calendar.userChecked || !checkHover),
                'uni-calendar-item--checked-range-text': checkHover,
                '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,
                }">
            <text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
            <text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text>
        </view>
        <view :class="{'uni-calendar-item--today': weeks.isToday}"></view>
    </view>
</template>
 
<script>
    export default {
        props: {
            weeks: {
                type: Object,
                default () {
                    return {}
                }
            },
            calendar: {
                type: Object,
                default: () => {
                    return {}
                }
            },
            selected: {
                type: Array,
                default: () => {
                    return []
                }
            },
            checkHover: {
                type: Boolean,
                default: false
            }
        },
        methods: {
            choiceDate(weeks) {
                this.$emit('change', weeks)
            },
            handleMousemove(weeks) {
                this.$emit('handleMouse', weeks)
            }
        }
    }
</script>
 
<style lang="scss" >
    $uni-primary: #007aff !default;
 
    .uni-calendar-item__weeks-box {
        flex: 1;
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin: 1px 0;
        position: relative;
    }
 
    .uni-calendar-item__weeks-box-text {
        font-size: 14px;
        // font-family: Lato-Bold, Lato;
        font-weight: bold;
        color: darken($color: $uni-primary, $amount: 40%);
    }
 
    .uni-calendar-item__weeks-box-item {
        position: relative;
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        /* #ifdef H5 */
        cursor: pointer;
        /* #endif */
    }
 
 
    .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__weeks-box .uni-calendar-item--disable {
        cursor: default;
    }
 
    .uni-calendar-item--disable .uni-calendar-item__weeks-box-text-disable {
        color: #D1D1D1;
    }
 
    .uni-calendar-item--today {
        position: absolute;
        top: 10px;
        right: 17%;
        background-color: #dd524d;
        width:6px;
        height: 6px;
        border-radius: 50%;
    }
 
    .uni-calendar-item--extra {
        color: #dd524d;
        opacity: 0.8;
    }
 
    .uni-calendar-item__weeks-box .uni-calendar-item--checked {
        background-color: $uni-primary;
        border-radius: 50%;
        box-sizing: border-box;
        border: 3px solid #fff;
    }
 
    .uni-calendar-item--checked .uni-calendar-item--checked-text {
        color: #fff;
    }
 
    .uni-calendar-item--multiple .uni-calendar-item--checked-range-text {
        color: #333;
    }
 
    .uni-calendar-item--multiple {
        background-color:  #F6F7FC;
        // color: #fff;
    }
 
    .uni-calendar-item--multiple .uni-calendar-item--before-checked,
    .uni-calendar-item--multiple .uni-calendar-item--after-checked {
        background-color: $uni-primary;
        border-radius: 50%;
        box-sizing: border-box;
        border: 3px solid #F6F7FC;
    }
 
    .uni-calendar-item--before-checked .uni-calendar-item--checked-text,
    .uni-calendar-item--after-checked .uni-calendar-item--checked-text {
        color: #fff;
    }
 
    .uni-calendar-item--before-checked-x {
        border-top-left-radius: 50px;
        border-bottom-left-radius: 50px;
        box-sizing: border-box;
        background-color: #F6F7FC;
    }
 
    .uni-calendar-item--after-checked-x {
        border-top-right-radius: 50px;
        border-bottom-right-radius: 50px;
        background-color: #F6F7FC;
    }
</style>