瀏覽代碼

新增诗词朗诵类型

liyanbo 1 月之前
父節點
當前提交
528c21901d
共有 1 個文件被更改,包括 81 次插入14 次删除
  1. 81 14
      src/views/bjdx/course/aiGenerate/aiGengrate.vue

+ 81 - 14
src/views/bjdx/course/aiGenerate/aiGengrate.vue

@@ -204,7 +204,7 @@
                           @click="generateMedia(sectionIndex)"
                           class="generate-btn"
                         >
-                          {{ 
+                          {{
                             section.backgroundImage.generating
                               ? '生成中...'
                               : section.backgroundImage.url
@@ -252,7 +252,7 @@
                       </div>
                     </div>
                   </template>
-                  
+
                   <!-- 视频背景 -->
                   <template v-else-if="section.backgroundType === 'video'">
                     <div class="media-item">
@@ -275,7 +275,7 @@
                           @click="generateVideo(sectionIndex)"
                           class="generate-btn"
                         >
-                          {{ 
+                          {{
                             section.backgroundVideo.generating
                               ? '生成中...'
                               : section.backgroundVideo.url
@@ -300,7 +300,7 @@
                   >
                     <div class="dialogue-header">
                       <div class="dialogue-type-tag" :class="dialogue.type">
-                        {{ 
+                        {{
                           dialogue.type === 'digital'
                             ? '数字人'
                             : dialogue.type === 'user'
@@ -309,7 +309,9 @@
                                 ? '提问'
                                 : dialogue.type === 'poem'
                                   ? '诗词'
-                                  : '视频'
+                                  : dialogue.type === 'poem_reading'
+                                    ? '朗诵评价'
+                                    : '视频'
                         }}
                       </div>
                     </div>
@@ -632,7 +634,7 @@
                           </div>
                         </div>
                       </template>
-                      
+
                       <!-- 视频 -->
                       <template v-else-if="dialogue.type === 'video'">
                         <div class="media-input-group" style="display: flex; align-items: center; justify-content: center;">
@@ -656,7 +658,7 @@
                             class="generate-btn"
                             style="margin-right: 10px;"
                           >
-                            {{ 
+                            {{
                               dialogue.generatingVideo
                                 ? '生成中...'
                                 : dialogue.videoUrl
@@ -673,6 +675,43 @@
                           >×</button>
                         </div>
                       </template>
+
+                      <!-- 朗诵评价 -->
+                      <template v-else-if="dialogue.type === 'poem_reading'">
+                        <div class="dialogue-role-select">
+                          <el-select
+                            v-model="dialogue.roleName"
+                            placeholder="选择角色"
+                            style="width: 140px"
+                            clearable
+                          >
+                            <el-option
+                              v-for="role in digitalHumans"
+                              :key="role.id"
+                              :label="role.name"
+                              :value="role.name"
+                            />
+                          </el-select>
+                        </div>
+                        <div class="dialogue-content-container">
+                          <el-input
+                            v-model="dialogue.content"
+                            type="textarea"
+                            class="dialogue-content"
+                            placeholder="朗诵评价内容..."
+                            :autosize="{ minRows: 2, maxRows: 4 }"
+                          />
+                        </div>
+                        <div class="action-buttons">
+                          <div class="action-buttons-row">
+                            <button
+                              class="remove-btn"
+                              @click="removeDialogue(sectionIndex, dialogueIndex)"
+                              >×</button
+                            >
+                          </div>
+                        </div>
+                      </template>
                     </div>
                   </div>
 
@@ -695,6 +734,10 @@
                       >+ 添加视频</button
                     >
 
+                    <button class="add-dialogue-btn poem_reading" @click="addPoemReadingDialogue(sectionIndex)"
+                      >+ 添加朗诵评价</button
+                    >
+
                   </div>
                 </div>
               </div>
@@ -786,7 +829,7 @@
                           <div class="dialogue-header">
                             <div class="dialogue-header-left">
                               <div class="dialogue-type-tag" :class="dialogue.type">
-                                {{ 
+                                {{
                           dialogue.type === 'digital'
                             ? '数字人'
                             : dialogue.type === 'user'
@@ -795,11 +838,13 @@
                                 ? '提问'
                                 : dialogue.type === 'poem'
                                   ? '诗词'
-                                  : '视频'
+                                  : dialogue.type === 'poem_reading'
+                                    ? '朗诵评价'
+                                    : '视频'
                         }}
                               </div>
                               <div class="dialogue-role">
-                                {{ 
+                                {{
                                   dialogue.type !== 'user' && dialogue.type !== 'video'
                                     ? getRoleName(dialogue.roleName)
                                     : dialogue.type === 'video' ? '视频' : '用户'
@@ -1576,6 +1621,15 @@ const addPoemDialogue = (sectionIndex) => {
   })
 }
 
+// 步骤2:添加朗诵评价
+const addPoemReadingDialogue = (sectionIndex) => {
+  scriptData.sections[sectionIndex].dialogues.push({
+    type: 'poem_reading',
+    content: '',
+    roleName: '',
+  })
+}
+
 // 步骤2:添加提问与用户回复
 const addQuestWithUserReply = (sectionIndex) => {
   // 添加提问类型对话
@@ -2079,12 +2133,12 @@ const validateScript = () => {
 
     // 检查对话
     section.dialogues.forEach((dialogue, dialogueIndex) => {
-      // 检查数字人、提问和诗词类型的对话
-      if (dialogue.type === 'digital' || dialogue.type === 'quest' || dialogue.type === 'poem') {
+      // 检查数字人、提问、诗词和朗诵评价类型的对话
+      if (dialogue.type === 'digital' || dialogue.type === 'quest' || dialogue.type === 'poem' || dialogue.type === 'poem_reading') {
         if (
           !dialogue.roleName ||
           !dialogue.content.trim() ||
-          (dialogue.type !== 'poem' && !dialogue.voiceoverUrl)
+          (dialogue.type !== 'poem' && dialogue.type !== 'poem_reading' && !dialogue.voiceoverUrl)
         ) {
           errorMessages.value.push(
             `环节${sectionIndex + 1}:对话${dialogueIndex + 1}:存在完成内容!`
@@ -2209,7 +2263,7 @@ onMounted(async () => {
   inProgressTimer.value = setInterval(async () => {
     await refreshWatchImages()
   }, 3000)
-  
+
   inProgressVideoTimer.value = setInterval(async () => {
     await refreshWatchVideos()
   }, 3000)
@@ -2519,6 +2573,10 @@ onUnmounted(() => {
   background-color: #909399;
 }
 
+.dialogue-type-tag.poem_reading {
+  background-color: #7d60a4;
+}
+
 .dialogue-type-tag.video {
   background-color: #8b4513;
 }
@@ -2554,6 +2612,10 @@ onUnmounted(() => {
   border-left: 4px solid #8b4513;
 }
 
+.dialogue-item.poem_reading {
+  border-left: 4px solid #7d60a4;
+}
+
 /* 对话头部 */
 .dialogue-header {
   margin-bottom: 10px;
@@ -2631,6 +2693,11 @@ onUnmounted(() => {
   color: white;
 }
 
+.add-dialogue-btn.poem_reading {
+  background-color: #7d60a4;
+  color: white;
+}
+
 .add-dialogue-btn.quest-user {
   background-color: #e6a23c;
   color: white;