瀏覽代碼

音频组件根据反馈调整

zq 2 周之前
父節點
當前提交
7f5fac0c22

+ 4 - 2
src/icons/svg/components/next.svg

@@ -1,3 +1,5 @@
 <svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M7.33341 5.38761L1.3702 9.36308C1.23618 9.45239 1.05509 9.41622 0.965731 9.28217C0.933793 9.23428 0.916748 9.17799 0.916748 9.12036V0.877016C0.916748 0.715935 1.04733 0.58535 1.20841 0.58535C1.266 0.58535 1.32229 0.602395 1.3702 0.634332L7.33341 4.60979V0.915365C7.33341 0.593201 7.59457 0.332031 7.91675 0.332031C8.23892 0.332031 8.50008 0.593201 8.50008 0.915365V9.08203C8.50008 9.40421 8.23892 9.66537 7.91675 9.66537C7.59457 9.66537 7.33341 9.40421 7.33341 9.08203V5.38761Z" fill="black"/>
-</svg>
+	<path
+		d="M7.33341 5.38761L1.3702 9.36308C1.23618 9.45239 1.05509 9.41622 0.965731 9.28217C0.933793 9.23428 0.916748 9.17799 0.916748 9.12036V0.877016C0.916748 0.715935 1.04733 0.58535 1.20841 0.58535C1.266 0.58535 1.32229 0.602395 1.3702 0.634332L7.33341 4.60979V0.915365C7.33341 0.593201 7.59457 0.332031 7.91675 0.332031C8.23892 0.332031 8.50008 0.593201 8.50008 0.915365V9.08203C8.50008 9.40421 8.23892 9.66537 7.91675 9.66537C7.59457 9.66537 7.33341 9.40421 7.33341 9.08203V5.38761Z"
+		fill="currentColor" />
+</svg>

+ 4 - 2
src/icons/svg/components/pre.svg

@@ -1,3 +1,5 @@
 <svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M1.66667 4.60979L7.62991 0.634332C7.7639 0.544983 7.94497 0.581196 8.03433 0.715229C8.0663 0.763138 8.08333 0.819435 8.08333 0.877016V9.12036C8.08333 9.28147 7.95272 9.41202 7.79167 9.41202C7.73409 9.41202 7.6778 9.39499 7.62991 9.36308L1.66667 5.38761V9.08203C1.66667 9.40421 1.4055 9.66537 1.08333 9.66537C0.76117 9.66537 0.5 9.40421 0.5 9.08203V0.915365C0.5 0.593201 0.76117 0.332031 1.08333 0.332031C1.4055 0.332031 1.66667 0.593201 1.66667 0.915365V4.60979Z" fill="black"/>
-</svg>
+	<path
+		d="M1.66667 4.60979L7.62991 0.634332C7.7639 0.544983 7.94497 0.581196 8.03433 0.715229C8.0663 0.763138 8.08333 0.819435 8.08333 0.877016V9.12036C8.08333 9.28147 7.95272 9.41202 7.79167 9.41202C7.73409 9.41202 7.6778 9.39499 7.62991 9.36308L1.66667 5.38761V9.08203C1.66667 9.40421 1.4055 9.66537 1.08333 9.66537C0.76117 9.66537 0.5 9.40421 0.5 9.08203V0.915365C0.5 0.593201 0.76117 0.332031 1.08333 0.332031C1.4055 0.332031 1.66667 0.593201 1.66667 0.915365V4.60979Z"
+		fill="currentColor" />
+</svg>

+ 9 - 0
src/icons/svg/components/sound.svg

