Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_vedio
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
uniapp_vedio
Commits
54356fc9
Commit
54356fc9
authored
Jun 07, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
da038380
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
34 deletions
+37
-34
recommendVideo.vue
vedio/components/home/recommendVideo.vue
+21
-34
home.vue
vedio/pages/home.vue
+16
-0
No files found.
vedio/components/home/recommendVideo.vue
View file @
54356fc9
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
duration=
"300"
>
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
duration=
"300"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
>
<view
v-if=
"Math.abs(displayIndex-index)==0"
style=
"height: 100%;"
@
click=
"tapVideoHover()"
>
<view
v-if=
"Math.abs(displayIndex-index)==0"
style=
"height: 100%;"
@
click=
"tapVideoHover()"
>
<tt-video-player
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"list.vedioId"
class=
"tsvideo"
<tt-video-player
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"
'remmend'+
list.vedioId"
class=
"tsvideo"
:album-id=
"list.douyinAlbumId"
:cover-id=
"list.douyinCoverId"
:episode-id=
"list.douyinEpisodeId"
:album-id=
"list.douyinAlbumId"
:cover-id=
"list.douyinCoverId"
:episode-id=
"list.douyinEpisodeId"
:cloud-type=
"1"
version=
"1"
object-fit=
"cover"
:controls=
"controls"
:poster=
"data.coverImage"
:cloud-type=
"1"
version=
"1"
object-fit=
"cover"
:controls=
"controls"
:poster=
"data.coverImage"
:loop=
"!isplay"
:autoplay=
"
tru
e"
:enable-progress-gesture=
"false"
:show-loading=
"true"
:loop=
"!isplay"
:autoplay=
"
fals
e"
:enable-progress-gesture=
"false"
:show-loading=
"true"
@
play=
"startPlay"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggl
e"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggle"
@
timeupdate=
"timeUpdat
e"
@
timeupdate=
"timeUpdate"
@
ended=
"ended"
>
@
ended=
"ended"
>
</tt-video-player>
</tt-video-player>
</view>
</view>
<view
v-if=
"!isqp"
class=
"userInfo flex"
>
<view
v-if=
"!isqp"
class=
"userInfo flex"
>
...
@@ -54,9 +54,8 @@
...
@@ -54,9 +54,8 @@
import
common
from
'@/mixins/common'
;
import
common
from
'@/mixins/common'
;
import
ttVideoPlayer
from
'@/ttcomponents/tt-video-player/index.js'
import
ttVideoPlayer
from
'@/ttcomponents/tt-video-player/index.js'
import
{
import
{
navigateTo
,
navigateTo
,
message
message
}
from
'@/utils/fun.js'
;
}
from
'@/utils/fun.js'
;
...
@@ -92,19 +91,12 @@
...
@@ -92,19 +91,12 @@
this
.
windowHeight
=
uni
.
getSystemInfoSync
().
windowHeight
this
.
windowHeight
=
uni
.
getSystemInfoSync
().
windowHeight
},
},
methods
:
{
methods
:
{
hide
()
{
try
{
this
.
$refs
.
recommendVideo
.
stop
();
}
catch
{
}
},
reShare
()
{
reShare
()
{
var
href
=
''
var
href
=
''
// #ifdef H5
// #ifdef H5
uni
.
setClipboardData
({
uni
.
setClipboardData
({
data
:
href
,
data
:
href
,
complete
()
{
complete
()
{
message
.
notify
(
"分享连接已复制到剪贴板"
)
message
.
notify
(
"分享连接已复制到剪贴板"
)
}
}
})
})
...
@@ -135,11 +127,13 @@
...
@@ -135,11 +127,13 @@
this
.
isFirstLoad
=
false
this
.
isFirstLoad
=
false
this
.
queryList
()
this
.
queryList
()
}
else
{
}
else
{
t
t
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioId
,
this
).
play
();
t
his
.
videoContext
.
play
()
}
}
},
},
stop
()
{
hide
()
{
tt
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioId
,
this
).
pause
();
if
(
this
.
videoContext
)
{
this
.
videoContext
.
pause
()
}
},
},
queryList
()
{
queryList
()
{
// 推荐
// 推荐
...
@@ -199,26 +193,19 @@
...
@@ -199,26 +193,19 @@
if
(
this
.
oid
<
0
)
{
if
(
this
.
oid
<
0
)
{
this
.
oid
=
this
.
originList
.
length
-
1
this
.
oid
=
this
.
originList
.
length
-
1
}
}
// console.log('++++++++++++上一条播放数据 Index:', this.oid)
// // audo.pause()
// this.videoContext = uni.createVideoContext("" + this.originList[this.oid].vedioId, this)
// this.videoContext.pause()
// this.videoContext.stop()
console
.
log
(
'++++++++++++上一条播放数据 Index:'
,
this
.
oid
)
console
.
log
(
'++++++++++++上一条播放数据 Index:'
,
this
.
oid
)
tt
.
createVideoContext
(
''
+
this
.
originList
[
this
.
oid
].
vedioId
,
this
).
pause
();
if
(
this
.
videoContext
)
{
this
.
videoContext
.
pause
()
this
.
videoContext
.
stop
()
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
log
(
'qqqqqq:'
,
this
.
originList
[
originIndex
].
vedioId
)
console
.
log
(
'qqqqqq:'
,
this
.
originList
[
originIndex
].
vedioId
)
t
t
.
createVideoContext
(
''
+
this
.
originList
[
originIndex
].
vedioId
,
this
).
play
();
t
his
.
videoContext
=
tt
.
createVideoContext
(
'remmend'
+
this
.
originList
[
originIndex
].
vedioId
)
// this.commitVideo
()
this
.
videoContext
.
play
()
},
500
)
},
500
)
// setTimeout(() => {
// console.log('qqqqqq:', this.originList[originIndex].vedioId)
// this.videoContext = uni.createVideoContext("" + this.originList[originIndex].vedioId, this)
// this.videoContext.play()
// }, 500)
var
pCount
=
this
.
originList
.
length
-
this
.
playCount
var
pCount
=
this
.
originList
.
length
-
this
.
playCount
if
(
originIndex
==
pCount
)
{
if
(
originIndex
==
pCount
)
{
this
.
queryList
()
this
.
queryList
()
...
@@ -273,8 +260,8 @@
...
@@ -273,8 +260,8 @@
showLoading
:
false
,
showLoading
:
false
,
success
:
({
success
:
({
data
data
})
=>
{
})
=>
{
message
.
notify
(
"收藏成功"
)
message
.
notify
(
"收藏成功"
)
}
}
});
});
},
},
...
@@ -289,8 +276,8 @@
...
@@ -289,8 +276,8 @@
showLoading
:
false
,
showLoading
:
false
,
success
:
({
success
:
({
data
data
})
=>
{
})
=>
{
message
.
notify
(
"取消收藏"
)
message
.
notify
(
"取消收藏"
)
}
}
});
});
},
},
...
...
vedio/pages/home.vue
View file @
54356fc9
...
@@ -155,6 +155,22 @@
...
@@ -155,6 +155,22 @@
// 渲染完成 初始化首页数据
// 渲染完成 初始化首页数据
this
.
loadComponentData
();
this
.
loadComponentData
();
},
},
onHide
()
{
try
{
// 在子组件重写show()代替onShow()
if
(
this
.
currentPage
==
0
)
{
this
.
$refs
.
index
.
hide
();
}
else
if
(
this
.
currentPage
==
1
)
{
this
.
$refs
.
recommend
.
hide
();
}
else
if
(
this
.
currentPage
==
2
)
{
this
.
$refs
.
follow
.
hide
();
}
else
if
(
this
.
currentPage
==
3
)
{
this
.
$refs
.
user
.
hide
();
}
}
catch
(
e
)
{
}
},
methods
:
{
methods
:
{
tabChange
(
index
)
{
tabChange
(
index
)
{
if
(
this
.
currentPage
==
index
)
return
if
(
this
.
currentPage
==
index
)
return
...
...
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