|
|
@@ -328,32 +328,42 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- ContentGetCoursewareContent({ id: this.courseware_id }).then(({ content, content_group_row_list }) => {
|
|
|
- if (content) {
|
|
|
- let parsedContent = JSON.parse(content);
|
|
|
- if (
|
|
|
- parsedContent &&
|
|
|
- Array.isArray(parsedContent.row_list) &&
|
|
|
- parsedContent.row_list.length > 0 &&
|
|
|
- !parsedContent.row_list[0]?.row_id
|
|
|
- ) {
|
|
|
- this.data = this.normalizeRowColIds(parsedContent);
|
|
|
- } else {
|
|
|
- this.data = parsedContent;
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '组件加载中...',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ });
|
|
|
+ ContentGetCoursewareContent({ id: this.courseware_id })
|
|
|
+ .then(({ content, content_group_row_list }) => {
|
|
|
+ if (content) {
|
|
|
+ let parsedContent = JSON.parse(content);
|
|
|
+ if (
|
|
|
+ parsedContent &&
|
|
|
+ Array.isArray(parsedContent.row_list) &&
|
|
|
+ parsedContent.row_list.length > 0 &&
|
|
|
+ !parsedContent.row_list[0]?.row_id
|
|
|
+ ) {
|
|
|
+ this.data = this.normalizeRowColIds(parsedContent);
|
|
|
+ } else {
|
|
|
+ this.data = parsedContent;
|
|
|
+ }
|
|
|
+ loading.close();
|
|
|
}
|
|
|
- }
|
|
|
- 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);
|
|
|
|
|
|
- this.$watch(
|
|
|
- 'data',
|
|
|
- () => {
|
|
|
- this.changeData();
|
|
|
- },
|
|
|
- {
|
|
|
- deep: true,
|
|
|
- },
|
|
|
- );
|
|
|
- });
|
|
|
+ this.$watch(
|
|
|
+ 'data',
|
|
|
+ () => {
|
|
|
+ this.changeData();
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
this.getBookUnifiedAttr();
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -398,12 +408,14 @@ export default {
|
|
|
*/
|
|
|
async saveCoursewareContent(type) {
|
|
|
let isAllLoader = false;
|
|
|
- if (this.isEdit) {
|
|
|
+
|
|
|
+ if (this.$refs?.component === undefined || this.$refs?.component.length === 0) {
|
|
|
+ isAllLoader = true;
|
|
|
+ } else if (this.isEdit) {
|
|
|
isAllLoader = this.$refs?.component?.every((item) => item.property.isGetContent);
|
|
|
} else {
|
|
|
isAllLoader = this.$refs?.previewEdit?.$refs?.preview?.every((item) => item.loader);
|
|
|
}
|
|
|
-
|
|
|
if (!isAllLoader) {
|
|
|
this.$message.warning('有组件内容未加载完成,请稍后再试');
|
|
|
return false;
|