@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="32"
+	height="32" style="" filter="none">
+
+	<g>
+		<path
+			d="M13.333 9.627l-4.529 3.707h-4.804v5.333h4.804l4.529 3.707v-12.747zM7.852 21.333h-5.185c-0.736 0-1.333-0.597-1.333-1.333v0-8c0-0.736 0.597-1.333 1.333-1.333v0h5.185l7.059-5.776c0.114-0.094 0.262-0.151 0.423-0.151 0.368 0 0.667 0.298 0.667 0.667 0 0 0 0 0 0v-0 21.187c0 0 0 0 0 0 0 0.368-0.298 0.667-0.667 0.667-0.161 0-0.309-0.057-0.424-0.152l0.001 0.001-7.057-5.776zM25.875 26.845l-1.888-1.888c2.467-2.203 4.013-5.392 4.013-8.943 0-0.005 0-0.010 0-0.015v0.001c0-0.003 0-0.007 0-0.011 0-3.733-1.708-7.066-4.384-9.263l-0.021-0.017 1.893-1.893c3.177 2.702 5.179 6.702 5.179 11.169 0 0.005 0 0.010 0 0.015v-0.001c0 4.297-1.848 8.163-4.792 10.845zM21.151 22.121l-1.896-1.896c1.269-0.983 2.079-2.507 2.079-4.221 0-0.002 0-0.003 0-0.005v0c0-1.907-1-3.58-2.507-4.523l1.919-1.919c1.983 1.471 3.255 3.804 3.255 6.435 0 0.002 0 0.005 0 0.007v-0c0 2.456-1.107 4.653-2.849 6.121z"
+			fill="currentColor"></path>
+	</g>
+</svg>

+ 1 - 1
src/views/book/courseware/create/components/base/audio/AudioSetting.vue

@@ -3,7 +3,7 @@
     <el-form :model="property" :label-position="labelPosition" label-width="90px">
       <SerailNumber :property="property" />
 
-      <el-form-item label="文件名称">
+      <el-form-item label="文件名称" v-if="false">
         <el-radio
           v-for="{ value, label } in displayList"
           :key="value"

+ 1 - 1
src/views/book/courseware/data/audio.js

@@ -18,7 +18,7 @@ export function getAudioProperty() {
     sn_position: serialNumberPositionList[3].value,
     sn_display_mode: displayList[1].value,
     view_method: audioViewMethodList[0].value,
-    file_name_display_mode: displayList[0].value,
+    file_name_display_mode: displayList[1].value,
     style_mode: audioViewStyleList[0].value,
   };
 }

+ 1 - 0
src/views/book/courseware/preview/components/audio/AudioPreview.vue

@@ -75,6 +75,7 @@
                 :audio-index="i"
                 :cur-audio-index="curAudioIndex"
                 :topic-color="data.unified_attrib?.topic_color"
+                :assist-color="data.unified_attrib?.assist_color"
               />
             </li>
           </ul>

+ 86 - 27
src/views/book/courseware/preview/components/common/AudioPlay.vue

@@ -9,20 +9,21 @@
             v-model="play_value"
             class="audio-slider"
             :format-tooltip="formatProcessToolTip"
+            :style="{ '--slider-color': topicColor }"
             @change="changeCurrentTime"
           />
           <span class="audio-time">{{ audio_allTime }}</span>
         </div>
         <div class="audio-icon">
           <SvgIcon icon-class="pre" size="12" :color="topicColor" @click="changeFile('prev')" />
-          <SvgIcon :icon-class="iconClass" size="26" @click="playAudio" />
+          <SvgIcon :icon-class="iconClass" :color="topicColor" size="26" @click="playAudio" />
           <SvgIcon icon-class="next" size="12" :color="topicColor" @click="changeFile('next')" />
         </div>
       </div>
       <div v-else class="independent-big">
         <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
         <div class="slider-area">
-          <SvgIcon :icon-class="iconClass" size="18" :color="topicColor" @click="playAudio" />
+          <SvgIcon :icon-class="iconClass" size="18" :color="topicColor" @click="playAudio" style="cursor: pointer" />
           <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
           <el-slider
             v-model="play_value"
@@ -35,34 +36,52 @@
         </div>
       </div>
     </div>
-    <div v-else-if="'middle' === viewSize" class="audio-middle">
+    <!-- <div v-else-if="'middle' === viewSize" class="audio-middle">
       <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
       <div class="slider-area">
-        <SvgIcon :icon-class="iconClass" size="18" @click="playAudio" />
+        <SvgIcon :icon-class="iconClass" size="18" :color="topicColor" @click="playAudio" />
         <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
         <el-slider
           v-model="play_value"
           class="audio-slider"
           :format-tooltip="formatProcessToolTip"
+          :style="{ '--slider-color': topicColor }"
           @change="changeCurrentTime"
         />
         <span class="audio-time">{{ audio_allTime }}</span>
       </div>
-    </div>
-    <div v-else-if="'small' === viewSize" class="audio-icons">
+    </div> -->
+    <div v-else-if="'middle' === viewSize" class="audio-middle">
       <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
