From 457cc6cf166d3b6c22be4f78c1db8802a7fbb4c7 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期一, 07 四月 2025 17:53:19 +0800
Subject: [PATCH] DigitalHuman

---
 src/views/project/ch/home/component/waterRight/center.vue |  193 +++++++++++++++++++++++------------------------
 1 files changed, 94 insertions(+), 99 deletions(-)

diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue
index 9a36a87..7542aa9 100644
--- a/src/views/project/ch/home/component/waterRight/center.vue
+++ b/src/views/project/ch/home/component/waterRight/center.vue
@@ -6,103 +6,91 @@
 				<span class="split"></span>
 				<span class="change cursor-pointer" @click="advanceExampleClick">楂樼骇绀轰緥 ></span>
 			</div>
-			<div class="cursor-pointer">
+			<div class="cursor-pointer" @click="batchChange">
 				<span class="mr-1 changeBatch">鎹竴鎵�</span>
-				<i class="iconfont icon-shuaxin"></i>
+				<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="item.ID"
-				:class="{ main_item_active: item.ID === state.exampleIndex }"
-				@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.Title }}</h4>
-					<p>{{ item.Content }}</p>
-				</div>
-			</div>
-		</div>
-		<el-drawer v-model="state.isShowAdvanceExample" direction="rtl" size="30%">
-			<div class="box-border w100 bg-[#e0e7fb] relative flex items-center justify-center" style="padding: 30px 20px 26px">
-				<!-- <el-tabs v-model="state.activeName" type="card" @tab-click="handleClick" class="set-tabs">
-					<el-tab-pane label="鎻愰棶绀轰緥" name="questionExample">鎻愰棶绀轰緥</el-tab-pane>
-					<el-tab-pane label="鎸囦护妯℃澘" name="instructionTemplate">鎸囦护妯℃澘</el-tab-pane>
-				</el-tabs> -->
-				<div
-					class="box-border flex w-[203px] h-[32px] rounded-md items-center justify-between cursor-pointer relative border border-solid border-[#2c2d33]"
-				>
-					<!-- <div class="w-[108px] h100 rounded-[5px] bg-transparent absolute left-0 transition-all"></div> -->
-
+			<el-carousel height="80" :interval="6000" indicator-position="none">
+				<el-carousel-item v-for="(group, index) in state.m_groupArr" :key="index" class="set-carousel-item">
 					<div
-						class="tabbar-item"
-						:class="state.activeName === item.ID ? 'set-tabbar-active' : ''"
-						@click="handleTabClick(item)"
-						v-for="item in state.tabNameList"
-						:key="item.ID"
+						class="main_item flex items-center cursor-pointer"
+						v-for="(item, index) in group"
+						:key="index"
+						:class="{ main_item_active: item.sample_id === activeSampleId }"
+						@click="changeExample(item)"
 					>
-						{{ item.Name }}
+						<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>
-				</div>
-			</div>
-		</el-drawer>
+				</el-carousel-item>
+			</el-carousel>
+		</div>
 	</div>
 </template>
 
 <script setup lang="ts">
 import { reactive } from 'vue';
+import { activeRoomId, activeSampleId, exampleSceneList, setRoomConfig } from '/@/stores/chatRoom';
 let state = reactive({
-	exampleContent: [
-		{
-			ID: 1,
-			Icon: '/static/images/wave/ChatImg.png',
-			Title: '瑙h鏉庡洓鐨勫弽搴�',
-			Content: '寮犱笁鎵撲簡鏉庡洓涓�宸存帉,鏉庡洓瀵瑰紶涓夎:"浣犳槸涓嶆槸娌″悆楗�",鏉庡洓璇磋繖鍙ヨ瘽鍚箟鏄�?',
-		},
-		{
-			ID: 2,
-			Icon: '/static/images/wave/ChatImg.png',
-			Title: '瑙i噴鍔姏涓庡唴鍗风殑鍖哄埆',
-			Content: '鎬庝箞瑙i噴鍔姏鍜屽唴鍗风殑鍖哄埆?',
-		},
-		{
-			ID: 3,
-			Icon: '/static/images/wave/ChatImg.png',
-			Title: '鍏朵粬闂',
-			Content: '璇锋悳绱綘鎯崇煡閬撶殑闂',
-		},
-		{
-			ID: 4,
-			Icon: '/static/images/wave/ChatImg.png',
-			Title: '缁欏疂瀹濆彇鏈夋枃鍖栧唴娑电殑鍚嶅瓧',
-			Content: '璇蜂互璇楃粡涓殑鍏告晠缁欑敺瀹濆疂鍙栧悕锛屽椤撅紝鍚嶅瓧瑕佹眰3涓瓧锛岀粰5涓悕瀛椾緵鎴戦�夋嫨銆�',
-		},
-	],
-	tabNameList: [
-		{ ID: 1, Name: '鎻愰棶绀轰緥' },
-		{ ID: 2, Name: '鎸囦护妯℃澘' },
-	],
-	exampleIndex: 0,
-	isShowAdvanceExample: false,
-	activeName: 1,
+	exampleContent: [],
+	isShowExample: false,
+	m_groupArr: [],
 });
