OfficeSystem/pages/index/index.vue

143 lines
3.9 KiB
Vue
Raw Normal View History

2025-10-30 16:42:12 +08:00
<template>
2025-10-31 09:35:40 +08:00
<view class="status_bar">
</view>
2025-10-30 18:00:30 +08:00
<!-- 顶部Tabs栏 -->
2025-10-31 09:35:40 +08:00
<view class="fixed">
<uv-tabs :list="topTabs" @click="click"></uv-tabs>
</view>
2025-10-30 18:00:30 +08:00
<!-- 日期条 -->
<DateBar :days="weekDays" v-model="selectedDate" />
2025-10-31 09:35:40 +08:00
<view>
<uv-calendar ref="calendar" mode="single" @confirm="handleConfirm"></uv-calendar>
<button @click="openCalendar">打开</button>
</view>
2025-10-30 18:00:30 +08:00
<!-- 时间轴表格 -->
<TimeTable :hours="hours" :events="eventsInDay" />
<!-- 悬浮新建按钮 -->
<FabPlus @click="showAdd = true" />
<!-- 新建日程弹窗 -->
<AddEventModal :show="showAdd" @ok="addEvent" @cancel="showAdd = false" />
<!-- 底部导航 -->
2025-10-31 09:35:40 +08:00
<uv-tabbar :value="value" @change="index=>value = index">
<uv-tabbar-item text="首页" icon="home"></uv-tabbar-item>
<uv-tabbar-item text="放映厅" icon="photo"></uv-tabbar-item>
<uv-tabbar-item text="直播" icon="play-right"></uv-tabbar-item>
<uv-tabbar-item text="我的" icon="account"></uv-tabbar-item>
</uv-tabbar>
2025-10-30 16:42:12 +08:00
</template>
2025-10-30 17:35:16 +08:00
<script setup>
2025-10-30 18:00:30 +08:00
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';
2025-10-30 17:19:26 +08:00
2025-10-30 18:00:30 +08:00
// 顶部tabs选项
const topTabs = [
2025-10-31 09:35:40 +08:00
{ name: '日程编辑', value: 0 },
{ name: '内容看板', value: 1 },
{ name: '待办事项', value: 2 },
{ name: '消息内容', value: 3 }
2025-10-30 17:35:16 +08:00
];
2025-10-30 18:00:30 +08:00
const topTabValue = ref(0);
2025-10-30 16:42:12 +08:00
2025-10-30 18:00:30 +08:00
// 生成一周日期
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);
2025-10-30 17:19:26 +08:00
2025-10-30 18:00:30 +08:00
// 小时段
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},
]);
2025-10-30 17:19:26 +08:00
2025-10-30 18:00:30 +08:00
// 根据当前选择日期过滤
const eventsInDay = computed(() =>
allEvents.value.filter(e=>e.date===selectedDate.value)
);
2025-10-31 09:35:40 +08:00
const calendar = ref(null)
// 打开日历方法
const openCalendar = () => {
if (calendar.value) {
calendar.value.open()
}
}
const handleConfirm = (e) => {
console.log('日历选择:', e)
}
2025-10-30 18:00:30 +08:00
// 悬浮按钮/弹窗控制
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;
}
2025-10-31 09:35:40 +08:00
const value=ref(0);
2025-10-30 18:00:30 +08:00
// 底部导航
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);
2025-10-30 16:42:12 +08:00
</script>
<style lang="scss" scoped>
2025-10-31 09:35:40 +08:00
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
2025-10-30 16:42:12 +08:00
2025-10-30 18:00:30 +08:00
:deep(.bottom-tabbar) { z-index: 1000 !important; }
.schedule-timeline {
padding-bottom: 130rpx !important;
2025-10-30 17:35:16 +08:00
}
2025-10-31 09:35:40 +08:00
.fixed{
position: relative;
left: 0;
width: 100%;
}
2025-10-30 17:35:16 +08:00
</style>