Browse Source

fix(Editor): 修复工作页URL替换逻辑并优化移动设备拖拽禁用

修复Canvas中工作页URL替换逻辑,确保正确替换为setWorkPage路径
优化Thumbnails组件在移动设备上的拖拽禁用逻辑
统一编辑器界面中的多语言文本显示
调整确认对话框样式和按钮交互
lsc 8 hours ago
parent
commit
64d1eb8718

+ 10 - 0
src/views/Editor/Canvas/index.vue

@@ -286,6 +286,16 @@ const getCourseDetail = async () => {
         jsonStr = new TextDecoder('utf-8').decode(uint8Array)
         try {
           const jsonObj = JSON.parse(jsonStr)
+          console.log('jsonObj:', jsonObj)
+          const slides = jsonObj.slides || []
+          for (const slide of slides) {
+            slide.elements = slide.elements || []
+            for (const element of slide.elements) {
+              if (element.type === 'frame' && element.url?.includes('/workPage') && !element.url.includes('/setWorkPage')) {
+                element.url = element.url.replace(/\/(workPage(?:New)?)\b(?![^\/?#]*\.html)/g, '/setWorkPage')
+              }
+            }
+          }
           readJSON(jsonObj, true)
           if (typeof window !== 'undefined') {
             const win = window as any

+ 40 - 4
src/views/Editor/CanvasTool/index2.vue

@@ -107,8 +107,9 @@
     <!-- 确认对话框 -->
     <Modal
       :visible="confirmDialogVisible"
-      :width="420"
-      :closeButton="true"
+      :width="400"
+      :contentStyle="{ borderRadius: '15px' }"
+      :closeButton="false"
       :closeOnClickMask="false"
       :closeOnEsc="false"
       @update:visible="val => confirmDialogVisible = val"
@@ -119,8 +120,8 @@
           {{ lang.ssClearToolContent }}
         </div>
         <div class="clear-confirm__footer">
-          <Button type="default" @click="handleCancel">{{ lang.ssCancel }}</Button>
-          <Button type="primary" @click="handleConfirm">{{ lang.ssApply }}</Button>
+          <div class="btn-c" @click="handleCancel">{{ lang.ssCancel }}</div>
+          <div class="btn-c confirm" @click="handleConfirm">{{ lang.ssApply }}</div>
         </div>
       </div>
     </Modal>
@@ -583,4 +584,39 @@ const editContent = (toolType: number) => {
     margin-top: 2px;
   }
 }
+
+.btn-c{
+  display: inline-block;
+  line-height: 1;
+  white-space: nowrap;
+  cursor: pointer;
+  background: #FFF;
+  border: 1px solid #DCDFE6;
+  color: #606266;
+  text-align: center;
+  box-sizing: border-box;
+  outline: 0;
+  margin: 0;
+  transition: .1s;
+  font-weight: 500;
+  padding: 12px 20px;
+  font-size: 14px;
+  border-radius: 10px;
+
+  +.btn-c {
+    margin-left: 10px;
+  }
+
+  &.confirm {
+    background: #FF9400;
+    color: white;
+    border: 1px solid #FF9400;
+
+    &:hover {
+      background: #FFA500;
+    }
+  }
+}
+
+
 </style>

+ 7 - 2
src/views/Editor/Thumbnails/index2.vue

@@ -25,7 +25,7 @@
       :animation="200"
       :scroll="true"
       :scrollSensitivity="50"
-      :disabled="true"
+      :disabled="isMobileDevice || editingSectionId"
       @end="handleDragEnd"
       itemKey="id"
     >
@@ -86,12 +86,17 @@ import useLoadSlides from '@/hooks/useLoadSlides'
 import useAddSlidesOrElements from '@/hooks/useAddSlidesOrElements'
 import type { Slide } from '@/types/slides'
 import { lang } from '@/main'
-
 import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue'
 import Templates from './Templates.vue'
 import Popover from '@/components/Popover.vue'
 import Draggable from 'vuedraggable'
 
+// 检测是否为移动设备(包括iPad和手机)
+const isMobileDevice = computed(() => {
+  const userAgent = navigator.userAgent
+  return /iPhone|iPad|iPod|Android|Mobile/.test(userAgent) || (navigator.maxTouchPoints > 1 && /Macintosh/.test(userAgent))
+})
+
 const mainStore = useMainStore()
 const slidesStore = useSlidesStore()
 const keyboardStore = useKeyboardStore()

+ 6 - 3
src/views/Editor/index3.vue

@@ -68,7 +68,7 @@
                   </g>
                 </g>
               </svg>
-              设置
+              {{lang.ssSettings}}
             </div>
             <div class="dropdown-item" @click="handleSaveAsCopy"><svg width="24" height="24" viewBox="0 0 24 24"
                 fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -78,7 +78,8 @@
                     fill="black" fill-opacity="0.6" />
                 </g>
               </svg>
-              另存为副本</div>
+              {{ lang.ssSaveAsCopy }}
+            </div>
             <div class="dropdown-item danger" @click="handleDelete" v-show="ccourseid"><svg width="24" height="24" viewBox="0 0 24 24"
                 fill="none" xmlns="http://www.w3.org/2000/svg">
                 <g>
@@ -97,7 +98,8 @@
                   </clipPath>
                 </defs>
               </svg>
-              删除</div>
+              {{ lang.ssDelete }}
+            </div>
           </div>
         </div>
 
@@ -512,6 +514,7 @@ usePasteEvent()
   overflow: hidden;
   display: block;
   text-overflow: ellipsis;
+  white-space: nowrap;
 
   &:hover {
     background-color: #f5f5f5;