no message
This commit is contained in:
parent
67e3268878
commit
78a7eb1714
BIN
dist.rar
Normal file
BIN
dist.rar
Normal file
Binary file not shown.
67
src/App.vue
67
src/App.vue
@ -40,6 +40,10 @@ let qrcode = ref("")
|
||||
// 获取二维码
|
||||
const getLoginQrcode = () => {
|
||||
getQrcode().then(res => {
|
||||
if (res.code == 401) {
|
||||
getLoginQrcode()
|
||||
return
|
||||
}
|
||||
if (res.code != 200) return
|
||||
|
||||
const data = res.data || {}
|
||||
@ -56,6 +60,10 @@ let monitorTimer = null
|
||||
const monitorLogin = () => {
|
||||
monitorTimer = setInterval(() => {
|
||||
monitorState({ token: token }).then(res => {
|
||||
if (res.code == 401) {
|
||||
getLoginQrcode()
|
||||
return
|
||||
}
|
||||
console.log(res)
|
||||
// code 200 为登录成功 400 是等待 201 是失效
|
||||
if (res.code == 400) return
|
||||
@ -132,11 +140,11 @@ let obj = ref({
|
||||
|
||||
// 点击创建音乐
|
||||
const creativeMusic = () => {
|
||||
console.log("提交了")
|
||||
|
||||
// return
|
||||
|
||||
Generate({ ...obj.value }).then(res => {
|
||||
if (res.code == 401) {
|
||||
getLoginQrcode()
|
||||
return
|
||||
}
|
||||
if (res.code != 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
@ -150,7 +158,7 @@ const creativeMusic = () => {
|
||||
monitorMusicState(data.metadataid)
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
message: "提交成功",
|
||||
type: "success",
|
||||
})
|
||||
})
|
||||
@ -184,22 +192,30 @@ const monitorMusicState = metadataid => {
|
||||
clearTimeout(monitorMusicTimer)
|
||||
monitorMusicTimer = setTimeout(() => {
|
||||
monitorMusic({ metadataid }).then(res => {
|
||||
if (res.code == 401) {
|
||||
getLoginQrcode()
|
||||
return
|
||||
}
|
||||
if (res.code != 200) return
|
||||
const data = res.data || {}
|
||||
const dataList = data.list || []
|
||||
|
||||
if (data.status != "complete") {
|
||||
monitorMusicState(metadataid)
|
||||
}
|
||||
|
||||
let obj = {}
|
||||
let isnoneed = 0 // isnoneed > 0 需要继续监听的意思 submitted streaming 代表生产中
|
||||
// let isnoneed = 0 // isnoneed > 0 需要继续监听的意思 submitted streaming 代表生产中
|
||||
dataList.forEach((element, index) => {
|
||||
if (element.status != "complete") isnoneed++
|
||||
// if (element.status != "complete") isnoneed++
|
||||
obj[element.sid] = index
|
||||
})
|
||||
|
||||
console.log("isnoneed", isnoneed)
|
||||
// console.log("isnoneed", isnoneed)
|
||||
|
||||
if (isnoneed > 0) {
|
||||
monitorMusicState(metadataid)
|
||||
}
|
||||
// if (isnoneed > 0) {
|
||||
// monitorMusicState(metadataid)
|
||||
// }
|
||||
|
||||
let targetlist = list.value || []
|
||||
targetlist.forEach((element, index) => {
|
||||
@ -214,14 +230,24 @@ const monitorMusicState = metadataid => {
|
||||
}
|
||||
list.value = targetlist
|
||||
})
|
||||
}, 1000)
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
let songInfo = ref({}) // 歌详情
|
||||
|
||||
const getMusicDetails = id => {
|
||||
getDetails({ id }).then(res => {
|
||||
if (res.code != 200) return
|
||||
if (res.code == 401) {
|
||||
getLoginQrcode()
|
||||
return
|
||||
}
|
||||
if (res.code != 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
songInfo.value = res.data
|
||||
|
||||
@ -400,7 +426,7 @@ const formatTime = time => {
|
||||
</div>
|
||||
|
||||
<div class="lyric-content">
|
||||
<el-input v-model="obj.gpt_description_prompt" class="lyric-input" maxlength="2000" style="width: 100%;" :rows="4" type="textarea" placeholder="请输入你的歌词" />
|
||||
<el-input v-model="obj.gpt_description_prompt" class="lyric-input" maxlength="200" show-word-limit style="width: 100%;" :rows="4" type="textarea" placeholder="请输入你的歌词" />
|
||||
<!-- <div class="random-btn flexcenter">随机生成歌词</div> -->
|
||||
</div>
|
||||
</div>
|
||||
@ -446,7 +472,7 @@ const formatTime = time => {
|
||||
<img class="question-icon" src="./assets/img/question-icon.svg" />
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-select v-model="modelValue" placeholder="选择模型" size="large" style="width: 100%;" popper-class="model-select" :teleported="false">
|
||||
@ -466,7 +492,8 @@ const formatTime = time => {
|
||||
<!-- <div class="progress-bar" :style="{ 'width': item.progress + '%' }"></div> -->
|
||||
<div class="progress-bar" v-if="item.status != 'complete'">生成中...</div>
|
||||
<div class="img-box" @click="playAudio(index)">
|
||||
<img class="img" :src="item.image_url" />
|
||||
<img v-if="item.image_url" class="img" :src="item.image_url" />
|
||||
<img v-else class="img" src="./assets/img/default-icon.png" />
|
||||
<div class="play flexcenter">
|
||||
<img class="play-btn" src="./assets/img/play-icon.png" />
|
||||
</div>
|
||||
@ -478,14 +505,14 @@ const formatTime = time => {
|
||||
|
||||
<el-popover popper-class="dot-popover" placement="bottom" :width="220" trigger="click" :teleported="false">
|
||||
<div class="dot-list">
|
||||
<a class="dot-item" v-if="item.audio_url" :href="item.audio_url" :download="item.title + '.mp3'">下载MP3</a>
|
||||
<a class="dot-item" target="_parent" v-if="item.audio_url" :href="item.audio_url" :download="item.title + '.mp3'">下载MP3</a>
|
||||
<!-- <div class="dot-item" v-if="item.audio_url">下载MP3</div> -->
|
||||
<!-- <div class="dot-item">下载wav</div> -->
|
||||
<a class="dot-item" v-if="item.video_url" :href="item.video_url" :download="item.title + '.mp4'">下载视频</a>
|
||||
<!-- <div class="dot-item" v-if="item.video_url">下载视频</div> -->
|
||||
</div>
|
||||
<template #reference>
|
||||
<div class="dot flexcenter">
|
||||
<div class="dot flexcenter" @click.stop="">
|
||||
<img class="dot-icon" src="./assets/img/dot.svg" />
|
||||
</div>
|
||||
</template>
|
||||
@ -745,6 +772,10 @@ body {
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.el-input__count {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
padding-bottom: 5px;
|
||||
box-shadow: 0 0 0 1px #252323 inset !important;
|
||||
|
BIN
src/assets/img/default-icon.png
Normal file
BIN
src/assets/img/default-icon.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 219 KiB |
Loading…
x
Reference in New Issue
Block a user