|
|
@@ -1,7 +1,7 @@
|
|
|
// pages/video/detail.js
|
|
|
-import {getVideoDetail, getRealVideoUrl, postWithCommonParams, getRelatedVideos, getUuid} from '../../api/api'
|
|
|
-import {rnd, SendEvent} from '../../utils/util'
|
|
|
-import {apple} from "../../config/config";
|
|
|
+import { getVideoDetail, getRealVideoUrl, postWithCommonParams, getRelatedVideos, getUuid } from '../../api/api'
|
|
|
+import { rnd, SendEvent } from '../../utils/util'
|
|
|
+import { apple } from "../../config/config";
|
|
|
|
|
|
const app = getApp();
|
|
|
let interstitialAd = null
|
|
|
@@ -37,7 +37,7 @@ Page({
|
|
|
this.setData({
|
|
|
scene: wx.getStorageSync('scene') || 1001
|
|
|
})
|
|
|
- SendEvent('show_video', {
|
|
|
+ SendEvent('show_video', {
|
|
|
"video_id": videoId,
|
|
|
"tag_id": tagId,
|
|
|
"scene": this.data.scene,
|
|
|
@@ -321,7 +321,7 @@ Page({
|
|
|
|
|
|
// 视频时间更新事件
|
|
|
onVideoUpdate(e) {
|
|
|
- const {currentTime, duration} = e.detail;
|
|
|
+ const { currentTime, duration } = e.detail;
|
|
|
this.setData({
|
|
|
currentTime,
|
|
|
duration
|
|
|
@@ -371,10 +371,9 @@ Page({
|
|
|
|
|
|
// 点击相关推荐视频
|
|
|
onRelatedVideoTap(e) {
|
|
|
- console.log(e.currentTarget.dataset)
|
|
|
+ const _this = this
|
|
|
const videoId = e.currentTarget.dataset.id;
|
|
|
const video = this.data.relatedVideos.find(item => item.id === videoId);
|
|
|
- // console.log('video',video)
|
|
|
if (!video) {
|
|
|
wx.showToast({
|
|
|
title: '视频信息获取失败',
|
|
|
@@ -383,7 +382,6 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
const tag_id = video.tag_ids[0];
|
|
|
- // console.log('tag_id',tag_id)
|
|
|
// 显示加载中提示
|
|
|
wx.showLoading({
|
|
|
title: '加载中...',
|
|
|
@@ -392,7 +390,7 @@ Page({
|
|
|
// 将标题进行URI编码处理
|
|
|
const encodedTitle = encodeURIComponent(video.title || '');
|
|
|
this.unlockUrl = `/pages/video/detail?id=${videoId}&title=${encodedTitle}&tag_id=${tag_id}`;
|
|
|
- SendEvent('click_recommend_video', {"video_id": videoId, "tag_id": tag_id, "uuid": app.globalData.uuid});
|
|
|
+ SendEvent('click_recommend_video', { "video_id": videoId, "tag_id": tag_id, "uuid": app.globalData.uuid });
|
|
|
if (!video.lock) {
|
|
|
// 跳转到视频详情页
|
|
|
wx.navigateTo({
|
|
|
@@ -410,8 +408,22 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- this.rewardType = 2
|
|
|
- this.rewardVideoPlayFn()
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '当前视频需要看完完整广告后才解锁',
|
|
|
+ cancelText: '关闭',
|
|
|
+ confirmText: '解锁视频',
|
|
|
+ confirmColor: '#02BB00',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ _this.rewardType = 2
|
|
|
+ _this.rewardVideoPlayFn()
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
|
|
|
},
|
|
|
@@ -429,8 +441,8 @@ Page({
|
|
|
// 返回上一页
|
|
|
goBack() {
|
|
|
wx.navigateBack({
|
|
|
- delta: 1
|
|
|
- }
|
|
|
+ delta: 1
|
|
|
+ }
|
|
|
);
|
|
|
// wx.redirectTo({
|
|
|
// url: '/pages/video/video',
|
|
|
@@ -460,7 +472,7 @@ Page({
|
|
|
if (jump === 1) {
|
|
|
url += '&jump=1';
|
|
|
}
|
|
|
- SendEvent('click_share', {"video_id": video.id, "tag_id": video.tag_ids[0]});
|
|
|
+ SendEvent('click_share', { "video_id": video.id, "tag_id": video.tag_ids[0] });
|
|
|
return {
|
|
|
title: video.title,
|
|
|
path: url,
|
|
|
@@ -488,7 +500,7 @@ Page({
|
|
|
if (jump === 1) {
|
|
|
url += '&jump=1';
|
|
|
}
|
|
|
- SendEvent('click_share', {"video_id": videoInfo.id, "tag_id": videoInfo.tag_ids[0]});
|
|
|
+ SendEvent('click_share', { "video_id": videoInfo.id, "tag_id": videoInfo.tag_ids[0] });
|
|
|
return {
|
|
|
title: videoInfo.title,
|
|
|
path: url,
|
|
|
@@ -518,7 +530,7 @@ Page({
|
|
|
if (jump === 1) {
|
|
|
params += '&jump=1';
|
|
|
}
|
|
|
- SendEvent('click_share_moment', {"video_id": videoInfo.id, "tag_id": videoInfo.tag_ids[0]});
|
|
|
+ SendEvent('click_share_moment', { "video_id": videoInfo.id, "tag_id": videoInfo.tag_ids[0] });
|
|
|
return {
|
|
|
title: videoInfo.title,
|
|
|
query: params,
|
|
|
@@ -567,7 +579,7 @@ Page({
|
|
|
// 使用第一个标签ID获取相关视频
|
|
|
const tagId = tagIds && tagIds.length > 0 ? tagIds[0] : 2072;
|
|
|
console.log("原始ID:", apple.ghid)
|
|
|
- const relatedVideos = await getRelatedVideos({tag_id: tagId, gh_id: apple.ghid});
|
|
|
+ const relatedVideos = await getRelatedVideos({ tag_id: tagId, gh_id: apple.ghid });
|
|
|
// 需要播放激励视频的索引
|
|
|
let rewardIndexList = []
|
|
|
console.log('详情激励配置', app.globalData.ads_config)
|
|
|
@@ -722,4 +734,4 @@ Page({
|
|
|
},
|
|
|
|
|
|
|
|
|
-})
|
|
|
+})
|