+const emits = defineEmits<{
+	(event: 'advanceExampleClick', data): void;
+	(event: 'updateChatInput', val): void;
+}>();
+const initGroupedArr = () => {
+	const groups = [];
+	let i = 0;
+	while (state.exampleContent.length > i) {
+		groups.push(state.exampleContent.slice(i, (i += 4)));
+	}
+
+	state.m_groupArr = groups;
+};
+
 const changeExample = (item) => {
-	state.exampleIndex = item.ID;
+	emits('updateChatInput', item.sample_question);
+	setRoomConfig(activeRoomId.value, 'isAnswerByLLM', false);
+	activeSampleId.value = item.sample_id;
 };
-//楂樼骇绀轰緥
+//鎹竴鎵�
+const batchChange = () => {
+	let groups = state.m_groupArr;
+	// 鎵撲贡鎵规椤哄簭
+	for (let i = groups.length - 1; i > 0; i--) {
+		const j = Math.floor(Math.random() * (i + 1));
+		[groups[i], groups[j]] = [groups[j], groups[i]];
+	}
+	state.m_groupArr = groups;
+};
+//鎵撳紑楂樼骇绀轰緥
 const advanceExampleClick = () => {
-	state.isShowAdvanceExample = true;
+	emits('advanceExampleClick', true);
 };
-const handleTabClick = (item) => {
-	console.log(item.ID);
-	state.activeName = item.ID;
+const tagListClick = (tagList) => {
+	let result = [];
+	tagList.forEach((tag) => {
+		exampleSceneList.value.forEach((sample) => {
+			if (tag == sample.group_id) {
+				result.push(sample);
+			}
+		});
+	});
+	state.exampleContent = result;
+	initGroupedArr();
 };
+defineExpose({
+	tagListClick,
+});
 </script>
 <style scoped lang="scss">
 .pc-prompts {
@@ -145,6 +133,7 @@
 			width: calc(50% - 16px);
 			margin: 8px;
 			padding: 12px;
+			height: 84px;
 			border: 1px solid #d9dbde;
 			border-radius: 5px;
 			background-color: transparent;
@@ -179,6 +168,9 @@
 					font-weight: 500;
 					height: 16px;
 					transition: background-color 0.2s;
+					overflow: hidden;
+					text-overflow: ellipsis;
+					white-space: nowrap;
 				}
 				p {
 					font-size: 12px;
@@ -203,30 +195,33 @@
 				}
 			}
 		}
+		.set-carousel-item {
+			display: flex;
+			flex-wrap: wrap;
+		}
 	}
 }
-.tabbar-item {
-	width: 108px;
-	height: 30px;
-	font-size: 13px;
-	font-weight: 400;
-	line-height: 30px;
-	text-align: center;
-	cursor: pointer;
-	// position: absolute;
-	-o-transition: color 0.2s;
-	transition: color 0.2s;
-	&:nth-child(3) {
-		top: 0;
-		left: 0;
-	}
+
+:deep(.el-drawer__header) {
+	padding: 30px 20px 26px !important;
+	box-sizing: border-box;
+	width: 100%;
+	background-color: #e0e7fb;
+
+	position: relative;
+
+	height: unset !important;
+	margin-bottom: unset !important;
+	border-bottom: unset !important;
 }
-.tabbar-item-active {
-	color: #fff;
+:deep(.el-drawer__body) {
+	overflow-x: hidden;
 }
-.set-tabbar-active {
-	left: 95px;
-	color: #fff;
-	background-color: #000;
+:deep(.el-carousel--horizontal) {
+	width: 100%;
+}
+:deep(.el-carousel__container) {
+	width: 100%;
+	height: 200px !important;
 }
 </style>

--
Gitblit v1.9.3