|
|
|
@ -11,10 +11,11 @@ |
|
|
|
</view> |
|
|
|
<!-- 出生日期 --> |
|
|
|
<view class="form-item border-b p-md m-b-md"> |
|
|
|
<view class="label m-b-xs">{{$t('auth.c5')}}</view> |
|
|
|
<view class="label m-b-xs">{{$t('auth.c5')}}(YYYY-MM-DD)</view> |
|
|
|
<view class="input color-light"> |
|
|
|
<uni-datetime-picker type="date" :placeholder="$t('auth.d4')" start="1873-1-01" :end="new Date().toLocaleDateString()" |
|
|
|
:clear-icon="false" v-model="form.birthday" @maskClick="maskClick" /> |
|
|
|
<!-- <uni-datetime-picker type="date" :placeholder="$t('auth.d4')" start="1873-1-01" :end="new Date().toLocaleDateString()" |
|
|
|
:clear-icon="false" v-model="form.birthday" @maskClick="maskClick" /> --> |
|
|
|
<input style="padding: 8px 8px;border-radius: 5px;font-size: 14px;" v-model="form.birthday" @input="formatDateInput" :placeholder="$t('common.date1')"></input> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 证件号类型 --> |
|
|
|
@ -122,6 +123,23 @@ export default { |
|
|
|
this.detail = res.data; |
|
|
|
}); |
|
|
|
}, |
|
|
|
formatDateInput(e) { |
|
|
|
let value = e.target.value; |
|
|
|
// 1. 移除非数字和横线 |
|
|
|
value = value.replace(/[^\d-]/g, ''); |
|
|
|
// 2. 自动添加横线(4位年份后加横线,7位后加横线) |
|
|
|
if (/^\d{4}$/.test(value)) { |
|
|
|
value = value + '-'; |
|
|
|
} else if (/^\d{4}-\d{2}$/.test(value)) { |
|
|
|
value = value + '-'; |
|
|
|
} |
|
|
|
// 3. 限制长度不超过10 |
|
|
|
if (value.length > 10) value = value.slice(0, 10); |
|
|
|
// 4. 更新模型(避免光标跳动问题,可使用 nextTick) |
|
|
|
this.$nextTick(() => { |
|
|
|
this.form.birthday = value; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 获取区号 |
|
|
|
getCountryCode() { |
|
|
|
Member.getCountryCode() |
|
|
|
@ -276,4 +294,7 @@ export default { |
|
|
|
::v-deep uni-input{ |
|
|
|
border: 1px solid #e5e5e5; |
|
|
|
} |
|
|
|
::v-deep .uni-select__input-placeholder{ |
|
|
|
font-size: 14px !important; |
|
|
|
} |
|
|
|
</style> |