From 68e9ca0b9076a0fe14474cc71b6dc2c420fc5e7f Mon Sep 17 00:00:00 2001
From: yangyin <18723093654@163.com>
Date: 星期日, 07 七月 2024 11:43:12 +0800
Subject: [PATCH] feat: 新增指令使用模板可以弹窗

---
 src/views/project/ch/home/component/waterRight/center.vue |   23 ++++++++++++++++++++++-
 src/views/project/ch/home/component/waterRight/bottom.vue |   32 +++++++++++++++++++++++---------
 2 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/src/views/project/ch/home/component/waterRight/bottom.vue b/src/views/project/ch/home/component/waterRight/bottom.vue
index f524457..5bb0057 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">
+		<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,8 +30,23 @@
 				</div>
 			</div>
 		</div>
-		<div class="set-page">
-			<el-pagination size="small" background layout="prev, pager, next" class="mt-4" />
+		<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>
 	</div>
 </template>
@@ -55,14 +70,12 @@
 	const iconList = ['biaodan', 'putong', 'zhongduancanshuchaxun', 'shidu'];
 	res.sections.forEach((sectionItem, index) => {
 		sectionItem.Icon = iconList[index];
-		if (index < 4) {
-			result.push(sectionItem);
-		}
+		// if (index < 4) {
+		// 	result.push(sectionItem);
+		// }
 	});
-	state.applicationScenarios = result;
-
+	state.applicationScenarios = res.sections;
 	res.sections?.[0] && changeScenarios(res.sections[0]);
-	// state.scenariosIds = result.map((item) => item.section_id);
 };
 const groupedArray = computed(() => {
 	const groups = [];
@@ -70,6 +83,7 @@
 	while (state.applicationScenarios.length > i) {
 		groups.push(state.applicationScenarios.slice(i, (i += 4)));
 	}
+	console.log(groups, 86);
 	return groups;
 });
 const nextPage = () => {
diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue
index 0ec5aee..e2b5ed5 100644
--- a/src/views/project/ch/home/component/waterRight/center.vue
+++ b/src/views/project/ch/home/component/waterRight/center.vue
@@ -145,6 +145,15 @@
 				</div>
 			</el-drawer>
 		</div>
+		<el-dialog v-model="state.useInstructDialog" :title="state.instructInfo?.template_title" width="500" :before-close="handleClose">
+			<el-input v-model="state.inputInstruct" :rows="10" type="textarea"></el-input>
+			<template #footer>
+				<div class="dialog-footer">
+					<el-button @click="handleClose">鍙栨秷</el-button>
+					<el-button type="primary" @click="submitInstruct"> 纭 </el-button>
+				</div>
+			</template>
+		</el-dialog>
 	</div>
 </template>
 
@@ -237,6 +246,9 @@
 	activeLabelName: 0,
 	activeInstructName: 0,
 	isShowExpand: false,
+	useInstructDialog: false,
+	instructInfo: {},
+	inputInstruct: '', //鍙慨鏀规寚浠�
 });
 const exampleList = ref([]); //妯$増鍒楄〃
 const instructContentList = ref([]); //鎸囦护鍒楄〃
@@ -320,7 +332,16 @@
 };
 //#region ====================== templateUseClick ======================
 const templateUseClick = (row) => {
-	emitter.emit('updateChatInput', row.template_value);
+	state.useInstructDialog = true;
+	state.instructInfo = row;
+	state.inputInstruct = row.template_value;
+};
+const handleClose = () => {
+	state.useInstructDialog = false;
+};
+const submitInstruct = () => {
+	emitter.emit('updateChatInput', state.inputInstruct);
+	handleClose();
 };
 //#endregion
 //#region ====================== 鎼滅储妯℃澘/鎸囦护 ======================

--
Gitblit v1.9.3