| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { computed, reactive, ref, watch } from 'vue'; |
| | | import { activeGroupType, sceneGroupList, sectionAList, topGroupId } from '/@/stores/chatRoom'; |
| | | import { computed, reactive, ref } from 'vue'; |
| | | import { activeGroupType, sceneGroupList, topGroupId } from '/@/stores/chatRoom'; |
| | | let state = reactive({ |
| | | applicationScenarios: [], |
| | | scenariosIds: [], |
| | |
| | | const iconCount = iconList.value.length; |
| | | return iconList.value[index % iconCount]; |
| | | }; |
| | | const getMainSectionList = (val) => { |
| | | const getMainSectionList = async () => { |
| | | let result = []; |
| | | console.log('🚀 ~ sceneGroupList.value:', sceneGroupList.value); |
| | | sceneGroupList.value.forEach((sectionItem, index) => { |
| | | await sceneGroupList.value.forEach((sectionItem, index) => { |
| | | sectionItem.Icon = getIconByIndex(index); |
| | | if (val == sectionItem.group_type) { |
| | | if (activeGroupType.value == sectionItem.group_type) { |
| | | result.push(sectionItem); |
| | | } |
| | | }); |
| | | state.applicationScenarios = result; |
| | | console.log("🚀 ~ 主场景处理后的数据源:", result) |
| | | sectionAList.value = sceneGroupList.value; |
| | | result?.[0] && changeScenarios(result[0]); |
| | | }; |
| | | const groupedArray = computed(() => { |
| | |
| | | } |
| | | return groups; |
| | | }); |
| | | watch( |
| | | () => activeGroupType.value, |
| | | (val) => { |
| | | getMainSectionList(val); |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | defineExpose({ |
| | | getMainSectionList, |
| | | }); |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .pc-scenes { |