Przeglądaj źródła

feat: 设计器、组件库保存数据时,如果保存封面失败,则使用上次的封面,数据依旧可以保存

wu.jian2 1 rok temu
rodzic
commit
498570227a

+ 4 - 1
data-room-ui/packages/BigScreenDesign/PageDesignTop.vue

@@ -191,6 +191,7 @@ export default {
           value: 'verticalAround'
         }
       ],
+      initialCoverPicture: '',
       appInfo: '',
       saveLoading: false,
       createdImgLoading: false,
@@ -222,6 +223,7 @@ export default {
     }
   },
   mounted () {
+    this.initialCoverPicture = this.pageInfo.coverPicture || ''
     this.$refs.zoomInput.$el.addEventListener('mousewheel', this.handleMouseWheel)
   },
   beforeDestroy () {
@@ -460,7 +462,8 @@ export default {
               pageInfo.coverPicture = dataUrl
             }
           } else {
-            pageInfo.coverPicture = ''
+            this.$message.warning('保存封面失败,将使用上次保存的封面')
+            pageInfo.coverPicture = this.initialCoverPicture
           }
           const res = await saveScreen(pageInfo)
           this.$message.success('保存成功')

+ 4 - 1
data-room-ui/packages/BizComponent/index.vue

@@ -172,6 +172,7 @@ export default {
   props: {},
   data () {
     return {
+      initialCoverPicture: '',
       form: {
         name: '',
         coverPicture: '',
@@ -237,6 +238,7 @@ export default {
       const type = this.$route.query.type
       if (code) {
         getBizComponentInfo(code).then(data => {
+          this.initialCoverPicture = data.coverPicture || ''
           if (type && type === 'g2plot') {
             this.form = {
               ...data,
@@ -370,7 +372,8 @@ export default {
           this.form.coverPicture = dataUrl
         }
       } else {
-        this.form.coverPicture = ''
+        this.$message.warning('保存封面失败,将使用上次保存的封面')
+        this.form.coverPicture = this.initialCoverPicture
       }
       updateBizComponent(this.form).then(() => {
         this.$message({