Prechádzať zdrojové kódy

fix: 修改更新图片的bug

mjh 4 rokov pred
rodič
commit
390ba5ba8b
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      src/views/ManagePage/ManagePage.vue

+ 2 - 3
src/views/ManagePage/ManagePage.vue

@@ -716,7 +716,7 @@ export default {
             }).then(async (res) => {
               const createdCourse = res.data.data;
               if (createdCourse) {
-                if (_this.form.fileList.length !== 0) {
+                if (_this.form.fileList.length !== 0 && this.form.fileList[0].raw) {
                   const imageUrl = (await _this.$apis.uploadCourseImage(createdCourse.name, this.form.fileList[0].raw)).data.data;
                   if (imageUrl) {
                     createdCourse.imageUrl = imageUrl;
@@ -745,10 +745,9 @@ export default {
               moocUrl: _this.form.moocUrl,
               price: Number(_this.form.price),
             }).then(async (res) => {
-              console.log(res);
               const updatedCourse = res.data.data;
               if (updatedCourse) {
-                if (_this.form.fileList.length !== 0) {
+                if (_this.form.fileList.length !== 0 && this.form.fileList[0].raw) {
                   const imageUrl = (await _this.$apis.uploadCourseImage(updatedCourse.name, this.form.fileList[0].raw)).data.data;
                   if (imageUrl) {
                     updatedCourse.imageUrl = imageUrl;