| | |
| | | <div class="flex item-center"> |
| | | <span>应用场景</span> |
| | | </div> |
| | | <!-- <div class="cursor-pointer"> |
| | | <el-button link class="changeBatch" @click="lookMore" |
| | | >查看更多 |
| | | <el-icon> |
| | | <ArrowRight /> |
| | | </el-icon> |
| | | </el-button> |
| | | </div> --> |
| | | </div> |
| | | |
| | | <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length <= 3"> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { computed, reactive, ref, watch } from 'vue'; |
| | | import { getSectionList } from '/@/api/ai/chat'; |
| | | import router from '/@/router'; |
| | | import { activeGroupType, sectionAList, topGroupId } from '/@/stores/chatRoom'; |
| | | import { activeGroupType, sceneGroupList, sectionAList, topGroupId } from '/@/stores/chatRoom'; |
| | | let state = reactive({ |
| | | applicationScenarios: [], |
| | | scenariosIds: [], |
| | |
| | | const iconCount = iconList.value.length; |
| | | return iconList.value[index % iconCount]; |
| | | }; |
| | | const getMainSectionList = async () => { |
| | | const res = await getSectionList(); |
| | | const getMainSectionList = (val) => { |
| | | let result = []; |
| | | res.groups.forEach((sectionItem, index) => { |
| | | console.log('🚀 ~ sceneGroupList.value:', sceneGroupList.value); |
| | | sceneGroupList.value.forEach((sectionItem, index) => { |
| | | sectionItem.Icon = getIconByIndex(index); |
| | | if (activeGroupType.value == sectionItem.group_type) { |
| | | if (val == sectionItem.group_type) { |
| | | result.push(sectionItem); |
| | | } |
| | | }); |
| | | state.applicationScenarios = result; |
| | | sectionAList.value = res.groups; |
| | | console.log("🚀 ~ 主场景处理后的数据源:", result) |
| | | sectionAList.value = sceneGroupList.value; |
| | | result?.[0] && changeScenarios(result[0]); |
| | | }; |
| | | const groupedArray = computed(() => { |
| | |
| | | } |
| | | return groups; |
| | | }); |
| | | |
| | | // 查看更多 |
| | | const lookMore = () => { |
| | | router.push({ |
| | | name: 'Scenario', |
| | | query: { |
| | | ID: topGroupId.value, |
| | | }, |
| | | }); |
| | | }; |
| | | watch( |
| | | () => activeGroupType.value, |
| | | () => { |
| | | getMainSectionList(); |
| | | (val) => { |
| | | getMainSectionList(val); |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | |
| | | &_item { |
| | | width: 50%; |
| | | border-radius: 5px; |
| | | |
| | | height: 100px; |
| | | padding: 18px 12px; |
| | | -webkit-transition: background-color 0.1s ease-in-out; |
| | | -o-transition: background-color 0.1s ease-in-out; |