Tcode平台改造升级-控制台登录组件开发及用户工作台页面开发
This commit is contained in:
281
src/views/Jyh/Dashboard/usage.vue
Normal file
281
src/views/Jyh/Dashboard/usage.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<d-content class="content-area">
|
||||
<div class="usage-container">
|
||||
|
||||
<div class="control-bar">
|
||||
|
||||
<d-range-date-picker-pro
|
||||
v-model="rangeDatePickerProValue"
|
||||
:maxDate="today"
|
||||
:format="dateFormat"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
class="dark-picker"
|
||||
/>
|
||||
|
||||
<div class="filter-tabs-container">
|
||||
|
||||
<d-tabs type="slider" v-model="activeDaysStr" class="custom-tabs-group time-tabs">
|
||||
<d-tab id="1天" title="1天"></d-tab>
|
||||
<d-tab id="7天" title="7天"></d-tab>
|
||||
<d-tab id="30天" title="30天"></d-tab>
|
||||
</d-tabs>
|
||||
|
||||
</div>
|
||||
|
||||
<d-button class="export-btn" variant="text">
|
||||
<i class="d-icon icon-download"></i> 导出 CSV 文件
|
||||
</d-button>
|
||||
</div>
|
||||
|
||||
<div class="data-content">
|
||||
<div class="no-events-found">
|
||||
<p class="main-text">No Events Found</p>
|
||||
<p class="sub-text">No usage events found for the selected filters</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</d-content>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
// 辅助函数:根据天数设置日期范围
|
||||
const today = new Date();
|
||||
today.setHours(23, 59, 59, 999); // 确保 maxDate 覆盖今天全天
|
||||
|
||||
const getRangeByDays = (days: number): Date[] => {
|
||||
const endDate = new Date(today); // 确保结束日期是今天
|
||||
const startDate = new Date(today);
|
||||
// 注意:如果是 1天,实际是今天这 24小时,所以减 1 天
|
||||
startDate.setDate(today.getDate() - (days - 1));
|
||||
startDate.setHours(0, 0, 0, 0); // 开始日期从当天 0点开始
|
||||
return [startDate, endDate];
|
||||
};
|
||||
|
||||
const dateFormat = 'MM月DD日';
|
||||
|
||||
// 默认值:30天
|
||||
const rangeDatePickerProValue = ref<Date[]>(getRangeByDays(30));
|
||||
|
||||
const activeTag = ref('Bug Bot');
|
||||
const activeDaysStr = ref('30天'); // 默认选中 30天
|
||||
|
||||
watch(activeDaysStr, (newVal) => {
|
||||
let days: number;
|
||||
|
||||
// 从字符串 'X天' 中提取天数
|
||||
switch (newVal) {
|
||||
case '1天':
|
||||
days = 1;
|
||||
break;
|
||||
case '7天':
|
||||
days = 7;
|
||||
break;
|
||||
case '30天':
|
||||
days = 30;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新日期范围
|
||||
rangeDatePickerProValue.value = getRangeByDays(days);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 定义核心暗色变量 */
|
||||
$bg-secondary: #141414;
|
||||
$bg-card: #1e1e1e;
|
||||
$text-primary: #eaeaea;
|
||||
$text-secondary: #aaaaaa;
|
||||
$border-color: #333333;
|
||||
$active-tag-bg: #444444;
|
||||
|
||||
|
||||
.content-area {
|
||||
background-color: #121212;
|
||||
padding: 40px 60px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
.usage-page {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background-color: $bg-secondary;
|
||||
min-height: 100vh;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.usage-container {
|
||||
//max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* --- 顶部控制栏样式 --- */
|
||||
.control-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid $border-color;
|
||||
}
|
||||
|
||||
/* 日期范围选择器样式重写 (d-range-date-picker-pro) */
|
||||
:deep(.d-range-date-picker-pro) {
|
||||
width: 180px;
|
||||
|
||||
.devui-input-wrap, .devui-input-affix-wrapper {
|
||||
background-color: $bg-card !important;
|
||||
border: 1px solid $border-color !important;
|
||||
border-radius: 6px !important;
|
||||
height: 36px !important;
|
||||
padding: 0 8px !important;
|
||||
|
||||
.devui-input {
|
||||
color: $text-primary !important;
|
||||
font-weight: 500 !important;
|
||||
cursor: pointer !important;
|
||||
padding: 0 4px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.d-icon-calendar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.devui-separator {
|
||||
color: $text-primary !important;
|
||||
margin: 0 4px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- 筛选标签区域样式 (d-tabs) --- */
|
||||
.filter-tabs-container {
|
||||
display: flex;
|
||||
gap: 8px; /* 保持两个 Tab 组之间的间隔 */
|
||||
flex-grow: 1; /* 占据中间空间 */
|
||||
}
|
||||
|
||||
// 统一对 Tab 组进行样式覆盖,以实现标签的外观
|
||||
:deep(.custom-tabs-group) {
|
||||
height: 36px; /* 保持与日期选择器高度一致 */
|
||||
|
||||
// 隐藏 Tab 的底部边框
|
||||
.devui-nav-container {
|
||||
border-bottom: none !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
// 针对每个 Tab Item 进行样式覆盖
|
||||
.devui-nav-item {
|
||||
margin-right: 8px; /* 调整 Tab Item 之间的间距 */
|
||||
}
|
||||
|
||||
// Tab 内容:实现卡片/标签样式
|
||||
.devui-nav-item__link {
|
||||
color: $text-primary !important;
|
||||
background-color: $bg-card !important;
|
||||
border: 1px solid $border-color !important;
|
||||
border-radius: 6px !important;
|
||||
padding: 6px 12px !important;
|
||||
height: 36px;
|
||||
line-height: 24px;
|
||||
transition: none;
|
||||
|
||||
// 隐藏 slider 类型自带的底部滑块
|
||||
&::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
// 鼠标悬停效果
|
||||
&:hover {
|
||||
border-color: #555555 !important;
|
||||
}
|
||||
}
|
||||
|
||||
// 选中 Tab 的样式
|
||||
.devui-nav-item.active .devui-nav-item__link {
|
||||
background-color: $active-tag-bg !important;
|
||||
border-color: $active-tag-bg !important;
|
||||
color: $text-primary !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 导出按钮样式 */
|
||||
.export-btn {
|
||||
color: $text-secondary !important;
|
||||
font-size: 14px;
|
||||
padding: 0 8px !important;
|
||||
|
||||
&:hover {
|
||||
color: $text-primary !important;
|
||||
}
|
||||
|
||||
.d-icon-upload {
|
||||
font-size: 16px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --- 数据内容区样式 --- */
|
||||
.data-content {
|
||||
background-color: $bg-card;
|
||||
border-radius: 8px;
|
||||
border: 1px solid $border-color;
|
||||
margin-top: 20px;
|
||||
height: 500px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.no-events-found {
|
||||
text-align: center;
|
||||
color: #666666;
|
||||
|
||||
.main-text {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.sub-text {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
:deep(.devui-range-date-picker-pro__range-picker) {
|
||||
background-color: black;
|
||||
|
||||
.devui-input__wrapper {
|
||||
background-color: black;
|
||||
color: white;
|
||||
.devui-input__inner {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.devui-tabs__nav) {
|
||||
background-color: black;
|
||||
border-color: black;
|
||||
}
|
||||
:deep(.devui-tabs__nav--slider) {
|
||||
li:first-child {
|
||||
border-left-width: 0;
|
||||
}
|
||||
span {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
:deep(.devui-tab__content) {
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user