增加获取场馆、字典

This commit is contained in:
筱野
2025-08-24 16:04:31 +08:00
parent c6f4f11259
commit bb6ec8c183
29 changed files with 1217 additions and 414 deletions

View File

@@ -6,8 +6,8 @@ import { Checkbox } from '@nutui/nutui-react-taro'
import './TextareaTag.scss'
interface TextareaTagProps {
value: string
onChange: (value: string) => void
value: { description: string, description_tag: string[] }
onChange: (value: { description: string, description_tag: string[] }) => void
title?: string
showTitle?: boolean
placeholder?: string
@@ -22,27 +22,15 @@ const TextareaTag: React.FC<TextareaTagProps> = ({
maxLength = 500,
options = []
}) => {
// 处理输入变化
const [tags, setTags] = useState<string[]>([])
console.log(value, 'options')
const handleInputChange = useCallback((e: any) => {
onChange(e.detail.value)
// 处理文本输入变化
const handleTextChange = useCallback((e: any) => {
onChange({...value, description: e.detail.value})
}, [onChange])
// 选择预设选项
const handleSelectOption = useCallback((option: string) => {
let newValue = ''
if (value) {
// 如果已有内容,用分号分隔添加
newValue = value + '' + option
} else {
// 如果没有内容,直接添加
newValue = option
}
onChange(newValue)
}, [value, onChange])
// 处理标签选择变化
const handleTagChange = useCallback((selectedTags: string[]) => {
onChange({...value, description_tag: selectedTags})
}, [onChange])
console.log(options, 'options')
return (
@@ -54,8 +42,8 @@ const TextareaTag: React.FC<TextareaTagProps> = ({
<Checkbox.Group
labelPosition="left"
direction="horizontal"
value={tags}
onChange={(value) => setTags(value)}
value={value.description_tag}
onChange={handleTagChange}
>
{
options?.map((option, index) => (
@@ -76,9 +64,9 @@ const TextareaTag: React.FC<TextareaTagProps> = ({
<Textarea
className='additional-input'
placeholder={placeholder}
value={value}
value={value.description}
placeholderClass='textarea-placeholder'
onInput={handleInputChange}
onInput={handleTextChange}
maxlength={maxLength}
autoHeight={false}
/>