|
|
@@ -7,7 +7,7 @@
|
|
|
/>
|
|
|
|
|
|
<main v-if="data" ref="newWordMain" class="main">
|
|
|
- <div class="NPC-zhedie" :style="{ width: width }">
|
|
|
+ <div class="NPC-zhedie" :style="{ width: width + 'px' }">
|
|
|
<!-- :style="{
|
|
|
backgroundColor:
|
|
|
data.unified_attrib && data.unified_attrib.topic_color ? data.unified_attrib.topic_color : '',
|
|
|
@@ -225,10 +225,40 @@
|
|
|
<svg-icon size="16" icon-class="eye-invisible"></svg-icon>
|
|
|
</i>
|
|
|
</li>
|
|
|
+ <li @click="handleShow(item.key)" v-for="(item, index) in data.addCol" :key="index">
|
|
|
+ <span>{{ item.label }}</span
|
|
|
+ ><i
|
|
|
+ slot="suffix"
|
|
|
+ class="el-icon-view show-icon"
|
|
|
+ v-if="showObj[item.key]"
|
|
|
+ size="16"
|
|
|
+ :style="{
|
|
|
+ color:
|
|
|
+ data.unified_attrib && data.unified_attrib.topic_color
|
|
|
+ ? data.unified_attrib.topic_color
|
|
|
+ : '#de4444',
|
|
|
+ marginLeft: '5px',
|
|
|
+ }"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ slot="suffix"
|
|
|
+ class="show-icon"
|
|
|
+ v-else
|
|
|
+ :style="{
|
|
|
+ color:
|
|
|
+ data.unified_attrib && data.unified_attrib.topic_color
|
|
|
+ ? data.unified_attrib.topic_color
|
|
|
+ : '#de4444',
|
|
|
+ marginLeft: '5px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <svg-icon size="16" icon-class="eye-invisible"></svg-icon>
|
|
|
+ </i>
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
<SvgIcon
|
|
|
slot="reference"
|
|
|
- v-if="is_list"
|
|
|
+ v-show="is_list"
|
|
|
icon-class="list2"
|
|
|
size="24"
|
|
|
:style="{
|
|
|
@@ -418,6 +448,8 @@
|
|
|
data.unified_attrib && data.unified_attrib.font_size
|
|
|
? data.unified_attrib.font_size
|
|
|
: '',
|
|
|
+ fontFamily:
|
|
|
+ data.unified_attrib && data.unified_attrib.font ? data.unified_attrib.font : '',
|
|
|
}"
|
|
|
v-if="showObj.newWord"
|
|
|
class="NPC-word-tab-common NPC-word-tab-word"
|
|
|
@@ -504,6 +536,8 @@
|
|
|
data.unified_attrib && data.unified_attrib.font_size
|
|
|
? data.unified_attrib.font_size
|
|
|
: '',
|
|
|
+ fontFamily:
|
|
|
+ data.unified_attrib && data.unified_attrib.font ? data.unified_attrib.font : '',
|
|
|
}"
|
|
|
v-html="convertText(sanitizeHTML(sItem.new_word))"
|
|
|
></p>
|
|
|
@@ -634,6 +668,33 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</div>
|
|
|
+ <template v-for="(itemC, indexC) in data.addCol">
|
|
|
+ <div v-if="sItem[itemC.key] && showObj[itemC.key]" :key="indexC">
|
|
|
+ <span class="collocation"
|
|
|
+ ><span>{{ convertText(itemC.label + ':') }}</span>
|
|
|
+ <div>
|
|
|
+ <b
|
|
|
+ v-html="convertText(sanitizeHTML(sItem[itemC.key]))"
|
|
|
+ :style="{
|
|
|
+ fontSize:
|
|
|
+ data.unified_attrib && data.unified_attrib.font_size
|
|
|
+ ? data.unified_attrib.font_size
|
|
|
+ : '',
|
|
|
+ }"
|
|
|
+ ></b>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span v-if="showLang" class="">
|
|
|
+ {{
|
|
|
+ multilingualTextList[getLang()] &&
|
|
|
+ multilingualTextList[getLang()][index] &&
|
|
|
+ multilingualTextList[getLang()][index][5 + indexC]
|
|
|
+ ? multilingualTextList[getLang()][index][5 + indexC]
|
|
|
+ : ''
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<div class="right-box">
|
|
|
<span>
|
|
|
@@ -750,10 +811,11 @@
|
|
|
>
|
|
|
<div class="NPC-word-tab-box">
|
|
|
<span
|
|
|
- v-if="data.property.pinyin_position == 'top' && showObj.pinyin"
|
|
|
+ v-if="data.property.pinyin_position == 'top' && showObj.pinyin && colHasContent[0]"
|
|
|
class="NPC-word-tab-common NPC-word-tab-pinyin"
|
|
|
:style="{
|
|
|
width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
fontSize:
|
|
|
data.unified_attrib && data.unified_attrib.pinyin_size
|
|
|
? data.unified_attrib.pinyin_size
|
|
|
@@ -766,21 +828,25 @@
|
|
|
<span
|
|
|
:style="{
|
|
|
width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
fontSize:
|
|
|
data.unified_attrib && data.unified_attrib.font_size
|
|
|
? data.unified_attrib.font_size
|
|
|
: '',
|
|
|
+ fontFamily:
|
|
|
+ data.unified_attrib && data.unified_attrib.font ? data.unified_attrib.font : '',
|
|
|
}"
|
|
|
- v-if="showObj.newWord"
|
|
|
+ v-if="showObj.newWord && colHasContent[1]"
|
|
|
class="NPC-word-tab-common NPC-word-tab-word"
|
|
|
v-html="convertText(sanitizeHTML(sItem.new_word))"
|
|
|
>
|
|
|
</span>
|
|
|
<span
|
|
|
- v-if="data.property.pinyin_position == 'bottom' && showObj.pinyin"
|
|
|
+ v-if="data.property.pinyin_position == 'bottom' && showObj.pinyin && colHasContent[0]"
|
|
|
class="NPC-word-tab-common NPC-word-tab-pinyin"
|
|
|
:style="{
|
|
|
width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
fontSize:
|
|
|
data.unified_attrib && data.unified_attrib.pinyin_size
|
|
|
? data.unified_attrib.pinyin_size
|
|
|
@@ -795,15 +861,25 @@
|
|
|
multilingualTextList[getLang()] &&
|
|
|
multilingualTextList[getLang()][index] &&
|
|
|
multilingualTextList[getLang()][index][0] &&
|
|
|
- showObj.newWord
|
|
|
+ showObj.newWord &&
|
|
|
+ colHasContent[1]
|
|
|
"
|
|
|
class="NPC-word-tab-common"
|
|
|
- :style="{ width: data.col_width[0].value + 'px' }"
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
>
|
|
|
{{ multilingualTextList[getLang()][index][0] }}
|
|
|
</span>
|
|
|
</div>
|
|
|
- <span :style="{ width: data.col_width[2].value + 'px' }" v-if="showObj.cixing">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[2].value + 'px',
|
|
|
+ flex: !data.col_width[2].value || data.col_width[2].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ v-if="showObj.cixing && colHasContent[2]"
|
|
|
+ >
|
|
|
<p
|
|
|
class="NPC-word-tab-common NPC-word-tab-cixing"
|
|
|
:class="[/[\u4E00-\u9FA5\uF900-\uFA2D]/.test(sItem.cixing) ? 'hasCn' : '']"
|
|
|
@@ -827,7 +903,13 @@
|
|
|
{{ multilingualTextList[getLang()][index][1] }}
|
|
|
</span>
|
|
|
</span>
|
|
|
- <span :style="{ width: data.col_width[3].value + 'px' }" v-if="showObj.shiyi">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[3].value + 'px',
|
|
|
+ flex: !data.col_width[3].value || data.col_width[3].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ v-if="showObj.shiyi && colHasContent[3]"
|
|
|
+ >
|
|
|
<p
|
|
|
class="NPC-word-tab-common NPC-word-tab-def"
|
|
|
v-html="convertText(sanitizeHTML(sItem.def_str))"
|
|
|
@@ -855,11 +937,13 @@
|
|
|
<span
|
|
|
v-if="
|
|
|
(!data.property.pinyin_position || data.property.pinyin_position == 'front') &&
|
|
|
- showObj.pinyin
|
|
|
+ showObj.pinyin &&
|
|
|
+ colHasContent[0]
|
|
|
"
|
|
|
class="NPC-word-tab-common NPC-word-tab-pinyin"
|
|
|
:style="{
|
|
|
width: data.col_width[1].value + 'px',
|
|
|
+ flex: !data.col_width[1].value || data.col_width[1].value === '0' ? '1' : '',
|
|
|
fontSize:
|
|
|
data.unified_attrib && data.unified_attrib.pinyin_size
|
|
|
? data.unified_attrib.pinyin_size
|
|
|
@@ -875,8 +959,9 @@
|
|
|
<span
|
|
|
:style="{
|
|
|
width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
}"
|
|
|
- v-if="showObj.newWord"
|
|
|
+ v-if="showObj.newWord && colHasContent[1]"
|
|
|
>
|
|
|
<p
|
|
|
class="NPC-word-tab-common NPC-word-tab-word"
|
|
|
@@ -885,6 +970,8 @@
|
|
|
data.unified_attrib && data.unified_attrib.font_size
|
|
|
? data.unified_attrib.font_size
|
|
|
: '',
|
|
|
+ fontFamily:
|
|
|
+ data.unified_attrib && data.unified_attrib.font ? data.unified_attrib.font : '',
|
|
|
}"
|
|
|
v-html="convertText(sanitizeHTML(sItem.new_word))"
|
|
|
></p>
|
|
|
@@ -896,16 +983,20 @@
|
|
|
multilingualTextList[getLang()][index][0]
|
|
|
"
|
|
|
class="NPC-word-tab-common"
|
|
|
- :style="{ width: data.col_width[0].value + 'px' }"
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[0].value + 'px',
|
|
|
+ flex: !data.col_width[0].value || data.col_width[0].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
>
|
|
|
{{ multilingualTextList[getLang()][index][0] }}
|
|
|
</span>
|
|
|
</span>
|
|
|
<span
|
|
|
- v-if="data.property.pinyin_position == 'back' && showObj.pinyin"
|
|
|
+ v-if="data.property.pinyin_position == 'back' && showObj.pinyin && colHasContent[0]"
|
|
|
class="NPC-word-tab-common NPC-word-tab-pinyin"
|
|
|
:style="{
|
|
|
width: data.col_width[1].value + 'px',
|
|
|
+ flex: !data.col_width[1].value ? '1' || data.col_width[1].value === '0' : '',
|
|
|
fontSize:
|
|
|
data.unified_attrib && data.unified_attrib.pinyin_size
|
|
|
? data.unified_attrib.pinyin_size
|
|
|
@@ -918,7 +1009,13 @@
|
|
|
v-html="sItem.pinyin"
|
|
|
>
|
|
|
</span>
|
|
|
- <span :style="{ width: data.col_width[2].value + 'px' }" v-if="showObj.cixing">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[2].value + 'px',
|
|
|
+ flex: !data.col_width[2].value || data.col_width[2].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ v-if="showObj.cixing && colHasContent[2]"
|
|
|
+ >
|
|
|
<p
|
|
|
class="NPC-word-tab-common NPC-word-tab-cixing"
|
|
|
:class="[/[\u4E00-\u9FA5\uF900-\uFA2D]/.test(sItem.cixing) ? 'hasCn' : '']"
|
|
|
@@ -943,7 +1040,13 @@
|
|
|
{{ multilingualTextList[getLang()][index][1] }}
|
|
|
</span>
|
|
|
</span>
|
|
|
- <span :style="{ width: data.col_width[3].value + 'px' }" v-if="showObj.shiyi">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[3].value + 'px',
|
|
|
+ flex: !data.col_width[3].value || data.col_width[3].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ v-if="showObj.shiyi && colHasContent[3]"
|
|
|
+ >
|
|
|
<p
|
|
|
class="NPC-word-tab-common NPC-word-tab-def"
|
|
|
v-html="convertText(sanitizeHTML(sItem.def_str))"
|
|
|
@@ -988,10 +1091,13 @@
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
- v-if="sItem.collocation && showObj.collocation"
|
|
|
- :style="{ width: data.col_width[4].value + 'px' }"
|
|
|
+ v-if="showObj.collocation && colHasContent[4]"
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[4].value + 'px',
|
|
|
+ flex: !data.col_width[4].value || data.col_width[4].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
>
|
|
|
- <span class="collocation"
|
|
|
+ <span class="collocation" v-if="sItem.collocation"
|
|
|
><span>{{ convertText('搭配:') }}</span
|
|
|
><b
|
|
|
v-html="convertText(sanitizeHTML(sItem.collocation))"
|
|
|
@@ -1013,8 +1119,14 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</div>
|
|
|
- <div v-if="sItem.liju_list && showObj.liju" :style="{ width: data.col_width[5].value + 'px' }">
|
|
|
- <span class="collocation"
|
|
|
+ <div
|
|
|
+ v-if="showObj.liju && colHasContent[5]"
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[5].value + 'px',
|
|
|
+ flex: !data.col_width[5].value || data.col_width[5].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span class="collocation" v-if="sItem.liju_list"
|
|
|
><span>{{ convertText('例句:') }}</span>
|
|
|
<div>
|
|
|
<b
|
|
|
@@ -1038,6 +1150,41 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</div>
|
|
|
+ <template v-for="(itemC, indexC) in data.addCol">
|
|
|
+ <div
|
|
|
+ :key="indexC"
|
|
|
+ v-if="showObj[itemC.key] && colHasContent[6 + indexC]"
|
|
|
+ :style="{
|
|
|
+ width: data.col_width[6 + indexC].value + 'px',
|
|
|
+ flex:
|
|
|
+ !data.col_width[6 + indexC].value || data.col_width[6 + indexC].value === '0' ? '1' : '',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span class="collocation" v-if="sItem[itemC.key]"
|
|
|
+ ><span>{{ convertText(itemC.label + ':') }}</span>
|
|
|
+ <div>
|
|
|
+ <b
|
|
|
+ v-html="convertText(sanitizeHTML(sItem[itemC.key]))"
|
|
|
+ :style="{
|
|
|
+ fontSize:
|
|
|
+ data.unified_attrib && data.unified_attrib.font_size
|
|
|
+ ? data.unified_attrib.font_size
|
|
|
+ : '',
|
|
|
+ }"
|
|
|
+ ></b>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span v-if="showLang" class="">
|
|
|
+ {{
|
|
|
+ multilingualTextList[getLang()] &&
|
|
|
+ multilingualTextList[getLang()][index] &&
|
|
|
+ multilingualTextList[getLang()][index][5 + indexC]
|
|
|
+ ? multilingualTextList[getLang()][index][5 + indexC]
|
|
|
+ : ''
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</div>
|
|
|
</li>
|
|
|
@@ -1292,6 +1439,12 @@
|
|
|
<label class="card-label">{{ convertText('例句:') }}</label>
|
|
|
<p v-html="convertText(sanitizeHTML(item.liju_list))"></p>
|
|
|
</div>
|
|
|
+ <template v-for="(itemC, indexC) in data.addCol">
|
|
|
+ <div v-if="item[itemC.key]" :key="indexC">
|
|
|
+ <label class="card-label">{{ convertText(itemC.label + ':') }}</label>
|
|
|
+ <p v-html="convertText(sanitizeHTML(item[itemC.key]))"></p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<a class="overturn-btn" @click="changeShowLeft(item)"><i class="el-icon-refresh"></i></a>
|
|
|
</div>
|
|
|
@@ -1451,6 +1604,7 @@ export default {
|
|
|
collocation: true,
|
|
|
liju: true,
|
|
|
},
|
|
|
+ colHasContent: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -1516,11 +1670,23 @@ export default {
|
|
|
this.$emit('handleHeightChange', this.id, newVal ? this.dataHeight : height);
|
|
|
});
|
|
|
},
|
|
|
+ width: {
|
|
|
+ handler(val) {
|
|
|
+ if (val) {
|
|
|
+ // 如果有宽度为0且有内容的列,则行宽最小为撑满
|
|
|
+ if (this.rowWidth < this.width - 48) {
|
|
|
+ this.rowWidth = this.width - 48;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
|
let totalWidth = document.querySelector('.newWord-preview').offsetWidth;
|
|
|
- this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0)}px`;
|
|
|
+ this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0)}`;
|
|
|
});
|
|
|
|
|
|
this.dataHeight = this.$refs.previewContainer.style.height;
|
|
|
@@ -1537,13 +1703,17 @@ export default {
|
|
|
if (index < 2) {
|
|
|
this.rowWidth = this.rowWidth > Number(item.value) ? this.rowWidth : Number(item.value);
|
|
|
} else {
|
|
|
- this.rowWidth += Number(item.value);
|
|
|
+ this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
|
|
|
}
|
|
|
} else {
|
|
|
- this.rowWidth += Number(item.value);
|
|
|
+ this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
|
|
|
}
|
|
|
});
|
|
|
this.rowWidth += 132;
|
|
|
+ // 如果有宽度为0且有内容的列,则行宽最小为撑满
|
|
|
+ if (this.rowWidth < this.width - 48) {
|
|
|
+ this.rowWidth = this.width - 48;
|
|
|
+ }
|
|
|
},
|
|
|
palyAudio(url, sIndex) {
|
|
|
this.stopAudio();
|
|
|
@@ -1648,6 +1818,41 @@ export default {
|
|
|
initData() {
|
|
|
this.hasVoice = false;
|
|
|
this.rowWidth = 0;
|
|
|
+ this.colHasContent = [];
|
|
|
+ this.showObj = {
|
|
|
+ pinyin: true,
|
|
|
+ newWord: true,
|
|
|
+ cixing: true,
|
|
|
+ shiyi: true,
|
|
|
+ collocation: true,
|
|
|
+ liju: true,
|
|
|
+ };
|
|
|
+ if (this.data.addCol) {
|
|
|
+ this.data.addCol.forEach((item) => {
|
|
|
+ this.$set(this.showObj, item.key, true);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 判断每列是否有内容
|
|
|
+ let pinyin_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.pinyin}`, '');
|
|
|
+ let new_word_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.new_word}`, '');
|
|
|
+ let cixing_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.cixing}`, '');
|
|
|
+ let def_str_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.def_str}`, '');
|
|
|
+ let collocation_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.collocation}`, '');
|
|
|
+ let liju_list_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss.liju_list}`, '');
|
|
|
+ this.colHasContent = [
|
|
|
+ pinyin_col ? true : false,
|
|
|
+ new_word_col ? true : false,
|
|
|
+ cixing_col ? true : false,
|
|
|
+ def_str_col ? true : false,
|
|
|
+ collocation_col ? true : false,
|
|
|
+ liju_list_col ? true : false,
|
|
|
+ ];
|
|
|
+ if (this.data.addCol) {
|
|
|
+ this.data.addCol.forEach((item) => {
|
|
|
+ let str_col = this.data.new_word_list.reduce((acc, itemss) => `${acc + itemss[item.key]}`, '');
|
|
|
+ this.colHasContent.push(str_col ? true : false);
|
|
|
+ });
|
|
|
+ }
|
|
|
this.data.col_width.forEach((item, index) => {
|
|
|
if (
|
|
|
this.data.property.pinyin_position &&
|
|
|
@@ -1656,13 +1861,14 @@ export default {
|
|
|
if (index < 2) {
|
|
|
this.rowWidth = this.rowWidth > Number(item.value) ? this.rowWidth : Number(item.value);
|
|
|
} else {
|
|
|
- this.rowWidth += Number(item.value);
|
|
|
+ this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
|
|
|
}
|
|
|
} else {
|
|
|
- this.rowWidth += Number(item.value);
|
|
|
+ this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
|
|
|
}
|
|
|
});
|
|
|
this.rowWidth += 132;
|
|
|
+
|
|
|
this.is_change = true;
|
|
|
setTimeout(() => {
|
|
|
this.is_change = false;
|
|
|
@@ -1726,6 +1932,7 @@ export default {
|
|
|
});
|
|
|
this.optionRes = JSON.parse(JSON.stringify(optionRes));
|
|
|
this.$set(this.data, 'option_list', option_list);
|
|
|
+
|
|
|
if (!this.isJudgingRightWrong) {
|
|
|
this.answer.answer_list = Bookanswer;
|
|
|
}
|