短视频样式细节优化
parent
1d1e552313
commit
c39d60a344
|
|
@ -147,7 +147,7 @@
|
|||
</view>
|
||||
<view class="flex-row align-c gap-10 wh-auto ht-auto pr-16 box-border-box">
|
||||
<input :value="comment_input_value" class="comment-input" type="text" confirm-type="send" :adjust-position="false" :placeholder="input_placeholder" @focus="add_comment" @input="comment_input_event" @confirm="send_comment" />
|
||||
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="chat_upload_images_event">
|
||||
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="upload_images_event">
|
||||
<iconfont name="icon-layout-module-single-images" size="32rpx" color="#999"></iconfont>
|
||||
</component-upload>
|
||||
</view>
|
||||
|
|
@ -212,7 +212,7 @@
|
|||
</view>
|
||||
<view class="flex-row align-c gap-10 wh-auto ht-auto pr-16 box-border-box">
|
||||
<input :value="comment_input_value" :focus="is_add_comment" class="comment-input" type="text" confirm-type="done" :adjust-position="false" :auto-blur="true" :placeholder="input_placeholder" @input="comment_input_event" @blur="() => is_add_comment = false" @confirm="send_comment" />
|
||||
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="chat_upload_images_event">
|
||||
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="upload_images_event">
|
||||
<iconfont name="icon-layout-module-single-images" size="48rpx" color="#999"></iconfont>
|
||||
</component-upload>
|
||||
</view>
|
||||
|
|
@ -536,20 +536,12 @@
|
|||
video_data_list: this.video_data_list,
|
||||
current_index: is_last == 1 && is_next == 1 ? (new_index == this.video_data_list.length - 1 ? 2 : (new_index == this.video_data_list.length - 2 ? 1 : 0)) : this.current_index,
|
||||
});
|
||||
|
||||
|
||||
if (is_last == 1 && is_next == 1) {
|
||||
// 更新数据信息
|
||||
this.update_display_data();
|
||||
|
||||
setTimeout(() => {
|
||||
//#ifdef H5
|
||||
// 更新页面标题
|
||||
const current_video = this.video_data_list.find(item => item.id == id);
|
||||
if (current_video && current_video.title) {
|
||||
document.title = current_video.title;
|
||||
}
|
||||
//#endif
|
||||
|
||||
// 更新分享信息
|
||||
this.update_share_info(this.display_video_list[this.current_index]);
|
||||
|
||||
|
|
@ -731,7 +723,8 @@
|
|||
this.video_play_event(videoContext);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 更新分享信息
|
||||
update_share_info(data) {
|
||||
const info = {
|
||||
title: data.title || '',
|
||||
|
|
@ -744,8 +737,12 @@
|
|||
share_info: info,
|
||||
});
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(info);
|
||||
},
|
||||
app.globalData.page_share_handle(info);
|
||||
|
||||
// 更新页面标题
|
||||
uni.setNavigationBarTitle({title: data.title});
|
||||
},
|
||||
|
||||
// 安全的视频播放事件处理
|
||||
video_play_event(videoContext, is_first_play = false) {
|
||||
if (!videoContext) {
|
||||
|
|
@ -790,7 +787,7 @@
|
|||
// 正常情况直接返回
|
||||
return this.video_data_list[index];
|
||||
},
|
||||
|
||||
|
||||
// 更新显示数据
|
||||
update_display_data() {
|
||||
let list = [];
|
||||
|
|
@ -818,13 +815,15 @@
|
|||
this.setData({
|
||||
display_video_list: list
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
// 评论输入框事件
|
||||
comment_input_event(e) {
|
||||
this.comment_input_value = e.detail.value;
|
||||
},
|
||||
|
||||
chat_upload_images_event(res) {
|
||||
},
|
||||
|
||||
// 图片上传回调
|
||||
upload_images_event(res) {
|
||||
if((res || null) != null) {
|
||||
// 存储上传图片内容
|
||||
this.form_images_list.push({
|
||||
|
|
@ -833,14 +832,16 @@
|
|||
size: res.size,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 上传图片预览
|
||||
upload_show_event(e) {
|
||||
uni.previewImage({
|
||||
current: this.form_images_list[e.currentTarget.dataset.index].url,
|
||||
urls: this.form_images_list.map(item => item.url),
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// 评论输入图片删除
|
||||
comment_input_img_close(e) {
|
||||
const index = e?.currentTarget?.dataset?.index || 0;
|
||||
|
|
@ -849,7 +850,9 @@
|
|||
this.setData({
|
||||
form_images_list: list,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// swiper-item 的位置发生改变时
|
||||
on_transition(e) {
|
||||
const dy = e.detail.dy;
|
||||
let status = 'direction';
|
||||
|
|
@ -864,10 +867,13 @@
|
|||
direction: status,
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 播放
|
||||
handle_play() {
|
||||
this.setData({ paused: false, is_manual_pause: false });
|
||||
},
|
||||
},
|
||||
|
||||
// 收藏
|
||||
handle_like(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
|
|
@ -991,10 +997,10 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 评论
|
||||
send_comment() {
|
||||
let comment_text = this.comment_input_value;
|
||||
|
||||
if (!comment_text.trim()) return;
|
||||
|
||||
// video_id 视频id video_comments_id 父级评论id id 当前评论id
|
||||
|
|
@ -1068,7 +1074,8 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// 展开子评论
|
||||
open_sub_comment(id, is_level) {
|
||||
const comment = this.active_comments.find(item => item.id == id);
|
||||
|
|
@ -1108,14 +1115,17 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 收起子评论
|
||||
close_sub_comment(id) {
|
||||
const comment = this.active_comments.find(item => item.id == id);
|
||||
if (comment) {
|
||||
comment.show_sub_comment = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 分享事件
|
||||
handle_share() {
|
||||
if ((this.$refs.share || null) != null) {
|
||||
this.$refs.share.init({
|
||||
|
|
@ -1123,7 +1133,8 @@
|
|||
share_info: this.share_info,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 更新视频数据信息
|
||||
get_video_data_detail(id) {
|
||||
uni.request({
|
||||
|
|
@ -1149,7 +1160,8 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// 更新点赞数量
|
||||
set_givethumbs_num(id, comments_id) {
|
||||
uni.request({
|
||||
|
|
@ -1216,7 +1228,9 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// 播放进度变化时触发
|
||||
handle_time_update(e) {
|
||||
if (this.is_seeking) return;
|
||||
let duration = this.current_video_duration;
|
||||
|
|
|
|||
Loading…
Reference in New Issue