From ef44f671b9b9ecdb3d95c1d8ff606e51c38843fc Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 28 十月 2024 13:42:50 +0800 Subject: [PATCH] Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.V1.0 into test --- src/views/project/ch/home/component/waterRight/center.vue | 88 +++++++++++++++++++++++++++++++++----------- 1 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue index 4e94a40..4235038 100644 --- a/src/views/project/ch/home/component/waterRight/center.vue +++ b/src/views/project/ch/home/component/waterRight/center.vue @@ -11,23 +11,26 @@ <i class="myiconfont icon-shuaxin"></i> </div> </div> - <div class="main"> - <div - class="main_item flex items-center cursor-pointer" - v-for="(item, index) in state.exampleContent" - :key="index" - :class="{ main_item_active: item.sample_id === activeSampleId }" - @click="changeExample(item)" - > - <div class="left flex items-center justify-center" :class="['color' + index]"> - <img :src="item.Icon" alt="" /> - </div> - <div class="right"> - <h4>{{ item.sample_title }}</h4> - <p>{{ item.sample_question }}</p> - </div> - </div> + <el-carousel height="80" :interval="6000" indicator-position="none"> + <el-carousel-item v-for="group in batchSourceData" :key="group" class="set-carousel-item"> + <div + class="main_item flex items-center cursor-pointer" + v-for="(item, index) in state.exampleContent" + :key="index" + :class="{ main_item_active: item.sample_id === activeSampleId }" + @click="changeExample(item)" + > + <div class="left flex items-center justify-center" :class="['color' + index]"> + <img :src="item.Icon" alt="" /> + </div> + <div class="right"> + <h4>{{ item.sample_title }}</h4> + <p>{{ item.sample_question }}</p> + </div> + </div> + </el-carousel-item> + </el-carousel> </div> </div> </template> @@ -48,6 +51,7 @@ onMounted(() => { getSelectListSample(); }); +//鎹竴鎵规暟鎹簮 const groupedArray = computed(() => { const groups = []; let i = 0; @@ -56,14 +60,19 @@ } return groups; }); +//鑷姩鎾斁 +const batchSourceData = computed(() => { + const batch = []; + let i = 0; + while (exampleList.value.length > i) { + batch.push(exampleList.value.slice(i, (i += 4))); + } + return batch; +}); //鑾峰彇妯$増鍒楄〃 const getSelectListSample = async () => { - const res = await getSelectSample({ - section_b_id: '', - }); - // console.log(res, 63); + const res = await getSelectSample({}); state.exampleRandomContent = res.samples; - const array = []; res.samples.forEach((sample, index) => { sample.Icon = '/static/images/wave/ChatImg.png'; @@ -91,7 +100,27 @@ const advanceExampleClick = () => { emits('advanceExampleClick', true); }; - +const tagListClick = (group_item) => { + const curGroupID = group_item.p_group_id; + const curID = group_item.group_id; + const exampleContent = exampleList.value; + let curGroupIDs = []; + if (!curGroupID) { + curGroupIDs.push(curID); + } else { + exampleContent.forEach((item) => { + curGroupIDs.push(item.group_id); + }); + } + let result = []; + curGroupIDs.forEach((curItem) => { + exampleContent.forEach((sample) => { + if (curItem == sample.group_id) result.push(sample); + }); + }); + console.log('馃殌 ~ result:', result); + batchChange(); +}; //闅忔満鐢熸垚棰滆壊 const randomHexColor = () => { return `#${Math.floor(Math.random() * 16777215) @@ -100,6 +129,7 @@ }; defineExpose({ getSelectListSample, + tagListClick, }); </script> <style scoped lang="scss"> @@ -177,6 +207,9 @@ font-weight: 500; height: 16px; transition: background-color 0.2s; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } p { font-size: 12px; @@ -201,6 +234,10 @@ } } } + .set-carousel-item { + display: flex; + flex-wrap: wrap; + } } } @@ -219,4 +256,11 @@ :deep(.el-drawer__body) { overflow-x: hidden; } +:deep(.el-carousel--horizontal) { + width: 100%; +} +:deep(.el-carousel__container) { + width: 100%; + height: 200px !important; +} </style> -- Gitblit v1.9.3