修改弹窗

This commit is contained in:
筱野
2025-11-24 23:30:27 +08:00
parent 78ab8c9a42
commit 8e558ac57f
9 changed files with 79 additions and 18 deletions

View File

@@ -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>

View File

@@ -85,6 +85,9 @@
font-size: 12px;
color: #8a8a8a;
}
.charCountTextExceeded {
color: #ff4d4f;
}
}
}

View File

@@ -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('')