rili-riqibeizhu.vue
5.64 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<template>
<u-popup :show="visible" mode="bottom" :round="24" :closeable="false" :custom-style="{ height: '80vh' }"
@close="handleClose">
<view class="date-note-popup">
<!-- 顶部导航栏 -->
<view class="popup-header">
<view class="close-btn" @click="handleClose">
<text class="close-icon">×</text>
</view>
<text class="popup-title">新增日程备注</text>
<button class="save-btn" @click="handleSave">保存</button>
</view>
<!-- 颜色选择区 -->
<view class="color-section">
<text class="section-title">选择显示颜色</text>
<view class="color-list">
<view v-for="(color, index) in colorList" :key="index" class="color-item"
:class="{ active: selectedColorIndex === index }" :style="{ backgroundColor: color }"
@click="selectedColorIndex = index" />
</view>
</view>
<!-- 输入框区域 -->
<view class="input-section">
<text class="section-title">日程标题</text>
<textarea v-model="noteContent" class="note-textarea" placeholder="输入当天的日程情况,如休息日、生病受伤了、经期等"
placeholder-class="placeholder" />
</view>
<!-- 历史备注区域 -->
<view class="history-section">
<view class="history-header">
<text class="section-title history-title">历史备注</text>
<text class="history-tip">点击填充到文本内容</text>
</view>
<view class="history-tags">
<view v-for="(tag, index) in historyTags" :key="index" class="tag-item"
:style="{ backgroundColor: tag.color }" @click="fillNote(tag.text)">
<text class="tag-text">+{{ tag.text }}</text>
</view>
</view>
</view>
</view>
</u-popup>
</template>
<script setup>
import { ref } from 'vue';
const props = defineProps({
visible: {
type: Boolean,
default: false
}
});
const emit = defineEmits(['update:visible', 'save', 'close']);
// 响应式数据
const noteContent = ref('');
const selectedColorIndex = ref(0);
// 颜色列表(和截图一致)
const colorList = ref([
'#ff9944',
'#ff7766',
'#ddaaff',
'#aabbff',
'#cccccc'
]);
// 历史备注数据(模拟截图效果)
const historyTags = ref([
{ text: '休息日', color: '#ff9944' },
{ text: '累了', color: '#ff9944' },
]);
// 事件处理
const handleClose = () => {
emit('update:visible', false);
emit('close');
};
const handleSave = () => {
const data = {
content: noteContent.value,
color: colorList.value[selectedColorIndex.value]
};
emit('save', data);
handleClose();
};
const fillNote = (text) => {
noteContent.value = text;
};
</script>
<style scoped lang="scss">
.date-note-popup {
width: 100%;
height: 100%;
background-color: #fff;
box-sizing: border-box;
padding: 24rpx 32rpx;
}
/* 顶部导航 */
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 40rpx;
.close-btn {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
.close-icon {
font-size: 40rpx;
color: #333;
line-height: 1;
}
}
.popup-title {
font-size: 34rpx;
font-weight: 600;
color: #111;
text-align: center;
display: block;
flex: 1;
}
.save-btn {
margin-right: 0;
background: #ffd100;
color: #000;
border: none;
border-radius: 20rpx;
padding: 5rpx 25rpx;
font-size: 28rpx;
font-weight: 500;
}
}
/* 通用标题 */
.section-title {
font-size: 30rpx;
color: #111;
font-weight: 500;
display: block;
margin-bottom: 24rpx;
}
/* 颜色选择区 */
.color-section {
margin-bottom: 40rpx;
.color-list {
display: flex;
gap: 40rpx;
.color-item {
width: 80rpx;
height: 80rpx;
border-radius: 12rpx;
border: 4rpx solid transparent;
&.active {
border-color: #333;
}
}
}
}
/* 输入框区域 */
.input-section {
margin-bottom: 40rpx;
.note-textarea {
width: 100%;
height: 200rpx;
background: #f7f8fa;
border-radius: 12rpx;
padding: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
box-sizing: border-box;
.placeholder {
color: #999;
}
}
}
.history-title {
margin-bottom: 0 !important;
/* 覆盖原来的 margin-bottom */
}
/* 历史备注区域 */
.history-section {
.history-header {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 24rpx;
margin-top: 0;
.history-tip {
font-size: 24rpx;
color: #999;
}
}
.history-tags {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
.tag-item {
border-radius: 8rpx;
padding: 16rpx 24rpx;
display: flex;
align-items: center;
.tag-text {
font-size: 26rpx;
color: #fff;
}
}
}
}
</style>