|
@@ -30,6 +30,10 @@ const mixin = {
|
|
|
type: String,
|
|
type: String,
|
|
|
required: true,
|
|
required: true,
|
|
|
},
|
|
},
|
|
|
|
|
+ oldId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: '',
|
|
|
|
|
+ },
|
|
|
componentMove: {
|
|
componentMove: {
|
|
|
type: Function,
|
|
type: Function,
|
|
|
required: true,
|
|
required: true,
|
|
@@ -94,43 +98,43 @@ const mixin = {
|
|
|
if (this.courseware_id === '' || this.id === '') return;
|
|
if (this.courseware_id === '' || this.id === '') return;
|
|
|
let temporaryCoursewareID = this.getTemporaryCoursewareID();
|
|
let temporaryCoursewareID = this.getTemporaryCoursewareID();
|
|
|
let coursewareID = temporaryCoursewareID || this.courseware_id;
|
|
let coursewareID = temporaryCoursewareID || this.courseware_id;
|
|
|
- ContentGetCoursewareComponentContent({ courseware_id: coursewareID, component_id: this.id }).then(
|
|
|
|
|
- ({ content }) => {
|
|
|
|
|
- if (content) {
|
|
|
|
|
- this.data = JSON.parse(content);
|
|
|
|
|
- } else {
|
|
|
|
|
- const bookUnifiedAttr = this.getBookUnifiedAttr();
|
|
|
|
|
|
|
+ let component_id = temporaryCoursewareID.length > 0 ? this.oldId || this.id : this.id;
|
|
|
|
|
|
|
|
- this.$set(this.data, 'unified_attrib', bookUnifiedAttr);
|
|
|
|
|
|
|
+ ContentGetCoursewareComponentContent({ courseware_id: coursewareID, component_id }).then(({ content }) => {
|
|
|
|
|
+ if (content) {
|
|
|
|
|
+ this.data = JSON.parse(content);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const bookUnifiedAttr = this.getBookUnifiedAttr();
|
|
|
|
|
|
|
|
- // 初始化时,如果有 view_pinyin 则根据全教材设置配置设 view_pinyin 和 pinyin_position
|
|
|
|
|
- if ('view_pinyin' in this.data.property) {
|
|
|
|
|
- this.data.property.view_pinyin = bookUnifiedAttr?.view_pinyin ?? 'false';
|
|
|
|
|
- this.data.property.pinyin_position = bookUnifiedAttr?.pinyin_position ?? 'top';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$set(this.data, 'unified_attrib', bookUnifiedAttr);
|
|
|
|
|
|
|
|
- if ('frame_color' in this.data.property) {
|
|
|
|
|
- // 框颜色初始化为主题色
|
|
|
|
|
- this.data.property.frame_color = bookUnifiedAttr?.topic_color ?? '#F13232';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 初始化时,如果有 view_pinyin 则根据全教材设置配置设 view_pinyin 和 pinyin_position
|
|
|
|
|
+ if ('view_pinyin' in this.data.property) {
|
|
|
|
|
+ this.data.property.view_pinyin = bookUnifiedAttr?.view_pinyin ?? 'false';
|
|
|
|
|
+ this.data.property.pinyin_position = bookUnifiedAttr?.pinyin_position ?? 'top';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ('sn_background_color' in this.data.property) {
|
|
|
|
|
- // 序号背景色
|
|
|
|
|
- this.data.property.sn_background_color = bookUnifiedAttr?.topic_color ?? '#EA3232';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ('frame_color' in this.data.property) {
|
|
|
|
|
+ // 框颜色初始化为主题色
|
|
|
|
|
+ this.data.property.frame_color = bookUnifiedAttr?.topic_color ?? '#F13232';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.property.isGetContent = true;
|
|
|
|
|
|
|
+ if ('sn_background_color' in this.data.property) {
|
|
|
|
|
+ // 序号背景色
|
|
|
|
|
+ this.data.property.sn_background_color = bookUnifiedAttr?.topic_color ?? '#EA3232';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.$watch(
|
|
|
|
|
- 'data',
|
|
|
|
|
- () => {
|
|
|
|
|
- this.$emit('changeData');
|
|
|
|
|
- },
|
|
|
|
|
- { deep: true },
|
|
|
|
|
- );
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ this.property.isGetContent = true;
|
|
|
|
|
+
|
|
|
|
|
+ this.$watch(
|
|
|
|
|
+ 'data',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ this.$emit('changeData');
|
|
|
|
|
+ },
|
|
|
|
|
+ { deep: true },
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* @description 复制组件
|
|
* @description 复制组件
|