Jelajahi Sumber

【我的素材-全景图片】调通设置封面功能

任一存 4 tahun lalu
induk
melakukan
ca98fe7464
1 mengubah file dengan 30 tambahan dan 3 penghapusan
  1. 30 3
      src/views/material/pano/index.vue

+ 30 - 3
src/views/material/pano/index.vue

@@ -281,9 +281,36 @@ export default {
             },
             () => {
               this.$msg.success("设置成功");
-              this.showCover = false;
-              this.popupItem = "";
-              this.getMaterialList();
+
+              const index = this.list.findIndex((eachItem) => {
+                return eachItem.id === this.popupItem.id
+              })
+              if (index >= 0) {
+                getMaterialList(
+                  {
+                    pageNum: index + 1,
+                    pageSize: 1,
+                    type: TYPE,
+                  },
+                  (data) => {
+                    const newData = data.data.list.map((i) => {
+                      i.fileSize = changeByteUnit(Number(i.fileSize));
+                      return i;
+                    });
+                    this.list.splice(index, 1, newData[0])
+                    this.showCover = false;
+                    this.popupItem = "";
+                  },
+                  () => {
+                    this.showCover = false;
+                    this.popupItem = "";
+                  }
+                )
+              } else {
+                console.error('在素材列表里没找到要设置封面的那一项!');
+                this.showCover = false;
+                this.popupItem = "";
+              }
             }
           );
         }