Przeglądaj źródła

生词表评分功能

natasha 1 tydzień temu
rodzic
commit
3c582cb091

+ 103 - 4
src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

@@ -730,6 +730,81 @@
                             @handleWav="handleWav"
                           />
                         </span>
+                        <div
+                          v-if="data.audio_data.file_id || sItem.mp3_list"
+                          class="compare-box"
+                          @click="sentIndex = sItem.sIndex"
+                        >
+                          <Audio-compare
+                            :theme-color="data.unified_attrib ? data.unified_attrib.topic_color : '#e35454'"
+                            :index="sItem.sIndex"
+                            :sent-index="sentIndex"
+                            :url="data.audio_data.file_id ? data.audio_data.url : sItem.mp3_list_url"
+                            :bg="
+                              data.lrc_arr.length > 0 && data.lrc_arr[sItem.sIndex] ? data.lrc_arr[sItem.sIndex].bg : 0
+                            "
+                            :ed="
+                              data.lrc_arr.length > 0 && data.lrc_arr[sItem.sIndex]
+                                ? data.lrc_arr[sItem.sIndex].ed
+                                : 1000000
+                            "
+                            :wavblob="
+                              answer &&
+                              answer.answer_list &&
+                              answer.answer_list[index][sIndex] &&
+                              answer.answer_list[index][sIndex].recordList &&
+                              answer.answer_list[index][sIndex].recordList.length > 0
+                                ? answer.answer_list[index][sIndex].recordList[
+                                    answer.answer_list[index][sIndex].recordList.length - 1
+                                  ].wavData
+                                : ''
+                            "
+                            :get-cur-time="getCurTimes"
+                            :sent-pause="sentPause"
+                            :is-record="isRecord"
+                            :handle-change-stop-audio="handleChangeStopAudio"
+                            :get-play-status="getPlayStatus"
+                            :attrib="data.unified_attrib"
+                          />
+                        </div>
+                        <el-button
+                          v-if="!(data.property.is_enable_score && data.property.is_enable_score === 'false')"
+                          type="text"
+                          :class="[
+                            'record-score-btn',
+                            answer &&
+                            answer.answer_list &&
+                            answer.answer_list[index][sIndex] &&
+                            answer.answer_list[index][sIndex].recordList &&
+                            answer.answer_list[index][sIndex].recordList.length > 0
+                              ? 'record-score-btn-has'
+                              : '',
+                          ]"
+                          :loading="scoreIndex === sItem.sIndex && scoreLoading"
+                          @click="handleSingleScore(sItem, sItem.sIndex, index, sIndex)"
+                          >评分</el-button
+                        >
+                        <template
+                          v-if="showRecordScoreList[sItem.sIndex] && showRecordScoreList[sItem.sIndex].detail_list"
+                        >
+                          <span
+                            class="record-score-content"
+                            :style="recordScoreStyle(showRecordScoreList[sItem.sIndex].score_total)"
+                            @click="
+                              recordScoreDetail = showRecordScoreList[sItem.sIndex];
+                              visibleRecordSingle = true;
+                            "
+                            >{{ showRecordScoreList[sItem.sIndex].score_total }}分</span
+                          >
+                          <b
+                            class="record-score-tips"
+                            @click="
+                              recordScoreDetail = showRecordScoreList[sItem.sIndex];
+                              visibleRecordSingle = true;
+                            "
+                            >详情</b
+                          >
+                        </template>
                         <span v-if="isEnable(data.property.is_has_infor)">
                           <img src="@/assets/detail-icon.png" class="detail-icon" @click="showDetail(sItem)" />
                         </span>
@@ -1825,7 +1900,11 @@ export default {
                   this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
                 }
               });
-              this.rowWidth += 132;
+              this.rowWidth += 180;
+              if (!(this.data.property.is_enable_score && this.data.property.is_enable_score === 'false')) {
+                // 有评分按钮
+                this.rowWidth += 50;
+              }
               if (this.rowWidth < this.width - 2) {
                 this.rowWidth = this.width - 2;
               }
@@ -1856,6 +1935,18 @@ export default {
       deep: true,
       immediate: true,
     },
+    isHasScore: {
+      handler(val) {
+        if (val) {
+          // 如果有录音评分数据
+          if (this.rowWidth < this.width - 2) {
+            this.rowWidth += 88;
+          }
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
   },
   mounted() {
     this.$nextTick(() => {
@@ -1877,7 +1968,11 @@ export default {
             this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
           }
         });
-        this.rowWidth += 132;
+        this.rowWidth += 180;
+        if (!(this.data.property.is_enable_score && this.data.property.is_enable_score === 'false')) {
+          // 有评分按钮
+          this.rowWidth += 50;
+        }
         if (this.rowWidth < this.width - 2) {
           this.rowWidth = this.width - 2;
         }
@@ -1904,7 +1999,11 @@ export default {
           this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
         }
       });
-      this.rowWidth += 132;
+      this.rowWidth += 180;
+      if (!(this.data.property.is_enable_score && this.data.property.is_enable_score === 'false')) {
+        // 有评分按钮
+        this.rowWidth += 50;
+      }
       // 如果有宽度为0且有内容的列,则行宽最小为撑满
       if (this.rowWidth < this.width - 2) {
         this.rowWidth = this.width - 2;
@@ -2475,7 +2574,7 @@ export default {
           // flex-flow: wrap;
           justify-content: flex-start;
           padding: 8px 13px 8px 12px;
-          padding-right: 86px;
+          padding-right: 116px;
           cursor: pointer;
           border-radius: 8px;