9999 v-if =" showActionRenderer"
100100 ref =" actionRendererRef"
101101 :action-data =" currentActionData"
102+ :module =" props.module"
103+ :extend =" props.extend"
104+ :api-url =" props.apiUrl"
102105 @close =" handleActionClose"
103106 @submit =" handleActionSubmit"
107+ @special-action =" handleSpecialAction"
104108 />
105109 </div >
106110</template >
107111
108112<script setup>
109113import { ref , nextTick , onMounted , onBeforeUnmount , watch } from ' vue'
110114import { useRouter } from ' vue-router'
115+ import { Message } from ' @arco-design/web-vue'
111116import { usePaginationStore } from ' @/stores/paginationStore'
112117import { usePageStateStore } from ' @/stores/pageStateStore'
113118import { useVisitedStore } from ' @/stores/visitedStore'
@@ -157,11 +162,26 @@ const props = defineProps({
157162 scrollPosition: {
158163 type: Number ,
159164 default: 0
165+ },
166+ // 模块名称,用于T4接口调用
167+ module: {
168+ type: String ,
169+ default: ' '
170+ },
171+ // 扩展参数,用于T4接口调用
172+ extend: {
173+ type: String ,
174+ default: ' '
175+ },
176+ // API URL,用于直接调用站点API
177+ apiUrl: {
178+ type: String ,
179+ default: ' '
160180 }
161181})
162182
163183// Emits
164- const emit = defineEmits ([' video-click' , ' exit-search' , ' load-more' ])
184+ const emit = defineEmits ([' video-click' , ' exit-search' , ' load-more' , ' refresh-list ' ])
165185
166186const containerRef = ref (null )
167187const scrollbarRef = ref (null )
@@ -307,7 +327,7 @@ const handleVideoClick = (video) => {
307327 // 检查是否为action类型
308328 if (video .vod_tag === ' action' ) {
309329 try {
310- // 解析vod_id中的JSON字符串获取action配置
330+ // 尝试解析vod_id中的JSON字符串获取action配置
311331 const actionConfig = JSON .parse (video .vod_id );
312332 console .log (' SearchResults解析action配置:' , actionConfig);
313333
@@ -316,9 +336,14 @@ const handleVideoClick = (video) => {
316336 showActionRenderer .value = true ;
317337 return ;
318338 } catch (error) {
319- console .error (' SearchResults解析action配置失败:' , error, ' vod_id:' , video .vod_id );
320- // 如果解析失败,显示错误信息
321- alert (` Action配置解析失败: ${ error .message } ` );
339+ console .log (' SearchResults vod_id不是JSON格式,作为普通文本处理:' , video .vod_id );
340+
341+ // 如果解析失败,说明vod_id是普通文本,显示Toast提示
342+ Message .info ({
343+ content: video .vod_id ,
344+ duration: 3000 ,
345+ closable: true
346+ });
322347 return ;
323348 }
324349 }
@@ -431,6 +456,34 @@ const handleActionSubmit = (result) => {
431456 currentActionData .value = null ;
432457 // 可以在这里处理action的提交结果
433458}
459+
460+ const handleSpecialAction = (actionType , actionData ) => {
461+ console .log (' 处理专项动作:' , actionType, actionData);
462+
463+ switch (actionType) {
464+ case ' self-search' :
465+ // 处理源内搜索
466+ console .log (' 执行源内搜索:' , actionData);
467+ break ;
468+ case ' detail' :
469+ // 处理详情页跳转
470+ console .log (' 跳转到详情页:' , actionData);
471+ break ;
472+ case ' ktv-player' :
473+ // 处理KTV播放
474+ console .log (' 启动KTV播放:' , actionData);
475+ break ;
476+ case ' refresh-list' :
477+ // 处理刷新列表
478+ console .log (' 刷新列表:' , actionData);
479+ // 可以触发父组件的刷新事件
480+ emit (' refresh-list' );
481+ break ;
482+ default :
483+ console .log (' 未知的专项动作:' , actionType, actionData);
484+ break ;
485+ }
486+ }
434487< / script>
435488
436489< style scoped>
0 commit comments