|
|
@@ -248,13 +248,14 @@ const showLampPreview = ref(true);
|
|
|
const isRecording = ref(false);
|
|
|
const recordingCountdown = ref(10);
|
|
|
let countdownInterval = null;
|
|
|
+let recognition = null;
|
|
|
|
|
|
// 返回虚拟实验室
|
|
|
const goLabShow = () => {
|
|
|
showLampPreview.value = true;
|
|
|
};
|
|
|
const goBack = () => {
|
|
|
- window.location.href = "/virtual-laboratory";
|
|
|
+ router.push("/virtual-laboratory");
|
|
|
};
|
|
|
|
|
|
const executeCode = () => {
|
|
|
@@ -487,7 +488,7 @@ const aiService = {
|
|
|
}
|
|
|
|
|
|
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
|
- const recognition = new SpeechRecognition();
|
|
|
+ recognition = new SpeechRecognition();
|
|
|
|
|
|
recognition.lang = language;
|
|
|
recognition.interimResults = false;
|
|
|
@@ -1027,9 +1028,11 @@ onMounted(() => {
|
|
|
// 从全局状态初始化年级ID
|
|
|
state.gradeId = globalState.initGradeId();
|
|
|
|
|
|
- device.value.name = router.currentRoute.value.query.name || "";
|
|
|
- device.value.image = router.currentRoute.value.query.image || "";
|
|
|
- device.value.jsonData = JSON.parse(router.currentRoute.value.query.jsonData || {});
|
|
|
+ // 从 window.history.state 接收参数
|
|
|
+ const routeState = window.history.state || {};
|
|
|
+ device.value.name = routeState.name || "";
|
|
|
+ device.value.image = routeState.image || "";
|
|
|
+ device.value.jsonData = routeState.jsonData || {};
|
|
|
|
|
|
// 注册AI语音识别积木
|
|
|
Blockly.Blocks["ai_voice_input"] = {
|