From 9a552e21711626af15ff36b298bcbe4422021f02 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期五, 24 一月 2025 10:20:19 +0800 Subject: [PATCH] 完成loading 显示 --- src/views/project/ch/home/component/waterRight/center.vue | 36 +++--------------------------------- 1 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue index 64b48d1..7542aa9 100644 --- a/src/views/project/ch/home/component/waterRight/center.vue +++ b/src/views/project/ch/home/component/waterRight/center.vue @@ -36,23 +36,17 @@ </template> <script setup lang="ts"> -import { onMounted, reactive, ref } from 'vue'; -import { getSelectSample } from '/@/api/ai/chat'; -import { activeRoomId, activeSampleId, topGroupId, setRoomConfig } from '/@/stores/chatRoom'; +import { reactive } from 'vue'; +import { activeRoomId, activeSampleId, exampleSceneList, setRoomConfig } from '/@/stores/chatRoom'; let state = reactive({ exampleContent: [], isShowExample: false, m_groupArr: [], }); -const exampleList = ref([]); //妯$増鍒楄〃 const emits = defineEmits<{ (event: 'advanceExampleClick', data): void; (event: 'updateChatInput', val): void; }>(); -onMounted(() => { - getSelectListSample(); -}); - const initGroupedArr = () => { const groups = []; let i = 0; @@ -63,25 +57,10 @@ state.m_groupArr = groups; }; -//鑾峰彇妯$増鍒楄〃 -const getSelectListSample = async () => { - const res = await getSelectSample({}); - const array = []; - res.samples.filter(item=>item.group_id===topGroupId.value).forEach((sample, index) => { - sample.Icon = '/static/images/wave/ChatImg.png'; - sample.BgColor = randomHexColor(); - if (index < 4) { - array.push(sample); - } - }); - exampleList.value = res.samples; -}; - const changeExample = (item) => { emits('updateChatInput', item.sample_question); setRoomConfig(activeRoomId.value, 'isAnswerByLLM', false); activeSampleId.value = item.sample_id; - // topGroupId.value = item.section_a_id; }; //鎹竴鎵� const batchChange = () => { @@ -91,7 +70,6 @@ const j = Math.floor(Math.random() * (i + 1)); [groups[i], groups[j]] = [groups[j], groups[i]]; } - state.m_groupArr = groups; }; //鎵撳紑楂樼骇绀轰緥 @@ -101,24 +79,16 @@ const tagListClick = (tagList) => { let result = []; tagList.forEach((tag) => { - exampleList.value.forEach((sample) => { + exampleSceneList.value.forEach((sample) => { if (tag == sample.group_id) { result.push(sample); } }); }); state.exampleContent = result; - initGroupedArr(); }; -//闅忔満鐢熸垚棰滆壊 -const randomHexColor = () => { - return `#${Math.floor(Math.random() * 16777215) - .toString(16) - .padEnd(6, '0')}`; -}; defineExpose({ - getSelectListSample, tagListClick, }); </script> -- Gitblit v1.9.3