修改短视频兼容nvue

master
于肖磊 2026-03-12 14:13:17 +08:00
parent 05d2a0dd70
commit 35d74f55d1
2 changed files with 357 additions and 354 deletions

View File

@ -0,0 +1,344 @@
.content {
background: #000;
}
.swiper-container {
width: 100vw;
height: 100vh;
}
.play-icon {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}
.play-icon-bg {
position: absolute;
background: #fff;
width: 60rpx;
height: 60rpx;
z-index: 0;
}
.right-actions {
position: absolute;
right: 20rpx;
bottom: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
color: #fff;
z-index: 10;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 40rpx;
}
.icon {
width: 70rpx;
height: 70rpx;
}
.action-text {
font-size: 28rpx;
color: #fff;
margin-top: 10rpx;
}
.product-card {
position: absolute;
width: 440rpx;
bottom: 180rpx;
left: 30rpx;
color: #fff;
z-index: 99;
}
.product-card-item {
background: #DDDDDD;
padding: 16rpx;
border-radius: 8rpx;
}
.product-name {
font-weight: 500;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
}
.product-price {
font-weight: 500;
font-size: 32rpx;
color: #FF1919;
line-height: 44rpx;
}
.product-close {
position: absolute;
right: -20rpx;
top: -26rpx;
}
.product-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 300rpx;
height: 88rpx;
padding: 0 20rpx;
background: rgba(40, 40, 40, 0.45);
border-radius: 88rpx;
border: 2rpx solid rgba(151, 151, 151, 0.53);
cursor: pointer;
}
.author {
font-size: 36rpx;
font-weight: bold;
}
::v-deep .uni-video-container {
background: transparent;
}
.video-bg {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
background: #000;
background-size: cover;
background-position: center;
transform: scale(3);
filter: blur(100rpx);
opacity: 0.7;
}
.video-mask {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
background: transparent;
}
.video-content {
display: block;
font-size: 30rpx;
margin-top: 16rpx;
max-width: 70%;
}
.progress-bar-container {
position: absolute;
bottom: 60rpx;
left: 20rpx;
right: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
z-index: 11;
}
.progress-slider {
flex: 1;
margin: 0 20rpx;
}
.time-display {
color: #fff;
font-size: 24rpx;
text-shadow: 2rpx 2rpx 2rpx rgba(0, 0, 0, 0.6);
width: 180rpx;
text-align: right;
}
/* 评论弹窗样式 */
.comment-modal {
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-end;
}
.comment-content {
background-color: #fff;
border-top-left-radius: 30rpx;
border-top-right-radius: 30rpx;
display: flex;
flex-direction: column;
}
.comment-header {
padding: 30rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #eee;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.comment-count {
font-weight: bold;
font-size: 32rpx;
}
.close-btn {
font-size: 40rpx;
color: #999;
}
.comment-list {
flex: 1;
overflow: hidden;
}
.comment-scroll {
padding: 30rpx;
box-sizing: border-box;
}
.comment-item {
margin-bottom: 30rpx;
}
.sub-comment {
margin-left: 100rpx;
}
.sub-comment-list {
gap: 40rpx;
}
.comment-input-container {
display: flex;
flex-direction: row;
padding: 20rpx;
border-top: 2rpx solid #eee;
}
.comment-input {
flex: 1;
font-size: 28rpx;
height: 82rpx;
padding: 16rpx;
box-sizing: border-box;
}
.comment-input-content {
flex: 1;
border: 2rpx solid #eee;
border-radius: 16rpx;
font-size: 28rpx;
}
.pr-16 {
padding-right: 16rpx;
}
.comment-input-img-container {
padding: 10rpx 16rpx 16rpx 16rpx;
}
.comment-input-img-close {
position: absolute;
right: -15rpx;
top: -15rpx;
z-index: 2;
}
.comment-input-img {
width: 50rpx;
height: 50rpx;
}
/* 新的举报弹窗样式 */
.report-content {
width: 750rpx;
max-width: 750rpx;
background-color: #fff;
border-radius: 20rpx;
}
.report-header {
padding: 30rpx 40rpx;
border-bottom: 1rpx solid #ddd;
background-color: #fff;
}
.report-btn {
font-size: 32rpx;
color: #333;
}
.report-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
color: #333;
}
.report-body {
padding: 30rpx 40rpx;
}
.report-section {
margin-bottom: 30rpx;
}
.report-label {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #333;
}
.report-required {
color: #e74c3c;
font-size: 30rpx;
vertical-align: middle;
}
/* 搜索 */
.header-top {
padding-left: 24rpx;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
z-index: 9;
}
.header-top ::v-deep .search-bar {
background:#D8D8D8;
opacity: 0.27;
border-color: transparent;
}
.keyboard-input {
position: fixed;
left: 0;
z-index: 99;
background: #fff;
padding: 20rpx;
box-sizing: border-box;
}
.keyboard-input-border {
border: 2rpx solid #ddd;
border-radius: 16rpx;
}
.keyboard-input-content {
padding: 16rpx 22rpx;
}
.comment-reply-content {
background-color: rgba(0, 0, 0, 0.6);
padding: 10rpx;
border-radius: 16rpx;
color: #fff;
}

