Просмотр исходного кода

搜索时补回 loading 反馈

按钮 loading + 列表区 Spin 罩层,避免再次触发 Drawer loading 卸载 children 的旧问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
刘立冬 6 часов назад
Родитель
Сommit
65275e333c

+ 4 - 1
src/views/publishContent/weCom/components/videoSelectModal/index.tsx

@@ -7,6 +7,7 @@ import {
 	Card,
 	Typography,
 	Space,
+	Spin,
 	message,
 	Modal,
 } from 'antd';
@@ -228,9 +229,10 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 							onPressEnter={handleSearch}
 						/>
 					</div>
-					<Button type="primary" onClick={handleSearch}>搜索</Button>
+					<Button type="primary" loading={loading} onClick={handleSearch}>搜索</Button>
 				</div>
 
+				<Spin spinning={loading}>
 				<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
 					{videoList.map((video) => {
 						const isSelected = selectedVideoIds.has(video.videoId);
@@ -287,6 +289,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 				<div ref={sentinelRef} className="text-center py-4 text-gray-400 text-xs">
 					{loading ? '加载中...' : loadingMore ? '加载中...' : !hasMore && videoList.length > 0 ? '— 没有更多了 —' : ''}
 				</div>
+				</Spin>
 			</Drawer>
 
 			<Modal

+ 4 - 1
src/views/publishContent/weGZH/components/videoSelectModal/index.tsx

@@ -7,6 +7,7 @@ import {
 	Card,
 	Typography,
 	Space,
+	Spin,
 	message,
 	Modal,
 } from 'antd';
@@ -214,9 +215,10 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
 							onChange={e => setSearchTerm(e.target.value)}
 						/>
 					</div>
-					<Button type="primary" onClick={handleSearch}>搜索</Button>
+					<Button type="primary" loading={loading} onClick={handleSearch}>搜索</Button>
 				</div>
 
+				<Spin spinning={loading}>
 				<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
 					{videoList.map((video) => {
 						const isSelected = selectedVideoIds.has(video.videoId);
@@ -257,6 +259,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
 				<div ref={sentinelRef} className="text-center py-4 text-gray-400 text-xs">
 					{loading ? '加载中...' : loadingMore ? '加载中...' : !hasMore && videoList.length > 0 ? '— 没有更多了 —' : ''}
 				</div>
+				</Spin>
 			</Drawer>
 
 			<Modal