Commit 10ee5310 authored by jyx's avatar jyx

代码优化

parent 60a0a5b0
......@@ -17,7 +17,7 @@
<view style="display: flex;flex-direction: column;align-items: flex-end;">
<view style="display: flex;flex-direction: row;">
<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;"
src="@/static/index/ic_quit_white.png"></image>
</view>
......@@ -156,14 +156,36 @@
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() {
let that = this;
if (tt.getSystemInfoSync().platform === 'ios') {
this.os = 'ios';
}
common.data.post({
common.methods.post({
url: '/vip/getVipProducts/point',
data: {
vedioId: that.point <= 0 ? null : that.vedioId
......@@ -174,7 +196,6 @@
}) => {
this.vipList = data.list;
if (data.list != null) {
// this.selectedIndex = data.list[0].activityType;
for (let i = 0; i < data.list.length; i++) {
if (data.list[i].activityType == 1) {
this.selectedIndex = i;
......@@ -185,7 +206,7 @@
}
});
common.data.post({
common.methods.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
......@@ -198,17 +219,17 @@
handleAgree() {
this.agreeFlag = true
},
handleClickClose() {},
handleClose() {},
handleClose() {
this.pm.toggleCustomDialog();
},
choosePack(item, index) {
this.selectedIndex = index;
this.handlePay();
},
handlePay() {
let that = this;
let vipBean = this.vipList[this.selectedIndex];
common.data.post({
common.methods.post({
url: '/vip/getVipPayParams/douyin',
data: {
vedioId: that.point <= 0 ? null : that.vedioId,
......@@ -224,7 +245,9 @@
});
},
onVip() {
navigateTo(`/pagesA/vipPay/vipPay?vedioId=` + this.vedioId)
tt.navigateTo({
url: `/pagesA/vipPay/vipPay?vedioId=` + this.vedioId
})
this.handleClose();
},
ttPrePay(ttData, largeType) {
......@@ -268,7 +291,7 @@
},
queryOrderStatus(largeType, tid) {
let that = this;
this.post({
common.methods.post({
data: {
tid: tid
},
......
......@@ -96,12 +96,7 @@
success: ({
data
}) => {
for (var i = 0; i < 10; i++) {
this.dataList = [...this.dataList, ...data.list];
}
// this.dataList = data.list;
this.dataList = data.list;
if (this.dataList.length > 0) {
this.$emit("showEdit", true)
} else {
......
<template>
<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;
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content">
......@@ -10,7 +10,18 @@
</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>
<view class="flex1" style="margin-left:20rpx;">
......@@ -22,6 +33,10 @@
<image @click="closeShortcutPop" style="width:30rpx;height:30rpx;" src="../../static/video/close.png">
</image>
</view>
<view class="box-wrap">
<image class="img1" @click="handleTaskPage" :src="boxImgUrl"></image>
</view>
</view>
</template>
<script>
......@@ -36,7 +51,7 @@
getPlayletManager
} = tt;
export default {
props: ["titles"],
props: ["tit"],
data() {
return {
pm: null,
......@@ -45,19 +60,18 @@
seq: 0,
episodeId: "",
countDown: 3,
showRewardAdPop: true,
showAdForServer: false,
showRewardAdPop: false,
showRewardAdMorePop: false,
showShortcutPop: false,
canShowShortcut: false,
boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
};
},
async beforeCreate() {
const pm = await getPlayletManager({
is: "playler", // 和插槽同名
});
console.log('AAAAAAAAAAAAA', pm)
});
pm.getPlayletInfo().then(res => {
this.albumId = res.albumId
this.seq = res.seq
......@@ -85,11 +99,11 @@
console.log("触发播放进度变化onTimeUpdate回调:", e);
// 播放到第10秒且今天没有弹出 ,弹出加入桌面
if ((e.currentTime > 10) && this.canShowShortcut) {
this.showShortcutPop = true
this.canShowShortcut = false
this.setShowShortcut()
}
// if ((e.currentTime > 10) && this.canShowShortcut) {
// this.showShortcutPop = true
// this.canShowShortcut = false
// this.setShowShortcut()
// }
});
pm.onWaiting((e) => {
console.log("触发视频出现缓冲onWaiting回调:", e);
......@@ -142,14 +156,8 @@
});
pm.onClickUnlock((e) => {
console.log("player解锁", e);
if (this.showAdForServer) {
this.showRewardAdPop = true
this.startCountdown()
} else {
this.pm.toggleCustomDialog()
}
this.showRewardAdPop = true
this.startCountdown()
});
pm.onTapCustomIcon((e) => {
console.log("触发点击自定义组件onTapCustomIcon回调:", e);
......@@ -179,8 +187,8 @@
console.log("playerBeforeMount");
},
mounted() {
this.loadAdSwitch()
this.getShowShortcut()
this.preloadAd()
// this.getShowShortcut()
console.log("playerMounted");
},
beforeUpdate() {
......@@ -207,6 +215,11 @@
console.log("添加到桌面成功");
}
},
handleTaskPage() {
tt.navigateTo({
url: `/pagesA/task/task`
})
},
closeShortcutPop() {
this.showShortcutPop = false
this.canShowShortcut = false
......@@ -220,22 +233,6 @@
this.pm.setPlayStatus("pause");
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() {
let that = this
// 创建实例
......@@ -262,13 +259,23 @@
})
});
// 监听视频播放完成
this.ad.onClose((data) => {
uni.hideLoading();
if (data.isEnded) {
message.notify("正在为您解锁剧集")
that.adUnlock()
if (data.isEnded) {
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 {
message.notify("未观看完整视频")
......@@ -305,11 +312,25 @@
this.showRewardAdPop = true
this.startCountdown()
},
showAdMorePop() {
this.showRewardAdMorePop = true
},
closeAdPop() {
this.showRewardAdPop = false
},
closeAdMorePop() {
this.showRewardAdMorePop = false
this.pm.setCurrentUnlock()
this.commitVideo()
},
showRewardAd() {
this.showRewardAdPop = false
// 播放激励视频
uni.showLoading({
title: '广告加载中'
});
this.ad.show();
},
showRewardAdMore() {
// 播放激励视频
uni.showLoading({
title: '广告加载中'
......@@ -355,8 +376,20 @@
}) => {}
});
},
addRewardPoint() {
// 看两次广告 10分钟内 免费看两集
common.methods.post({
url: '/vTask/vedioPageSeeAdForAddPoint',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {}
});
},
unlock() {
let that = this
common.methods.post({
url: '/vedio/unlock',
data: {
......@@ -369,24 +402,17 @@
}) => {
message.notify(data.msg)
if (data.code == 200) {
if (data.code == 200 || data.code == 301 || data.code == 302) {
this.pm.setCurrentUnlock()
// this.commitVideo()
} else if (data.code == 301) {
this.pm.setCurrentUnlock()
// this.commitVideo()
} else if (data.code == 302) {
this.pm.setCurrentUnlock()
// this.commitVideo()
this.commitVideo()
} else if (data.code == 303) {
this.pm.toggleCustomDialog()
this.showAdPop()
}
}
});
},
adUnlock() {
let that = this
this.post({
common.methods.post({
url: '/vedio/unlockByAd',
data: {
adSource: 'csj',
......@@ -400,17 +426,11 @@
}) => {
message.notify(data.msg)
if (data.code == 200) {
that.pm.setCurrentUnlock()
this.commitVideo()
} else if (data.code == 301) {
that.pm.setCurrentUnlock()
this.commitVideo()
} else if (data.code == 302) {
that.pm.setCurrentUnlock()
this.commitVideo()
if (data.code == 200 || data.code == 301 || data.code == 302) {
this.showRewardAdPop = false
this.showAdMorePop()
} else if (data.code == 303) {
that.pm.toggleCustomDialog()
this.showAdPop()
}
}
});
......@@ -471,6 +491,60 @@
display: flex;
flex-direction: column;
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 {
......@@ -508,4 +582,18 @@
font-size: 26rpx;
}
}
.box-wrap {
height: 100rpx;
width: 120rpx;
left: 20rpx;
top: 240rpx;
position: absolute;
z-index: 999;
.img1 {
width: 100rpx;
height: 100rpx;
}
}
</style>
\ No newline at end of file
......@@ -36,12 +36,19 @@
{
"root": "pagesC",
"pages": [{
"path": "ttvideo/ttVideoDetail"
"path": "ttvideo/ttVideoDetail",
"usingComponents": {
"tt-video-player": "ext://industry/video-player"
}
}, {
"path": "playlet/index",
"style": {
"extends": "ext://industry/playlet-plugin",
"isPageExtension": true
"isPageExtension": true,
"usingComponents": {
"player": "../../components/player/player",
"charge": "../../components/charge/charge"
}
}
}]
},
......@@ -65,10 +72,7 @@
}, {
"path": "useDotRecord/useDotRecord",
"style": {
"navigationBarTitleText": "消费记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "消费记录"
}
}, {
"path": "invite/invite",
......@@ -98,9 +102,6 @@
"app-plus": {
"bounce": "none",
"scrollIndicator": "none"
},
"usingComponents": {
"tt-video-player": "ext://industry/video-player"
}
},
"condition": { //模式配置,仅开发期间生效
......
<template></template>
<script>
import Player from "@/components/player/player.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