Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ai_web_page_prod
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
ai_web_page_prod
Commits
abe7f348
Commit
abe7f348
authored
Jun 02, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
13a1c150
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
28 deletions
+152
-28
src/components/Admin/PageEdit.vue
+3
-1
src/components/Admin/StartBroadcast.vue
+120
-18
src/components/Admin/button.vue
+3
-0
src/pages/AILiveStreaming/LiveStreamDetail/index.vue
+8
-1
src/utils/api/ai.ts
+18
-0
vite.config.ts
+0
-8
No files found.
src/components/Admin/PageEdit.vue
View file @
abe7f348
...
@@ -144,7 +144,9 @@
...
@@ -144,7 +144,9 @@
<GenerateVoice
:list=
"form.conversion.list"
></GenerateVoice>
<GenerateVoice
:list=
"form.conversion.list"
></GenerateVoice>
</template>
</template>
<
template
v-if=
"form.start_broadcast"
>
<
template
v-if=
"form.start_broadcast"
>
<StartBroadcast
:status=
"'not_on_air'"
></StartBroadcast>
<StartBroadcast
:start_broadcast=
"form.start_broadcast"
></StartBroadcast>
</
template
>
</
template
>
<
template
v-if=
"form.is_send"
>
<
template
v-if=
"form.is_send"
>
<div
class=
"custom-send-box"
>
<div
class=
"custom-send-box"
>
...
...
src/components/Admin/StartBroadcast.vue
View file @
abe7f348
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
<div
class=
"admin-start-broadcast"
>
<div
class=
"admin-start-broadcast"
>
<CustomButton
<CustomButton
@
click=
"onClose"
@
click=
"onClose"
:loading=
"CloseLoading"
:class=
"[
:class=
"[
'live-stream--default',
'live-stream--default',
BroadcastStatus == 'not_on_air' ? 'close-live-stream--disabled' : '',
'live-stream--close',
BroadcastStatus == 'air_success' ? 'can-close-live-stream' : '',
CanAvailableAir() ? 'close-live-stream--disabled' : '',
BroadcastStatus == '2' ? 'can-close-live-stream' : '',
]"
]"
>
>
关播
关播
...
@@ -18,10 +20,12 @@
...
@@ -18,10 +20,12 @@
<!-- -->
<!-- -->
<CustomButton
<CustomButton
@
click=
"onStart"
@
click=
"onStart"
:loading=
"StartLoading"
:class=
"[
:class=
"[
'live-stream--default',
'live-stream--default',
BroadcastStatus == 'not_on_air' ? 'start-not-air' : '',
'live-stream--start',
BroadcastStatus == 'air_success' ? 'start-not-air--success' : '',
CanAvailableAir() ? 'start-not-air' : '',
BroadcastStatus == '2' ? 'start-not-air--success' : '',
]"
]"
>
>
{{ StartLiveStreamText() }}
{{ StartLiveStreamText() }}
...
@@ -35,50 +39,114 @@
...
@@ -35,50 +39,114 @@
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
;
import
{
ref
,
watch
}
from
'vue'
;
import
CustomButton
from
'./button.vue'
;
import
CustomButton
from
'./button.vue'
;
import
CloseSvg
from
'@/assets/svg/form/close.svg'
;
import
CloseSvg
from
'@/assets/svg/form/close.svg'
;
import
StartLiveStreamSvg
from
'@/assets/svg/form/startLiveStream.svg'
;
import
StartLiveStreamSvg
from
'@/assets/svg/form/startLiveStream.svg'
;
import
{
show_message
}
from
'@/utils/tdesign_tool'
;
import
{
VoicesStopLive
,
VoicesStartLive
}
from
'@/utils/api/ai'
;
import
{
useRouter
}
from
'vue-router'
;
const
props
=
withDefaults
(
const
props
=
withDefaults
(
defineProps
<
{
defineProps
<
{
sta
tus
:
string
;
sta
rt_broadcast
:
any
;
}
>
(),
}
>
(),
{}
{}
);
);
const
emit
=
defineEmits
([
'update:modelValue'
]
);
const
router
=
useRouter
(
);
/**
/**
* 开播状态
* 开播状态
* not_on_air-未开播
* air_success - 已开播
*/
*/
const
BroadcastStatus
=
ref
<
'not_on_air'
|
'air_success'
>
(
'not_on_air'
);
const
BroadcastStatus
=
ref
(
props
.
start_broadcast
.
status
?
props
.
start_broadcast
.
status
:
'1'
);
// 关播按钮loading
// 关播按钮loading
const
CloseLoading
=
ref
(
false
);
const
CloseLoading
=
ref
(
false
);
// 开播按钮loading
// 开播按钮loading
const
StartLoading
=
ref
(
false
);
const
StartLoading
=
ref
(
false
);
// 是否可以开播
const
CanAvailableAir
=
()
=>
{
const
list
=
[
'1'
,
'3'
];
return
list
.
includes
(
BroadcastStatus
.
value
);
};
watch
(
props
.
start_broadcast
,
(
v
)
=>
{
if
(
v
&&
v
.
status
)
{
BroadcastStatus
.
value
=
v
.
status
;
}
});
// 开播按钮显示的文字
// 开播按钮显示的文字
const
StartLiveStreamText
=
()
=>
{
const
StartLiveStreamText
=
()
=>
{
if
(
BroadcastStatus
.
value
==
'not_on_air'
)
{
if
(
CanAvailableAir
()
)
{
return
'开播'
;
return
'开播'
;
}
else
if
(
BroadcastStatus
.
value
==
'
air_success
'
)
{
}
else
if
(
BroadcastStatus
.
value
==
'
2
'
)
{
return
'开播中'
;
return
'开播中'
;
}
}
return
'开播'
;
return
'开播'
;
};
};
// 开关播提交前校验
const
beforeSubmit
=
()
=>
{
const
{
row
}
=
props
.
start_broadcast
;
if
(
!
row
.
hash
||
!
row
.
live_link
)
{
show_message
(
'缺少参数'
);
return
false
;
}
return
{
hash
:
row
.
hash
,
live_link
:
row
.
live_link
,
};
};
// 回到列表页
const
goBack
=
()
=>
{
router
.
replace
({
path
:
'/AILiveStreaming/LiveStream'
,
});
};
// 关播
// 关播
const
onClose
=
()
=>
{
const
onClose
=
async
()
=>
{
if
(
BroadcastStatus
.
value
==
'
air_success
'
)
{
if
(
BroadcastStatus
.
value
==
'
2
'
)
{
// 开播成功才可以关闭
// 开播成功才可以关闭
try
{
const
params
=
beforeSubmit
();
if
(
!
params
)
{
return
;
}
CloseLoading
.
value
=
true
;
const
res
:
any
=
await
VoicesStopLive
(
params
);
if
(
res
.
code
==
0
)
{
show_message
(
'已关播'
,
'success'
);
goBack
();
}
CloseLoading
.
value
=
false
;
}
catch
(
e
)
{
console
.
log
(
e
);
CloseLoading
.
value
=
false
;
}
}
}
};
};
// 开播
// 开播
const
onStart
=
()
=>
{
const
onStart
=
async
()
=>
{
if
(
BroadcastStatus
.
value
==
'not_on_air'
)
{
if
(
CanAvailableAir
())
{
// 未开播才可以开播
try
{
console
.
log
(
'可以开播'
);
const
params
=
beforeSubmit
();
if
(
!
params
)
{
return
;
}
StartLoading
.
value
=
true
;
const
res
:
any
=
await
VoicesStartLive
(
params
);
if
(
res
.
code
==
0
)
{
show_message
(
'已开播'
,
'success'
);
goBack
();
}
StartLoading
.
value
=
false
;
}
catch
(
e
)
{
console
.
log
(
e
);
StartLoading
.
value
=
false
;
}
}
}
};
};
</
script
>
</
script
>
...
@@ -111,6 +179,39 @@ const onStart = () => {
...
@@ -111,6 +179,39 @@ const onStart = () => {
}
}
}
}
}
}
//
开
.live-stream--start.t-is-loading
{
background-color
:
unset
;
border-color
:
unset
;
&:hover
{
border-color
:
#00dddd
;
color
:
#00dddd
;
}
.t-loading__gradient-conic
{
background
:
conic-gradient
(
from
90deg
at
50%
50%
,
rgba
(
0
,
0
,
0
,
0
)
0deg
,
#00dddd
360deg
)
!important
;
}
}
//
关
.live-stream--close.t-is-loading
{
background-color
:
unset
;
border-color
:
unset
;
&:hover
{
border-color
:
#e5404f
;
color
:
#e5404f
;
background
:
unset
;
}
.t-loading__gradient-conic
{
background
:
conic-gradient
(
from
90deg
at
50%
50%
,
rgba
(
0
,
0
,
0
,
0
)
0deg
,
#e5404f
360deg
)
!important
;
}
}
//
禁止点击
//
禁止点击
.close-live-stream--disabled
{
.close-live-stream--disabled
{
border
:
1px
solid
#8e8e8e
;
border
:
1px
solid
#8e8e8e
;
...
@@ -164,6 +265,7 @@ const onStart = () => {
...
@@ -164,6 +265,7 @@ const onStart = () => {
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
background
:
#00dddd
;
background
:
#00dddd
;
color
:
black
;
color
:
black
;
cursor
:
not-allowed
;
.start-broadcast-icon
{
.start-broadcast-icon
{
svg
{
svg
{
fill
:
black
;
fill
:
black
;
...
...
src/components/Admin/button.vue
View file @
abe7f348
<
template
>
<
template
>
<TButton
<TButton
class=
"custom-admin-button"
class=
"custom-admin-button"
:loading=
"loading"
:style=
"
{
:style=
"
{
width: width,
width: width,
background: bk,
background: bk,
...
@@ -23,10 +24,12 @@ const props = withDefaults(
...
@@ -23,10 +24,12 @@ const props = withDefaults(
width
?:
string
;
width
?:
string
;
bold
?:
boolean
;
bold
?:
boolean
;
bk
?:
string
;
bk
?:
string
;
loading
?:
boolean
;
}
>
(),
}
>
(),
{
{
width
:
''
,
width
:
''
,
bk
:
''
,
bk
:
''
,
loading
:
false
,
}
}
);
);
</
script
>
</
script
>
...
...
src/pages/AILiveStreaming/LiveStreamDetail/index.vue
View file @
abe7f348
...
@@ -17,6 +17,11 @@ const imgs = {
...
@@ -17,6 +17,11 @@ const imgs = {
};
};
const
cur_id
=
ref
(
''
);
const
cur_id
=
ref
(
''
);
const
cur_hash
=
ref
(
''
);
const
cur_hash
=
ref
(
''
);
const
start_broadcast
=
ref
({
show
:
true
,
status
:
''
,
row
:
{},
});
// 查看页面
// 查看页面
const
ManagementForm
=
reactive
({
const
ManagementForm
=
reactive
({
title
:
'直播管理'
,
title
:
'直播管理'
,
...
@@ -37,7 +42,7 @@ const ManagementForm = reactive({
...
@@ -37,7 +42,7 @@ const ManagementForm = reactive({
// 播放音频
// 播放音频
play_audio
:
false
,
play_audio
:
false
,
// 开播按钮
// 开播按钮
start_broadcast
:
tr
ue
,
start_broadcast
:
start_broadcast
.
val
ue
,
form_options
:
[
form_options
:
[
{
{
icon
:
imgs
.
fill
,
icon
:
imgs
.
fill
,
...
@@ -157,6 +162,8 @@ onBeforeMount(async () => {
...
@@ -157,6 +162,8 @@ onBeforeMount(async () => {
cur_id
.
value
=
row
.
id
;
cur_id
.
value
=
row
.
id
;
cur_hash
.
value
=
row
.
hash
;
cur_hash
.
value
=
row
.
hash
;
start_broadcast
.
value
.
status
=
row
.
status
;
start_broadcast
.
value
.
row
=
row
;
});
});
</
script
>
</
script
>
...
...
src/utils/api/ai.ts
View file @
abe7f348
...
@@ -250,6 +250,24 @@ export const LiveStreamTaskManual = (data: any) => {
...
@@ -250,6 +250,24 @@ export const LiveStreamTaskManual = (data: any) => {
});
});
};
};
// 开播
export
const
VoicesStartLive
=
(
data
:
any
)
=>
{
return
request
.
post
(
'/api/voices/start-live'
,
data
,
{
headers
:
{
authorization
:
`Bearer
${
getUserCookie
()}
`
,
},
});
};
// 关播
export
const
VoicesStopLive
=
(
data
:
any
)
=>
{
return
request
.
post
(
'/api/voices/stop-live'
,
data
,
{
headers
:
{
authorization
:
`Bearer
${
getUserCookie
()}
`
,
},
});
};
/**
/**
* 直播管理 end
* 直播管理 end
*/
*/
vite.config.ts
View file @
abe7f348
...
@@ -31,14 +31,6 @@ export default defineConfig(({ mode }) => {
...
@@ -31,14 +31,6 @@ export default defineConfig(({ mode }) => {
host
:
'0.0.0.0'
,
host
:
'0.0.0.0'
,
proxy
:
{
proxy
:
{
'/api'
:
api
,
'/api'
:
api
,
'/video'
:
'http://192.168.1.19:5000'
,
'/files'
:
{
target
:
'https://chensav.oss-cn-shenzhen.aliyuncs.com'
,
// 代理的目标地址
changeOrigin
:
true
,
// 开发模式,默认的origin是真实的 origin:localhost:3000 代理服务会把origin修改为目标地址
// secure: true, // 是否https接口
// ws: true, // 是否代理websockets
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
files/
,
''
),
},
},
},
},
},
plugins
:
[
plugins
:
[
...
...
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