-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1081d4
commit b46a96e
Showing
10 changed files
with
233 additions
and
7 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@acedatacloud-nexior-3d8ee345-9ada-4b8a-a564-c0f218d65ddc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "add suno extend", | ||
"packageName": "@acedatacloud/nexior", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<template> | ||
<div class="field"> | ||
<div class="box"> | ||
<h2 class="title">{{ $t('suno.name.extend') }}</h2> | ||
<div class="input-wrapper"> | ||
<el-input-number | ||
v-model="value" | ||
class="value" | ||
:min="0" | ||
:max="audio?.duration" | ||
:controls="false" | ||
:placeholder="$t('suno.placeholder.extend.continue_at')" | ||
@change="handleChange" | ||
/> | ||
</div> | ||
</div> | ||
<div class="task"> | ||
<div class="audio" @click="onClick(audio)"> | ||
<div v-loading="!audio?.audio_url || !audio?.video_url" class="left"> | ||
<el-image :src="audio?.image_url" class="cover" fit="cover" /> | ||
<div | ||
v-if=" | ||
audio?.audio_url && | ||
$store.state?.suno?.audio?.id === audio.id && | ||
$store.state?.suno?.audio?.state === 'playing' | ||
" | ||
class="overlay" | ||
@click="onPause(audio)" | ||
> | ||
<el-icon><video-pause /></el-icon> | ||
</div> | ||
<div | ||
v-if=" | ||
audio?.audio_url && | ||
($store.state?.suno?.audio?.id !== audio.id || | ||
($store.state?.suno?.audio?.id === audio.id && $store.state?.suno?.audio?.state === 'paused')) | ||
" | ||
class="overlay" | ||
@click="onPlay(audio)" | ||
> | ||
<el-icon><video-play /></el-icon> | ||
</div> | ||
<div v-if="audio?.duration" class="duration"> | ||
{{ useFormatDuring(audio?.duration) }} | ||
</div> | ||
</div> | ||
<div class="info"> | ||
<h2 class="title">{{ audio?.title }}</h2> | ||
<p class="style">{{ audio?.style }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { useFormatDuring } from '@/utils/number'; | ||
import { ISunoAudio } from '@/models'; | ||
import { ElImage, ElIcon, ElInputNumber } from 'element-plus'; | ||
import { VideoPlay, VideoPause } from '@element-plus/icons-vue'; | ||
export const DEFAULT_LYRIC = ''; | ||
export default defineComponent({ | ||
name: 'ExtendFromInput', | ||
components: { | ||
ElImage, | ||
ElIcon, | ||
ElInputNumber, | ||
VideoPlay, | ||
VideoPause | ||
}, | ||
data() { | ||
return {}; | ||
}, | ||
computed: { | ||
// @ts-ignore | ||
audio() { | ||
// @ts-ignore | ||
return this.$store.state.suno?.config?.audio; | ||
}, | ||
value: { | ||
get() { | ||
return this.$store.state.suno?.config?.continue_at; | ||
}, | ||
set(val: string) { | ||
console.debug('set continue_at', val); | ||
this.$store.commit('suno/setConfig', { | ||
...this.$store.state.suno?.config, | ||
continue_at: val ? parseInt(val) : undefined | ||
}); | ||
} | ||
} | ||
}, | ||
mounted() { | ||
if (!this.value) { | ||
this.value = undefined; | ||
} | ||
}, | ||
methods: { | ||
handleChange(val: number) { | ||
if (val < 0) { | ||
this.value = 0; | ||
// @ts-ignore | ||
} else if (val > this.audio?.duration) { | ||
this.value = this.audio?.duration; | ||
} else { | ||
this.value = val; | ||
} | ||
}, | ||
useFormatDuring, | ||
onPlay(audio: ISunoAudio) { | ||
this.$store.dispatch('suno/setAudio', { | ||
...this.$store.state.suno.audio, | ||
...audio, | ||
state: 'playing' | ||
}); | ||
console.log('on play'); | ||
}, | ||
onPause(audio: ISunoAudio) { | ||
this.$store.dispatch('suno/setAudio', { | ||
...this.$store.state.suno.audio, | ||
...audio, | ||
state: 'paused' | ||
}); | ||
console.log('on pause'); | ||
}, | ||
onClick(audio: ISunoAudio) { | ||
if (this.$store.state?.suno?.audio?.id !== audio.id) { | ||
this.onPlay({ | ||
...audio, | ||
progress: 0 | ||
}); | ||
} | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.field { | ||
.box { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; // 添加这行 | ||
position: relative; | ||
.title { | ||
font-size: 14px; | ||
margin-bottom: 10px; | ||
} | ||
.input-wrapper { | ||
width: 150px; // 根据需要调整宽度 | ||
margin-left: 30px; // 增加左边距 | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default ['suno.config', 'suno.credential', 'suno.application', 'suno.tasks']; | ||
export default ['suno.credential', 'suno.application', 'suno.tasks']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters