Explorar o código

图片不出,给分板就不展示

刘洋 hai 1 ano
pai
achega
d054fc6f63
Modificáronse 2 ficheiros con 4 adicións e 1 borrados
  1. 3 0
      src/hooks/useSetImgBg.ts
  2. 1 1
      src/modules/marking/mark/index.vue

+ 3 - 0
src/hooks/useSetImgBg.ts

@@ -5,6 +5,7 @@ import TintImageWorker from '@/utils/image.worker?worker'
 import useMainStore from '@/store/main'
 import { useRoute } from 'vue-router'
 import analyze from 'rgbaster'
+import { ElMessage } from 'element-plus'
 export type RGBA = number[]
 
 export type Point = [number, number]
@@ -88,6 +89,7 @@ export const useSetImgBg = (option: Ref<SetImgBgOption>, frontColor?: Ref<string
     }
   })
   const initImage = async ({ image, frontColor, setFrontColor }: InitOption) => {
+    const filePath = image as string
     if (!image) {
       return console.warn(`return for img define ${image}`)
     }
@@ -125,6 +127,7 @@ export const useSetImgBg = (option: Ref<SetImgBgOption>, frontColor?: Ref<string
         }
         img.onerror = () => {
           console.log('img error')
+          ElMessage.error('图片渲染失败:' + filePath)
           reject()
         }
         img.onabort = () => {

+ 1 - 1
src/modules/marking/mark/index.vue

@@ -64,7 +64,7 @@
           />
         </div> -->
         <scoring-panel-with-confirm
-          v-if="currentTask"
+          v-if="currentTask && dataUrl"
           :id="currentTask?.taskId"
           v-model:visible="scoringPanelVisible"
           v-model:score="modelScore"