diff --git a/src/App.jsx b/src/App.jsx index 6263565..5c3f9c3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -25,14 +25,14 @@ function App() { // 如果用户已认证但WebSocket未连接,则初始化连接 if (user && !isConnected) { - // initWebSocket() - // .then(() => { - // dispatch(setWebSocketConnected(true)); - // console.log('WebSocket connection initialized'); - // }) - // .catch((error) => { - // console.error('Failed to initialize WebSocket connection:', error); - // }); + initWebSocket() + .then(() => { + dispatch(setWebSocketConnected(true)); + console.log('WebSocket connection initialized'); + }) + .catch((error) => { + console.error('Failed to initialize WebSocket connection:', error); + }); } // 组件卸载或用户登出时关闭WebSocket连接 diff --git a/src/components/SearchBar.jsx b/src/components/SearchBar.jsx index c6ae245..8c7bdf3 100644 --- a/src/components/SearchBar.jsx +++ b/src/components/SearchBar.jsx @@ -15,6 +15,7 @@ import SvgIcon from './SvgIcon'; * @param {boolean} props.isSearchLoading - 搜索是否正在加载 * @param {Function} props.onResultClick - 点击搜索结果的回调 * @param {Function} props.onRequestAccess - 申请权限的回调 + * @param {string} props.cornerStyle - 设置圆角风格,可选值: 'rounded'(圆角) 或 'square'(方角) */ const SearchBar = ({ searchKeyword, @@ -22,17 +23,23 @@ const SearchBar = ({ onSearchChange, onSearch, onClearSearch, - placeholder = '搜索...', + placeholder = '搜索知识库...', className = 'w-50', searchResults = [], isSearchLoading = false, onResultClick, onRequestAccess, + cornerStyle = 'rounded', // 默认为圆角 }) => { const [showDropdown, setShowDropdown] = useState(false); const searchRef = useRef(null); const inputRef = useRef(null); + // 计算边框圆角样式类 + const getBorderRadiusClass = () => { + return cornerStyle === 'rounded' ? 'rounded-pill' : 'rounded-0'; + }; + // 处理点击外部关闭下拉框 useEffect(() => { const handleClickOutside = (event) => { @@ -69,11 +76,11 @@ const SearchBar = ({ return (