2025-10-30 16:42:12 +08:00
|
|
|
|
<template>
|
2025-10-31 09:35:40 +08:00
|
|
|
|
|
2025-10-31 10:16:00 +08:00
|
|
|
|
<!-- 顶部Tabs栏 -->
|
|
|
|
|
|
<view class="fixed-tabs" >
|
|
|
|
|
|
<uv-tabs :list="topTabs" @click="click"></uv-tabs>
|
|
|
|
|
|
</view>
|
2025-10-31 09:35:40 +08:00
|
|
|
|
|
2025-10-31 10:16:00 +08:00
|
|
|
|
<!-- 内容区域 -->
|
|
|
|
|
|
<view class="content-wrapper" :style="{ paddingTop: ( tabsHeight) + 'px' }">
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<uv-calendar ref="calendar" mode="single" @change="handleConfirm" closeOnClickConfirm="false"></uv-calendar>
|
|
|
|
|
|
<button @click="openCalendar">选择日期</button>
|
|
|
|
|
|
</view>
|
2025-10-30 18:00:30 +08:00
|
|
|
|
|
2025-10-31 10:16:00 +08:00
|
|
|
|
<!-- 时间轴表格 -->
|
|
|
|
|
|
<TimeTable :hours="hours" :events="eventsInDay" />
|
2025-10-31 09:35:40 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-10-30 18:00:30 +08:00
|
|
|
|
<!-- 悬浮新建按钮 -->
|
|
|
|
|
|
<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>
|
2025-10-31 10:45:23 +08:00
|
|
|
|
<uv-tabbar-item text="直播 " icon="play-right"></uv-tabbar-item>
|
2025-10-31 09:35:40 +08:00
|
|
|
|
<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-31 10:45:23 +08:00
|
|
|
|
import { ref, computed } from 'vue';
|
2025-10-31 10:16:00 +08:00
|
|
|
|
|
2025-10-30 18:00:30 +08:00
|
|
|
|
import TimeTable from '@/components/TimeTable.vue';
|
|
|
|
|
|
import FabPlus from '@/components/FabPlus.vue';
|
|
|
|
|
|
import AddEventModal from '@/components/AddEventModal.vue';
|
2025-10-30 17:19:26 +08:00
|
|
|
|
|
2025-10-31 10:16:00 +08:00
|
|
|
|
// 获取状态栏高度
|
|
|
|
|
|
|
|
|
|
|
|
const tabsHeight = ref(44); // tabs 高度,单位:px
|
|
|
|
|
|
|
|
|
|
|
|
|
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-31 10:16:00 +08:00
|
|
|
|
function click(item) {
|
|
|
|
|
|
topTabValue.value = item.value;
|
|
|
|
|
|
console.log('切换tab:', item.name);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-31 10:45:23 +08:00
|
|
|
|
// 当前选择的日期,格式:YYYY-MM-DD
|
|
|
|
|
|
const selectedDate = ref(new Date().toISOString().slice(0, 10));
|
2025-10-30 17:19:26 +08:00
|
|
|
|
|
2025-10-30 18:00:30 +08:00
|
|
|
|
// 小时段
|
2025-10-31 10:45:23 +08:00
|
|
|
|
const hours = Array.from({length: 24}, (_,i)=>i); // 8~20点
|
2025-10-30 18:00:30 +08:00
|
|
|
|
// 示例日程
|
2025-10-31 10:45:23 +08:00
|
|
|
|
const today = new Date().toISOString().slice(0, 10);
|
2025-10-30 18:00:30 +08:00
|
|
|
|
const allEvents = ref([
|
2025-10-31 10:45:23 +08:00
|
|
|
|
{id:1,title:'日程标题',startHour:15,startMin:30,color:'#e3fae6',date:today},
|
|
|
|
|
|
{id:2,title:'日程标题',startHour:16,startMin:0,color:'#fae1e1',date:today},
|
|
|
|
|
|
{id:3,title:'日程标题',startHour:23,startMin:0,color:'#e3fae6',date:today},
|
2025-10-30 18:00:30 +08:00
|
|
|
|
]);
|
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) => {
|
2025-10-31 10:45:23 +08:00
|
|
|
|
console.log('日历选择:', e);
|
|
|
|
|
|
// 处理日历返回的日期,可能是对象或字符串
|
|
|
|
|
|
let dateStr = '';
|
|
|
|
|
|
if (typeof e === 'string') {
|
|
|
|
|
|
dateStr = e;
|
|
|
|
|
|
} else if (e?.date) {
|
|
|
|
|
|
dateStr = e.date;
|
|
|
|
|
|
} else if (e?.value) {
|
|
|
|
|
|
dateStr = e.value;
|
|
|
|
|
|
} else if (Array.isArray(e) && e.length > 0) {
|
|
|
|
|
|
// 如果是数组,取第一个
|
|
|
|
|
|
dateStr = typeof e[0] === 'string' ? e[0] : (e[0]?.date || e[0]?.value || '');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 格式化日期为 YYYY-MM-DD
|
|
|
|
|
|
if (dateStr) {
|
|
|
|
|
|
const date = new Date(dateStr);
|
|
|
|
|
|
if (!isNaN(date.getTime())) {
|
|
|
|
|
|
selectedDate.value = date.toISOString().slice(0, 10);
|
|
|
|
|
|
console.log('更新选择日期:', selectedDate.value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-31 09:35:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
width: 100%;
|
2025-10-31 10:16:00 +08:00
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fixed-tabs {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
z-index: 999;
|
|
|
|
|
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content-wrapper {
|
|
|
|
|
|
min-height: 100vh;
|
2025-10-31 09:35:40 +08:00
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
|
</style>
|