106 lines
3.0 KiB
Vue
106 lines
3.0 KiB
Vue
<template>
|
||
<!-- 顶部Tabs栏 -->
|
||
<TopTabs :tabs="topTabs" v-model="topTabValue" />
|
||
|
||
<!-- 日期条 -->
|
||
<DateBar :days="weekDays" v-model="selectedDate" />
|
||
|
||
<!-- 时间轴表格 -->
|
||
<TimeTable :hours="hours" :events="eventsInDay" />
|
||
|
||
<!-- 悬浮新建按钮 -->
|
||
<FabPlus @click="showAdd = true" />
|
||
|
||
<!-- 新建日程弹窗 -->
|
||
<AddEventModal :show="showAdd" @ok="addEvent" @cancel="showAdd = false" />
|
||
|
||
<!-- 底部导航 -->
|
||
<BottomTabbar :items="tabbarItems" v-model="tabbarVal" />
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed } from 'vue';
|
||
import TopTabs from '@/components/TopTabs.vue';
|
||
import DateBar from '@/components/DateBar.vue';
|
||
import TimeTable from '@/components/TimeTable.vue';
|
||
import FabPlus from '@/components/FabPlus.vue';
|
||
import BottomTabbar from '@/components/BottomTabbar.vue';
|
||
import AddEventModal from '@/components/AddEventModal.vue';
|
||
|
||
// 顶部tabs选项
|
||
const topTabs = [
|
||
{ label: '日程编辑', value: 0 },
|
||
{ label: '内容看板', value: 1 },
|
||
{ label: '待办事项', value: 2 },
|
||
{ label: '消息内容', value: 3 }
|
||
];
|
||
const topTabValue = ref(0);
|
||
|
||
// 生成一周日期
|
||
function getWeekDays() {
|
||
const days = [];
|
||
const base = new Date();
|
||
base.setHours(0,0,0,0);
|
||
for(let i=-2; i<=4; i++) {
|
||
const d = new Date(base);
|
||
d.setDate(base.getDate() + i);
|
||
const ymd = d.toISOString().slice(0,10);
|
||
days.push({
|
||
date: ymd,
|
||
weekStr: '日一二三四五六'[d.getDay()],
|
||
day: d.getDate(),
|
||
tip: '',
|
||
isHoliday: d.getDay() === 0 || d.getDay() === 6,
|
||
isWeekend: d.getDay() === 6 || d.getDay() === 0,
|
||
});
|
||
}
|
||
return days;
|
||
}
|
||
const weekDays = ref(getWeekDays());
|
||
const selectedDate = ref(weekDays.value.find(i=>i.date === new Date().toISOString().slice(0,10))?.date || weekDays.value[2].date);
|
||
|
||
// 小时段
|
||
const hours = Array.from({length: 13}, (_,i)=>i+8); // 8~20点
|
||
// 示例日程
|
||
const allEvents = ref([
|
||
{id:1,title:'日程标题',startHour:15,startMin:30,color:'#e3fae6',date:weekDays.value[3].date},
|
||
{id:2,title:'日程标题',startHour:16,startMin:0,color:'#fae1e1',date:weekDays.value[3].date},
|
||
{id:3,title:'日程标题',startHour:23,startMin:0,color:'#e3fae6',date:weekDays.value[3].date},
|
||
]);
|
||
|
||
// 根据当前选择日期过滤
|
||
const eventsInDay = computed(() =>
|
||
allEvents.value.filter(e=>e.date===selectedDate.value)
|
||
);
|
||
|
||
// 悬浮按钮/弹窗控制
|
||
const showAdd = ref(false);
|
||
function addEvent(e) {
|
||
// e是{title, startHour, startMin, color},补充date
|
||
allEvents.value.push({
|
||
...e, date: selectedDate.value,
|
||
id: Date.now()
|
||
});
|
||
showAdd.value = false;
|
||
}
|
||
|
||
// 底部导航
|
||
const tabbarItems = [
|
||
{ label: '任务列表', value: 0, icon: 'list' },
|
||
{ label: '首页', value: 1, icon: 'home' },
|
||
{ label: '工作台', value: 2, icon: 'calendar' },
|
||
{ label: '月度考核', value: 3, icon: 'integral' },
|
||
{ label: '管理', value: 4, icon: 'account' }
|
||
];
|
||
const tabbarVal = ref(1);
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
@import "@/uni.scss";
|
||
|
||
:deep(.bottom-tabbar) { z-index: 1000 !important; }
|
||
|
||
.schedule-timeline {
|
||
padding-bottom: 130rpx !important;
|
||
}
|
||
</style> |