feat: 新增短链接工具,优化日历提醒功能
1. 新增完整短链接工具服务,包括前端页面、后端API与数据库支持 2. 新增移动端日历提醒工具与鉴权配置 3. 优化日历事件编辑与展示: - 添加事件循环重复设置 - 新增全天事件支持 - 时间选择器自动对齐15分钟间隔 - 保存状态加载动画 - 事件卡片显示重复规则 4. 更新API基础地址与路由配置 5. 新增SSL证书文件与相关工具静态资源
This commit is contained in:
@@ -12,6 +12,33 @@ interface EventCardProps {
|
||||
onDelete: (event: Event) => void;
|
||||
}
|
||||
|
||||
const WEEKDAY_NAMES = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
|
||||
|
||||
// 生成循环规则中文描述
|
||||
const getRecurrenceLabel = (recurrence: string | null): string | null => {
|
||||
if (!recurrence) return null;
|
||||
const parts = recurrence.split(';');
|
||||
const type = parts[0];
|
||||
let interval = 1;
|
||||
let by: number[] = [];
|
||||
for (let i = 1; i < parts.length; i++) {
|
||||
const [key, val] = parts[i].split('=');
|
||||
if (key === 'interval') interval = parseInt(val) || 1;
|
||||
if (key === 'by') by = val.split(',').map(Number);
|
||||
}
|
||||
if (type === 'DAILY') {
|
||||
return interval === 1 ? '每天' : `每${interval}天`;
|
||||
}
|
||||
if (type === 'WEEKLY') {
|
||||
const prefix = interval === 1 ? '每周' : `每${interval}周`;
|
||||
if (by.length > 0) {
|
||||
return `${prefix} ${by.map(d => WEEKDAY_NAMES[d] || '').join('、')}`;
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export default function EventCard({
|
||||
event,
|
||||
onEdit,
|
||||
@@ -26,6 +53,8 @@ export default function EventCard({
|
||||
});
|
||||
};
|
||||
|
||||
const recurrenceLabel = getRecurrenceLabel(event.recurrence);
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={[styles.container, event.completed && styles.completedContainer]}
|
||||
@@ -71,6 +100,17 @@ export default function EventCard({
|
||||
color={theme.colors.textSecondary}
|
||||
/>
|
||||
<Text style={styles.timeText}>{formatTime(event.start)}</Text>
|
||||
{recurrenceLabel && (
|
||||
<>
|
||||
<Ionicons
|
||||
name="repeat-outline"
|
||||
size={14}
|
||||
color={theme.colors.primary}
|
||||
style={{ marginLeft: 8 }}
|
||||
/>
|
||||
<Text style={styles.recurrenceText}>{recurrenceLabel}</Text>
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -133,6 +173,10 @@ const styles = StyleSheet.create({
|
||||
...theme.typography.caption,
|
||||
color: theme.colors.textSecondary,
|
||||
},
|
||||
recurrenceText: {
|
||||
...theme.typography.caption,
|
||||
color: theme.colors.primary,
|
||||
},
|
||||
deleteButton: {
|
||||
padding: theme.spacing.sm,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user