1
0
tangning 16 часов назад
Родитель
Сommit
d13d6ea32a
2 измененных файлов с 9 добавлено и 5 удалено
  1. 3 1
      src/view/case/photos/canvas-photo-editor.js
  2. 6 4
      src/view/case/photos/index.vue

+ 3 - 1
src/view/case/photos/canvas-photo-editor.js

@@ -926,13 +926,15 @@ export class CanvasPhotoEditor {
     // if (!photo) return
     // if (!photo) return
 
 
     let img = this.imgCache.get(photoId)
     let img = this.imgCache.get(photoId)
+    console.log(img, photo,'imgCache', this.photos)
     if (!img && photo && photo.url) {
     if (!img && photo && photo.url) {
       img = new Image()
       img = new Image()
       img.crossOrigin = 'anonymous'
       img.crossOrigin = 'anonymous'
       // 仅首次绑定onload,避免重复绑定
       // 仅首次绑定onload,避免重复绑定
       img.onload = () => {
       img.onload = () => {
         // 加载完成后触发全量重绘(保证使用最新状态)
         // 加载完成后触发全量重绘(保证使用最新状态)
-        this.drawAllPages()
+        console.log(`图片 ${photoId} 加载成功:`)
+        debounce(this.drawAllPages, 500)
       }
       }
       img.onerror = (err) => {
       img.onerror = (err) => {
         console.error(`图片 ${photoId} 加载失败:`, err)
         console.error(`图片 ${photoId} 加载失败:`, err)

+ 6 - 4
src/view/case/photos/index.vue

@@ -220,11 +220,13 @@ const getImgList = async () => {
   let pageCentent = await getCasePhotoRollList(caseId.value)
   let pageCentent = await getCasePhotoRollList(caseId.value)
   let item = pageCentent.find(ele => ele.id == id)
   let item = pageCentent.find(ele => ele.id == id)
   title.value = item?.name || '照片制卷'
   title.value = item?.name || '照片制卷'
-  let content = item && item.content && JSON.parse(item?.content) || {}
-  if(content.pages) pages.value = content.pages
+  let content = item && item.content && JSON.parse(item?.content)
   // editor.value.drawAllPages(photos.value);
   // editor.value.drawAllPages(photos.value);
-  editor.value.pages = pages.value;
-  editor.value.indexingLineList = content.indexingLineList;
+  if(content){
+    pages.value = content.pages
+    editor.value.pages = pages.value;
+    editor.value.indexingLineList = content.indexingLineList || [];
+  }
   editor.value.drawAllPages(photos.value);
   editor.value.drawAllPages(photos.value);
 }
 }
 getImgList();
 getImgList();