mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-11 22:15:32 +08:00
fix: 数字输入
This commit is contained in:
35144
package-lock.json
generated
35144
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -87,8 +87,8 @@ function GoodReservate(props) {
|
||||
}
|
||||
|
||||
//无模板跳活动详情
|
||||
if(activity_info.temp_id == '0'){
|
||||
Taro.redirectTo({url:`/marketing/pages/member/activity-info?activity_id=${activity_info.activity_id}`})
|
||||
if (activity_info.temp_id == '0') {
|
||||
Taro.redirectTo({ url: `/marketing/pages/member/activity-info?activity_id=${activity_info.activity_id}` })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -243,14 +243,21 @@ function GoodReservate(props) {
|
||||
draft.showCheckboxPanel = false
|
||||
})
|
||||
}
|
||||
|
||||
const onChangeNumber = (e, key) => {
|
||||
// 只允许输入数字
|
||||
const value = e.replace(/[^\d]/g, '')
|
||||
const _form = JSON.parse(JSON.stringify(form))
|
||||
_form[key] = value
|
||||
setState((draft) => {
|
||||
draft.form = _form
|
||||
})
|
||||
}
|
||||
console.log('form', form, 'rules', rules)
|
||||
|
||||
const renderFormItem = (item) => {
|
||||
const { field_title, field_name, id, form_element, options = [] } = item
|
||||
switch (form_element) {
|
||||
case 'text':
|
||||
case 'number':
|
||||
return (
|
||||
<AtInput
|
||||
name={id}
|
||||
@@ -260,6 +267,16 @@ function GoodReservate(props) {
|
||||
onChange={(e) => onChange(e, id)}
|
||||
/>
|
||||
)
|
||||
case 'number':
|
||||
return (
|
||||
<AtInput
|
||||
name={id}
|
||||
value={form[id]}
|
||||
type={form_element}
|
||||
placeholder={`请填写${field_title}`}
|
||||
onChange={(e) => onChangeNumber(e, id)}
|
||||
/>
|
||||
)
|
||||
case 'textarea':
|
||||
return (
|
||||
<AtTextarea
|
||||
@@ -283,10 +300,10 @@ function GoodReservate(props) {
|
||||
form_element == 'date'
|
||||
? form[id]
|
||||
: [
|
||||
options?.findIndex((item) => item.value == form[id]) != -1
|
||||
? options?.findIndex((item) => item.value == form[id])
|
||||
: 0
|
||||
]
|
||||
options?.findIndex((item) => item.value == form[id]) != -1
|
||||
? options?.findIndex((item) => item.value == form[id])
|
||||
: 0
|
||||
]
|
||||
}
|
||||
onChange={(e) => handleSelectChange(e, id, options, form_element)}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user