正式版

This commit is contained in:
lipenggao 2024-07-29 09:16:58 +08:00
parent 2efce804a6
commit cb66e5125f
7 changed files with 48 additions and 38 deletions

View File

@ -34,7 +34,7 @@ Page({
const id = ev.currentTarget.dataset.id;
console.log(id, "chapteridchapteridchapterid")
tt.navigateTo({
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${id}`,
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${id || ''}`,
});
},
myModalRef(ref: any) {

View File

@ -27,7 +27,7 @@ Page({
const sid = ev.currentTarget.dataset.sid;
const id = ev.currentTarget.dataset.id;
tt.navigateTo({
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${id}`,
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${id || ''}`,
});
},
})

View File

@ -25,7 +25,7 @@ Page({
const sid = ev.currentTarget.dataset.sid;
const chapterid = ev.currentTarget.dataset.chapterid;
tt.navigateTo({
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${chapterid}`,
url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${chapterid || ''}`,
});
},
})

View File

@ -93,7 +93,7 @@ Page({
});
if (otherInfo.toStatus == 1) {
tt.redirectTo({
url: `/pages/videoDetail/videoDetail?sid=${otherInfo.sid}&id=${otherInfo.id}`
url: `/pages/videoDetail/videoDetail?sid=${otherInfo.sid}&id=${otherInfo.id || ''}`
});
} else {
tt.navigateBack({});

View File

@ -12,6 +12,7 @@
display: flex;
width: 100%;
height: 100rpx;
z-index: 9999;
}
._reh_rec_ta_item {

View File

@ -22,8 +22,8 @@ Page({
// collectionItem: {},
nextbatchList: [],
selectedId: '',
adBanner: null,
unlockFlag: true
unlockFlag: true,
adBanner: null
},
onLoad(options: any) {
const videoCanIUse = tt.canIUse('video-player');
@ -41,10 +41,9 @@ Page({
})
this.initFn();
this.adInit()
},
onShow() {
},
onShow() { },
async initFn() {
const sid = this.data.sid;
@ -173,7 +172,6 @@ Page({
// batchList: bs
})
}
// this.selectComponent(`#${nextId}`, (res: any) => {
// res?.hidePauseIcon()
// });
@ -264,9 +262,10 @@ Page({
}
httpRequest('/addkeep', 'POST', params).then((res: any) => {
if (res.status == 1) {
const ic: any = count + 1;
videoInfo.bookcase = videoInfo?.bookcase == 1 ? 0 : 1;
videoInfo.count = count + 1;
videoInfo.isCount = this.handelCount(count + 1)
videoInfo.count = ic;
videoInfo.isCount = this.handelCount(ic)
this.setData({
videoInfo: videoInfo
// videoInfo: {
@ -363,23 +362,25 @@ Page({
},
watchAdvertisement() {
let adBanner: any = this.data.adBanner;
const videoInfo: any = this.data.videoInfo;
const batchList: any = this.data.batchList;
const selectionConList = this.data.selectionConList;
const context: any = tt.createVideoContext(`${videoInfo.id}`);
tt.showToast({
title: `广告加载中...`,
icon: 'none',
});
adBanner.show().then((res: any) => {
// console.log("视频广告展示");
});
},
adInit() {
let isAdBanner: any = this.data.adBanner;
// const context: any = tt.createVideoContext(`${videoInfo.id}`);
// this.watchInfo.isvip = 0;
if (!adBanner) {
tt.showToast({
title: `广告加载中...`,
icon: 'none',
});
adBanner = tt.createRewardedVideoAd({
if (!isAdBanner) {
const adBanner = tt.createRewardedVideoAd({
adUnitId: "wh0y4vcxsbk7ixwktg",
});
adBanner.show().then((res: any) => {
// console.log("视频广告展示");
});
// 监听错误
adBanner.onError((err: any) => {
tt.hideLoading({});
@ -393,10 +394,9 @@ Page({
});
// 监听视频播放完成
adBanner.onClose(async (res: any) => {
adBanner.onClose((res: any) => {
console.log(res, "resres")
if (res.isEnded || true) {
if (res.isEnded) {
// const videoIndex = batchList.findIndex(
// (r: any) => r.id === videoInfo.id
// );
@ -430,7 +430,9 @@ Page({
// ny.push(bb)
// })
const videoInfo: any = this.data.videoInfo;
const batchList: any = this.data.batchList;
const selectionConList = this.data.selectionConList;
const ny: any = selectionConList.map((m: any) => {
const temp: any = m.temp.map((k: any) => {
return {
@ -455,15 +457,18 @@ Page({
sid: videoInfo.sid,
id: videoInfo.id,
};
const transferadRes: any = await httpRequest('/transferad', 'POST', params);
videoInfo.chackpay = 1;
// transferadRes: any
httpRequest('/transferad', 'POST', params).then(() => {
videoInfo.chackpay = 1;
this.setData({
batchList: bk,
videoInfo: videoInfo,
selectionConList: ny
this.setData({
batchList: bk,
videoInfo: videoInfo,
selectionConList: ny
})
})
} else {
tt.showToast({
title: '看完广告方可解锁',
@ -475,6 +480,9 @@ Page({
// 预加载资源
adBanner.load();
this.setData({
adBanner: adBanner,
})
}
},
toPathVideoitself(ev: any) {
@ -532,9 +540,10 @@ Page({
// count: videoInfo?.count - 1,
// isCount: this.handelCount(videoInfo?.count - 1)
// }
const ic: any = videoInfo?.count - 1;
videoInfo.bookcase = videoInfo?.bookcase == 1 ? 0 : 1;
videoInfo.count = videoInfo?.count - 1;
videoInfo.isCount = this.handelCount(videoInfo?.count - 1)
videoInfo.count = ic;
videoInfo.isCount = this.handelCount(ic)
this.setData({
videoInfo: videoInfo
})

View File

@ -22,7 +22,7 @@ export const httpRequest = (url: string, method: any = 'GET', data: any = {}, he
},
header: header,
success: (res: any) => {
console.log(res,"pppppppp")
// console.log(res,"pppppppp")
if (res.data.status == 1) {
resolve(res.data);
} else {