Commit 9443e949 by 李伟康

style(FinishStep): 优化表单组件样式和必填标识显示

- 将必填星号从伪元素改为独立视图组件
- 修复表单项之间的间距布局问题
- 调整选择器占位符样式的优先级
- 优化表单项错误提示的判断逻辑
- 调整选择框的对齐方式为两端对齐
- 移除不必要的flex换行和间隙设置
- 添加errorTip变化的监控日志用于调试
1 parent be029d48
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
<view <view
class="form-item" class="form-item"
> >
<view :class="['label', { required: i.required == true}]"> <view class="label flex">
<view v-if="i.required == true" class="required">*</view>
{{ i.label }} {{ i.label }}
</view> </view>
<view :class="['value', { error: showError(i.key) && i.required == true }, { disabled: customerType == 0 || i.disabled == true }]"> <view :class="['value', { error: showError(i.key) && i.required == true }, { disabled: customerType == 0 || i.disabled == true }]">
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
</template> </template>
<template v-else> <template v-else>
<view <view
:class="['select', `${(formData as UTSJSONObject)[i.key] != '' ? '' : 'placeholder'}`]" :class="['select', {'placeholder': (formData as UTSJSONObject)[i.key] == ''}]"
@click="showPopup(i)" @click="showPopup(i)"
:key="selectKey" :key="selectKey"
> >
...@@ -290,7 +291,9 @@ ...@@ -290,7 +291,9 @@
(formRef.value as ComponentPublicInstance).$callMethod('close') (formRef.value as ComponentPublicInstance).$callMethod('close')
} }
}, { immediate: true }) }, { immediate: true })
watch(errorTip, () => {
console.log('errorTip', errorTip.value)
})
function showError(key: string): boolean { function showError(key: string): boolean {
const value = formData.value const value = formData.value
let flag = (value as UTSJSONObject)[key] == '' let flag = (value as UTSJSONObject)[key] == ''
...@@ -419,7 +422,7 @@ ...@@ -419,7 +422,7 @@
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
const key = keys[i] const key = keys[i]
const value = customerInfo[key] as string | null const value = customerInfo[key] as string | null
if (value == null || value === '') { if (value == null || value == '') {
stepValue = 1 stepValue = 1
break break
} }
...@@ -505,10 +508,8 @@ ...@@ -505,10 +508,8 @@
.form { .form {
display: flex; display: flex;
flex-wrap: wrap;
gap: 24rpx 0;
padding-top: 30rpx; padding-top: 30rpx;
flex-direction: column;
&-item { &-item {
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -516,7 +517,7 @@ ...@@ -516,7 +517,7 @@
color: #6c6c70; color: #6c6c70;
font-size: 30rpx; font-size: 30rpx;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto; margin: 0 auto 24rpx;
flex-direction: row; flex-direction: row;
.label { .label {
position: relative; position: relative;
...@@ -524,18 +525,8 @@ ...@@ -524,18 +525,8 @@
flex-shrink: 0; flex-shrink: 0;
width: 144rpx; width: 144rpx;
font-size: 30rpx; font-size: 30rpx;
.required{
&.required {
padding-left: 20rpx;
&::before {
content: '*';
color: #ff0000; color: #ff0000;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
} }
} }
...@@ -572,7 +563,7 @@ ...@@ -572,7 +563,7 @@
.select { .select {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
.arrow { .arrow {
margin-left: auto; margin-left: auto;
} }
...@@ -580,7 +571,7 @@ ...@@ -580,7 +571,7 @@
.placeholder { .placeholder {
font-size: 30rpx; font-size: 30rpx;
color: #c9c9c9; color: #c9c9c9 !important;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!