Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8d334764
authored
Jun 27, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】AI:音乐管理 50%
parent
39d3995e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
329 additions
and
64 deletions
+329
-64
src/api/ai/image/index.ts
+2
-2
src/api/ai/music/index.ts
+40
-0
src/views/ai/image/ImageDetailDrawer.vue
+15
-19
src/views/ai/image/ImageTask.vue
+25
-21
src/views/ai/image/ImageTaskCard.vue
+29
-19
src/views/ai/image/manager/index.vue
+3
-3
src/views/ai/music/manager/index.vue
+215
-0
No files found.
src/api/ai/image/index.ts
View file @
8d334764
import
request
from
'@/config/axios'
import
request
from
'@/config/axios'
// AI
API 密钥
VO
// AI
绘图
VO
export
interface
Image
Resp
VO
{
export
interface
ImageVO
{
id
:
number
// 编号
id
:
number
// 编号
platform
:
string
// 平台
platform
:
string
// 平台
model
:
string
// 模型
model
:
string
// 模型
...
...
src/api/ai/music/index.ts
0 → 100644
View file @
8d334764
import
request
from
'@/config/axios'
// AI 音乐 VO
export
interface
MusicVO
{
id
:
number
// 编号
userId
:
number
// 用户编号
title
:
string
// 音乐名称
lyric
:
string
// 歌词
imageUrl
:
string
// 图片地址
audioUrl
:
string
// 音频地址
videoUrl
:
string
// 视频地址
status
:
number
// 音乐状态
gptDescriptionPrompt
:
string
// 描述词
prompt
:
string
// 提示词
platform
:
string
// 模型平台
model
:
string
// 模型
generateMode
:
number
// 生成模式
tags
:
string
// 音乐风格标签
publicStatus
:
boolean
// 是否发布
taskId
:
string
// 任务id
errorMessage
:
string
// 错误信息
}
// AI 音乐 API
export
const
MusicApi
=
{
// 查询音乐分页
getMusicPage
:
async
(
params
:
any
)
=>
{
return
await
request
.
get
({
url
:
`/ai/music/page`
,
params
})
},
// 修改音乐
updateMusic
:
async
(
data
:
MusicVO
)
=>
{
return
await
request
.
put
({
url
:
`/ai/music/update`
,
data
})
},
// 删除音乐
deleteMusic
:
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/music/delete?id=`
+
id
})
}
}
src/views/ai/image/ImageDetailDrawer.vue
View file @
8d334764
...
@@ -7,11 +7,11 @@
...
@@ -7,11 +7,11 @@
>
>
<!-- 图片 -->
<!-- 图片 -->
<div
class=
"item"
>
<div
class=
"item"
>
<!--
<div
class=
"header"
>
-->
<!--
<div
class=
"header"
>
-->
<!--
<div>
图片
</div>
-->
<!--
<div>
图片
</div>
-->
<!--
<div>
-->
<!--
<div>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</div>
-->
<div
class=
"body"
>
<div
class=
"body"
>
<!-- TODO @fan: 要不,这里只展示图片???不用 ImageTaskCard -->
<!-- TODO @fan: 要不,这里只展示图片???不用 ImageTaskCard -->
<ImageTaskCard
:image-detail=
"imageDetail"
/>
<ImageTaskCard
:image-detail=
"imageDetail"
/>
...
@@ -21,30 +21,30 @@
...
@@ -21,30 +21,30 @@
<div
class=
"item"
>
<div
class=
"item"
>
<div
class=
"tip"
>
时间
</div>
<div
class=
"tip"
>
时间
</div>
<div
class=
"body"
>
<div
class=
"body"
>
<div>
提交时间:
{{
imageDetail
.
createTime
}}
</div>
<div>
提交时间:
{{
imageDetail
.
createTime
}}
</div>
<!-- TODO @fan:要不加个完成时间的字段 finishTime?updateTime 不算特别合理哈 -->
<!-- TODO @fan:要不加个完成时间的字段 finishTime?updateTime 不算特别合理哈 -->
<div>
生成时间:
{{
imageDetail
.
updateTime
}}
</div>
<div>
生成时间:
{{
imageDetail
.
updateTime
}}
</div>
</div>
</div>
</div>
</div>
<!-- 模型 -->
<!-- 模型 -->
<div
class=
"item"
>
<div
class=
"item"
>
<div
class=
"tip"
>
模型
</div>
<div
class=
"tip"
>
模型
</div>
<div
class=
"body"
>
<div
class=
"body"
>
{{
imageDetail
.
model
}}
(
{{
imageDetail
.
height
}}
x
{{
imageDetail
.
width
}}
)
{{
imageDetail
.
model
}}
(
{{
imageDetail
.
height
}}
x
{{
imageDetail
.
width
}}
)
</div>
</div>
</div>
</div>
<!-- 提示词 -->
<!-- 提示词 -->
<div
class=
"item"
>
<div
class=
"item"
>
<div
class=
"tip"
>
提示词
</div>
<div
class=
"tip"
>
提示词
</div>
<div
class=
"body"
>
<div
class=
"body"
>
{{
imageDetail
.
prompt
}}
{{
imageDetail
.
prompt
}}
</div>
</div>
</div>
</div>
<!-- 地址 -->
<!-- 地址 -->
<div
class=
"item"
>
<div
class=
"item"
>
<div
class=
"tip"
>
图片地址
</div>
<div
class=
"tip"
>
图片地址
</div>
<div
class=
"body"
>
<div
class=
"body"
>
{{
imageDetail
.
picUrl
}}
{{
imageDetail
.
picUrl
}}
</div>
</div>
</div>
</div>
<!-- 风格 -->
<!-- 风格 -->
...
@@ -53,18 +53,18 @@
...
@@ -53,18 +53,18 @@
<div
class=
"body"
>
<div
class=
"body"
>
<!-- TODO @fan:貌似需要把 imageStyleList 搞到 api/image/index.ts 枚举起来? -->
<!-- TODO @fan:貌似需要把 imageStyleList 搞到 api/image/index.ts 枚举起来? -->
<!-- TODO @fan:这里的展示,可能需要按照平台做区分 -->
<!-- TODO @fan:这里的展示,可能需要按照平台做区分 -->
{{
imageDetail
?.
options
?.
style
}}
{{
imageDetail
?.
options
?.
style
}}
</div>
</div>
</div>
</div>
</el-drawer>
</el-drawer>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageRespVO
}
from
'@/api/ai/image'
;
import
{
ImageApi
,
ImageVO
}
from
'@/api/ai/image'
import
ImageTaskCard
from
'./ImageTaskCard.vue'
;
import
ImageTaskCard
from
'./ImageTaskCard.vue'
const
showDrawer
=
ref
<
boolean
>
(
false
)
// 是否显示
const
showDrawer
=
ref
<
boolean
>
(
false
)
// 是否显示
const
imageDetail
=
ref
<
Image
RespVO
>
({}
as
ImageResp
VO
)
// 图片详细信息
const
imageDetail
=
ref
<
Image
VO
>
({}
as
Image
VO
)
// 图片详细信息
const
props
=
defineProps
({
const
props
=
defineProps
({
show
:
{
show
:
{
...
@@ -109,12 +109,9 @@ watch(id, async (newVal, oldVal) => {
...
@@ -109,12 +109,9 @@ watch(id, async (newVal, oldVal) => {
//
//
const
emits
=
defineEmits
([
'handlerDrawerClose'
])
const
emits
=
defineEmits
([
'handlerDrawerClose'
])
//
//
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{})
})
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.item
{
.item
{
margin-bottom
:
20px
;
margin-bottom
:
20px
;
width
:
100%
;
width
:
100%
;
...
@@ -136,7 +133,6 @@ onMounted(async () => {
...
@@ -136,7 +133,6 @@ onMounted(async () => {
margin-top
:
10px
;
margin-top
:
10px
;
color
:
#616161
;
color
:
#616161
;
.taskImage
{
.taskImage
{
border-radius
:
10px
;
border-radius
:
10px
;
}
}
...
...
src/views/ai/image/ImageTask.vue
View file @
8d334764
...
@@ -6,15 +6,17 @@
...
@@ -6,15 +6,17 @@
v-for=
"image in imageList"
v-for=
"image in imageList"
:key=
"image"
:key=
"image"
:image-detail=
"image"
:image-detail=
"image"
@
on-btn-click=
"handlerImageBtnClick"
@
on-btn-click=
"handlerImageBtnClick"
@
on-mj-btn-click=
"handlerImageMjBtnClick"
/>
@
on-mj-btn-click=
"handlerImageMjBtnClick"
/>
</div>
</div>
<div
class=
"task-image-pagination"
>
<div
class=
"task-image-pagination"
>
<el-pagination
background
layout=
"prev, pager, next"
<el-pagination
:default-page-size=
"pageSize"
background
:total=
"pageTotal"
layout=
"prev, pager, next"
@
change=
"handlerPageChange"
:default-page-size=
"pageSize"
:total=
"pageTotal"
@
change=
"handlerPageChange"
/>
/>
</div>
</div>
</el-card>
</el-card>
...
@@ -26,14 +28,14 @@
...
@@ -26,14 +28,14 @@
/>
/>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageRespVO
,
ImageMjActionVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
;
import
{
ImageApi
,
ImageVO
,
ImageMjActionVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
import
ImageDetailDrawer
from
'./ImageDetailDrawer.vue'
import
ImageDetailDrawer
from
'./ImageDetailDrawer.vue'
import
ImageTaskCard
from
'./ImageTaskCard.vue'
import
ImageTaskCard
from
'./ImageTaskCard.vue'
import
{
ElLoading
,
LoadingOptionsResolved
}
from
"element-plus"
;
import
{
ElLoading
,
LoadingOptionsResolved
}
from
'element-plus'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
imageList
=
ref
<
Image
Resp
VO
[]
>
([])
// image 列表
const
imageList
=
ref
<
ImageVO
[]
>
([])
// image 列表
const
imageListInterval
=
ref
<
any
>
()
// image 列表定时器,刷新列表
const
imageListInterval
=
ref
<
any
>
()
// image 列表定时器,刷新列表
const
isShowImageDetail
=
ref
<
boolean
>
(
false
)
// 是否显示 task 详情
const
isShowImageDetail
=
ref
<
boolean
>
(
false
)
// 是否显示 task 详情
const
showImageDetailId
=
ref
<
number
>
(
0
)
// 是否显示 task 详情
const
showImageDetailId
=
ref
<
number
>
(
0
)
// 是否显示 task 详情
...
@@ -57,14 +59,17 @@ const handlerDrawerOpen = async () => {
...
@@ -57,14 +59,17 @@ const handlerDrawerOpen = async () => {
/**
/**
* 获取 - image 列表
* 获取 - image 列表
*/
*/
const
getImageList
=
async
(
apply
:
boolean
=
false
)
=>
{
const
getImageList
=
async
(
apply
:
boolean
=
false
)
=>
{
imageTaskLoading
.
value
=
true
imageTaskLoading
.
value
=
true
try
{
try
{
imageTaskLoadingInstance
.
value
=
ElLoading
.
service
({
imageTaskLoadingInstance
.
value
=
ElLoading
.
service
({
target
:
imageTaskRef
.
value
,
target
:
imageTaskRef
.
value
,
text
:
'加载中...'
text
:
'加载中...'
}
as
LoadingOptionsResolved
)
}
as
LoadingOptionsResolved
)
const
{
list
,
total
}
=
await
ImageApi
.
getImagePageMy
({
pageNo
:
pageNo
.
value
,
pageSize
:
pageSize
.
value
})
const
{
list
,
total
}
=
await
ImageApi
.
getImagePageMy
({
pageNo
:
pageNo
.
value
,
pageSize
:
pageSize
.
value
})
if
(
apply
)
{
if
(
apply
)
{
imageList
.
value
=
[...
imageList
.
value
,
...
list
]
imageList
.
value
=
[...
imageList
.
value
,
...
list
]
}
else
{
}
else
{
...
@@ -73,14 +78,14 @@ const getImageList = async (apply:boolean = false) => {
...
@@ -73,14 +78,14 @@ const getImageList = async (apply:boolean = false) => {
pageTotal
.
value
=
total
pageTotal
.
value
=
total
}
finally
{
}
finally
{
if
(
imageTaskLoadingInstance
.
value
)
{
if
(
imageTaskLoadingInstance
.
value
)
{
imageTaskLoadingInstance
.
value
.
close
()
;
imageTaskLoadingInstance
.
value
.
close
()
imageTaskLoadingInstance
.
value
=
null
;
imageTaskLoadingInstance
.
value
=
null
}
}
}
}
}
}
/** 图片 - btn click */
/** 图片 - btn click */
const
handlerImageBtnClick
=
async
(
type
,
imageDetail
:
Image
Resp
VO
)
=>
{
const
handlerImageBtnClick
=
async
(
type
,
imageDetail
:
ImageVO
)
=>
{
// 获取 image detail id
// 获取 image detail id
showImageDetailId
.
value
=
imageDetail
.
id
showImageDetailId
.
value
=
imageDetail
.
id
console
.
log
(
'type'
,
imageDetail
.
id
)
console
.
log
(
'type'
,
imageDetail
.
id
)
...
@@ -91,18 +96,18 @@ const handlerImageBtnClick = async (type, imageDetail: ImageRespVO) => {
...
@@ -91,18 +96,18 @@ const handlerImageBtnClick = async (type, imageDetail: ImageRespVO) => {
await
message
.
confirm
(
`是否删除照片?`
)
await
message
.
confirm
(
`是否删除照片?`
)
await
ImageApi
.
deleteImageMy
(
imageDetail
.
id
)
await
ImageApi
.
deleteImageMy
(
imageDetail
.
id
)
await
getImageList
()
await
getImageList
()
await
message
.
success
(
"删除成功!"
)
await
message
.
success
(
'删除成功!'
)
}
else
if
(
type
===
'download'
)
{
}
else
if
(
type
===
'download'
)
{
await
downloadImage
(
imageDetail
.
picUrl
)
await
downloadImage
(
imageDetail
.
picUrl
)
}
}
}
}
/** 图片 - mj btn click */
/** 图片 - mj btn click */
const
handlerImageMjBtnClick
=
async
(
button
:
ImageMjButtonsVO
,
imageDetail
:
Image
Resp
VO
)
=>
{
const
handlerImageMjBtnClick
=
async
(
button
:
ImageMjButtonsVO
,
imageDetail
:
ImageVO
)
=>
{
// 1、构建 params 参数
// 1、构建 params 参数
const
data
=
{
const
data
=
{
id
:
imageDetail
.
id
,
id
:
imageDetail
.
id
,
customId
:
button
.
customId
,
customId
:
button
.
customId
}
as
ImageMjActionVO
}
as
ImageMjActionVO
// 2、发送 action
// 2、发送 action
await
ImageApi
.
midjourneyAction
(
data
)
await
ImageApi
.
midjourneyAction
(
data
)
...
@@ -137,7 +142,7 @@ const handlerPageChange = async (page) => {
...
@@ -137,7 +142,7 @@ const handlerPageChange = async (page) => {
}
}
/** 暴露组件方法 */
/** 暴露组件方法 */
defineExpose
({
getImageList
})
defineExpose
({
getImageList
})
/** 组件挂在的时候 */
/** 组件挂在的时候 */
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -177,11 +182,11 @@ onUnmounted(async () => {
...
@@ -177,11 +182,11 @@ onUnmounted(async () => {
padding-bottom
:
140px
;
padding-bottom
:
140px
;
box-sizing
:
border-box
;
/* 确保内边距不会增加高度 */
box-sizing
:
border-box
;
/* 确保内边距不会增加高度 */
>div
{
>
div
{
margin-right
:
20px
;
margin-right
:
20px
;
margin-bottom
:
20px
;
margin-bottom
:
20px
;
}
}
>
div
:last-of-type
{
>
div
:last-of-type
{
//
margin-bottom
:
100px
;
//
margin-bottom
:
100px
;
}
}
}
}
...
@@ -199,7 +204,6 @@ onUnmounted(async () => {
...
@@ -199,7 +204,6 @@ onUnmounted(async () => {
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
}
}
</
style
>
</
style
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
src/views/ai/image/ImageTaskCard.vue
View file @
8d334764
...
@@ -8,22 +8,34 @@
...
@@ -8,22 +8,34 @@
</div>
</div>
<!-- TODO @fan:1)按钮要不调整成详情、下载、再次生成、删除?;2)如果是再次生成,就把当前的参数填写到左侧的框框里? -->
<!-- TODO @fan:1)按钮要不调整成详情、下载、再次生成、删除?;2)如果是再次生成,就把当前的参数填写到左侧的框框里? -->
<div>
<div>
<el-button
class=
"btn"
text
:icon=
"Download"
<el-button
@
click=
"handlerBtnClick('download', imageDetail)"
/>
class=
"btn"
<el-button
class=
"btn"
text
:icon=
"Delete"
@
click=
"handlerBtnClick('delete', imageDetail)"
/>
text
<el-button
class=
"btn"
text
:icon=
"More"
@
click=
"handlerBtnClick('more', imageDetail)"
/>
:icon=
"Download"
@
click=
"handlerBtnClick('download', imageDetail)"
/>
<el-button
class=
"btn"
text
:icon=
"Delete"
@
click=
"handlerBtnClick('delete', imageDetail)"
/>
<el-button
class=
"btn"
text
:icon=
"More"
@
click=
"handlerBtnClick('more', imageDetail)"
/>
</div>
</div>
</div>
</div>
<div
class=
"image-wrapper"
ref=
"cardImageRef"
>
<div
class=
"image-wrapper"
ref=
"cardImageRef"
>
<!-- TODO @fan:要不加个点击,大图预览? -->
<!-- TODO @fan:要不加个点击,大图预览? -->
<img
class=
"image"
:src=
"imageDetail?.picUrl"
/>
<img
class=
"image"
:src=
"imageDetail?.picUrl"
/>
<div
v-if=
"imageDetail?.status === 30"
>
{{
imageDetail
?.
errorMessage
}}
</div>
<div
v-if=
"imageDetail?.status === 30"
>
{{
imageDetail
?.
errorMessage
}}
</div>
</div>
</div>
<!-- TODO @fan:style 使用 unocss 替代下 -->
<!-- TODO @fan:style 使用 unocss 替代下 -->
<div
class=
"image-mj-btns"
>
<div
class=
"image-mj-btns"
>
<el-button
size=
"small"
v-for=
"button in imageDetail?.buttons"
:key=
"button"
<el-button
style=
"min-width: 40px;margin-left: 0; margin-right: 10px; margin-top: 5px;"
size=
"small"
@
click=
"handlerMjBtnClick(button)"
v-for=
"button in imageDetail?.buttons"
:key=
"button"
style=
"min-width: 40px; margin-left: 0; margin-right: 10px; margin-top: 5px"
@
click=
"handlerMjBtnClick(button)"
>
>
{{
button
.
label
}}{{
button
.
emoji
}}
{{
button
.
label
}}{{
button
.
emoji
}}
</el-button>
</el-button>
...
@@ -31,23 +43,23 @@
...
@@ -31,23 +43,23 @@
</el-card>
</el-card>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
Delete
,
Download
,
More
}
from
"@element-plus/icons-vue"
;
import
{
Delete
,
Download
,
More
}
from
'@element-plus/icons-vue'
import
{
ImageRespVO
,
ImageMjButtonsVO
}
from
"@/api/ai/image"
;
import
{
ImageVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
import
{
PropType
}
from
"vue"
;
import
{
PropType
}
from
'vue'
import
{
ElLoading
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElLoading
,
ElMessageBox
}
from
'element-plus'
const
cardImageRef
=
ref
<
any
>
()
// 卡片 image ref
const
cardImageRef
=
ref
<
any
>
()
// 卡片 image ref
const
cardImageLoadingInstance
=
ref
<
any
>
()
// 卡片 image ref
const
cardImageLoadingInstance
=
ref
<
any
>
()
// 卡片 image ref
const
message
=
useMessage
()
const
message
=
useMessage
()
const
props
=
defineProps
({
const
props
=
defineProps
({
imageDetail
:
{
imageDetail
:
{
type
:
Object
as
PropType
<
Image
Resp
VO
>
,
type
:
Object
as
PropType
<
ImageVO
>
,
require
:
true
require
:
true
}
}
})
})
/** 按钮 - 点击事件 */
/** 按钮 - 点击事件 */
const
handlerBtnClick
=
async
(
type
,
imageDetail
:
Image
Resp
VO
)
=>
{
const
handlerBtnClick
=
async
(
type
,
imageDetail
:
ImageVO
)
=>
{
emits
(
'onBtnClick'
,
type
,
imageDetail
)
emits
(
'onBtnClick'
,
type
,
imageDetail
)
}
}
...
@@ -60,8 +72,8 @@ const handlerLoading = async (status: number) => {
...
@@ -60,8 +72,8 @@ const handlerLoading = async (status: number) => {
})
})
}
else
{
}
else
{
if
(
cardImageLoadingInstance
.
value
)
{
if
(
cardImageLoadingInstance
.
value
)
{
cardImageLoadingInstance
.
value
.
close
()
;
cardImageLoadingInstance
.
value
.
close
()
cardImageLoadingInstance
.
value
=
null
;
cardImageLoadingInstance
.
value
=
null
}
}
}
}
}
}
...
@@ -89,7 +101,6 @@ onMounted(async () => {
...
@@ -89,7 +101,6 @@ onMounted(async () => {
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.image-card
{
.image-card
{
width
:
320px
;
width
:
320px
;
height
:
auto
;
height
:
auto
;
...
@@ -131,5 +142,4 @@ onMounted(async () => {
...
@@ -131,5 +142,4 @@ onMounted(async () => {
justify-content
:
flex-start
;
justify-content
:
flex-start
;
}
}
}
}
</
style
>
</
style
>
src/views/ai/image/manager/index.vue
View file @
8d334764
...
@@ -163,7 +163,7 @@
...
@@ -163,7 +163,7 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
getIntDictOptions
,
DICT_TYPE
,
getStrDictOptions
,
getBoolDictOptions
}
from
'@/utils/dict'
import
{
getIntDictOptions
,
DICT_TYPE
,
getStrDictOptions
,
getBoolDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
ImageApi
,
Image
Resp
VO
}
from
'@/api/ai/image'
import
{
ImageApi
,
ImageVO
}
from
'@/api/ai/image'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserApi
from
'@/api/system/user'
/** AI 绘画 列表 */
/** AI 绘画 列表 */
...
@@ -173,7 +173,7 @@ const message = useMessage() // 消息弹窗
...
@@ -173,7 +173,7 @@ const message = useMessage() // 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
const
loading
=
ref
(
true
)
// 列表的加载中
const
loading
=
ref
(
true
)
// 列表的加载中
const
list
=
ref
<
Image
Resp
VO
[]
>
([])
// 列表的数据
const
list
=
ref
<
ImageVO
[]
>
([])
// 列表的数据
const
total
=
ref
(
0
)
// 列表的总页数
const
total
=
ref
(
0
)
// 列表的总页数
const
queryParams
=
reactive
({
const
queryParams
=
reactive
({
pageNo
:
1
,
pageNo
:
1
,
...
@@ -225,7 +225,7 @@ const handleDelete = async (id: number) => {
...
@@ -225,7 +225,7 @@ const handleDelete = async (id: number) => {
}
}
/** 修改是否发布 */
/** 修改是否发布 */
const
handleUpdatePublicStatusChange
=
async
(
row
:
Image
Resp
VO
)
=>
{
const
handleUpdatePublicStatusChange
=
async
(
row
:
ImageVO
)
=>
{
try
{
try
{
// 修改状态的二次确认
// 修改状态的二次确认
const
text
=
row
.
publicStatus
?
'公开'
:
'私有'
const
text
=
row
.
publicStatus
?
'公开'
:
'私有'
...
...
src/views/ai/music/manager/index.vue
0 → 100644
View file @
8d334764
<
template
>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"用户编号"
prop=
"userId"
>
<el-input
v-model=
"queryParams.userId"
placeholder=
"请输入用户编号"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"音乐名称"
prop=
"title"
>
<el-input
v-model=
"queryParams.title"
placeholder=
"请输入音乐名称"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"音乐状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择音乐状态"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.AI_MUSIC_STATUS)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"生成模式"
prop=
"generateMode"
>
<el-input
v-model=
"queryParams.generateMode"
placeholder=
"请输入生成模式"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"daterange"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"是否发布"
prop=
"publicStatus"
>
<el-select
v-model=
"queryParams.publicStatus"
placeholder=
"请选择是否发布"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"true"
>
<el-table-column
label=
"编号"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"用户编号"
align=
"center"
prop=
"userId"
/>
<el-table-column
label=
"音乐名称"
align=
"center"
prop=
"title"
/>
<el-table-column
label=
"歌词"
align=
"center"
prop=
"lyric"
/>
<el-table-column
label=
"图片地址"
align=
"center"
prop=
"imageUrl"
/>
<el-table-column
label=
"音频地址"
align=
"center"
prop=
"audioUrl"
/>
<el-table-column
label=
"视频地址"
align=
"center"
prop=
"videoUrl"
/>
<el-table-column
label=
"音乐状态"
align=
"center"
prop=
"status"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.AI_MUSIC_STATUS"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"描述词"
align=
"center"
prop=
"gptDescriptionPrompt"
/>
<el-table-column
label=
"提示词"
align=
"center"
prop=
"prompt"
/>
<el-table-column
label=
"模型平台"
align=
"center"
prop=
"platform"
/>
<el-table-column
label=
"模型"
align=
"center"
prop=
"model"
/>
<el-table-column
label=
"生成模式"
align=
"center"
prop=
"generateMode"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.AI_GENERATE_MODE"
:value=
"scope.row.generateMode"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"音乐风格标签"
align=
"center"
prop=
"tags"
/>
<el-table-column
label=
"任务id"
align=
"center"
prop=
"taskId"
/>
<el-table-column
label=
"错误信息"
align=
"center"
prop=
"errorMessage"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"是否发布"
align=
"center"
prop=
"publicStatus"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.INFRA_BOOLEAN_STRING"
:value=
"scope.row.publicStatus"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['ai:music:delete']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
import
{
getIntDictOptions
,
getBoolDictOptions
,
DICT_TYPE
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
MusicApi
,
MusicVO
}
from
'@/api/ai/music'
/** AI 音乐 列表 */
defineOptions
({
name
:
'AiMusicManager'
})
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
loading
=
ref
(
true
)
// 列表的加载中
const
list
=
ref
<
MusicVO
[]
>
([])
// 列表的数据
const
total
=
ref
(
0
)
// 列表的总页数
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
userId
:
undefined
,
title
:
undefined
,
status
:
undefined
,
generateMode
:
undefined
,
createTime
:
[],
publicStatus
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
MusicApi
.
getMusicPage
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
loading
.
value
=
false
}
}
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
getList
()
}
/** 重置按钮操作 */
const
resetQuery
=
()
=>
{
queryFormRef
.
value
.
resetFields
()
handleQuery
()
}
/** 删除按钮操作 */
const
handleDelete
=
async
(
id
:
number
)
=>
{
try
{
// 删除的二次确认
await
message
.
delConfirm
()
// 发起删除
await
MusicApi
.
deleteMusic
(
id
)
message
.
success
(
t
(
'common.delSuccess'
))
// 刷新列表
await
getList
()
}
catch
{}
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
})
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment