Эх сурвалжийг харах

Merge branch 'wanzi' of http://59.110.91.129:3000/zhangmengying/AIClass into wanzi

丸子 8 сар өмнө
parent
commit
ca14462288

+ 3 - 2
.env

@@ -2,8 +2,9 @@
 VITE_APP_TITLE=AI课程网
 
 # 请求路径
-# VITE_BASE_URL='http://59.110.91.129/admin-api'
-VITE_BASE_URL='http://192.168.110.8:8080/admin-api'
+VITE_BASE_URL='http://59.110.91.129:8088/admin-api'
+#VITE_BASE_URL='https://learn-ai.com.cn/admin-api'
+#VITE_BASE_URL='http://192.168.110.8:8080/admin-api'
 
 # 默认账户密码
 VITE_APP_DEFAULT_LOGIN_TENANT = 博雅智算

+ 32 - 4
src/components/PPT/PptView.vue

@@ -12,6 +12,7 @@
               @rendered="handlePptRendered"
               :animation="true"
               :animation-speed="1.0"
+              :key="pptKey"
           />
         </div>
         
@@ -41,7 +42,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted, defineProps } from 'vue'
+import { ref, onMounted, onUnmounted, defineProps } from 'vue'
 import { ElMessage } from 'element-plus'
 // 导入图标
 import leftImg from '@/assets/icon/videoImage01.png'
@@ -86,7 +87,20 @@ const handlePageChange = (newPage) => {
 
 // 新增滚动控制变量
 const pptContainer = ref(null)
-const pageHeight = ref(620) // 单页高度
+const pageHeight = ref(0) // 单页高度,初始设为0
+const pptKey = ref(0) // 添加key用于重新渲染
+
+// 窗口大小变化处理函数
+const handleResize = () => {
+  if (pptContainer.value) {
+    // 更新页面高度
+    pageHeight.value = pptContainer.value.clientHeight || 620;
+    // 通过更新key强制重新渲染PPT
+    pptKey.value += 1;
+    // 重新定位到当前页
+    scrollToPage(currentPage.value);
+  }
+}
 
 const nextPage = () => {
   if (currentPage.value < totalPages.value) {
@@ -124,8 +138,18 @@ const scrollToPage = (pageNum) => {
 onMounted(() => {
   // 获取容器元素
   pptContainer.value = document.querySelector('.carousel-wrapper');
+  // 初始化页面高度
+  if (pptContainer.value) {
+    pageHeight.value = pptContainer.value.clientHeight || 620;
+  }
   // 初始滚动到第一页
   scrollToPage(1);
+  // 添加窗口大小监听
+  window.addEventListener('resize', handleResize);
+})
+// 组件卸载时移除监听
+onUnmounted(() => {
+  window.removeEventListener('resize', handleResize);
 })
 
 // PPT错误处理事件
@@ -169,7 +193,9 @@ const handlePptError = (error) => {
 
 .carousel-wrapper {
   width: 70%;
-  height: rpx(290);
+  //height: rpx(290);
+
+  height: 100%;
   overflow: hidden;
   border-radius: rpx(12);
   position: relative;
@@ -287,7 +313,9 @@ const handlePptError = (error) => {
 
 // 确保每张幻灯片占满容器高度
 ::v-deep .slide-item {
-  height: rpx(620) !important;
+  //height: rpx(620) !important;
+
+  height: 100% !important;
   width: 100% !important;
   box-sizing: border-box;
 }

+ 2 - 2
src/views/AIQuestions.vue

@@ -242,7 +242,7 @@ const initSpeechRecognition = () => {
   }
 
   const instance = new SpeechRecognition();
-  instance.lang = "zh-CN";
+  instance.lang = 'zh-CN';
   instance.interimResults = false;
 
   instance.onresult = (event) => {
@@ -259,7 +259,7 @@ const initSpeechRecognition = () => {
   };
 
   instance.onerror = (event) => {
-    console.error("语音识别错误:", event.error);
+    console.error('语音识别错误:', event.error);
     clearInterval(countdownTimer.value); // 出错时清除定时器
     isRecording.value = false;
     alert("语音输入失败,请重试");