修改弹窗

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>