From bc4ab46fb5c4cb4435efabfe4b316be4ace5b026 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 22 七月 2024 15:31:04 +0800 Subject: [PATCH] 修改 customDrawer --- src/views/project/ch/home/component/waterRight/bottom.vue | 81 ++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/views/project/ch/home/component/waterRight/bottom.vue b/src/views/project/ch/home/component/waterRight/bottom.vue index 5bb0057..3be8ae6 100644 --- a/src/views/project/ch/home/component/waterRight/bottom.vue +++ b/src/views/project/ch/home/component/waterRight/bottom.vue @@ -14,7 +14,7 @@ </div> </div> - <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length <= 3"> + <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length < 3"> <div class="main_item flex cursor-pointer" v-for="item in state.applicationScenarios" @@ -30,51 +30,65 @@ </div> </div> </div> - <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length > 3"> - <div - class="main_item flex cursor-pointer" - v-for="item in state.applicationScenarios" - :key="item.section_id" - :class="{ main_item_active: item.section_id === activeSectionAId }" - @click="changeScenarios(item)" - > - <div :class="['iconfont icon-' + item.Icon]"></div> - <div class="right"> - <h4>{{ item.section_name }}</h4> - <p>{{ item.section_title }}</p> - </div> - <el-carousel height="10px"> - <el-carousel-item v-for="group in groupedArray" :key="group">{{ group }} </el-carousel-item> - </el-carousel> - </div> + + <div class="block main" v-show="state.applicationScenarios && state.applicationScenarios.length > 3"> + <el-carousel height="80"> + <el-carousel-item v-for="group in groupedArray" :key="group" class="set-carousel-item"> + <div + class="main_item flex cursor-pointer" + v-for="item in group" + :key="item.section_id" + :class="{ main_item_active: item.section_id === activeSectionAId }" + @click="changeScenarios(item)" + > + <div :class="['iconfont icon-' + item.Icon]"></div> + <div class="right"> + <h4>{{ item.section_name }}</h4> + <p>{{ item.section_title }}</p> + </div> + </div> + </el-carousel-item> + </el-carousel> </div> </div> </template> <script setup lang="ts"> -import { onMounted, reactive, computed } from 'vue'; +import { computed, onMounted, reactive } from 'vue'; import { getSectionList } from '/@/api/ai/chat'; import router from '/@/router'; -import { activeSectionAId } from '/@/stores/chatRoom'; +import { activeRoomId, activeSectionAId, setRoomConfig, sectionAList } from '/@/stores/chatRoom'; let state = reactive({ applicationScenarios: [], scenariosIds: [], }); +const emits = defineEmits<{ + (event: 'tagListClick', data): void; +}>(); const changeScenarios = async (item) => { activeSectionAId.value = item.section_id; + setRoomConfig(activeRoomId.value, 'isAnswerByLLM', false); }; const getMainSectionList = async () => { const res = await getSectionList(); let result = []; - const iconList = ['biaodan', 'putong', 'zhongduancanshuchaxun', 'shidu']; + const iconList = [ + 'biaodan', + 'putong', + 'zhongduancanshuchaxun', + 'shidu', + 'fuwenbenkuang', + 'fuwenben', + 'jiliandongxuanzeqi', + 'jinridaiban', + 'gongju', + ]; res.sections.forEach((sectionItem, index) => { sectionItem.Icon = iconList[index]; - // if (index < 4) { - // result.push(sectionItem); - // } }); state.applicationScenarios = res.sections; + sectionAList.value = res.sections; res.sections?.[0] && changeScenarios(res.sections[0]); }; const groupedArray = computed(() => { @@ -83,17 +97,16 @@ while (state.applicationScenarios.length > i) { groups.push(state.applicationScenarios.slice(i, (i += 4))); } - console.log(groups, 86); return groups; }); -const nextPage = () => { - const index = Math.floor(Math.random() * groupedArray.value.length); - state.applicationScenarios = groupedArray.value[index]; -}; + // 鏌ョ湅鏇村 const lookMore = () => { router.push({ name: 'Scenario', + query: { + ID: activeSectionAId.value, + }, }); }; onMounted(() => { @@ -142,10 +155,7 @@ width: 100%; border-radius: 5px; border: 1px solid #d9dbde; - display: flex; padding: 8px; - flex-wrap: wrap; - &_item { width: 50%; border-radius: 5px; @@ -216,6 +226,10 @@ } } } + .set-carousel-item { + display: flex; + flex-wrap: wrap; + } } .set-page { display: flex; @@ -224,4 +238,7 @@ margin: 10px 0px; } } +:deep(.el-carousel__container) { + height: 200px !important; +} </style> -- Gitblit v1.9.3