Initial screen starter scaffold
This commit is contained in:
commit
d136b9dddc
49 files changed
+2966
No files matched your search
@@ -0,0 +1,38 @@
|
||||
export const metrics = [
|
||||
{ label: '今日订单', value: 1280, unit: '单', tone: 'blue' as const },
|
||||
{ label: '在线设备', value: 342, unit: '台', tone: 'green' as const },
|
||||
{ label: '告警数量', value: 17, unit: '条', tone: 'amber' as const }
|
||||
]
|
||||
|
||||
export const orderTrend = {
|
||||
xAxis: ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00'],
|
||||
values: [120, 240, 380, 520, 760, 920]
|
||||
}
|
||||
|
||||
export const channelOrders = {
|
||||
categories: ['小程序', 'App', '门店', '渠道商', '客服'],
|
||||
values: [420, 360, 280, 190, 130]
|
||||
}
|
||||
|
||||
export const regionRank = {
|
||||
categories: ['华东', '华南', '华北', '西南', '东北'],
|
||||
values: [960, 820, 680, 520, 390]
|
||||
}
|
||||
|
||||
export const orderShare = [
|
||||
{ name: '标准订单', value: 56 },
|
||||
{ name: '加急订单', value: 24 },
|
||||
{ name: '售后工单', value: 12 },
|
||||
{ name: '异常订单', value: 8 }
|
||||
]
|
||||
|
||||
export const qualityRadar = {
|
||||
indicators: [
|
||||
{ name: '响应', max: 100 },
|
||||
{ name: '履约', max: 100 },
|
||||
{ name: '成本', max: 100 },
|
||||
{ name: '质量', max: 100 },
|
||||
{ name: '满意度', max: 100 }
|
||||
],
|
||||
values: [88, 76, 68, 92, 84]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { DemoOverview } from './pages/DemoOverview'
|
||||
import './styles/screen.css'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<DemoOverview />)
|
||||
@@ -0,0 +1,85 @@
|
||||
import {
|
||||
createBarOption,
|
||||
createGaugeOption,
|
||||
createLineOption,
|
||||
createPieOption,
|
||||
createRadarOption,
|
||||
createRankBarOption,
|
||||
EChart
|
||||
} from '@dev-screen-starter/charts'
|
||||
import { DebugBadge } from '@dev-screen-starter/debug'
|
||||
import { MetricCard, Panel, ScreenStage } from '@dev-screen-starter/screen-core'
|
||||
import { channelOrders, metrics, orderShare, orderTrend, qualityRadar, regionRank } from '../demo/mockData'
|
||||
|
||||
export function DemoOverview() {
|
||||
return (
|
||||
<ScreenStage background="#061826">
|
||||
<header className="screen-title">
|
||||
<span>客户项目大屏模板</span>
|
||||
<strong>运营态势总览</strong>
|
||||
</header>
|
||||
|
||||
<section className="metric-row">
|
||||
{metrics.map((metric) => (
|
||||
<MetricCard key={metric.label} {...metric} />
|
||||
))}
|
||||
</section>
|
||||
|
||||
<section className="chart-grid">
|
||||
<Panel title="折线图:订单趋势">
|
||||
<EChart
|
||||
option={createLineOption({
|
||||
categories: orderTrend.xAxis,
|
||||
values: orderTrend.values,
|
||||
name: '订单',
|
||||
color: '#63a4ff'
|
||||
})}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel title="柱状图:渠道订单">
|
||||
<EChart
|
||||
option={createBarOption({
|
||||
categories: channelOrders.categories,
|
||||
values: channelOrders.values,
|
||||
name: '订单',
|
||||
color: '#56d08a'
|
||||
})}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel title="排名条:区域排行">
|
||||
<EChart
|
||||
option={createRankBarOption({
|
||||
categories: regionRank.categories,
|
||||
values: regionRank.values,
|
||||
name: '订单',
|
||||
color: '#7aa7ff'
|
||||
})}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel title="环图:订单结构">
|
||||
<EChart option={createPieOption({ data: orderShare })} />
|
||||
</Panel>
|
||||
|
||||
<Panel title="仪表盘:履约率">
|
||||
<EChart option={createGaugeOption({ name: '履约率', value: 87, unit: '%', color: '#56d08a' })} />
|
||||
</Panel>
|
||||
|
||||
<Panel title="雷达图:运营质量">
|
||||
<EChart
|
||||
option={createRadarOption({
|
||||
indicators: qualityRadar.indicators,
|
||||
values: qualityRadar.values,
|
||||
name: '质量评分',
|
||||
color: '#d8a13e'
|
||||
})}
|
||||
/>
|
||||
</Panel>
|
||||
</section>
|
||||
|
||||
<DebugBadge enabled scale={1} />
|
||||
</ScreenStage>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #05090d;
|
||||
color: #dce8f5;
|
||||
font-family:
|
||||
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
.screen-viewport {
|
||||
background: #05090d;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.screen-stage {
|
||||
left: 50%;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
.screen-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
left: 56px;
|
||||
position: absolute;
|
||||
top: 42px;
|
||||
}
|
||||
|
||||
.screen-title span {
|
||||
color: #88a1bd;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.screen-title strong {
|
||||
color: #f1f7ff;
|
||||
font-size: 42px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.metric-row {
|
||||
display: grid;
|
||||
gap: 24px;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
left: 56px;
|
||||
position: absolute;
|
||||
right: 56px;
|
||||
top: 150px;
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
background: rgb(9 26 42 / 88%);
|
||||
border: 1px solid rgb(88 130 171 / 42%);
|
||||
border-radius: 8px;
|
||||
min-height: 148px;
|
||||
padding: 22px 24px;
|
||||
}
|
||||
|
||||
.metric-card span {
|
||||
color: #9fb4cc;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.metric-card strong {
|
||||
color: #f0f7ff;
|
||||
font-size: 48px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.metric-card small {
|
||||
color: #9fb4cc;
|
||||
font-size: 18px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.tone-green {
|
||||
border-color: rgb(78 170 116 / 42%);
|
||||
}
|
||||
|
||||
.tone-amber {
|
||||
border-color: rgb(216 161 62 / 42%);
|
||||
}
|
||||
|
||||
.screen-panel {
|
||||
background: rgb(8 22 36 / 86%);
|
||||
border: 1px solid rgb(88 130 171 / 36%);
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.screen-panel header {
|
||||
color: #d7e6f7;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.screen-panel-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.chart-grid {
|
||||
bottom: 56px;
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: repeat(2, minmax(0, 1fr));
|
||||
left: 56px;
|
||||
position: absolute;
|
||||
right: 56px;
|
||||
top: 340px;
|
||||
}
|
||||
|
||||
.chart-host {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.debug-badge {
|
||||
background: rgb(3 8 13 / 80%);
|
||||
border: 1px solid rgb(100 135 170 / 35%);
|
||||
border-radius: 6px;
|
||||
bottom: 18px;
|
||||
color: #9fb4cc;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 8px 10px;
|
||||
position: absolute;
|
||||
right: 18px;
|
||||
}
|
||||
Reference in new issue
Block a user