View File

@ -2,7 +2,7 @@
<view :class="theme_view" :style="width_height_style">
<view v-if="display_video_list && display_video_list.length > 0" class="content pr" :style="width_height_style">
<!-- 视频列表 -->
<swiper class="swiper-container" :key="'top-or-buttom-' + swiper_key" :style="width_height_style + swiperStyle" :duration="500" :vertical="true" :circular="false" :skip-hidden-item-layout="true" :current="current_index" easing-function="linear" @transition="on_transition" @change="handle_swiper_change">
<swiper class="swiper-container" :key="'top-or-buttom-' + swiper_key" :style="width_height_style + swiperStyle" :duration="300" :vertical="true" :circular="false" :skip-hidden-item-layout="true" :current="current_index" easing-function="linear" @transition="on_transition" @change="handle_swiper_change">
<swiper-item v-for="(video_item, index) in display_video_list" :key="video_item.id" :style="width_height_style">
<view class="pr" @tap.stop="toggle_play_pause" :style="width_height_style" @touchstart.prevent="handle_swiper_touch_start" @touchmove.prevent="handle_swiper_touch_move" @touchend="handle_swiper_touch_end">
<view class="video-bg" :style="(!isEmpty(video_item.cover) ? 'background-image: url(' + video_item.cover + ')' : '') + width_height_style"></view>
@ -888,23 +888,23 @@
const list = this.update_video_list([0, 1, 2]);
this.is_slide_start = false;
this.current_index = 0;
this.current_index = 0;
// this.swiper_key = get_math();
// 刷新数据
this.update_display_video_list(list);
} else if (this.current_video_index == this.video_data_list.length - 1) {
const list = this.update_video_list([-2, -1, 0]);
this.current_index = list.length - 1;
this.current_index = list.length - 1;
// this.swiper_key = get_math();
// 刷新数据
this.update_display_video_list(list);
} else {
this.is_slide_start = true;
this.is_slide_start = true;
// this.swiper_key = get_math();
this.update_display_data();
}
// 更新分享信息
this.update_share_info(this.display_video_list[current]);
this.update_share_info(this.display_video_list[current]);
this.swiper_key = get_math();
// 延迟播放当前视频确保DOM更新完成
setTimeout(() => {
@ -1004,8 +1004,8 @@
this.display_video_list.splice(0, this.display_video_list.length)
} else {
this.display_video_list = [];
}
// this.display_video_list.splice(0, this.display_video_list.length, ...list);
}
// this.display_video_list.splice(0, this.display_video_list.length, ...list);
// this.$nextTick(() => {
// setTimeout(() => {
@ -1110,11 +1110,11 @@
}
} else if (this.current_index == 1) { // 索引为1时为确保无限轮播正常需要改变数据插入顺序
list = this.update_video_list([-1, 0, 1]);
} else {
if (this.current_video_index == this.video_data_list.length - 1) {
list = this.update_video_list([-2, -1, 0]);
} else {
list = this.update_video_list([1, -1, 0]);
} else {
if (this.current_video_index == this.video_data_list.length - 1) {
list = this.update_video_list([-2, -1, 0]);
} else {
list = this.update_video_list([1, -1, 0]);
}
}
// 刷新数据
@ -2110,346 +2110,5 @@
};
</script>
<style lang="scss" scoped>
.swiper-container {
width: 100vw;
height: 100vh;
}
.play-icon {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}
.play-icon-bg {
position: absolute;
background: #fff;
width: 60rpx;
height: 60rpx;
z-index: 0;
}
.right-actions {
position: absolute;
right: 20rpx;
bottom: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
color: #fff;
z-index: 10;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 40rpx;
}
.icon {
width: 70rpx;
height: 70rpx;
}
.action-text {
font-size: 28rpx;
color: #fff;
margin-top: 10rpx;
}
.product-card {
position: absolute;
width: 440rpx;
bottom: 180rpx;
left: 30rpx;
color: #fff;
z-index: 99;
}
.product-card-item {
background: #DDDDDD;
padding: 16rpx;
border-radius: 8rpx;
}
.product-name {
font-weight: 500;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
}
.product-price {
font-weight: 500;
font-size: 32rpx;
color: #FF1919;
line-height: 44rpx;
}
.product-close {
position: absolute;
right: -20rpx;
top: -26rpx;
}
.product-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 300rpx;
height: 88rpx;
padding: 0 20rpx;
background: rgba(40, 40, 40, 0.45);
border-radius: 88rpx;
border: 2rpx solid rgba(151, 151, 151, 0.53);
cursor: pointer;
}
.author {
font-size: 36rpx;
font-weight: bold;
}
::v-deep .uni-video-container {
background: transparent;
}
.video-bg {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
background: #000;
background-size: cover;
background-position: center;
transform: scale(3);
filter: blur(100rpx);
opacity: 0.7;
}
.video-mask {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
background: transparent;
}
.video-content {
display: block;
font-size: 30rpx;
margin-top: 16rpx;
max-width: 70%;
}
.progress-bar-container {
position: absolute;
bottom: 60rpx;
left: 20rpx;
right: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
z-index: 11;
}
.progress-slider {
flex: 1;
margin: 0 20rpx;
}
.time-display {
color: #fff;
font-size: 24rpx;
text-shadow: 2rpx 2rpx 2rpx rgba(0, 0, 0, 0.6);
width: 180rpx;
text-align: right;
}
/* 评论弹窗样式 */
.comment-modal {
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-end;
}
.comment-content {
background-color: #fff;
border-top-left-radius: 30rpx;
border-top-right-radius: 30rpx;
display: flex;
flex-direction: column;
}
.comment-header {
padding: 30rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #eee;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.comment-count {
font-weight: bold;
font-size: 32rpx;
}
.close-btn {
font-size: 40rpx;
color: #999;
}
.comment-list {
flex: 1;
overflow: hidden;
}
.comment-scroll {
padding: 30rpx;
box-sizing: border-box;
}
.comment-item {
margin-bottom: 30rpx;
}
.sub-comment {
margin-left: 100rpx;
}
.sub-comment-list {
gap: 40rpx;
}
.comment-input-container {
display: flex;
flex-direction: row;
padding: 20rpx;
border-top: 2rpx solid #eee;
}
.comment-input {
flex: 1;
font-size: 28rpx;
height: 82rpx;
padding: 16rpx;
box-sizing: border-box;
}
.comment-input-content {
flex: 1;
border: 2rpx solid #eee;
border-radius: 16rpx;
font-size: 28rpx;
}
.pr-16 {
padding-right: 16rpx;
}
.comment-input-img-container {
padding: 10rpx 16rpx 16rpx 16rpx;
}
.comment-input-img-close {
position: absolute;
right: -15rpx;
top: -15rpx;
z-index: 2;
}
.comment-input-img {
width: 50rpx;
height: 50rpx;
}
/* 新的举报弹窗样式 */
.report-content {
width: 750rpx;
max-width: 750rpx;
background-color: #fff;
border-radius: 20rpx;
}
.report-header {
padding: 30rpx 40rpx;
border-bottom: 1rpx solid #ddd;
background-color: #fff;
}
.report-btn {
font-size: 32rpx;
color: #333;
}
.report-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
color: #333;
}
.report-body {
padding: 30rpx 40rpx;
}
.report-section {
margin-bottom: 30rpx;
}
.report-label {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #333;
}
.report-required {
color: #e74c3c;
font-size: 30rpx;
vertical-align: middle;
}
/* 搜索 */
.header-top {
padding-left: 24rpx;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
z-index: 9;
// width: 100%;
}
.header-top ::v-deep .search-bar {
background:#D8D8D8;
opacity: 0.27;
border-color: transparent;
}
.keyboard-input {
position: fixed;
left: 0;
z-index: 99;
background: #fff;
padding: 20rpx;
box-sizing: border-box;
}
.keyboard-input-border {
border: 2rpx solid #ddd;
border-radius: 16rpx;
}
.keyboard-input-content {
padding: 16rpx 22rpx;
}
.comment-reply-content {
background-color: rgba(0, 0, 0, 0.6);
padding: 10rpx;
border-radius: 16rpx;
color: #fff;
}
@import './detail.css';
</style>