|
@@ -37,6 +37,14 @@ const mixin = {
|
|
type: String,
|
|
type: String,
|
|
required: true,
|
|
required: true,
|
|
},
|
|
},
|
|
|
|
+ content: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: '{}',
|
|
|
|
+ },
|
|
|
|
+ type: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: '',
|
|
|
|
+ },
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
ModuleBase,
|
|
ModuleBase,
|
|
@@ -57,26 +65,19 @@ const mixin = {
|
|
borderColor(newVal) {
|
|
borderColor(newVal) {
|
|
this.borderColorObj.value = newVal;
|
|
this.borderColorObj.value = newVal;
|
|
},
|
|
},
|
|
|
|
+ content: {
|
|
|
|
+ handler(newVal) {
|
|
|
|
+ if (this.type !== 'interaction') return;
|
|
|
|
+ this.data = JSON.parse(newVal);
|
|
|
|
+ },
|
|
|
|
+ immediate: true,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
inject: ['courseware_id', 'project_id'],
|
|
inject: ['courseware_id', 'project_id'],
|
|
created() {
|
|
created() {
|
|
- ContentGetCoursewareComponentContent({ courseware_id: this.courseware_id, component_id: this.id }).then(
|
|
|
|
- ({ content }) => {
|
|
|
|
- if (content) {
|
|
|
|
- this.data = JSON.parse(content);
|
|
|
|
- }
|
|
|
|
- this.property.isGetContent = true;
|
|
|
|
-
|
|
|
|
- this.$watch(
|
|
|
|
- 'data',
|
|
|
|
- () => {
|
|
|
|
- this.$emit('changeData');
|
|
|
|
- },
|
|
|
|
- { deep: true },
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
|
|
+ if (this.type !== 'interaction') {
|
|
|
|
+ this.GetCoursewareComponentContent();
|
|
|
|
+ }
|
|
// 初始化 mind_map.node_list[0].id
|
|
// 初始化 mind_map.node_list[0].id
|
|
if (!this.data?.mind_map?.node_list?.[0]?.id) {
|
|
if (!this.data?.mind_map?.node_list?.[0]?.id) {
|
|
this.data.mind_map = this.data.mind_map ?? {};
|
|
this.data.mind_map = this.data.mind_map ?? {};
|
|
@@ -87,6 +88,24 @@ const mixin = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ GetCoursewareComponentContent() {
|
|
|
|
+ ContentGetCoursewareComponentContent({ courseware_id: this.courseware_id, component_id: this.id }).then(
|
|
|
|
+ ({ content }) => {
|
|
|
|
+ if (content) {
|
|
|
|
+ this.data = JSON.parse(content);
|
|
|
|
+ }
|
|
|
|
+ this.property.isGetContent = true;
|
|
|
|
+
|
|
|
|
+ this.$watch(
|
|
|
|
+ 'data',
|
|
|
|
+ () => {
|
|
|
|
+ this.$emit('changeData');
|
|
|
|
+ },
|
|
|
|
+ { deep: true },
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* @description 显示设置
|
|
* @description 显示设置
|
|
*/
|
|
*/
|
|
@@ -126,7 +145,7 @@ const mixin = {
|
|
this.componentMove({ ...data, id: this.id });
|
|
this.componentMove({ ...data, id: this.id });
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
- * 保护课节组件内容
|
|
|
|
|
|
+ * 保存课节组件内容
|
|
* @returns {Promise} 返回 Promise,便于父组件 await
|
|
* @returns {Promise} 返回 Promise,便于父组件 await
|
|
*/
|
|
*/
|
|
saveCoursewareComponentContent() {
|
|
saveCoursewareComponentContent() {
|