@@ -83,7 +83,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="mini-player" :class="{ 'with-close': closable }" @tap="handleExpand">
|
||||
<view v-else class="mini-player" :class="{ 'with-close': closable, 'is-static': !expandable }" @tap="handleExpand">
|
||||
<view class="control-btn play-btn mini-play" @tap.stop="togglePlay">
|
||||
<svg v-if="displayPlaying" width="26" height="26" viewBox="0 0 24 24" fill="none">
|
||||
<rect x="6" y="5" width="4" height="14" rx="1" fill="currentColor"/>
|
||||
@@ -105,7 +105,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="expand-action">
|
||||
<view v-if="expandable" class="expand-action">
|
||||
<text class="expand-text">展开</text>
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M6 9L12 15L18 9" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
@@ -147,6 +147,7 @@ const props = defineProps<{
|
||||
currentTime?: number
|
||||
durationValue?: number
|
||||
closable?: boolean
|
||||
expandable?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -201,6 +202,7 @@ const displayPlaybackError = computed(() => props.controlled ? props.playbackErr
|
||||
const displayCurrentTime = computed(() => props.controlled ? props.currentTime || 0 : localCurrentTime.value)
|
||||
const displayMode = computed<AudioDisplayMode>(() => props.mode || 'mini')
|
||||
const closable = computed(() => props.closable !== false)
|
||||
const expandable = computed(() => props.expandable !== false)
|
||||
const displayAudioLanguage = computed<AudioLanguage>(() => (
|
||||
displayAudio.value?.language === 'en-US' ? 'en-US' : 'zh-CN'
|
||||
))
|
||||
@@ -497,6 +499,8 @@ const handleSeek = (e: any) => {
|
||||
|
||||
// 展开播放器
|
||||
const handleExpand = () => {
|
||||
if (!expandable.value) return
|
||||
|
||||
emit('expand')
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
:current-time="currentTime"
|
||||
:duration-value="duration"
|
||||
:closable="closable"
|
||||
:expandable="expandable"
|
||||
:avoid-bottom-nav="avoidBottomNav"
|
||||
:mode="currentDisplayMode"
|
||||
@toggle="handleToggle"
|
||||
@@ -34,10 +35,12 @@ const props = withDefaults(defineProps<{
|
||||
avoidBottomNav?: boolean
|
||||
displayMode?: AudioDisplayMode
|
||||
closable?: boolean
|
||||
expandable?: boolean
|
||||
}>(), {
|
||||
avoidBottomNav: true,
|
||||
displayMode: 'mini',
|
||||
closable: true
|
||||
closable: true,
|
||||
expandable: true
|
||||
})
|
||||
|
||||
const player = useGlobalAudioPlayer()
|
||||
@@ -99,6 +102,8 @@ const handleVisibleChange = (visible: boolean) => {
|
||||
}
|
||||
|
||||
const handleExpand = () => {
|
||||
if (!props.expandable) return
|
||||
|
||||
if (currentDisplayMode.value === 'floating') {
|
||||
player.setDisplayMode('mini')
|
||||
return
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
:avoid-bottom-nav="audioPlayerAvoidBottomNav"
|
||||
:display-mode="audioPlayerMode"
|
||||
:closable="audioPlayerClosable"
|
||||
:expandable="audioPlayerExpandable"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
@@ -60,6 +61,7 @@ withDefaults(defineProps<{
|
||||
audioPlayerAvoidBottomNav?: boolean
|
||||
audioPlayerMode?: AudioDisplayMode
|
||||
audioPlayerClosable?: boolean
|
||||
audioPlayerExpandable?: boolean
|
||||
showAudioPlayerHost?: boolean
|
||||
}>(), {
|
||||
activeTab: 'guide',
|
||||
@@ -74,6 +76,7 @@ withDefaults(defineProps<{
|
||||
audioPlayerAvoidBottomNav: true,
|
||||
audioPlayerMode: 'mini',
|
||||
audioPlayerClosable: true,
|
||||
audioPlayerExpandable: true,
|
||||
showAudioPlayerHost: false
|
||||
})
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
:show-top-tabs="false"
|
||||
:audio-player-avoid-bottom-nav="false"
|
||||
:audio-player-closable="false"
|
||||
:audio-player-expandable="false"
|
||||
:show-audio-player-host="true"
|
||||
audio-player-mode="expanded"
|
||||
audio-player-mode="mini"
|
||||
@back="handleBack"
|
||||
>
|
||||
<view class="explain-detail-page" :class="{ 'with-audio-player': showAudioPlayer }">
|
||||
@@ -610,7 +611,7 @@ const handlePlayAudio = async () => {
|
||||
detailRoute: buildDetailRoute()
|
||||
},
|
||||
retryOnError: refreshCurrentAudioOnce,
|
||||
displayMode: 'expanded'
|
||||
displayMode: 'mini'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user