litian
2024-11-20 7a4a5658ba89afda9e89b31e92a40ad7658fd29e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
  <div class="voiceReader">
    <ul class="reader-box">
      <li @click="changePlay">
        <img :src="readerState.isPlay ? playIcon : pauseIcon" alt="" />
        <span>{{ readerState.isPlay ? '播放' : '暂停' }}</span>
      </li>
      <li>
        <img :src="prevIcon" alt="" class="next-icon" />
        <span>上一句</span>
      </li>
      <li>
        <img :src="nextIcon" alt="" class="next-icon" />
        <span>下一句</span>
      </li>
      <li>
        <img :src="repeateIcon" alt="" />
        <span>复读</span>
      </li>
      <li>
        <img :src="followIcon" alt="" />
        <span>跟读</span>
      </li>
      <li>
        <img :src="followPlayIcon" alt="" />
        <span>跟读播放</span>
      </li>
      <li class="voice-dropDown">
        <el-dropdown @command="changeSpeed">
          <div class="el-dropdown-link dropDown-box">
            <img :src="speedIcon" alt="" />
            <span> 速度 </span>
          </div>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item v-for="(item, index) in readerState.speedList" :key="index" :command="item">{{
                item
              }}x</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </li>
    </ul>
  </div>
</template>
 
<script setup lang="ts">
import { reactive } from 'vue'
import playIcon from '@/assets/images/voice/play.png'
import pauseIcon from '@/assets/images/voice/pause.png'
import prevIcon from '@/assets/images/voice/shangyiju.png'
import nextIcon from '@/assets/images/voice/xiayiju.png'
import repeateIcon from '@/assets/images/voice/fudu.png'
import followIcon from '@/assets/images/voice/gendu.png'
import followPlayIcon from '@/assets/images/voice/gendubofang.png'
import speedIcon from '@/assets/images/voice/sudu.png'
const readerState = reactive({
  isPlay: false,
  selecte: '', // 选中
  speed:"", // 播放速度
  speedList: ['0.5', '0.8', '1.0', '1.5']
})
 
const changePlay = () => {
  if (readerState.isPlay) {
    readerState.isPlay = false
  } else {
    readerState.isPlay = true
  }
}
const changeSpeed = (command:string) => {
  console.log('速度',command);
  
}
</script>
 
<style scoped lang="less">
.voiceReader {
  height: 58px;
  width: 500px;
  border: 1px solid #0093ff;
  background-color: #fff;
  border-radius: 8px;
}
.reader-box {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  font-size: 12px;
  color: #2c2c2c;
  li {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    img {
      width: 20px;
      object-fit: contain;
      margin-top: 5px;
    }
  }
}
.next-icon {
  width: 16px !important;
}
.el-dropdown-link {
  height: 100%;
}
.voice-dropDown {
  .dropDown-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    img {
      margin-top: 5px;
    }
  }
  /deep/ .el-tooltip__trigger:focus {
    outline: none;  // unset 这个也行
  }
}
.el-dropdown-menu {
    background-color: #2C2C2C ;
    border-color: #2C2C2C !important;
  }
</style>