Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
zxn-adputin
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lijin
zxn-adputin
Commits
05575d85
Commit
05575d85
authored
Dec 23, 2024
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加youtube视频
parent
e3c503d5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
201 additions
and
314 deletions
+201
-314
cloud.js
src/api/cloud.js
+5
-5
ImageUploader.vue
src/views/createDelivery/childComponents/ImageUploader.vue
+0
-1
YouTubeVideoInput.vue
...iews/createDelivery/childComponents/YouTubeVideoInput.vue
+184
-0
index.vue
src/views/createDelivery/index.vue
+12
-308
No files found.
src/api/cloud.js
View file @
05575d85
...
...
@@ -183,11 +183,11 @@ export function getSelectApps(params) {
/* 获取投放任务列表*/
export
function
putinFetchPutinTasks
(
params
)
{
return
request
({
url
:
process
.
env
.
PUTIN_API
+
"/putin/fetch/putin/tasks"
,
method
:
"GET"
,
params
});
//
return request({
//
url: process.env.PUTIN_API + "/putin/fetch/putin/tasks",
//
method: "GET",
//
params
//
});
}
/* 获取创意素材库列表 */
...
...
src/views/createDelivery/childComponents/ImageUploader.vue
View file @
05575d85
<
template
>
<div
class=
"el-image-uploader"
>
图片上传组件
<el-upload
ref=
"upload"
action
...
...
src/views/createDelivery/childComponents/YouTubeVideoInput.vue
0 → 100644
View file @
05575d85
<
template
>
<div
class=
"youtube-video-input"
>
<!-- 视频链接输入区域 -->
<el-input
v-model=
"currentInput"
placeholder=
"请输入YouTube视频链接,按Enter添加多个"
@
blur=
"handleInputBlur"
@
keyup
.
enter
.
native=
"handleEnter"
clearable
>
<el-button
slot=
"append"
@
click=
"handleEnter"
:disabled=
"!currentInput"
>
添加
</el-button>
</el-input>
<!-- 视频预览列表 -->
<el-row
:gutter=
"20"
class=
"video-list"
v-if=
"videoList.length > 0"
>
<el-col
:span=
"8"
v-for=
"(video, index) in videoList"
:key=
"index"
class=
"video-item mt-20"
>
<el-card
shadow=
"hover"
>
<!-- 使用 vue-core-video-player 播放 YouTube 视频 -->
<div
class=
"video-player-container"
>
<vue-core-video-player
:src=
"video.url"
:autoplay=
"false"
:controls=
"true"
:loop=
"false"
:muted=
"true"
:volume=
"0.6"
/>
</div>
<!-- 视频信息和操作区 -->
<div
class=
"video-info mt-10"
>
<el-tooltip
:content=
"video.url"
placement=
"top"
>
<div
class=
"video-url text-truncate"
>
{{
video
.
url
}}
</div>
</el-tooltip>
<el-button
type=
"danger"
size=
"mini"
icon=
"el-icon-delete"
@
click=
"removeVideo(index)"
class=
"mt-10"
>
删除
</el-button>
</div>
</el-card>
</el-col>
</el-row>
<!-- 空状态 -->
<el-empty
v-else
description=
"还没有添加视频,请输入YouTube视频链接"
class=
"mt-20"
></el-empty>
</div>
</
template
>
<
script
>
export
default
{
name
:
'YouTubeVideoInput'
,
props
:
{
value
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
return
{
currentInput
:
''
,
videoList
:
[]
}
},
watch
:
{
value
:
{
handler
(
newVal
)
{
if
(
JSON
.
stringify
(
newVal
)
!==
JSON
.
stringify
(
this
.
videoList
))
{
this
.
videoList
=
newVal
.
map
(
url
=>
({
url
:
this
.
getEmbedUrl
(
url
),
originalUrl
:
url
}))
}
},
immediate
:
true
},
videoList
:
{
handler
(
newVal
)
{
this
.
$emit
(
'input'
,
newVal
.
map
(
video
=>
video
.
originalUrl
))
},
deep
:
true
}
},
methods
:
{
handleInputBlur
()
{
if
(
this
.
currentInput
.
trim
())
{
this
.
addVideo
(
this
.
currentInput
)
}
},
handleEnter
()
{
if
(
this
.
currentInput
.
trim
())
{
this
.
addVideo
(
this
.
currentInput
)
}
},
addVideo
(
url
)
{
const
videoId
=
this
.
extractVideoId
(
url
)
if
(
videoId
)
{
const
embedUrl
=
this
.
getEmbedUrl
(
url
)
this
.
videoList
.
push
({
url
:
embedUrl
,
originalUrl
:
url
.
trim
()
})
this
.
currentInput
=
''
this
.
$message
.
success
(
'视频添加成功'
)
}
else
{
this
.
$message
.
error
(
'请输入有效的YouTube视频链接'
)
}
},
removeVideo
(
index
)
{
this
.
$confirm
(
'确定要删除这个视频吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
this
.
videoList
.
splice
(
index
,
1
)
this
.
$message
.
success
(
'删除成功'
)
}).
catch
(()
=>
{})
},
extractVideoId
(
url
)
{
const
regExp
=
/^.*
(
youtu.be
\/
|v
\/
|u
\/\w\/
|embed
\/
|watch
\?
v=|&v=
)([^
#&?
]
*
)
.*/
const
match
=
url
.
match
(
regExp
)
return
(
match
&&
match
[
2
].
length
===
11
)
?
match
[
2
]
:
null
},
getEmbedUrl
(
url
)
{
const
videoId
=
this
.
extractVideoId
(
url
)
return
videoId
?
`https://www.youtube.com/embed/
${
videoId
}
`
:
''
}
}
}
</
script
>
<
style
scoped
>
.youtube-video-input
{
width
:
100%
;
max-width
:
1200px
;
margin
:
0
auto
;
}
.video-player-container
{
aspect-ratio
:
16
/
9
;
width
:
100%
;
background
:
#000
;
}
.video-url
{
font-size
:
12px
;
color
:
#606266
;
margin
:
8px
0
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.mt-10
{
margin-top
:
10px
;
}
.mt-20
{
margin-top
:
20px
;
}
.text-truncate
{
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
</
style
>
src/views/createDelivery/index.vue
View file @
05575d85
This diff is collapsed.
Click to expand it.
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