Commit 38e37589 by Lin

feat(reception): 增强接待中心表单和详情页的动态适配样式

- 在 FormAdd 和 FormDetail 组件中添加动态样式计算,确保在 768x1174 分辨率下的适配性
- 更新导航栏标题样式以提升视觉一致性
- 为表单项添加自定义样式,改善用户体验
- 扩展 portrait.uts 中的样式配置,支持新的表单项布局和导航栏样式
1 parent c1a6062c
......@@ -2,12 +2,12 @@
<view class="form-add-root">
<!-- 与接待中心 center.uvue 一致:安全区 + 固定导航占位,避免首屏表单被导航栏遮挡 -->
<view class="reception-safe-top-spacer" :style="receptionSafeTopSpacerStyle"></view>
<un-navbar title="客户档案" @leftClick="handleClose" />
<un-navbar title="客户档案" @leftClick="handleClose" :titleStyle="formAddNavbarTitleStyle" />
<view class="reception-navbar-spacer"></view>
<view class="form-add-wrap">
<view class="form-add-body">
<un-form :model="formData" labelWidth="80" labelAlign="left" borderBottom>
<un-form-item prop="ownerName">
<un-form-item prop="ownerName" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">车主姓名</text>
</template>
......@@ -22,7 +22,7 @@
></un-input>
</un-form-item>
<un-form-item prop="ownerPhone">
<un-form-item prop="ownerPhone" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">车主电话</text>
</template>
......@@ -38,7 +38,7 @@
></un-input>
</un-form-item>
<un-form-item prop="brandModel">
<un-form-item prop="brandModel" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">品牌车型</text>
</template>
......@@ -52,7 +52,7 @@
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
<un-form-item prop="receptionSceneName">
<un-form-item prop="receptionSceneName" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">接待场景</text>
</template>
......@@ -67,7 +67,7 @@
</view>
</un-form-item>
<un-form-item prop="arrivalDate">
<un-form-item prop="arrivalDate" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">到店日期</text>
</template>
......@@ -82,7 +82,7 @@
</view>
</un-form-item>
<un-form-item prop="customerTagName">
<un-form-item prop="customerTagName" :customStyle="formAddFormItemCustomStyle">
<template #label>
<text :style="formAddLabelTextStyle">客户标签</text>
</template>
......@@ -155,6 +155,10 @@ import { storage } from '@/utils/storage.uts'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitFormAddTextConfig,
getReceptionPortraitFormAddItemLayoutConfig,
getReceptionPortraitFormAddNavbarConfig,
type ReceptionPortraitFormAddItemLayoutConfig,
type ReceptionPortraitFormAddNavbarConfig,
type ReceptionPortraitFormAddTextConfig,
} from './styles/portrait.uts'
......@@ -164,6 +168,14 @@ const portraitFormAddText = computed((): ReceptionPortraitFormAddTextConfig | nu
return getReceptionPortraitFormAddTextConfig(cssClassRef.value)
})
const portraitFormAddItemLayout = computed((): ReceptionPortraitFormAddItemLayoutConfig | null => {
return getReceptionPortraitFormAddItemLayoutConfig(cssClassRef.value)
})
const portraitFormAddNavbar = computed((): ReceptionPortraitFormAddNavbarConfig | null => {
return getReceptionPortraitFormAddNavbarConfig(cssClassRef.value)
})
function formAddTextPick(mapper: (c: ReceptionPortraitFormAddTextConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitFormAddText.value
if (c == null) {
......@@ -172,6 +184,22 @@ function formAddTextPick(mapper: (c: ReceptionPortraitFormAddTextConfig) => UTSJ
return mapper(c)
}
const formAddFormItemCustomStyle = computed((): UTSJSONObject => {
const c = portraitFormAddItemLayout.value
if (c == null) {
return {} as UTSJSONObject
}
return c.itemCustomStyle
})
const formAddNavbarTitleStyle = computed((): UTSJSONObject => {
const c = portraitFormAddNavbar.value
if (c == null) {
return {} as UTSJSONObject
}
return c.titleStyle
})
const formAddCellValueTextStyle = computed((): UTSJSONObject => {
return formAddTextPick((c) => {
return { fontSize: c.cellValueFontSize } as UTSJSONObject
......
......@@ -6,7 +6,11 @@
</view> -->
<view class="reception-center-page">
<!-- 顶部安全区 -->
<!-- <view class="reception-safe-top-spacer" :style="receptionSafeTopSpacerStyle"></view> -->
<view
v-if="isPortrait768x1174"
class="reception-safe-top-spacer"
:style="receptionSafeTopSpacerStyle"
></view>
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <view class="reception-navbar-spacer"></view> -->
......@@ -190,6 +194,11 @@ import {
getReceptionPortraitMainTabsConfig,
type ReceptionPortraitMainTabsConfig
} from "./styles/portrait.uts";
const isPortrait768x1174 = computed((): boolean => {
// 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位
return cssClassRef.value.indexOf('layout-portrait-768x1174') >= 0
})
// ========== Tab 管理 ==========
// ========== Tab 管理 ==========
/** 主 Tab:0=业绩看板,1=客户列表 */
......@@ -305,7 +314,8 @@ const mainTabItemStyle = computed((): UTSJSONObject => {
}
return {
paddingLeft: c.itemPaddingLeft,
paddingRight: c.itemPaddingRight
paddingRight: c.itemPaddingRight,
paddingBottom: c.itemPaddingBottom
} as UTSJSONObject
})
......
......@@ -2,7 +2,7 @@
<view class="form-detail-root">
<!-- 与 FormAdd 一致:安全区 + 固定导航占位,避免首屏内容被导航栏遮挡 -->
<view class="reception-safe-top-spacer" :style="receptionSafeTopSpacerStyle"></view>
<un-navbar title="客户档案" @leftClick="handleClose" />
<un-navbar title="客户档案" @leftClick="handleClose" :titleStyle="formDetailNavbarTitleStyle" />
<view class="reception-navbar-spacer"></view>
<view class="form-detail-wrap">
<!-- 使用 flex: 1 自动撑满剩余空间,避免底部留白 -->
......@@ -73,6 +73,8 @@ import CustomEmpty from '@/components/CustomEmpty/index.uvue'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitFormDetailTextConfig,
getReceptionPortraitFormDetailNavbarConfig,
type ReceptionPortraitFormDetailNavbarConfig,
type ReceptionPortraitFormDetailTextConfig,
} from '../styles/portrait.uts'
......@@ -90,6 +92,10 @@ const portraitFormDetailText = computed((): ReceptionPortraitFormDetailTextConfi
return getReceptionPortraitFormDetailTextConfig(cssClassRef.value)
})
const portraitFormDetailNavbar = computed((): ReceptionPortraitFormDetailNavbarConfig | null => {
return getReceptionPortraitFormDetailNavbarConfig(cssClassRef.value)
})
function formDetailTextPick(mapper: (c: ReceptionPortraitFormDetailTextConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitFormDetailText.value
if (c == null) {
......@@ -98,6 +104,14 @@ function formDetailTextPick(mapper: (c: ReceptionPortraitFormDetailTextConfig) =
return mapper(c)
}
const formDetailNavbarTitleStyle = computed((): UTSJSONObject => {
const c = portraitFormDetailNavbar.value
if (c == null) {
return {} as UTSJSONObject
}
return c.titleStyle
})
const formSectionTitleTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.sectionTitleFontSize } as UTSJSONObject
......
......@@ -29,6 +29,11 @@ export type ReceptionPortraitMainTabsConfig = {
inactiveFontSize: string
itemPaddingLeft: string
itemPaddingRight: string
/**
* 主 Tab 单项底部内边距(用于微调文字与选中下划线间距)
* 说明:仅在需要特定分辨率下拉开间距时使用,其余分辨率可保持为 0
*/
itemPaddingBottom: string
containerPadding: string
mainTabsPadding: string
mainTabsBorderRadius: string
......@@ -46,6 +51,7 @@ export const RECEPTION_PORTRAIT_MAIN_TABS_768x1174: ReceptionPortraitMainTabsCon
inactiveFontSize: '19px',
itemPaddingLeft: '26px',
itemPaddingRight: '26px',
itemPaddingBottom: '10px',
containerPadding: '14px 18px 12px',
mainTabsPadding: '0 16px',
mainTabsBorderRadius: '18px',
......@@ -355,6 +361,81 @@ export function getReceptionPortraitFormAddTextConfig(resolutionKey: string): nu
}
/**
* 768×1174 竖屏下客户档案新增/编辑页(FormAdd)表单项布局覆盖:
* - 增加每个表单项的高度与上下内边距,避免竖屏视觉过紧
* - 其余分辨率返回 null,走组件默认样式
*/
export type ReceptionPortraitFormAddItemLayoutConfig = {
/** un-form-item.customStyle 直接展开使用 */
itemCustomStyle: UTSJSONObject
}
export const RECEPTION_PORTRAIT_FORM_ADD_ITEM_LAYOUT_768x1174: ReceptionPortraitFormAddItemLayoutConfig = {
itemCustomStyle: {
// 说明:un-form-item 内部一般用 flex 对齐,增加 height + paddingVertical 能同时拉开行高与上下留白
height: '72px',
paddingTop: '10px',
paddingBottom: '10px',
} as UTSJSONObject,
}
export function getReceptionPortraitFormAddItemLayoutConfig(
resolutionKey: string
): null | ReceptionPortraitFormAddItemLayoutConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_FORM_ADD_ITEM_LAYOUT_768x1174
}
return null
}
/**
* 768×1174 竖屏下客户档案新增/编辑页(FormAdd)导航栏标题字号覆盖
*/
export type ReceptionPortraitFormAddNavbarConfig = {
/** un-navbar.titleStyle 直接使用 */
titleStyle: UTSJSONObject
}
export const RECEPTION_PORTRAIT_FORM_ADD_NAVBAR_768x1174: ReceptionPortraitFormAddNavbarConfig = {
titleStyle: {
fontSize: '22px',
} as UTSJSONObject,
}
export function getReceptionPortraitFormAddNavbarConfig(
resolutionKey: string
): null | ReceptionPortraitFormAddNavbarConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_FORM_ADD_NAVBAR_768x1174
}
return null
}
/**
* 768×1174 竖屏下客户档案详情页(FormDetail)导航栏标题字号覆盖
* 与 FormAdd 档位保持一致
*/
export type ReceptionPortraitFormDetailNavbarConfig = {
/** un-navbar.titleStyle 直接使用 */
titleStyle: UTSJSONObject
}
export const RECEPTION_PORTRAIT_FORM_DETAIL_NAVBAR_768x1174: ReceptionPortraitFormDetailNavbarConfig = {
titleStyle: {
fontSize: '22px',
} as UTSJSONObject,
}
export function getReceptionPortraitFormDetailNavbarConfig(
resolutionKey: string
): null | ReceptionPortraitFormDetailNavbarConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_FORM_DETAIL_NAVBAR_768x1174
}
return null
}
/**
* 768×1174 竖屏下接待详情页(receptionDetail)文字字号覆盖(其余分辨率走 scss 默认值)
*/
export type ReceptionPortraitReceptionDetailTextConfig = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!