whx 6 days ago
parent
commit
de51714824

+ 3 - 5
virgo.wzfrontend/aiChat/src/components/AIFlowChat.vue

@@ -125,7 +125,6 @@
 			str = data;
 		}
 		let obj = str.split('<workark>');
-		console.log(obj);
 		let newData = obj.map(node => {
 			try {
 				return JSON.parse(node)
@@ -171,7 +170,6 @@
 					result += event.data;
 					if (!setTime) {
 						setTime = setTimeout(() => {
-							console.log(result);
 							if (result.indexOf('markdown') > -1) {
 								initChatList();
 							} else {
@@ -313,7 +311,7 @@
 									</div>
 									<div class="wk-content">
 										<div class="title">{{ item.label }}</div>
-										<div class="content">
+										<div class="content" v-if="item.status === 'success'">
 											<el-icon>
 												<Monitor />
 											</el-icon>
@@ -326,7 +324,7 @@
 									</div>
 								</div>
 								<div class="wk-url" v-if="item.type === 'url'">
-									<div class="label">网站生成成功</div>
+									<div class="label">{{item.label || '网站生成成功'}}</div>
 									<el-button size="small" type="primary" @click="AIClick(item.url)">点击查看</el-button>
 								</div>
 							</div>
@@ -465,7 +463,7 @@
 		}
 
 		.timeline-warning {
-			.el-timeline-item__icon {
+			.step-icon {
 				animation: rotating 2s linear infinite;
 			}
 		}

+ 57 - 8
virgo.wzfrontend/aiChat/src/views/AIChat.vue

@@ -11,12 +11,15 @@
 	} from 'vue-router';
 
 	import {
-		Promotion
+		Notification,
+		Position
 	} from '@element-plus/icons-vue'
 	const router = ref(useRouter())
 	const user = ref(useUserStore().userData);
 	const websiteUrl = ref('');
 	const loading = ref(false);
+	const iframeDom = ref(null);
+	const isEdit = ref(false);
 	const updateURL = (url) => {
 		if (websiteUrl.value === url) return;
 		websiteUrl.value = url;
@@ -24,10 +27,38 @@
 	}
 	const onloadIframe = () => {
 		loading.value = false;
+		removeEdit();
 	}
 	const linTo = () => {
 		window.open(websiteUrl.value)
 	}
+	const edit = () => {
+		const iframe = iframeDom.value;
+		if (iframe.contentWindow) {
+			if (isEdit.value) {
+				removeEdit();
+			} else {
+				iframe.contentWindow.postMessage({
+					designMode: true,
+					enabled: true,
+					type: "devtools_enable",
+					__v0_remote__: 1
+				}, '*')
+			}
+			isEdit.value = !isEdit.value;
+		}
+	}
+	const removeEdit = () => {
+		const iframe = iframeDom.value;
+		if (iframe.contentWindow) {
+			iframe.contentWindow.postMessage({
+				designMode: true,
+				enabled: false,
+				type: "devtools_enable",
+				__v0_remote__: 1
+			}, '*')
+		}
+	}
 </script>
 <template>
 	<div class="ai-website">
@@ -53,10 +84,15 @@
 			</div>
 			<div class="website-show ai-website-box">
 				<div class="website-form-title">
-					<span>网页展示</span>
-					<span v-if="websiteUrl">
-						<el-button type="primary" size="small" :icon="Promotion" @click="linTo">预览</el-button>
-					</span>
+					<div>网页展示</div>
+					<div class="title-icon-box" v-if="websiteUrl">
+						<el-icon @click="edit">
+							<Position />
+						</el-icon>
+						<el-icon @click="linTo">
+							<Notification />
+						</el-icon>
+					</div>
 				</div>
 				<div class="hui-flex-box">
 					<div class="no-empty" v-if="!websiteUrl">
@@ -68,9 +104,6 @@
 						</iframe>
 					</div>
 				</div>
-				<div class="hui-drawer-submit">
-
-				</div>
 			</div>
 		</div>
 	</div>
@@ -172,6 +205,22 @@
 			display: flex;
 			justify-content: space-between;
 			align-items: center;
+
+			.title-icon-box {
+				font-size: 18px;
+				color: #6c6d70;
+				display: flex;
+				align-items: center;
+				cursor: pointer;
+
+				.el-icon {
+					margin-left: 10px;
+
+					&:hover {
+						color: var(--el-color-primary);
+					}
+				}
+			}
 		}
 
 		.website-form {