fix bug
parent
8e48e39b0b
commit
e2fca080a9
|
|
@ -123,42 +123,74 @@ export default function detail () {
|
|||
// draft.visible = true
|
||||
})
|
||||
} else {
|
||||
let flag = true
|
||||
const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
|
||||
if (formData['mobile'] !== userInfo.mobile) {
|
||||
if (!reg.test(answer)) {
|
||||
return Taro.showToast({
|
||||
title: '手机号格式不正确',
|
||||
icon: 'none'
|
||||
})
|
||||
flag = false
|
||||
}
|
||||
}
|
||||
if (formData['username'] !== userInfo.username && (!formData['username'] || !formData['username'].trim())) {
|
||||
return Taro.showToast({
|
||||
title: '请输入姓名',
|
||||
icon: 'none'
|
||||
})
|
||||
flag = false
|
||||
}
|
||||
if (!formData['gender']) {
|
||||
return Taro.showToast({
|
||||
title: '请选择性别',
|
||||
icon: 'none'
|
||||
})
|
||||
flag = false
|
||||
}
|
||||
if (!formData['has_bought']) {
|
||||
return Taro.showToast({
|
||||
title: '请选择是否拥有BIRKENSTOCK鞋履',
|
||||
icon: 'none'
|
||||
})
|
||||
flag = false
|
||||
}
|
||||
|
||||
// try {
|
||||
// const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
|
||||
// _formData.forEach((d) => {
|
||||
// const { field_name, field_title, answer } = d
|
||||
// if ((formData['has_partner'] === '否' && field_name.includes('partner') || field_name.includes('city') || (field_name === 'mobile' && answer === userInfo.mobile))) {
|
||||
// return
|
||||
// }
|
||||
// if (field_name === 'mobile' || field_name === 'partner_mobile') {
|
||||
// if (!reg.test(answer)) {
|
||||
// Taro.showToast({
|
||||
// title: `${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}格式不正确`,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// throw new Error(`${field_title}格式不正确`)
|
||||
// }
|
||||
// } else {
|
||||
// if (!answer || !answer.trim()) {
|
||||
// Taro.showToast({
|
||||
// title: `请填写${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}`,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// throw new Error(`${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}不能为空`)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// } catch (error) {
|
||||
// flag = false
|
||||
// }
|
||||
if (!flag) return
|
||||
const _formData = formDataList.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
answer: formData[d.field_name]
|
||||
}
|
||||
})
|
||||
let flag = true
|
||||
try {
|
||||
_formData.forEach((d) => {
|
||||
const { field_name, field_title, answer } = d
|
||||
const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
|
||||
if ((formData['has_partner'] === '否' && field_name.includes('partner') || field_name.includes('city') || (field_name === 'mobile' && answer === userInfo.mobile))) {
|
||||
return
|
||||
}
|
||||
if (field_name === 'mobile' || field_name === 'partner_mobile') {
|
||||
if (!reg.test(answer)) {
|
||||
Taro.showToast({
|
||||
title: `${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}格式不正确`,
|
||||
icon: 'none'
|
||||
})
|
||||
throw new Error(`${field_title}格式不正确`)
|
||||
}
|
||||
} else {
|
||||
if (!answer || !answer.trim()) {
|
||||
Taro.showToast({
|
||||
title: `请填写${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}`,
|
||||
icon: 'none'
|
||||
})
|
||||
throw new Error(`${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}不能为空`)
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
flag = false
|
||||
}
|
||||
if (!flag) return
|
||||
const content = {
|
||||
title: '',
|
||||
sort: 1,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export default function detail () {
|
|||
}
|
||||
draft.checked = !!_item
|
||||
// MM-DD
|
||||
draft.changci = changci.map((item, index) => ({ index: index + 1, start: dayjs(item.start_time).format('HH:mm'), end: dayjs(item.end_time).format('HH:mm'), limit: item.join_limit, join: item.has_join_num, id: item.registration_session_id, activity_id: item.activity_id, has_stauts: item.has_stauts == 1 }))
|
||||
draft.changci = changci.map((item, index) => ({ index: index + 1, start: dayjs(item.start_time).format('MM-DD HH:mm'), end: dayjs(item.end_time).format('HH:mm'), limit: item.join_limit, join: item.has_join_num, id: item.registration_session_id, activity_id: item.activity_id, has_stauts: item.has_stauts == 1 }))
|
||||
draft.applyStatus = _applyStatus
|
||||
})
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ export default function detail () {
|
|||
<View style={{ paddingBottom: '80px' }}>
|
||||
{changci.length > 0 && changci.map((item, index) => <View className='time-item' key={index + '__item'}>
|
||||
<Text className="time-item-title">第{item.index}场 {item.start}-{item.end}</Text>
|
||||
<View className={`btn ${(item.limit - item.join <= 0) && !item.has_stauts ? 'disabled' : ''}`} onClick={() => handleGoApply(item)} >{item.has_stauts ? '已报名' : `${item.limit - item.join}席可选`}</View>
|
||||
<View className={`btn ${(item.limit - item.join <= 0) && !item.has_stauts ? 'disabled' : ''}`} onClick={() => handleGoApply(item)} >{item.has_stauts ? '已报名' : item.limit - item.join > 0 ? `${item.limit - item.join}席可选` : '已满员'}</View>
|
||||
</View>)}
|
||||
</View>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue