Commit 697288f8 by Lin

refactor(reception): 简化接待中心组件和样式变量

- 移除冗余的样式和逻辑,优化组件结构
- 更新样式变量以支持动态适配,提升在不同分辨率下的视觉一致性
- 统一样式配置,增强可维护性和用户体验
1 parent 4c166a8a
<template> <template>
<card-container variant="funnel" :root-style="flowCardRootStyle"> <card-container variant="funnel">
<view class="title-box"> <view class="title-box">
<text class="title-text" :style="flowTitleTextStyle">门店客流情况</text> <text class="title-text">门店客流情况</text>
</view> </view>
<view class="funnel-container" :style="funnelContainerStyle"> <view class="funnel-container">
<view class="flow-layout" :style="flowLayoutStyle"> <view class="flow-layout">
<view class="funnel-main" :style="funnelMainStyle"> <view class="funnel-main">
<view class="metric-card" :style="metricCardStyle"> <view class="metric-card">
<text class="metric-label" :style="metricLabelTextStyle">累计交付数</text> <text class="metric-label">累计交付数</text>
<text class="metric-value" :style="metricValueTextStyle">{{ funnelCountDisplay1 }}</text> <text class="metric-value">{{ funnelCountDisplay1 }}</text>
</view> </view>
<view class="metric-card metric-card-secondary" :style="metricCardSecondaryStyle"> <view class="metric-card metric-card-secondary">
<text class="metric-label" :style="metricLabelTextStyle">实际触客数</text> <text class="metric-label">实际触客数</text>
<text class="metric-value" :style="metricValueTextStyle">{{ funnelCountDisplay2 }}</text> <text class="metric-value">{{ funnelCountDisplay2 }}</text>
</view> </view>
</view> </view>
<view class="rate-badge" :style="rateBadgeStyle"> <view class="rate-badge">
<text class="rate-caption" :style="rateCaptionTextStyle">触客率</text> <text class="rate-caption">触客率</text>
<text class="rate-value" :style="rateValueTextStyle">{{ contactRateMasked }}%</text> <text class="rate-value">{{ contactRateMasked }}%</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -27,11 +27,6 @@ ...@@ -27,11 +27,6 @@
<script setup lang="uts"> <script setup lang="uts">
import { computed } from 'vue' import { computed } from 'vue'
import CardContainer from './CardContainer.uvue' import CardContainer from './CardContainer.uvue'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitDashboardConfig,
type ReceptionPortraitDashboardConfig
} from '../styles/portrait.uts'
/** 业绩看板聚合数据,与 center 中 performanceData 同源 */ /** 业绩看板聚合数据,与 center 中 performanceData 同源 */
const props = withDefaults( const props = withDefaults(
...@@ -95,119 +90,11 @@ const contactRateMasked = computed((): string => { ...@@ -95,119 +90,11 @@ const contactRateMasked = computed((): string => {
} }
return contactRateDisplay.value return contactRateDisplay.value
}) })
const portraitDash = computed((): ReceptionPortraitDashboardConfig | null => {
return getReceptionPortraitDashboardConfig(cssClassRef.value)
})
function flowPick(mapper: (c: ReceptionPortraitDashboardConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitDash.value
if (c == null) {
return {} as UTSJSONObject
}
return mapper(c)
}
const flowCardRootStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
padding: c.dashCardPadding,
borderRadius: c.dashCardBorderRadius,
boxShadow: c.dashCardBoxShadow,
marginBottom: c.dashCardFunnelMarginBottom
} as UTSJSONObject
})
})
const flowTitleTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashFlowTitleFontSize } as UTSJSONObject
})
})
const funnelContainerStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
borderRadius: c.dashFunnelContainerBorderRadius,
padding: c.dashFunnelContainerPadding,
marginTop: c.dashFunnelContainerMarginTop
} as UTSJSONObject
})
})
const flowLayoutStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { minHeight: c.dashFlowLayoutMinHeight } as UTSJSONObject
})
})
const funnelMainStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
minHeight: c.dashFunnelMainMinHeight,
paddingRight: c.dashFunnelMainPaddingRight
} as UTSJSONObject
})
})
const metricCardStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
minHeight: c.dashMetricCardMinHeight,
borderRadius: c.dashMetricCardBorderRadius,
padding: c.dashMetricCardPadding
} as UTSJSONObject
})
})
const metricCardSecondaryStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { marginTop: c.dashMetricCardSecondaryMarginTop } as UTSJSONObject
})
})
const metricLabelTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashMetricLabelFontSize } as UTSJSONObject
})
})
const metricValueTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
fontSize: c.dashMetricValueFontSize,
marginTop: c.dashMetricValueMarginTop
} as UTSJSONObject
})
})
const rateBadgeStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
width: c.dashRateBadgeWidth,
height: c.dashRateBadgeHeight,
borderRadius: c.dashRateBadgeBorderRadius
} as UTSJSONObject
})
})
const rateCaptionTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashRateCaptionFontSize } as UTSJSONObject
})
})
const rateValueTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
fontSize: c.dashRateValueFontSize,
marginTop: c.dashRateValueMarginTop
} as UTSJSONObject
})
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/common.scss";
.title-box { .title-box {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
...@@ -216,8 +103,8 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -216,8 +103,8 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
.title-text { .title-text {
color: #333333; color: #333333;
font-size: 14px; font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 600; font-weight: 700;
} }
.funnel-container { .funnel-container {
...@@ -249,7 +136,7 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -249,7 +136,7 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
.metric-card { .metric-card {
width: 100%; width: 100%;
min-height: 48px; min-height: var(--reception-dash-flow-metric-card-min-height, 48px);
border-radius: 12px; border-radius: 12px;
background: rgba(255, 255, 255, 0.86); background: rgba(255, 255, 255, 0.86);
box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10);
...@@ -267,23 +154,23 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -267,23 +154,23 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
} }
.metric-label { .metric-label {
font-size: 11px; font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #7b90ad; color: #7b90ad;
line-height: 14px; line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
} }
.metric-value { .metric-value {
margin-top: 3px; margin-top: 3px;
font-size: 19px; font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700; font-weight: 700;
color: #1e40af; color: #1e40af;
line-height: 22px; line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
} }
.rate-badge { .rate-badge {
width: 94px; width: var(--reception-dash-flow-rate-badge-size, 94px);
height: 94px; height: var(--reception-dash-flow-rate-badge-size, 94px);
border-radius: 47px; border-radius: var(--reception-dash-flow-rate-badge-radius, 47px);
background-color: #eaf2ff; background-color: #eaf2ff;
background-image: linear-gradient(145deg, #eaf2ff 0%, #dbeafe 100%); background-image: linear-gradient(145deg, #eaf2ff 0%, #dbeafe 100%);
border: 1px solid #cfe0ff; border: 1px solid #cfe0ff;
...@@ -296,14 +183,16 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -296,14 +183,16 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
} }
.rate-caption { .rate-caption {
font-size: 11px; font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #5f7ea8; color: #5f7ea8;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
} }
.rate-value { .rate-value {
margin-top: 2px; margin-top: 2px;
font-size: 17px; font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700; font-weight: 700;
color: #1d4ed8; color: #1d4ed8;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
} }
</style> </style>
...@@ -23,6 +23,20 @@ export default { ...@@ -23,6 +23,20 @@ export default {
'--reception-dash-compare-bar-bg-margin-right': '12px', '--reception-dash-compare-bar-bg-margin-right': '12px',
'--reception-dash-compare-value-font-size': '13px', '--reception-dash-compare-value-font-size': '13px',
'--reception-dash-compare-value-width': '60px', '--reception-dash-compare-value-width': '60px',
// receptionCenter: dashboard(CardFlow) 默认字体变量(可被 resolutions 覆盖)
'--reception-dash-flow-title-font-size': '14px',
'--reception-dash-flow-metric-label-font-size': '11px',
'--reception-dash-flow-metric-value-font-size': '19px',
'--reception-dash-flow-metric-card-min-height': '48px',
'--reception-dash-flow-metric-label-line-height': '14px',
'--reception-dash-flow-metric-value-line-height': '22px',
'--reception-dash-flow-rate-caption-font-size': '11px',
'--reception-dash-flow-rate-caption-line-height': '14px',
'--reception-dash-flow-rate-value-font-size': '17px',
'--reception-dash-flow-rate-value-line-height': '22px',
'--reception-dash-flow-rate-badge-size': '94px',
'--reception-dash-flow-rate-badge-radius': '47px',
}, },
portrait: { portrait: {
'--adapter-color': 'red', '--adapter-color': 'red',
...@@ -66,6 +80,20 @@ export default { ...@@ -66,6 +80,20 @@ export default {
'--reception-dash-compare-bar-bg-margin-right': '14px', '--reception-dash-compare-bar-bg-margin-right': '14px',
'--reception-dash-compare-value-font-size': '17px', '--reception-dash-compare-value-font-size': '17px',
'--reception-dash-compare-value-width': '72px', '--reception-dash-compare-value-width': '72px',
// 针对 768x1174 竖屏:客流卡片(CardFlow) 文本样式自适应增大
'--reception-dash-flow-title-font-size': '20px',
'--reception-dash-flow-metric-label-font-size': '16px',
'--reception-dash-flow-metric-value-font-size': '28px',
'--reception-dash-flow-metric-card-min-height': '72px',
'--reception-dash-flow-metric-label-line-height': '20px',
'--reception-dash-flow-metric-value-line-height': '34px',
'--reception-dash-flow-rate-caption-font-size': '16px',
'--reception-dash-flow-rate-caption-line-height': '20px',
'--reception-dash-flow-rate-value-font-size': '26px',
'--reception-dash-flow-rate-value-line-height': '32px',
'--reception-dash-flow-rate-badge-size': '140px',
'--reception-dash-flow-rate-badge-radius': '70px',
}, },
'landscape-1174x768': { 'landscape-1174x768': {
'--adapter-color': '#FF4444', '--adapter-color': '#FF4444',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!