调整页面错乱问题

This commit is contained in:
cst61
2026-02-01 16:45:15 +08:00
parent eef85dce4a
commit 30b1c8f9ba
14 changed files with 1063 additions and 548 deletions

View File

@@ -31,8 +31,9 @@
<view class="form-item">
<text class="form-item__label">客户来源</text>
<view class="customer-source-select-wrapper">
<view
class="customer-source-select"
<view
ref="customerSourceSelect"
class="customer-source-select"
@click.stop="toggleCustomerSourceDropdown"
>
<text
@@ -42,9 +43,10 @@
</text>
<uni-icons type="bottom" size="16" color="#9ca3af"></uni-icons>
</view>
<view
v-if="showCustomerSourceDropdown"
class="customer-source-select-dropdown"
<view
ref="customerSourceDropdown"
v-if="showCustomerSourceDropdown"
class="customer-source-select-dropdown"
@click.stop
>
<view
@@ -208,6 +210,12 @@ export default {
mounted() {
// 加载当前登录用户信息,填充销售姓名和电话
this.loadCurrentUserInfo();
// 监听窗口大小变化,重新定位下拉框
uni.onWindowResize(() => {
if (this.showCustomerSourceDropdown) {
this.updateDropdownPosition();
}
});
},
methods: {
/**
@@ -244,6 +252,23 @@ export default {
},
toggleCustomerSourceDropdown() {
this.showCustomerSourceDropdown = !this.showCustomerSourceDropdown;
if (this.showCustomerSourceDropdown) {
this.$nextTick(() => {
this.updateDropdownPosition();
});
}
},
updateDropdownPosition() {
const selectEl = this.$refs.customerSourceSelect;
if (selectEl) {
const rect = selectEl.getBoundingClientRect();
const dropdownEl = this.$refs.customerSourceDropdown;
if (dropdownEl) {
dropdownEl.style.top = (rect.bottom + 8) + 'px';
dropdownEl.style.left = rect.left + 'px';
dropdownEl.style.width = rect.width + 'px';
}
}
},
selectCustomerSource(option) {
this.formData.customerSource = option;
@@ -523,7 +548,7 @@ export default {
box-sizing: border-box;
background-color: #ffffff;
border-radius: 16rpx;
padding: 32rpx 24rpx;
padding: 40rpx 24rpx 32rpx 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
margin-bottom: 24rpx;
overflow: visible; /* 确保内容不被裁剪 */
@@ -533,14 +558,26 @@ export default {
margin-bottom: 0;
}
/* 第一个表单项特殊处理,确保顶部空间 */
.form-card .form-item:first-child {
padding-top: 24rpx;
margin-top: 16rpx;
}
.form-item {
display: flex;
align-items: center;
display: flex !important;
align-items: flex-start;
margin-bottom: 32rpx;
min-height: 88rpx;
padding-top: 8rpx;
box-sizing: border-box;
width: 100%;
flex-wrap: nowrap;
flex-wrap: nowrap !important;
overflow: hidden;
flex-shrink: 0;
justify-content: center;
flex-direction: row !important;
padding-left: 0;
}
/* 对于包含 textarea 的表单项label 顶部对齐 */
@@ -550,10 +587,15 @@ export default {
.gender-radio-group {
flex: 1;
flex-shrink: 1;
display: flex;
gap: 32rpx;
flex-wrap: nowrap;
align-items: center;
min-width: 0;
overflow: hidden;
height: 88rpx;
justify-content: flex-start;
}
.gender-radio {
@@ -561,6 +603,7 @@ export default {
align-items: center;
gap: 12rpx;
flex-shrink: 0;
height: 88rpx;
}
.gender-radio__text {
@@ -576,9 +619,19 @@ export default {
font-weight: 500;
width: 140rpx;
flex-shrink: 0;
flex-grow: 0;
margin-right: 24rpx;
margin-left: 0;
padding: 12rpx 0 12rpx 16rpx;
white-space: nowrap;
box-sizing: border-box;
min-height: 88rpx;
line-height: 1.4;
text-align: left;
display: flex;
align-items: flex-start;
justify-content: flex-start;
/* 确保标签可见且不被遮挡 */
}
.form-item--half {
@@ -586,8 +639,12 @@ export default {
}
.form-item__input {
flex: 1;
min-width: 0;
flex: 1 !important;
flex-shrink: 1 !important;
flex-grow: 1 !important;
min-width: 0 !important;
max-width: none !important;
width: auto !important;
height: 88rpx;
line-height: 88rpx;
background-color: #f9fafb;
@@ -596,10 +653,22 @@ export default {
font-size: 28rpx;
color: #333;
box-sizing: border-box;
border: 2rpx solid #e5e7eb;
transition: all 0.2s ease;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.form-item__input:focus {
border-color: #007AFF;
background-color: #FFFFFF;
box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.1);
}
.form-item__text {
flex: 1;
flex-shrink: 1;
min-width: 0;
height: 88rpx;
background-color: #f9fafb;
@@ -607,7 +676,9 @@ export default {
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
overflow: hidden;
}
.form-item__text text {
@@ -680,9 +751,12 @@ export default {
.customer-source-select-wrapper {
position: relative;
flex: 1;
flex-shrink: 1;
min-width: 0;
display: flex;
align-items: center;
overflow: hidden;
height: 88rpx;
}
.customer-source-select {
@@ -706,17 +780,16 @@ export default {
}
.customer-source-select-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
position: fixed;
background-color: #fff;
border-radius: 16rpx;
box-shadow: 0 12rpx 30rpx rgba(15, 23, 42, 0.1);
margin-top: 8rpx;
z-index: 11;
z-index: 9999;
padding: 12rpx 0;
box-sizing: border-box;
max-height: 400rpx;
overflow-y: auto;
min-width: 200rpx;
}
.customer-source-select-dropdown__item {
@@ -744,7 +817,7 @@ export default {
right: 0;
bottom: 0;
background-color: transparent;
z-index: 10;
z-index: 9998;
}
.form-item__picker-text {
@@ -766,4 +839,56 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
/* 小屏幕适配 */
@media (max-width: 750rpx) {
.form-item__label {
width: 120rpx;
font-size: 26rpx;
margin-right: 16rpx;
margin-left: 0;
padding: 10rpx 0 10rpx 12rpx;
min-height: 80rpx;
line-height: 1.4;
align-items: flex-start;
}
.form-item {
min-height: 80rpx;
padding-top: 6rpx;
}
.form-item__input,
.form-item__text,
.customer-source-select-wrapper,
.gender-radio-group,
.gender-radio {
height: 80rpx;
}
.form-item__input,
.form-item__text,
.customer-source-select-wrapper,
.gender-radio-group {
flex-shrink: 1;
}
.form-item__input,
.customer-source-select {
font-size: 26rpx;
padding: 0 16rpx;
}
.form-item__text {
padding: 0 16rpx;
}
.form-item__text text {
font-size: 26rpx;
}
.gender-radio-group {
gap: 24rpx;
}
}
</style>