Commit 38e37589 by Lin

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

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