木星 1 month ago
parent
commit
2c112b7d77
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/views/Material/MaterialMange.vue

+ 11 - 1
src/views/Material/MaterialMange.vue

@@ -383,7 +383,12 @@ const signIn = async () => {
383 383
     return
384 384
   }
385 385
 
386
-  formData.jsonValue = JSON.parse(formData.jsonValue)
386
+  try {
387
+    formData.jsonValue = JSON.parse(formData.jsonValue)
388
+  } catch (error) {
389
+    ElMessage.error('材质内容格式错误')
390
+    return
391
+  }
387 392
 
388 393
   console.log('shdjasd1', formData.TIETU)
389 394
   if (formData.TIETU) {
@@ -396,10 +401,15 @@ const signIn = async () => {
396 401
   await formRef?.validate(async (isValid) => {
397 402
     if (isValid) {
398 403
       const res = await saveResource(formData)
404
+      console.log('shdjasd22', res)
399 405
       if (res) {
400 406
         dialogVisible.value = false
401 407
         ElMessage.success('保存成功')
402 408
         refresh()
409
+      } else {
410
+        console.log('asdhjasd')
411
+        delete formData.jsonValue.texture
412
+        formData.jsonValue = JSON.stringify(formData.jsonValue)
403 413
       }
404 414
     }
405 415
   })