-      <span class="icon-box">
+      <span class="icon-box" :style="{ borderColor: topicColor }">
         <SvgIcon
           :icon-class="iconClass"
-          size="14"
+          size="12"
+          :color="topicColor"
           :style="{ marginLeft: audio.paused ? '4px' : '0' }"
           @click="playAudio"
         />
       </span>
     </div>
-    <div v-else :class="['audio-list', audioIndex === curAudioIndex ? 'active' : '']">
+    <div v-else-if="'small' === viewSize" class="audio-small">
+      <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
+      <SvgIcon
+        icon-class="sound"
+        size="20"
+        :color="topicColor"
+        @click="playAudio"
+        :class="{ 'sound-icon--playing': !audio.paused }"
+      />
+    </div>
+    <div v-else :class="['audio-list', { active: audioIndex === curAudioIndex }]" :style="cssVars">
       <div class="active-mark">
-        <SvgIcon v-if="audioIndex === curAudioIndex" icon-class="paused" size="12" style="cursor: default" />
+        <SvgIcon
+          v-if="audioIndex === curAudioIndex"
+          icon-class="paused"
+          size="12"
+          :color="topicColor"
+          style="cursor: default"
+        />
       </div>
       <span class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</span>
       <span class="audio-time">{{ audio_allTime }}</span>
@@ -127,6 +146,10 @@ export default {
       type: String,
       default: '#076aff',
     },
+    assistColor: {
+      type: String,
+      default: '#076aff',
+    },
   },
   data() {
     return {
@@ -150,6 +173,11 @@ export default {
     iconClass() {
       return this.audio.paused ? 'paused' : 'playing';
     },
+    cssVars() {
+      return {
+        '--assist-color': this.assistColor,
+      };
+    },
   },
   watch: {
     fileId: {
@@ -284,28 +312,27 @@ export default {
     }
   }
 
-  .audio-middle {
+  .audio-middle1 {
     width: 280px;
     padding: 12px 16px;
-    background-color: #f8f8f8;
-    border: 1px solid #e7e7e7;
     border-radius: 4px;
 
     .audio-name {
       padding: 8px;
       margin-bottom: 8px;
       font-size: 14px;
-      text-align: center;
+      text-align: left;
       background-color: #eee;
       border-radius: 4px;
     }
   }
 
-  .audio-icons {
+  .audio-middle {
     display: flex;
     flex-direction: column;
     column-gap: 10px;
-    align-items: center;
+    align-items: left;
+    margin-left: 5px;
 
     .audio-name {
       padding: 8px;
@@ -320,15 +347,33 @@ export default {
       display: flex;
       align-items: center;
       justify-content: center;
-      width: 40px;
-      height: 40px;
+      width: 32px;
+      height: 32px;
       cursor: pointer;
-      background-color: #076aff;
+      border: 4px solid #076aff;
       border-radius: 20px;
 
-      .svg-icon {
-        color: #fff;
-      }
+      // .svg-icon {
+      //   color: #fff;
+      // }
+    }
+  }
+
+  .audio-small {
+    display: flex;
+    flex-direction: column;
+    column-gap: 10px;
+    align-items: left;
+    margin-left: 10px;
+    cursor: pointer;
+
+    .audio-name {
+      padding: 8px;
+      margin-bottom: 8px;
+      font-size: 14px;
+      text-align: center;
+      background-color: #eee;
+      border-radius: 4px;
     }
   }
 
@@ -339,16 +384,13 @@ export default {
     padding: 8px 24px 8px 16px;
 
     &.active {
-      background-color: #f4f9ff;
+      //background-color: #ebb572;
+      background-color: var(--assist-color, #f4f9ff);
     }
 
     .active-mark {
       width: 20px;
       height: 28px;
-
-      .svg-icon {
-        color: #076aff;
-      }
     }
 
     .audio-name {
@@ -384,4 +426,21 @@ export default {
     }
   }
 }
+
+.sound-icon--playing {
+  animation: soundWave 1s infinite;
+}
+
+@keyframes soundWave {
+  0%,
+  100% {
+    opacity: 1;
+    transform: scale(1);
+  }
+
+  50% {
+    opacity: 0.5;
+    transform: scale(1.2);
+  }
+}
 </style>