Pārlūkot izejas kodu

背景设置修改

dsy 1 nedēļu atpakaļ
vecāks
revīzija
9082a67ad4

+ 4 - 5
src/courseware_preview/index.vue

@@ -371,15 +371,14 @@ export default {
      */
     getCoursewareComponentContent_View(id) {
       ContentGetCoursewareContent_View({ id }).then(
-        ({ content, component_list, content_group_row_list, title_list }) => {
+        ({ content, component_list, content_group_row_list, title_list, background }) => {
           if (title_list) this.title_list = title_list || [];
+          if (background) {
+            this.background = JSON.parse(background);
+          }
           if (content) {
             const _content = JSON.parse(content);
             this.data = _content;
-            this.background = {
-              background_image_url: _content.background_image_url,
-              background_position: _content.background_position,
-            };
           } else {
             this.data = { row_list: [] };
           }

+ 32 - 31
src/mobile_preview/index.vue

@@ -225,40 +225,41 @@ export default {
      * @param {string} id - 课件ID
      */
     getCoursewareComponentContent_View(id) {
-      ContentGetCoursewareContent_View({ id }).then(({ content, component_list, content_group_row_list }) => {
-        if (content) {
-          const _content = JSON.parse(content);
-          this.data = _content;
-          this.background = {
-            background_image_url: _content.background_image_url,
-            background_position: _content.background_position,
-          };
-        } else {
-          this.data = { row_list: [] };
-        }
+      ContentGetCoursewareContent_View({ id }).then(
+        ({ content, component_list, content_group_row_list, background }) => {
+          if (background) {
+            this.background = JSON.parse(background);
+          }
+          if (content) {
+            const _content = JSON.parse(content);
+            this.data = _content;
+          } else {
+            this.data = { row_list: [] };
+          }
 
-        if (component_list) this.component_list = component_list;
-        this.component_list.forEach((x) => {
-          if (x.component_type === 'audio') {
-            let _c = JSON.parse(x.content);
-            let p = _c.property || {};
-            if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
-            if (p.view_method === 'independent' && !p.style_mode) {
-              p.style_mode = 'middle';
-            }
-            if (!p.style_mode) p.style_mode = 'big';
-            if (p.view_method === 'icon') {
-              p.file_name_display_mode = 'false';
-              p.view_method = 'independent';
-              p.style_mode = 'small';
+          if (component_list) this.component_list = component_list;
+          this.component_list.forEach((x) => {
+            if (x.component_type === 'audio') {
+              let _c = JSON.parse(x.content);
+              let p = _c.property || {};
+              if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
+              if (p.view_method === 'independent' && !p.style_mode) {
+                p.style_mode = 'middle';
+              }
+              if (!p.style_mode) p.style_mode = 'big';
+              if (p.view_method === 'icon') {
+                p.file_name_display_mode = 'false';
+                p.view_method = 'independent';
+                p.style_mode = 'small';
+              }
+
+              x.content = JSON.stringify(_c);
             }
+          });
 
-            x.content = JSON.stringify(_c);
-          }
-        });
-
-        if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
-      });
+          if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
+        },
+      );
     },
 
     getLangList() {

+ 1 - 0
src/views/book/courseware/preview/CoursewarePreview.vue

@@ -432,6 +432,7 @@ export default {
 
         if (back.imageMode === 'fill') {
           canvasStyle['backgroundRepeat'] = 'repeat';
+          canvasStyle['backgroundSize'] = '';
         } else {
           canvasStyle['backgroundRepeat'] = 'no-repeat';
         }

+ 1 - 1
src/views/book/courseware/preview/components/matching/MatchingPreview.vue

@@ -33,7 +33,7 @@
                 {{ multilingual.find((item) => item.type === getLang())?.translation }}
               </div>
             </div>
-            <div v-else :key="mark" style="width: calc(50% - 36px)"></div>
+            <div v-else :key="mark" style="width: calc(50% - 36px); padding: 12px 24px"></div>
           </template>
         </li>
       </ul>

+ 4 - 5
src/web_preview/index.vue

@@ -635,15 +635,14 @@ export default {
      */
     getCoursewareComponentContent_View(id) {
       ContentGetCoursewareContent_View({ id }).then(
-        ({ content, component_list, content_group_row_list, title_list }) => {
+        ({ content, component_list, content_group_row_list, title_list, background }) => {
           if (title_list) this.title_list = title_list || [];
+          if (background) {
+            this.background = JSON.parse(background);
+          }
           if (content) {
             const _content = JSON.parse(content);
             this.data = _content;
-            this.background = {
-              background_image_url: _content.background_image_url,
-              background_position: _content.background_position,
-            };
           } else {
             this.data = { row_list: [] };
           }