|
@@ -54,7 +54,12 @@
|
|
|
<b class="record-score-tips" @click="openScoreDetail">详情</b>
|
|
<b class="record-score-tips" @click="openScoreDetail">详情</b>
|
|
|
</template>
|
|
</template>
|
|
|
<span v-if="showScoring" class="selection-tip" :title="selectionLabel">
|
|
<span v-if="showScoring" class="selection-tip" :title="selectionLabel">
|
|
|
- {{ selectionLabel }}
|
|
|
|
|
|
|
+ {{ selectionDisplay.prefix
|
|
|
|
|
+ }}<template v-for="(word, index) in selectionDisplay.words"
|
|
|
|
|
+ ><template v-if="index">、</template
|
|
|
|
|
+ ><span v-if="isPinyinWord(word.text)" :key="index" class="word-pinyin">{{ word.text }}</span
|
|
|
|
|
+ ><template v-else>{{ word.text }}</template></template
|
|
|
|
|
+ >{{ selectionDisplay.suffix }}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -79,6 +84,7 @@
|
|
|
:attrib="attrib"
|
|
:attrib="attrib"
|
|
|
:record-score-detail="scoreDetails"
|
|
:record-score-detail="scoreDetails"
|
|
|
:score-title="scoreTitle"
|
|
:score-title="scoreTitle"
|
|
|
|
|
+ :score-title-parts="scoreTitleParts"
|
|
|
item-unit="词"
|
|
item-unit="词"
|
|
|
:show-index="false"
|
|
:show-index="false"
|
|
|
/>
|
|
/>
|
|
@@ -137,15 +143,23 @@ export default {
|
|
|
selectedRecord() {
|
|
selectedRecord() {
|
|
|
return this.selectedIndex === null ? null : this.records[this.selectedIndex] || null;
|
|
return this.selectedIndex === null ? null : this.records[this.selectedIndex] || null;
|
|
|
},
|
|
},
|
|
|
- selectionLabel() {
|
|
|
|
|
|
|
+ selectionDisplay() {
|
|
|
if (this.recording) {
|
|
if (this.recording) {
|
|
|
- if (this.recordMode === 'free') return '随意录制中';
|
|
|
|
|
- return this.sessionAll
|
|
|
|
|
- ? '整体朗读中'
|
|
|
|
|
- : `已选:${this.describeSelection(this.sessionSelection, this.sessionWords)}`;
|
|
|
|
|
|
|
+ if (this.recordMode === 'free') return { prefix: '随意录制中', words: [], suffix: '' };
|
|
|
|
|
+ if (this.sessionAll) return { prefix: '整体朗读中', words: [], suffix: '' };
|
|
|
|
|
+ }
|
|
|
|
|
+ const words = this.recording ? this.sessionWords : this.selectedWords;
|
|
|
|
|
+ if (!this.recording && !words.length) return { prefix: '未选择词汇', words: [], suffix: '' };
|
|
|
|
|
+ const selection = this.recording ? this.sessionSelection : this.selectData;
|
|
|
|
|
+ if (selection.type === 'row' || selection.type === 'column') {
|
|
|
|
|
+ const unit = selection.type === 'row' ? '行' : '列';
|
|
|
|
|
+ return { prefix: `已选:第 ${selection.index + 1} ${unit}(`, words, suffix: ')' };
|
|
|
}
|
|
}
|
|
|
- if (!this.selectedWords.length) return '未选择词汇';
|
|
|
|
|
- return `已选:${this.describeSelection(this.selectData, this.selectedWords)}`;
|
|
|
|
|
|
|
+ return { prefix: '已选:词汇「', words, suffix: '」' };
|
|
|
|
|
+ },
|
|
|
|
|
+ selectionLabel() {
|
|
|
|
|
+ const { prefix, words, suffix } = this.selectionDisplay;
|
|
|
|
|
+ return `${prefix}${words.map((word) => word.text).join('、')}${suffix}`;
|
|
|
},
|
|
},
|
|
|
averageScore() {
|
|
averageScore() {
|
|
|
const words = this.selectedRecord && this.selectedRecord.words;
|
|
const words = this.selectedRecord && this.selectedRecord.words;
|
|
@@ -158,7 +172,12 @@ export default {
|
|
|
const words = this.selectedRecord && this.selectedRecord.words;
|
|
const words = this.selectedRecord && this.selectedRecord.words;
|
|
|
if (!words) return [];
|
|
if (!words) return [];
|
|
|
// 兼容历史答案中缺少逐词评分的情况,避免详情弹窗读到 undefined
|
|
// 兼容历史答案中缺少逐词评分的情况,避免详情弹窗读到 undefined
|
|
|
- return words.map((word) => word.score || { text: word.text, isShow: false });
|
|
|
|
|
|
|
+ return words.map((word) => {
|
|
|
|
|
+ const score = word.score || { text: word.text, isShow: false };
|
|
|
|
|
+ const text = score.text_new_word || score.text;
|
|
|
|
|
+ if (!this.isPinyinWord(text)) return score;
|
|
|
|
|
+ return { ...score, text_new_word: `<span style="font-family:League">${text}</span>` };
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
// 得分明细小标题:单个单元格为逐字得分,整行/整列为第 x 行(词1、词2)
|
|
// 得分明细小标题:单个单元格为逐字得分,整行/整列为第 x 行(词1、词2)
|
|
|
scoreTitle() {
|
|
scoreTitle() {
|
|
@@ -171,6 +190,20 @@ export default {
|
|
|
if (selection.type === 'all') return '整体朗读(逐词连录)';
|
|
if (selection.type === 'all') return '整体朗读(逐词连录)';
|
|
|
return '逐字得分';
|
|
return '逐字得分';
|
|
|
},
|
|
},
|
|
|
|
|
+ scoreTitleParts() {
|
|
|
|
|
+ const record = this.selectedRecord;
|
|
|
|
|
+ if (!record || !record.words || !record.words.length) return [];
|
|
|
|
|
+ const selection = record.selectData || {};
|
|
|
|
|
+ if (selection.type !== 'row' && selection.type !== 'column') return [];
|
|
|
|
|
+ const unit = selection.type === 'row' ? '行' : '列';
|
|
|
|
|
+ const parts = [{ text: `第 ${selection.index + 1} ${unit}(` }];
|
|
|
|
|
+ record.words.forEach((word, index) => {
|
|
|
|
|
+ if (index) parts.push({ text: '、' });
|
|
|
|
|
+ parts.push({ text: word.text, isPinyin: this.isPinyinWord(word.text) });
|
|
|
|
|
+ });
|
|
|
|
|
+ parts.push({ text: ')' });
|
|
|
|
|
+ return parts;
|
|
|
|
|
+ },
|
|
|
currentWordText() {
|
|
currentWordText() {
|
|
|
const word = this.sessionWords[this.currentIndex];
|
|
const word = this.sessionWords[this.currentIndex];
|
|
|
return word ? word.text : '';
|
|
return word ? word.text : '';
|
|
@@ -219,12 +252,11 @@ export default {
|
|
|
const time = Math.max(0, Math.floor(seconds || 0));
|
|
const time = Math.max(0, Math.floor(seconds || 0));
|
|
|
return `${String(Math.floor(time / 60)).padStart(2, '0')}:${String(time % 60).padStart(2, '0')}`;
|
|
return `${String(Math.floor(time / 60)).padStart(2, '0')}:${String(time % 60).padStart(2, '0')}`;
|
|
|
},
|
|
},
|
|
|
- // 已选对象描述:单词用引号,整行/整列带序号和词汇列表
|
|
|
|
|
- describeSelection(selection, words) {
|
|
|
|
|
- const texts = words.map((word) => word.text).join('、');
|
|
|
|
|
- if (selection.type === 'row') return `第 ${selection.index + 1} 行(${texts})`;
|
|
|
|
|
- if (selection.type === 'column') return `第 ${selection.index + 1} 列(${texts})`;
|
|
|
|
|
- return `词汇「${texts}」`;
|
|
|
|
|
|
|
+ isPinyinWord(text) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ typeof text === 'string' &&
|
|
|
|
|
+ /^[a-zāáǎàōóǒòēéěèīíǐìūúǔùǖǘǚǜü]+(?:\s+[a-zāáǎàōóǒòēéěèīíǐìūúǔùǖǘǚǜü]+)*$/i.test(text.trim().normalize('NFC'))
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
onPlay() {
|
|
onPlay() {
|
|
|
this.playing = true;
|
|
this.playing = true;
|
|
@@ -758,11 +790,14 @@ export default {
|
|
|
flex: 0 1 auto;
|
|
flex: 0 1 auto;
|
|
|
min-width: 0;
|
|
min-width: 0;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
- font-family: 'Inter', 'League', system-ui, 'Avenir', 'Helvetica', 'Arial', sans-serif;
|
|
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
color: #8b97a8;
|
|
color: #8b97a8;
|
|
|
text-overflow: ellipsis;
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
|
|
|
+
|
|
|
|
|
+ .word-pinyin {
|
|
|
|
|
+ font-family: 'League';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.record-score-content {
|
|
.record-score-content {
|