修改弹窗
This commit is contained in:
@@ -25,6 +25,7 @@ const AiImportPopup: React.FC<AiImportPopupProps> = ({
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [uploadLoading, setUploadLoading] = useState(false)
|
||||
const maxFailCount = 3
|
||||
const isCharCountExceeded = text.length > 100
|
||||
|
||||
// 获取 actions(在组件顶层调用 Hook)
|
||||
const { setPublishData } = usePublishBallActions()
|
||||
@@ -56,6 +57,7 @@ const AiImportPopup: React.FC<AiImportPopupProps> = ({
|
||||
}
|
||||
const handlePasteAndRecognize = async () => {
|
||||
if (text) {
|
||||
if (text.length > 100) return;
|
||||
textIdentification(text)
|
||||
} else {
|
||||
getClipboardData()
|
||||
@@ -71,6 +73,7 @@ const AiImportPopup: React.FC<AiImportPopupProps> = ({
|
||||
duration: 2,
|
||||
wordBreak:'break-word'
|
||||
})
|
||||
if (res.data.length > 100) return;
|
||||
textIdentification(res.data)
|
||||
// Taro.showToast({
|
||||
// title: '已读取你的剪切板信息',
|
||||
@@ -220,7 +223,7 @@ const AiImportPopup: React.FC<AiImportPopupProps> = ({
|
||||
onFocus={() => {}}
|
||||
onBlur={() => {}}
|
||||
placeholder="在此「粘贴识别」或输入文本,智能拆分球局时间、费用、地点和其他信息,并帮你智能生成球局标题"
|
||||
maxlength={100}
|
||||
maxlength={-1}
|
||||
showConfirmBar={false}
|
||||
placeholderClass={styles.textArea_placeholder}
|
||||
autoHeight
|
||||
@@ -228,7 +231,9 @@ const AiImportPopup: React.FC<AiImportPopupProps> = ({
|
||||
adjustPosition={false}
|
||||
/>
|
||||
<View className={styles.charCount}>
|
||||
<Text className={styles.charCountText}>{text.length}/100</Text>
|
||||
<Text className={`${styles.charCountText} ${isCharCountExceeded ? styles.charCountTextExceeded : ''}`}>
|
||||
{text.length}/100
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@
|
||||
font-size: 12px;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
.charCountTextExceeded {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,14 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
const formData = stadiumDetailRef.current.getFormData()
|
||||
console.log('获取球馆表单数据:', formData)
|
||||
const { description, ...rest } = formData
|
||||
const { description: descriptionInfo} = description;
|
||||
if (descriptionInfo.length > 200 ) {
|
||||
Taro.showToast({
|
||||
title: `场地信息补充最多可输入200个字`,
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
};
|
||||
onConfirm({ ...rest, ...description })
|
||||
setSelectedStadium(null)
|
||||
setSearchValue('')
|
||||
|
||||
@@ -206,8 +206,10 @@ const PublishBall: React.FC = () => {
|
||||
image_list,
|
||||
players,
|
||||
current_players,
|
||||
descriptionInfo
|
||||
} = formData;
|
||||
const { play_type, price, location_name } = activityInfo;
|
||||
const { description } = descriptionInfo;
|
||||
|
||||
const { max } = players;
|
||||
if (!image_list?.length && activityType === "group") {
|
||||
@@ -241,6 +243,16 @@ const PublishBall: React.FC = () => {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (title.length > 20) {
|
||||
if (!isOnSubmit) {
|
||||
Taro.showToast({
|
||||
title: `标题最多可输入20个字`,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!price ||
|
||||
(typeof price === "number" && price <= 0) ||
|
||||
@@ -324,6 +336,16 @@ const PublishBall: React.FC = () => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (description?.length > 200) {
|
||||
if (!isOnSubmit) {
|
||||
Taro.showToast({
|
||||
title: `补充要求最多可输入200个字`,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
const validateOnSubmit = () => {
|
||||
@@ -865,7 +887,7 @@ const PublishBall: React.FC = () => {
|
||||
</Text>
|
||||
</Text>
|
||||
)}
|
||||
{activityType === "group" && (
|
||||
{/* {activityType === "group" && (
|
||||
<View className={styles["submit-tip"]}>
|
||||
<Checkbox
|
||||
className={styles["submit-checkbox"]}
|
||||
@@ -874,7 +896,7 @@ const PublishBall: React.FC = () => {
|
||||
/>
|
||||
已认证 徐汇爱打球官方球场,请严格遵守签约协议
|
||||
</View>
|
||||
)}
|
||||
)} */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user