Commit 10ee5310 authored by jyx's avatar jyx

代码优化

parent 60a0a5b0
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<view style="display: flex;flex-direction: column;align-items: flex-end;"> <view style="display: flex;flex-direction: column;align-items: flex-end;">
<view style="display: flex;flex-direction: row;"> <view style="display: flex;flex-direction: row;">
<view @click="handleAgree" style="margin-top: 12rpx;margin-right: 10rpx;">付费须知></view> <view @click="handleAgree" style="margin-top: 12rpx;margin-right: 10rpx;">付费须知></view>
<image @click="handleClickClose" <image @click="handleClose"
style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin-top: 20rpx;margin-right: 20rpx;margin-bottom: 10rpx;" style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin-top: 20rpx;margin-right: 20rpx;margin-bottom: 10rpx;"
src="@/static/index/ic_quit_white.png"></image> src="@/static/index/ic_quit_white.png"></image>
</view> </view>
...@@ -156,14 +156,36 @@ ...@@ -156,14 +156,36 @@
return parseInt(num * 10); return parseInt(num * 10);
}, },
// 支付完成回调 // 支付完成回调
paySuccess(largeType) {}, paySuccess(largeType) {
this.unlockAll();
this.pm.toggleCustomDialog();
},
unlockAll() {
common.methods.post({
url: '/vedio/getIndexList',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {
this.pm.setCatalog({
freeList: data.vedioMsg.douyinFreeList,
unlockList: data.vedioMsg.douyinUnlockList,
lockList: data.vedioMsg.douyinLockList,
});
}
});
},
loadData() { loadData() {
let that = this; let that = this;
if (tt.getSystemInfoSync().platform === 'ios') { if (tt.getSystemInfoSync().platform === 'ios') {
this.os = 'ios'; this.os = 'ios';
} }
common.data.post({ common.methods.post({
url: '/vip/getVipProducts/point', url: '/vip/getVipProducts/point',
data: { data: {
vedioId: that.point <= 0 ? null : that.vedioId vedioId: that.point <= 0 ? null : that.vedioId
...@@ -174,7 +196,6 @@ ...@@ -174,7 +196,6 @@
}) => { }) => {
this.vipList = data.list; this.vipList = data.list;
if (data.list != null) { if (data.list != null) {
// this.selectedIndex = data.list[0].activityType;
for (let i = 0; i < data.list.length; i++) { for (let i = 0; i < data.list.length; i++) {
if (data.list[i].activityType == 1) { if (data.list[i].activityType == 1) {
this.selectedIndex = i; this.selectedIndex = i;
...@@ -185,7 +206,7 @@ ...@@ -185,7 +206,7 @@
} }
}); });
common.data.post({ common.methods.post({
url: '/user/baseMsg', url: '/user/baseMsg',
showLoading: false, showLoading: false,
success: ({ success: ({
...@@ -198,17 +219,17 @@ ...@@ -198,17 +219,17 @@
handleAgree() { handleAgree() {
this.agreeFlag = true this.agreeFlag = true
}, },
handleClickClose() {}, handleClose() {
handleClose() {}, this.pm.toggleCustomDialog();
},
choosePack(item, index) { choosePack(item, index) {
this.selectedIndex = index; this.selectedIndex = index;
this.handlePay(); this.handlePay();
}, },
handlePay() { handlePay() {
let that = this; let that = this;
let vipBean = this.vipList[this.selectedIndex]; let vipBean = this.vipList[this.selectedIndex];
common.data.post({ common.methods.post({
url: '/vip/getVipPayParams/douyin', url: '/vip/getVipPayParams/douyin',
data: { data: {
vedioId: that.point <= 0 ? null : that.vedioId, vedioId: that.point <= 0 ? null : that.vedioId,
...@@ -224,7 +245,9 @@ ...@@ -224,7 +245,9 @@
}); });
}, },
onVip() { onVip() {
navigateTo(`/pagesA/vipPay/vipPay?vedioId=` + this.vedioId) tt.navigateTo({
url: `/pagesA/vipPay/vipPay?vedioId=` + this.vedioId
})
this.handleClose(); this.handleClose();
}, },
ttPrePay(ttData, largeType) { ttPrePay(ttData, largeType) {
...@@ -268,7 +291,7 @@ ...@@ -268,7 +291,7 @@
}, },
queryOrderStatus(largeType, tid) { queryOrderStatus(largeType, tid) {
let that = this; let that = this;
this.post({ common.methods.post({
data: { data: {
tid: tid tid: tid
}, },
......
...@@ -96,12 +96,7 @@ ...@@ -96,12 +96,7 @@
success: ({ success: ({
data data
}) => { }) => {
for (var i = 0; i < 10; i++) { this.dataList = data.list;
this.dataList = [...this.dataList, ...data.list];
}
// this.dataList = data.list;
if (this.dataList.length > 0) { if (this.dataList.length > 0) {
this.$emit("showEdit", true) this.$emit("showEdit", true)
} else { } else {
......
<template> <template>
<view> <view>
<view class="container" v-show="true"> <view class="container" v-show="showRewardAdPop">
<image @click="closeAdPop" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx; <image @click="closeAdPop" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx;
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image> margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content"> <view class="content">
...@@ -10,7 +10,18 @@ ...@@ -10,7 +10,18 @@
</view> </view>
</view> </view>
<view class="shortcut" v-show="true"> <view class="container" v-show="showRewardAdMorePop">
<view class="content">
<text class="title">恭喜解锁剧集成功!</text>
<text class="info">再看一个广告可额外解锁 2 集视频,是否继续观看广告领取福利?</text>
<view class="flex space">
<text class="button1" @click="closeAdMorePop">取消</text>
<text class="button2" @click="showRewardAdMore">看广告领取</text>
</view>
</view>
</view>
<view class="shortcut" v-show="showShortcutPop">
<image style="width:70rpx;height:70rpx;margin-left:10rpx;" src="../../static/logo-about.png"> <image style="width:70rpx;height:70rpx;margin-left:10rpx;" src="../../static/logo-about.png">
</image> </image>
<view class="flex1" style="margin-left:20rpx;"> <view class="flex1" style="margin-left:20rpx;">
...@@ -22,6 +33,10 @@ ...@@ -22,6 +33,10 @@
<image @click="closeShortcutPop" style="width:30rpx;height:30rpx;" src="../../static/video/close.png"> <image @click="closeShortcutPop" style="width:30rpx;height:30rpx;" src="../../static/video/close.png">
</image> </image>
</view> </view>
<view class="box-wrap">
<image class="img1" @click="handleTaskPage" :src="boxImgUrl"></image>
</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -36,7 +51,7 @@ ...@@ -36,7 +51,7 @@
getPlayletManager getPlayletManager
} = tt; } = tt;
export default { export default {
props: ["titles"], props: ["tit"],
data() { data() {
return { return {
pm: null, pm: null,
...@@ -45,19 +60,18 @@ ...@@ -45,19 +60,18 @@
seq: 0, seq: 0,
episodeId: "", episodeId: "",
countDown: 3, countDown: 3,
showRewardAdPop: true, showRewardAdPop: false,
showAdForServer: false, showRewardAdMorePop: false,
showShortcutPop: false, showShortcutPop: false,
canShowShortcut: false, canShowShortcut: false,
boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
}; };
}, },
async beforeCreate() { async beforeCreate() {
const pm = await getPlayletManager({ const pm = await getPlayletManager({
is: "playler", // 和插槽同名 is: "playler", // 和插槽同名
}); });
console.log('AAAAAAAAAAAAA', pm)
pm.getPlayletInfo().then(res => { pm.getPlayletInfo().then(res => {
this.albumId = res.albumId this.albumId = res.albumId
this.seq = res.seq this.seq = res.seq
...@@ -85,11 +99,11 @@ ...@@ -85,11 +99,11 @@
console.log("触发播放进度变化onTimeUpdate回调:", e); console.log("触发播放进度变化onTimeUpdate回调:", e);
// 播放到第10秒且今天没有弹出 ,弹出加入桌面 // 播放到第10秒且今天没有弹出 ,弹出加入桌面
if ((e.currentTime > 10) && this.canShowShortcut) { // if ((e.currentTime > 10) && this.canShowShortcut) {
this.showShortcutPop = true // this.showShortcutPop = true
this.canShowShortcut = false // this.canShowShortcut = false
this.setShowShortcut() // this.setShowShortcut()
} // }
}); });
pm.onWaiting((e) => { pm.onWaiting((e) => {
console.log("触发视频出现缓冲onWaiting回调:", e); console.log("触发视频出现缓冲onWaiting回调:", e);
...@@ -142,14 +156,8 @@ ...@@ -142,14 +156,8 @@
}); });
pm.onClickUnlock((e) => { pm.onClickUnlock((e) => {
console.log("player解锁", e); console.log("player解锁", e);
this.showRewardAdPop = true
if (this.showAdForServer) { this.startCountdown()
this.showRewardAdPop = true
this.startCountdown()
} else {
this.pm.toggleCustomDialog()
}
}); });
pm.onTapCustomIcon((e) => { pm.onTapCustomIcon((e) => {
console.log("触发点击自定义组件onTapCustomIcon回调:", e); console.log("触发点击自定义组件onTapCustomIcon回调:", e);
...@@ -179,8 +187,8 @@ ...@@ -179,8 +187,8 @@
console.log("playerBeforeMount"); console.log("playerBeforeMount");
}, },
mounted() { mounted() {
this.loadAdSwitch() this.preloadAd()
this.getShowShortcut() // this.getShowShortcut()
console.log("playerMounted"); console.log("playerMounted");
}, },
beforeUpdate() { beforeUpdate() {
...@@ -207,6 +215,11 @@ ...@@ -207,6 +215,11 @@
console.log("添加到桌面成功"); console.log("添加到桌面成功");
} }
}, },
handleTaskPage() {
tt.navigateTo({
url: `/pagesA/task/task`
})
},
closeShortcutPop() { closeShortcutPop() {
this.showShortcutPop = false this.showShortcutPop = false
this.canShowShortcut = false this.canShowShortcut = false
...@@ -220,22 +233,6 @@ ...@@ -220,22 +233,6 @@
this.pm.setPlayStatus("pause"); this.pm.setPlayStatus("pause");
this.$emit("cliPause", 1); this.$emit("cliPause", 1);
}, },
loadAdSwitch() {
let that = this
common.methods.post({
url: '/vedio/confs',
showLoading: false,
success: ({
data
}) => {
that.showAdForServer = data.douyinAdTipOpen;
if (!that.showAdForServer) {
// 预加载广告
that.preloadAd()
}
}
});
},
preloadAd() { preloadAd() {
let that = this let that = this
// 创建实例 // 创建实例
...@@ -262,13 +259,23 @@ ...@@ -262,13 +259,23 @@
}) })
}); });
// 监听视频播放完成 // 监听视频播放完成
this.ad.onClose((data) => { this.ad.onClose((data) => {
uni.hideLoading(); uni.hideLoading();
if (data.isEnded) { if (data.isEnded) {
message.notify("正在为您解锁剧集")
that.adUnlock() console.log("FFFFFFFFF")
if (that.showRewardAdMorePop) {
that.showRewardAdMorePop = false
that.pm.setCurrentUnlock()
that.addRewardPoint()
that.commitVideo()
message.notify("正在为您解锁剧集")
} else if (that.showRewardAdPop) {
that.adUnlock()
}
} else { } else {
message.notify("未观看完整视频") message.notify("未观看完整视频")
...@@ -305,11 +312,25 @@ ...@@ -305,11 +312,25 @@
this.showRewardAdPop = true this.showRewardAdPop = true
this.startCountdown() this.startCountdown()
}, },
showAdMorePop() {
this.showRewardAdMorePop = true
},
closeAdPop() { closeAdPop() {
this.showRewardAdPop = false this.showRewardAdPop = false
}, },
closeAdMorePop() {
this.showRewardAdMorePop = false
this.pm.setCurrentUnlock()
this.commitVideo()
},
showRewardAd() { showRewardAd() {
this.showRewardAdPop = false // 播放激励视频
uni.showLoading({
title: '广告加载中'
});
this.ad.show();
},
showRewardAdMore() {
// 播放激励视频 // 播放激励视频
uni.showLoading({ uni.showLoading({
title: '广告加载中' title: '广告加载中'
...@@ -355,8 +376,20 @@ ...@@ -355,8 +376,20 @@
}) => {} }) => {}
}); });
}, },
addRewardPoint() {
// 看两次广告 10分钟内 免费看两集
common.methods.post({
url: '/vTask/vedioPageSeeAdForAddPoint',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {}
});
},
unlock() { unlock() {
let that = this
common.methods.post({ common.methods.post({
url: '/vedio/unlock', url: '/vedio/unlock',
data: { data: {
...@@ -369,24 +402,17 @@ ...@@ -369,24 +402,17 @@
}) => { }) => {
message.notify(data.msg) message.notify(data.msg)
if (data.code == 200) { if (data.code == 200 || data.code == 301 || data.code == 302) {
this.pm.setCurrentUnlock() this.pm.setCurrentUnlock()
// this.commitVideo() this.commitVideo()
} else if (data.code == 301) {
this.pm.setCurrentUnlock()
// this.commitVideo()
} else if (data.code == 302) {
this.pm.setCurrentUnlock()
// this.commitVideo()
} else if (data.code == 303) { } else if (data.code == 303) {
this.pm.toggleCustomDialog() this.showAdPop()
} }
} }
}); });
}, },
adUnlock() { adUnlock() {
let that = this common.methods.post({
this.post({
url: '/vedio/unlockByAd', url: '/vedio/unlockByAd',
data: { data: {
adSource: 'csj', adSource: 'csj',
...@@ -400,17 +426,11 @@ ...@@ -400,17 +426,11 @@
}) => { }) => {
message.notify(data.msg) message.notify(data.msg)
if (data.code == 200) { if (data.code == 200 || data.code == 301 || data.code == 302) {
that.pm.setCurrentUnlock() this.showRewardAdPop = false
this.commitVideo() this.showAdMorePop()
} else if (data.code == 301) {
that.pm.setCurrentUnlock()
this.commitVideo()
} else if (data.code == 302) {
that.pm.setCurrentUnlock()
this.commitVideo()
} else if (data.code == 303) { } else if (data.code == 303) {
that.pm.toggleCustomDialog() this.showAdPop()
} }
} }
}); });
...@@ -471,6 +491,60 @@ ...@@ -471,6 +491,60 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.content {
border-radius: 20rpx;
background-color: white;
display: flex;
// width: 600rpx;
padding: 50rpx 0;
flex-direction: column;
align-items: center;
.title {
color: black;
font-size: 40rpx;
margin-bottom: 30rpx;
}
.info {
width: 500rpx;
color: gray;
font-size: 34rpx;
margin-bottom: 30rpx;
}
.button1 {
width: 210rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
margin: 10rpx 20rpx;
border-radius: 80rpx;
background-color: lightgrey;
color: black;
font-size: 36rpx;
box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1);
}
.button2 {
width: 210rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
margin: 10rpx 20rpx;
border-radius: 80rpx;
background-color: orangered;
color: white;
font-size: 36rpx;
box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1);
}
.downtext {
color: darkgray;
font-size: 26rpx;
}
}
} }
.ad-view { .ad-view {
...@@ -508,4 +582,18 @@ ...@@ -508,4 +582,18 @@
font-size: 26rpx; font-size: 26rpx;
} }
} }
.box-wrap {
height: 100rpx;
width: 120rpx;
left: 20rpx;
top: 240rpx;
position: absolute;
z-index: 999;
.img1 {
width: 100rpx;
height: 100rpx;
}
}
</style> </style>
\ No newline at end of file
...@@ -36,12 +36,19 @@ ...@@ -36,12 +36,19 @@
{ {
"root": "pagesC", "root": "pagesC",
"pages": [{ "pages": [{
"path": "ttvideo/ttVideoDetail" "path": "ttvideo/ttVideoDetail",
"usingComponents": {
"tt-video-player": "ext://industry/video-player"
}
}, { }, {
"path": "playlet/index", "path": "playlet/index",
"style": { "style": {
"extends": "ext://industry/playlet-plugin", "extends": "ext://industry/playlet-plugin",
"isPageExtension": true "isPageExtension": true,
"usingComponents": {
"player": "../../components/player/player",
"charge": "../../components/charge/charge"
}
} }
}] }]
}, },
...@@ -65,10 +72,7 @@ ...@@ -65,10 +72,7 @@
}, { }, {
"path": "useDotRecord/useDotRecord", "path": "useDotRecord/useDotRecord",
"style": { "style": {
"navigationBarTitleText": "消费记录", "navigationBarTitleText": "消费记录"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "invite/invite", "path": "invite/invite",
...@@ -98,9 +102,6 @@ ...@@ -98,9 +102,6 @@
"app-plus": { "app-plus": {
"bounce": "none", "bounce": "none",
"scrollIndicator": "none" "scrollIndicator": "none"
},
"usingComponents": {
"tt-video-player": "ext://industry/video-player"
} }
}, },
"condition": { //模式配置,仅开发期间生效 "condition": { //模式配置,仅开发期间生效
......
<template></template>
<script> <script>
import Player from "@/components/player/player.vue"; import Player from "@/components/player/player.vue";
import Charge from "@/components/charge/charge.vue"; import Charge from "@/components/charge/charge.vue";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment