Pārlūkot izejas kodu

音频组件根据反馈调整

zq 1 mēnesi atpakaļ
vecāks
revīzija
c754a7a48e

+ 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/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,
   };
 }

+ 3 - 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>
@@ -114,6 +115,8 @@ export default {
         this.fileLen = val.file_list.length;
         if (this.fileLen > 0 && this.data.property.view_method === 'list') {
           const ele = this.$refs.audioAreaBox;
+          // this.elementWidth = ele.clientWidth;
+          // this.elementHeight = ele.clientHeight;
 
           const sn_position = this.data.property.sn_position;
           // 序号在左和右补齐序号高度,去掉padding(8*2)

+ 72 - 48
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"
@@ -37,32 +38,35 @@
     </div>
     <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" />
-        <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
-        <el-slider
-          v-model="play_value"
-          class="audio-slider"
-          :format-tooltip="formatProcessToolTip"
-          @change="changeCurrentTime"
-        />
-        <span class="audio-time">{{ audio_allTime }}</span>
-      </div>
-    </div>
-    <div v-else-if="'small' === viewSize" class="audio-icons">
-      <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 +131,10 @@ export default {
       type: String,
       default: '#076aff',
     },
+    assistColor: {
+      type: String,
+      default: '#076aff',
+    },
   },
   data() {
     return {
@@ -150,6 +158,11 @@ export default {
     iconClass() {
       return this.audio.paused ? 'paused' : 'playing';
     },
+    cssVars() {
+      return {
+        '--assist-color': this.assistColor,
+      };
+    },
   },
   watch: {
     fileId: {
@@ -178,7 +191,6 @@ export default {
     getCurTime(curTime) {
       this.curTime = curTime * 1000;
     },
-
     playAudio() {
       if (!this.url) return;
       const audio = this.$refs[this.fileId];
@@ -286,11 +298,11 @@ export default {
   }
 
   .audio-middle {
-    width: 280px;
-    padding: 12px 16px;
-    background-color: #f8f8f8;
-    border: 1px solid #e7e7e7;
-    border-radius: 4px;
+    display: flex;
+    flex-direction: column;
+    column-gap: 10px;
+    align-items: left;
+    margin-left: 5px;
 
     .audio-name {
       padding: 8px;
@@ -300,13 +312,27 @@ export default {
       background-color: #eee;
       border-radius: 4px;
     }
+
+    .icon-box {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      width: 32px;
+      height: 32px;
+      cursor: pointer;
+      border: 4px solid #076aff;
+      border-radius: 20px;
+
+    }
   }
 
-  .audio-icons {
+  .audio-small {
     display: flex;
     flex-direction: column;
     column-gap: 10px;
-    align-items: center;
+    align-items: left;
+    margin-left: 10px;
+    cursor: pointer;
 
     .audio-name {
       padding: 8px;
@@ -316,21 +342,6 @@ export default {
       background-color: #eee;
       border-radius: 4px;
     }
-
-    .icon-box {
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      width: 40px;
-      height: 40px;
-      cursor: pointer;
-      background-color: #076aff;
-      border-radius: 20px;
-
-      .svg-icon {
-        color: #fff;
-      }
-    }
   }
 
   .audio-list {
@@ -340,16 +351,12 @@ export default {
     padding: 8px 24px 8px 16px;
 
     &.active {
-      background-color: #f4f9ff;
+      background-color: var(--assist-color, #f4f9ff);
     }
 
     .active-mark {
       width: 20px;
       height: 28px;
-
-      .svg-icon {
-        color: #076aff;
-      }
     }
 
     .audio-name {
@@ -385,4 +392,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>