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