Przeglądaj źródła

refactor(Editor): 将setTitle功能移至index3.vue并清理EditorHeader中的代码

移除EditorHeader中未使用的setTitle函数及相关全局挂载,将其功能整合到index3.vue中
lsc 3 tygodni temu
rodzic
commit
88c462253f

+ 5 - 5
src/views/Editor/EditorHeader/index.vue

@@ -158,12 +158,12 @@ const enterStudentView = () => {
   window.location.href = '/?mode=student'
   window.location.href = '/?mode=student'
 }
 }
 
 
-const setTitle = (newTitle: string) => {
-  titleValue.value = newTitle
-  slidesStore.setTitle(newTitle)
-}
+// const setTitle = (newTitle: string) => {
+//   titleValue.value = newTitle
+//   slidesStore.setTitle(newTitle)
+// }
 
 
-(window as any).setTitle = setTitle
+// (window as any).setTitle = setTitle
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 10 - 2
src/views/Editor/index3.vue

@@ -182,7 +182,7 @@
 <script lang="ts" setup>
 <script lang="ts" setup>
 import { ref, computed, onMounted, onUnmounted } from 'vue'
 import { ref, computed, onMounted, onUnmounted } from 'vue'
 import { storeToRefs } from 'pinia'
 import { storeToRefs } from 'pinia'
-import { useMainStore } from '@/store'
+import { useMainStore, useSlidesStore } from '@/store'
 import useGlobalHotkey from '@/hooks/useGlobalHotkey'
 import useGlobalHotkey from '@/hooks/useGlobalHotkey'
 import usePasteEvent from '@/hooks/usePasteEvent'
 import usePasteEvent from '@/hooks/usePasteEvent'
 
 
@@ -203,6 +203,7 @@ import CollapsibleToolbar from '@/components/CollapsibleToolbar/index2.vue'
 import CreateCourseDialog from '@/components/CreateCourseDialog.vue'
 import CreateCourseDialog from '@/components/CreateCourseDialog.vue'
 import api from '@/services/course'
 import api from '@/services/course'
 
 
+
 interface ParentWindowWithToolList extends Window {
 interface ParentWindowWithToolList extends Window {
   lastSteps?: () => void;
   lastSteps?: () => void;
   setCouresTitle?: (title: string) => void;
   setCouresTitle?: (title: string) => void;
@@ -223,6 +224,7 @@ const props = withDefaults(defineProps<Props>(), {
 })
 })
 
 
 const mainStore = useMainStore()
 const mainStore = useMainStore()
+const slidesStore = useSlidesStore()
 const { dialogForExport, showSelectPanel, showSearchPanel, showNotesPanel, showMarkupPanel, showAIPPTDialog } = storeToRefs(mainStore)
 const { dialogForExport, showSelectPanel, showSearchPanel, showNotesPanel, showMarkupPanel, showAIPPTDialog } = storeToRefs(mainStore)
 const closeExportDialog = () => mainStore.setDialogForExport('')
 const closeExportDialog = () => mainStore.setDialogForExport('')
 const closeAIPPTDialog = () => mainStore.setAIPPTDialogState(false)
 const closeAIPPTDialog = () => mainStore.setAIPPTDialogState(false)
@@ -336,7 +338,13 @@ const getCourseDetail = async (courseid: string) => {
   handleCourseLoaded(res[0][0])
   handleCourseLoaded(res[0][0])
 }
 }
 
 
-Object.assign(window, { getCourseDetail })
+const setTitle = (newTitle: string) => {
+  courseTitle.value = newTitle
+  slidesStore.setTitle(newTitle)
+}
+
+
+Object.assign(window, { getCourseDetail, setTitle })
 
 
 onMounted(() => {
 onMounted(() => {
   if (!props.courseid) {
   if (!props.courseid) {