From b65fbea138ec5806e339fe8301437e82866e6059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E4=B8=87=E4=BF=8A?= Date: Wed, 27 Aug 2025 09:07:34 +0800 Subject: [PATCH] =?UTF-8?q?style/=E9=A6=96=E9=A1=B5=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=20=E8=AF=AD=E9=9F=B3=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E6=96=B0=E5=BB=BA=EF=BC=8C=E6=90=9C=E7=B4=A2=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/components/speechControl.vue | 74 ++++++--------------------- src/view/index.vue | 31 ++++++----- 2 files changed, 32 insertions(+), 73 deletions(-) diff --git a/src/view/components/speechControl.vue b/src/view/components/speechControl.vue index eda99c9..01f5b92 100644 --- a/src/view/components/speechControl.vue +++ b/src/view/components/speechControl.vue @@ -72,68 +72,23 @@ const config = { params: [], }, { - command: "input_username", - description: "在用户名输入框中填写用户名", + command: "search_project", + description: "搜索项目", action: "input", - selector: "#username, #username-input, input[type='text'][name*='user']", + selector: "#search_project", params: [ { - name: "username", + name: "projectname", type: "string", - description: "要输入的用户名", + description: "要输入的项目名称", }, ], }, - { - command: "input_password", - description: "在密码输入框中填写密码", - action: "input", - selector: "#password, #password-input, input[type='password']", - params: [ - { - name: "password", - type: "string", - description: "要输入的密码", - }, - ], - }, - { - command: "submit_login", - description: "提交登录表单", - action: "click", - selector: "#submit-login, .login-submit, button[type='submit']", - params: [], - }, - { - command: "search_product", - description: "在搜索框中输入关键词", - action: "input", - selector: "#search-input, .search-box, input[type='search']", - params: [ - { - name: "keyword", - type: "string", - description: "搜索关键词", - }, - ], - }, - { - command: "perform_search", - description: "执行搜索操作", - action: "click", - selector: "#search-button, .search-btn, button[type='submit']", - params: [], - }, - { - command: "add_to_cart", - description: "将当前产品添加到购物车", - action: "click", - selector: ".add-to-cart, .cart-btn, [data-add-to-cart]", - params: [], - }, ], }; +const listenStatus = ref(false); + const props = defineProps({ config: { type: Object, @@ -263,7 +218,7 @@ class VoiceControl { if (this.isListening) { // 只有在用户希望继续聆听时才重启 setTimeout(() => { - this.recognition.start(); + this.recognition.start(); }, 100); // 短暂延迟后重启 } else { this.updateUI(); @@ -407,6 +362,9 @@ class VoiceControl { } const element = document.querySelector(commandConfig.selector); + + console.log(element,"-----element"); + if (!element) { throw new Error(`找不到元素: ${commandConfig.selector}`); } @@ -518,8 +476,14 @@ const toggleListening = () => { } if (voiceControl.value.isListening) { + listenStatus.value = false; voiceControl.value.stopListening(); + const voiceBtn = document.getElementById("voice-btn"); + if (voiceBtn) { + voiceBtn.classList.remove("listening"); + } } else { + listenStatus.value = true; voiceControl.value.startListening(); } }; @@ -547,10 +511,6 @@ body { } .container { - max-width: 1200px; - width: 100%; - text-align: center; - padding: 20px; } h1 { diff --git a/src/view/index.vue b/src/view/index.vue index 3028cce..0702e74 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -32,17 +32,6 @@
- - @@ -102,7 +91,7 @@ @@ -127,7 +116,9 @@ -
+
+ +
@@ -144,6 +135,8 @@ import projectModal from '@/view/components/projectModal.vue' import { ref } from "vue"; const dialogVisible = ref(false) +const projectsrc = new URL("./../assets/images/sjdp1.png", import.meta.url).href; + const menu = ref([ { name: "我的项目", @@ -176,13 +169,14 @@ const menu = ref([ active: false, }, ]); + const searchValue = ref(""); const tabName = ref("local"); const projects = ref([ { name: '苏州站基础大屏示例', - img: '' + img: projectsrc } ]) @@ -431,7 +425,7 @@ const addProject = () => { height: 1px; background: rgba(255, 255, 255, 0.9); position: absolute; - left: -220px; + left: -150px; top: 50%; transform: translateY(-50%); } @@ -442,7 +436,7 @@ const addProject = () => { height: 1px; background: rgba(255, 255, 255, 0.9); position: absolute; - right: -220px; + right: -150px; top: 50%; transform: translateY(-50%); } @@ -551,6 +545,11 @@ const addProject = () => { background: #444; border-radius: 4px; margin-bottom: 12px; + overflow: hidden; + img { + width: 100%; + height: 100%; + } } .card-title {