浏览代码

1、优化组件移动 2、添加参考答案按钮缩小 3、预览操作组件增加是否显示答案按钮参数 4、审校提示修改

dsy 3 周之前
父节点
当前提交
480bb3596d

+ 12 - 5
src/api/book.js

@@ -166,10 +166,12 @@ export function MangerAddResource(data) {
  * @param {object} data
  */
 export function SubmitFileToResourceStore(data) {
-  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-SubmitFileToResourceStore`, data);
+  return http.post(
+    `${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-SubmitFileToResourceStore`,
+    data,
+  );
 }
 
-
 /**
  * @description 删除项目资源
  * @param {object} data
@@ -422,13 +424,15 @@ export function SetBookResourceHide(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_content_manager-SetBookResourceHide`, data);
 }
 
-
 /**
  * @description 得到项目成员资源权限列表
  * @param {Object} data
  */
 export function GetProjectMemberResourcePopedomList(data) {
-  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-GetProjectMemberResourcePopedomList`, data);
+  return http.post(
+    `${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-GetProjectMemberResourcePopedomList`,
+    data,
+  );
 }
 
 /**
@@ -436,5 +440,8 @@ export function GetProjectMemberResourcePopedomList(data) {
  * @param {Object} data
  */
 export function SetProjectMemberResourcePopedom(data) {
-  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-SetProjectMemberResourcePopedom`, data);
+  return http.post(
+    `${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-SetProjectMemberResourcePopedom`,
+    data,
+  );
 }

+ 54 - 27
src/views/book/courseware/create/components/CreateCanvas.vue

@@ -140,7 +140,12 @@
 <script>
 import { getRandomNumber } from '@/utils/index';
 import { componentList } from '../../data/bookType';
-import { ContentSaveCoursewareContent, ContentGetCoursewareContent, GetBookUnifiedAttrib } from '@/api/book';
+import {
+  ContentSaveCoursewareContent,
+  ContentGetCoursewareContent,
+  GetBookUnifiedAttrib,
+  ContentSaveCoursewareComponentContent,
+} from '@/api/book';
 import _ from 'lodash';
 import { unified_attrib } from '@/common/data';
 
@@ -1069,6 +1074,7 @@ export default {
       if (this.enterCanvas) {
         if (this.curType === 'component') {
           this.handleComponentMove();
+          return;
         }
 
         if (this.curRow >= -1 && this.curCol <= -1) {
@@ -1076,35 +1082,10 @@ export default {
         }
 
         if (this.curRow >= -1 && this.curCol > -1 && this.curGrid <= -1) {
-          // 当拖拽组件和放置位置在同一列内,且行内组件数量为 1,将 curRow 减 1,才能正确插入
-          if ('col' in this.curParams) {
-            const { col, row, rowNum } = this.curParams;
-            if (col === this.curCol && row === this.curRow && rowNum === 1) {
-              this.curRow = Math.max(0, this.curRow - 1);
-              this.calculateRowInsertedObject();
-              return;
-            }
-          }
           this.calculateColObject();
         }
 
         if (this.curRow >= -1 && this.curCol > -1 && this.curGrid > -1) {
-          if ('col' in this.curParams) {
-            const { col, row, grid } = this.curParams;
-
-            // 当拖拽组件和放置位置在同一列内,将 curGrid 减 1,对应上面的删除组件,才能正确插入
-            if (col === this.curCol && row === this.curRow && grid < this.curGrid) {
-              this.curGrid = Math.max(0, this.curGrid - 1);
-            }
-
-            // 当拖拽组件和放置位置在同一列内,且行内组件数量为 1,将 curRow 减 1,才能正确插入
-            if (col === this.curCol && row === this.curRow && grid === this.curGrid) {
-              this.curRow = Math.max(0, this.curRow - 1);
-              this.calculateRowInsertedObject();
-              return;
-            }
-          }
-
           this.calculateGridObject();
         }
       }
@@ -1116,8 +1097,11 @@ export default {
      * 处理组件移动
      * 组件拖拽移动后,先删除组件,再根据拖拽位置计算插入行、列、格子
      */
-    handleComponentMove() {
+    async handleComponentMove() {
       const component = this.findChildComponentByKey(`grid-${this.curParams.id}`);
+      // 获取组件内容,保存后再插入到新的位置
+      const requestData = component.getComponentRequestContent();
+
       const data = component?.data;
       this.curType = data?.type || 'select';
       let col = component?.$attrs['data-col'];
@@ -1136,6 +1120,49 @@ export default {
         rowNum,
       };
       this.deleteComponent(this.curParams.id);
+
+      await ContentSaveCoursewareComponentContent(requestData);
+
+      if (this.curRow >= -1 && this.curCol <= -1) {
+        this.calculateRowInsertedObject();
+      }
+
+      if (this.curRow >= -1 && this.curCol > -1 && this.curGrid <= -1) {
+        // 当拖拽组件和放置位置在同一列内,且行内组件数量为 1,将 curRow 减 1,才能正确插入
+        if ('col' in this.curParams) {
+          const { col, row, rowNum } = this.curParams;
+          if (col === this.curCol && row === this.curRow && rowNum === 1) {
+            this.curRow = Math.max(0, this.curRow - 1);
+            this.calculateRowInsertedObject();
+            return;
+          }
+        }
+        this.calculateColObject();
+      }
+
+      if (this.curRow >= -1 && this.curCol > -1 && this.curGrid > -1) {
+        if ('col' in this.curParams) {
+          const { col, row, grid } = this.curParams;
+
+          // 当拖拽组件和放置位置在同一列内,将 curGrid 减 1,对应上面的删除组件,才能正确插入
+          if (col === this.curCol && row === this.curRow && grid < this.curGrid) {
+            this.curGrid = Math.max(0, this.curGrid - 1);
+          }
+
+          // 当拖拽组件和放置位置在同一列内,且行内组件数量为 1,将 curRow 减 1,才能正确插入
+          if (col === this.curCol && row === this.curRow && grid === this.curGrid) {
+            this.curRow = Math.max(0, this.curRow - 1);
+            this.calculateRowInsertedObject();
+            return;
+          }
+        }
+
+        this.calculateGridObject();
+      }
+
+      this.curType = '';
+      this.curParams = {};
+      this.enterCanvas = false;
     },
     /**
      * 计算行样式

+ 6 - 2
src/views/book/courseware/create/components/common/AddAnswer.vue

@@ -19,7 +19,11 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.el-button + .el-button {
-  margin-left: 5px;
+.el-button {
+  padding: 7px 8px;
+
+  & + .el-button {
+    margin-left: 5px;
+  }
 }
 </style>

+ 1 - 1
src/views/book/courseware/create/components/common/ModuleBase.vue

@@ -188,11 +188,11 @@ export default {
       display: flex;
       justify-content: space-between;
       margin-bottom: 3px;
-      cursor: move;
 
       .title {
         font-size: 12px;
         color: $label-color;
+        cursor: move;
       }
     }
 

+ 12 - 0
src/views/book/courseware/create/components/common/ModuleMixin.js

@@ -235,6 +235,18 @@ const mixin = {
         content: JSON.stringify(this.data),
       });
     },
+    /**
+     * @description 获取组件请求内容
+      @returns {Object} 组件请求内容
+     */
+    getComponentRequestContent() {
+      return {
+        courseware_id: this.courseware_id,
+        component_id: this.id,
+        component_type: this.data.type,
+        content: JSON.stringify(this.data),
+      };
+    },
     findComponentWithRefAndMethod(children, refName, methodName) {
       for (const child of children) {
         // 检查当前组件是否符合条件

+ 3 - 3
src/views/book/courseware/create/components/question/dialogue_article/ArticleSetting.vue

@@ -210,6 +210,9 @@ export default {
       return `${process.env.VUE_APP_EEP}/FileServer/WebFileUpload?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}&SecurityLevel=Mid`;
     },
   },
+  created() {
+    this.getTextToAudioConfParamList();
+  },
   methods: {
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : '';
@@ -291,9 +294,6 @@ export default {
         .catch(() => {});
     },
   },
-  created() {
-    this.getTextToAudioConfParamList();
-  },
 };
 </script>
 

+ 12 - 1
src/views/book/courseware/preview/common/PreviewOperation.vue

@@ -6,7 +6,11 @@
       class="button correct"
       @click="openAnswerCorrect()"
     ></div>
-    <div v-show="permissionControl.can_show_answer" class="button answer" @click="showAnswerAnalysis()"></div>
+    <div
+      v-show="permissionControl.can_show_answer && isShowAnswer"
+      class="button answer"
+      @click="showAnswerAnalysis()"
+    ></div>
   </div>
 </template>
 
@@ -14,6 +18,13 @@
 export default {
   name: 'PreviewOperation',
   inject: ['getPermissionControl', 'openAnswerCorrect'],
+  props: {
+    // 是否显示答案按钮
+    isShowAnswer: {
+      type: Boolean,
+      default: true,
+    },
+  },
   data() {
     return {};
   },

+ 5 - 5
src/views/personal_workbench/check_task/audit/index.vue

@@ -51,9 +51,9 @@ export default {
       project_id: this.$route.query.project_id || '',
       isSubmitting: false,
       actionTip: {
-        complete: '是否确认审校完成',
-        pass: '是否确认审校通过',
-        reject: '是否确认审校驳回',
+        complete: '审校完成',
+        pass: '审校通过',
+        reject: '审校驳回',
       },
       isTrue,
     };
@@ -69,14 +69,14 @@ export default {
       if (this.isSubmitting) return;
 
       try {
-        await this.$confirm(this.actionTip[action], '提示', {
+        await this.$confirm(`是否确认${this.actionTip[action]}?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning',
         });
 
         if (flow_node_type === 2) {
-          await this.$confirm('当前为终审环节,请确认审校通过?', '提示', {
+          await this.$confirm(`当前为终审环节,请确认${this.actionTip[action]}?`, '提示', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             type: 'warning',