正式版

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

View File

@ -27,7 +27,7 @@ Page({
const sid = ev.currentTarget.dataset.sid; const sid = ev.currentTarget.dataset.sid;
const id = ev.currentTarget.dataset.id; const id = ev.currentTarget.dataset.id;
tt.navigateTo({ 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 sid = ev.currentTarget.dataset.sid;
const chapterid = ev.currentTarget.dataset.chapterid; const chapterid = ev.currentTarget.dataset.chapterid;
tt.navigateTo({ 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) { if (otherInfo.toStatus == 1) {
tt.redirectTo({ tt.redirectTo({
url: `/pages/videoDetail/videoDetail?sid=${otherInfo.sid}&id=${otherInfo.id}` url: `/pages/videoDetail/videoDetail?sid=${otherInfo.sid}&id=${otherInfo.id || ''}`
}); });
} else { } else {
tt.navigateBack({}); tt.navigateBack({});

View File

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

View File

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

View File

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