Commit 545cb2d3 authored by jyx's avatar jyx

代码优化

parent 83b5b31c
{
"version" : "1",
"prompt" : "template",
"title" : "服务协议和隐私政策",
"message" : "请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://shimo.im/docs/dPkpKL1EVNIBbXqO\">《用户协议》</a>和<a href=\"https://shimo.im/docs/aBAYVY4mNXfgLm3j\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"second" : {
"title" : "确认提示",
"message" : "进入应用前,你需先同意<a href=\"https://shimo.im/docs/dPkpKL1EVNIBbXqO\">《用户协议》</a>和<a href=\"https://shimo.im/docs/aBAYVY4mNXfgLm3j\">《隐私政策》</a>,否则将退出应用。",
"buttonAccept" : "同意并继续",
"buttonRefuse" : "退出应用"
},
"styles" : {
"backgroundColor" : "#ffffff",
"borderRadius" : "5px",
"title" : {
"color" : "#008cfb"
},
"buttonAccept" : {
"color" : "#008cfb"
},
"buttonRefuse" : {
"color" : "#c0c0c0"
}
}
}
function gotoVideoPlayerPage(detail, playNext = 0) {
if (tt.canIUse('PlayletExtension')) {
if (detail.douyinAlbumIdNext && detail.douyinEpisodeIdNext) {
//跳转至绑定短剧的页面
uni.navigateTo({
url: '/pagesC/playlet/index?data=' + encodeURIComponent(JSON.stringify(detail)) +
'&tt_album_id=' + detail.douyinAlbumIdNext + '&tt_episode_id=' + detail.douyinEpisodeIdNext
})
return
}
//跳转至绑定短剧的页面
uni.navigateTo({
url: '/pagesC/playlet/index?data=' + encodeURIComponent(JSON.stringify(detail)) +
'&tt_album_id=' + detail.douyinAlbumId + '&tt_episode_id=' + detail.douyinEpisodeId
})
} else {
tt.navigateTo({
url: '/pagesC/ttvideo/ttVideoDetail?data=' + encodeURIComponent(JSON.stringify(detail)) +
'&tt_album_id=' + detail.douyinAlbumId + '&tt_episode_id=' + detail.douyinEpisodeId +
'&playNext=' + playNext
})
}
}
export {
gotoVideoPlayerPage
}
\ No newline at end of file
<template>
<view style="position: relative;">
<view v-if="agreeFlag"
style="width: 100%;height: 100%;background-color: black;opacity: 0.8;display: flex;position: absolute;z-index: 100;color: white;flex-direction: column;align-items: center;padding:40rpx 0;">
<text style="font-size: 30rpx;">
付费须知 \n
1、看点和会员属于虚拟商品,一经购买不可退换 \n
2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作;\n
3、充值看点一般5分钟内到账,如未到账请在“我的”页面联系客服;
</text>
<image @click="agreeFlag=false" style="width: 30rpx;height: 30rpx;margin-top:150rpx;"
src="@/static/index/ic_quit_white.png"></image>
</view>
<view class="body" style="width: 100%;height: 100%;">
<scroll-view scroll-y>
<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"
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>
</view>
<view style="display: flex;flex-direction: column;margin-bottom: 20rpx;padding-left: 14rpx;">
<view style="font-size: 38rpx;color: black;">{{titleText}}</view>
<view class="flex">
<view v-if="point>0" style="display: flex;flex-direction: row;margin-top: 10rpx;">
<view style="font-size: 28rpx;color: #644238;margin-top: 12rpx;">解锁本集需:</view>
<view style="font-size: 42rpx;color: red;font-weight: 777;">{{point}}</view>
<view style="font-size: 28rpx;color: #644238;margin-top: 12rpx;margin-left: 6rpx;">
看点,
</view>
</view>
<view v-if="point>0" style="width: 60rpx;"></view>
<view style="display: flex;flex-direction: row;margin-top: 10rpx;">
<view style="font-size: 28rpx;color: #644238;margin-top: 12rpx;">当前账户余额:</view>
<view style="font-size: 42rpx;color: red;font-weight: 777;">{{userBean.point}}
</view>
<view style="font-size: 28rpx;color: #644238;margin-top: 12rpx;margin-left: 6rpx;">
看点
</view>
</view>
</view>
</view>
<view class="section">
<view class="pack-box">
<view class="pack-item"
:style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f5f5f5;'"
:class="[{active: index==selectedIndex}]" v-for='(item, index) in vipList' :key='index'
@click="choosePack(item, index)">
<view style="display: flex;flex-direction: column;align-items: center;">
<view v-if="os=='android'" class="price row">
{{item.firstPayPrice}}
</view>
<view v-else style="display: flex;align-items: center;font-size: 40rpx;
color: #f2b068;
font-weight: 700;">
<image style="width: 50rpx;height: 50rpx;display: flex;margin-right: 10rpx;"
src="@/static/ic_zuan.png">
</image>
+{{multiply(item.firstPayPrice)}}
</view>
<view class="name row" v-if="item.title!=null&&item.title!=''">
{{item.title}}
</view>
<view class="origin row" v-if="item.remarks!=null&&item.remarks!=''">
{{item.remarks}}
</view>
</view>
<view class="cut-down" v-if='item.topTitle!=null&&item.topTitle.length>0'>
{{item.topTitle}}
</view>
<view v-if="index==selectedIndex" style="position: absolute;bottom: 0;right: 0;">
<image mode="scaleToFill"
style="width: 100rpx;height: 100rpx;display: flex;align-items: right;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_loading.gif">
</image>
</view>
</view>
</view>
</view>
<view style="display: flex;flex-direction: column;align-items: center;">
<view @click="onVip" style="font-size: 34rpx;color: black;margin-top: 16rpx;margin-bottom: 10rpx;">
更多充值及说明 ></view>
</view>
<view style="display: flex;flex-direction: column;align-items: center;">
<view style="font-size: 29rpx;color: gray;margin-top: 16rpx;">
客服时间工作日 9:00-18:00</view>
<button class="button2" open-type="im" data-im-id="kaixinhaha7785">在线客服</button>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
message
} from '@/utils/fun';
const {
getPlayletManager
} = tt;
export default {
mixins: [common],
data() {
return {
vipList: [],
selectedIndex: 0,
agreeFlag: false,
userBean: {},
os: 'android',
titleText: '解锁剧集',
showClone: false
};
},
async beforeCreate() {
const pm = await getPlayletManager({
is: 'charge' // 和插槽同名
});
this.pm = pm;
console.error(pm, this, "charge_pm_this_beforeCreate");
},
created() {
console.log("chargeCreated");
},
beforeMount() {
console.log("chargeBeforeMount");
this.loadData()
},
mounted() {
console.log("chargeMounted");
},
beforeUpdate() {
console.log("chargeBeforeUpdate");
},
updated() {
console.log("chargeUpdated");
},
beforeDestroy() {
console.log("chargeBeforeDestroy");
},
destroyed() {
console.log("chargeDestroyed");
},
methods: {
multiply(num) {
return parseInt(num * 10);
},
// 支付完成回调
paySuccess(largeType) {},
loadData() {
let that = this;
if (tt.getSystemInfoSync().platform === 'ios') {
this.os = 'ios';
}
common.data.post({
url: '/vip/getVipProducts/point',
data: {
vedioId: that.point <= 0 ? null : that.vedioId
},
showLoading: false,
success: ({
data
}) => {
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;
break;
}
}
}
}
});
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
handleAgree() {
this.agreeFlag = true
},
handleClickClose() {},
handleClose() {},
choosePack(item, index) {
this.selectedIndex = index;
this.handlePay();
},
handlePay() {
let that = this;
let vipBean = this.vipList[this.selectedIndex];
this.post({
url: '/vip/getVipPayParams/douyin',
data: {
vedioId: that.point <= 0 ? null : that.vedioId,
os: that.os,
pid: vipBean.pid
},
showLoading: true,
success: ({
data
}) => {
that.ttPrePay(data, vipBean.largeType);
}
});
},
onVip() {
navigateTo(`/pagesA/vipPay/vipPay?vedioId=` + this.vedioId)
this.handleClose();
},
ttPrePay(ttData, largeType) {
if (!tt.canIUse('requestOrder')) {
message.notify('请升级抖音APP版本');
return
}
let that = this;
tt.requestOrder({
data: ttData.params.data,
byteAuthorization: ttData.params.byteAuthorization,
success(res) {
that.ttPay(largeType, res.orderId, ttData);
},
fail(res) {
// message.notify(res.errMsg);
},
});
},
ttPay(largeType, oid, ttData) {
if (!tt.canIUse('getOrderPayment')) {
message.notify('请升级抖音APP版本');
return
}
let that = this;
tt.getOrderPayment({
orderId: oid,
success(res) {
that.queryOrderStatus(largeType, ttData.tidStr);
},
fail(res) {
if (res.errNo == '4') {
// 4-支付取消
}
// message.notify(res.errMsg);
},
});
},
queryOrderStatus(largeType, tid) {
let that = this;
this.post({
data: {
tid: tid
},
url: '/vip/queryVipOrder',
showLoading: true,
success: ({
data
}) => {
that.paySuccess(largeType);
}
});
},
}
};
</script>
<style lang="scss">
.body {
padding: 10rpx 0 30rpx 0;
border-radius: 20rpx 20rpx 0 0;
background-color: white;
display: flex;
flex-direction: column;
align-items: center;
}
.section {
min-height: 400rpx;
display: flex;
flex-direction: column;
background: white;
}
.pack-box {
margin-top: 25rpx;
margin-left: 18rpx;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.active {
border: 6rpx solid #fd5350 !important;
}
.pack-item {
margin-bottom: 25rpx;
margin-right: 22rpx;
width: calc(45%);
height: 190rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
// background: #f5f5f5;
border: 6rpx solid #f5f5f5;
border-radius: 10rpx;
position: relative;
.row {
margin: 8rpx 15rpx;
marign-bottom: 0;
}
.row:last-child {
margin-bottom: 8rpx;
}
.name {
font-size: 29rpx;
color: #333;
}
.price {
font-size: 40rpx;
color: #fd5350;
font-weight: 700;
}
.origin {
color: #5A3C0F;
// background: #5a1505;
background-image: linear-gradient(90deg, #F3DEBE, #EAC180);
font-size: 22rpx;
border-radius: 20rpx;
height: 30rpx;
line-height: 30rpx;
padding-top: 4rpx;
padding-bottom: 3rpx;
padding-left: 16rpx;
padding-right: 16rpx;
}
.cut-down {
position: absolute;
top: 0;
color: #fff;
background: #ff502f;
font-size: 22rpx;
border-radius: 15rpx;
height: 30rpx;
line-height: 30rpx;
padding-top: 6rpx;
padding-bottom: 3rpx;
padding-left: 16rpx;
padding-right: 16rpx;
transform: translate(0, -50%);
}
}
}
.button2 {
width: 300rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
margin: 10rpx 20rpx;
border-radius: 10rpx;
background-color: white;
border: 1px orange solid;
color: orange;
font-size: 26rpx;
box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1);
}
</style>
\ No newline at end of file
...@@ -42,10 +42,14 @@ ...@@ -42,10 +42,14 @@
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import {
gotoVideoPlayerPage
} from "@/common/page-route.js"
import { import {
message, message,
navigateTo, navigateTo,
} from '../../utils/fun.js' } from '../../utils/fun.js'
...@@ -109,8 +113,7 @@ ...@@ -109,8 +113,7 @@
this.$emit("goRecommend") this.$emit("goRecommend")
}, },
click(detail) { click(detail) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) + gotoVideoPlayerPage(detail)
'&tt_album_id=' + detail.douyinAlbumId + '&tt_episode_id=' + detail.douyinEpisodeId);
}, },
longClick(key) { longClick(key) {
this.isEditStyle = true this.isEditStyle = true
...@@ -154,7 +157,7 @@ ...@@ -154,7 +157,7 @@
success: ({ success: ({
data data
}) => { }) => {
this.isEditStyle = false this.isEditStyle = false
message.notify("删除成功") message.notify("删除成功")
this.loadData() this.loadData()
} }
......
<template> <template>
<view class="body"> <view class="body">
<view v-if="showMask" class="show-mask flex-v" @click="showMask=false"> <view v-if="showMask" class="show-mask flex-v" @click="showMask=false">
<view class="mt-30" style="width: 90%;text-align: right;"> <view class="mt-30" style="width: 90%;text-align: right;">
<image style="width: 30rpx;height: 30rpx;padding:6rpx; <image style="width: 30rpx;height: 30rpx;padding:6rpx;
border-radius: 40rpx;border: 2px solid darkgray;" src="@/static/index/ic_quit_white.png" /> border-radius: 40rpx;border: 2px solid darkgray;" src="@/static/index/ic_quit_white.png" />
</view> </view>
<text class="mt-10" style="font-size: 46rpx;">如何继续看剧?</text> <text class="mt-10" style="font-size: 46rpx;">如何继续看剧?</text>
<text class="m-10">找到“山梨剧场” 小程序</text> <text class="m-10">找到“山梨剧场” 小程序</text>
<image class="mt-30" mode="widthFix" :src="maskImage1"></image> <image class="mt-30" mode="widthFix" :src="maskImage1"></image>
<image :src="maskImage2" mode="widthFix"></image> <image :src="maskImage2" mode="widthFix"></image>
</view> </view>
<z-paging class="flex-1" ref="paging" v-model="dataList" @query="queryList"> <z-paging class="flex-1" ref="paging" v-model="dataList" @query="queryList">
<view class="search-wrap"> <view class="search-wrap">
<!-- <image style="width: 80rpx; height: 80rpx" src="@/static/index/ic_quit_white.png"></image> --> <!-- <image style="width: 80rpx; height: 80rpx" src="@/static/index/ic_quit_white.png"></image> -->
<view class="search-bar" @click="handleSearchPage"> <view class="search-bar" @click="handleSearchPage">
<image style="width: 40rpx; height: 40rpx" src="@/static/search.png"></image> <image style="width: 40rpx; height: 40rpx" src="@/static/search.png"></image>
<text style="margin-left: 30rpx;color: darkgray;">{{ <text style="margin-left: 30rpx;color: darkgray;">{{
bannerList.length > 0 ? bannerList[0].title : '' bannerList.length > 0 ? bannerList[0].title : ''
}}</text> }}</text>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<swiper class="banner" :style="'margin-top:'+statusBarHeight+'px;'" :indicator-dots="true" <swiper class="banner" :style="'margin-top:'+statusBarHeight+'px;'" :indicator-dots="true"
:autoplay="true" :interval="2000" :duration="500"> :autoplay="true" :interval="2000" :duration="500">
<swiper-item v-for="banner in bannerList" :key="banner.vedioId" @click="handleBanner(banner)"> <swiper-item v-for="banner in bannerList" :key="banner.vedioId" @click="handleBanner(banner)">
<image class="banner-img" :src="banner.tabImage" mode="aspectFill"></image> <image class="banner-img" :src="banner.tabImage" mode="aspectFill"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view <view
style="display: flex;flex-direction: column;background-color:white;border-radius:10rpx;margin-top: 20rpx;"> style="display: flex;flex-direction: column;background-color:white;border-radius:10rpx;margin-top: 20rpx;">
<view style="font-size: 30rpx;font-weight: 777;margin-left: 12rpx;margin-top: 18rpx;">排行榜</view> <view style="font-size: 30rpx;font-weight: 777;margin-left: 12rpx;margin-top: 18rpx;">排行榜</view>
<scroll-view scroll-x="true" style="white-space: nowrap; margin-top: 18rpx;"> <scroll-view scroll-x="true" style="white-space: nowrap; margin-top: 18rpx;">
<block v-for="(item, index) in topList" :key="item.vedioId"> <block v-for="(item, index) in topList" :key="item.vedioId">
<view @click="handleTop(item)" <view @click="handleTop(item)"
style="display:inline-block;background-color:white;border-radius:10rpx;width: 200rpx;margin: 5rpx 10rpx 15rpx 10rpx;"> style="display:inline-block;background-color:white;border-radius:10rpx;width: 200rpx;margin: 5rpx 10rpx 15rpx 10rpx;">
<view style="position: relative;"> <view style="position: relative;">
<view style="position: relative;"> <view style="position: relative;">
<view style="position: absolute;z-index: 10;margin-left: 20rpx;"> <view style="position: absolute;z-index: 10;margin-left: 20rpx;">
<view style="position: relative;"> <view style="position: relative;">
<view style=" <view style="
position: absolute; position: absolute;
z-index: 10; z-index: 10;
width: 50rpx; width: 50rpx;
text-align: center; text-align: center;
margin-top: 8rpx; margin-top: 8rpx;
font-size: 24rpx; font-size: 24rpx;
color: white;"> color: white;">
{{index+1}} {{index+1}}
</view> </view>
<image v-if="index==0" <image v-if="index==0"
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/y43.png"></image> src="../../static/index/y43.png"></image>
<image v-else-if="index==1" <image v-else-if="index==1"
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/y42.png"></image> src="../../static/index/y42.png"></image>
<image v-else-if="index==2" <image v-else-if="index==2"
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/y41.png"></image> src="../../static/index/y41.png"></image>
<image v-else <image v-else
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/y4.png"></image> src="../../static/index/y4.png"></image>
</view> </view>
</view> </view>
<image style="border-radius:10rpx; width: 200rpx;height: 260rpx;" <image style="border-radius:10rpx; width: 200rpx;height: 260rpx;"
:src="item.coverImage" mode="aspectFill"></image> :src="item.coverImage" mode="aspectFill"></image>
</view> </view>
<view style=" <view style="
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
background-color: black; background-color: black;
width: 100%; width: 100%;
opacity: 0.5; opacity: 0.5;
"> ">
<view style="display: flex;align-items: center;margin-left: 10rpx;"> <view style="display: flex;align-items: center;margin-left: 10rpx;">
<image <image
style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/ic_index_play.png"></image> src="../../static/index/ic_index_play.png"></image>
<view style="font-size: 22rpx;color: white;">{{item.showNum}}</view> <view style="font-size: 22rpx;color: white;">{{item.showNum}}</view>
</view> </view>
</view> </view>
</view> </view>
<view style="font-size: 26rpx;margin-top: 10rpx;height: 62rpx;">{{item.title}}</view> <view style="font-size: 26rpx;margin-top: 10rpx;height: 62rpx;">{{item.title}}</view>
<view class="ellipsis" style="font-size: 22rpx;margin-top: 10rpx;" <view class="ellipsis" style="font-size: 22rpx;margin-top: 10rpx;"
v-if="item.orderTags!=null&&item.orderTags.length>0"> v-if="item.orderTags!=null&&item.orderTags.length>0">
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
<block v-for="t in item.orderTags" :key="item.orderTags"> <block v-for="t in item.orderTags" :key="item.orderTags">
<view style="display:inline-block;margin-right: 4rpx;">{{t}} </view> <view style="display:inline-block;margin-right: 4rpx;">{{t}} </view>
</block> </block>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
</view> </view>
<!-- <view <!-- <view
style="font-size: 30rpx;font-weight: 777;margin-top: 20rpx;margin-bottom: 10rpx;margin-left: 4rpx;"> style="font-size: 30rpx;font-weight: 777;margin-top: 20rpx;margin-bottom: 10rpx;margin-left: 4rpx;">
推荐</view> --> 推荐</view> -->
<u-sticky></u-sticky> <u-sticky></u-sticky>
<view style="width: 100%;"> <view style="width: 100%;">
<!-- <u-sticky bgColor="#fff"> --> <!-- <u-sticky bgColor="#fff"> -->
<u-tabs :current="typeIndex" :list="typesList" @change="popHandleChange" lineWidth="30" <u-tabs :current="typeIndex" :list="typesList" @change="popHandleChange" lineWidth="30"
keyName='type' lineColor="#0faeff" :activeStyle="{ keyName='type' lineColor="#0faeff" :activeStyle="{
color: '#0faeff', color: '#0faeff',
fontWeight: 'bold', fontWeight: 'bold',
transform: 'scale(1.05)' transform: 'scale(1.05)'
}" :inactiveStyle="{ }" :inactiveStyle="{
color: '#808080', color: '#808080',
transform: 'scale(1)' transform: 'scale(1)'
}"></u-tabs> }"></u-tabs>
<!-- </u-sticky> --> <!-- </u-sticky> -->
</view> </view>
<view style="column-count: 2;column-gap: 20rpx;margin-top: 20rpx;"> <view style="column-count: 2;column-gap: 20rpx;margin-top: 20rpx;">
<view class="item-wrap" v-for="(item, index) in dataList" :key="index" v-if="index % 2 == 0" <view class="item-wrap" v-for="(item, index) in dataList" :key="index" v-if="index % 2 == 0"
@click="handleInfo(item)"> @click="handleInfo(item)">
<view style="position: relative;"> <view style="position: relative;">
<image class="img" :src="item.coverImage" mode="aspectFill"></image> <image class="img" :src="item.coverImage" mode="aspectFill"></image>
<view style=" <view style="
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
width: 95%; width: 95%;
padding: 10rpx; padding: 10rpx;
background-color: black; background-color: black;
opacity: 0.5; opacity: 0.5;
"> ">
<view style="display: flex;flex-direction: row;justify-content:space-between;"> <view style="display: flex;flex-direction: row;justify-content:space-between;">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image <image
style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/ic_index_play.png"></image> src="../../static/index/ic_index_play.png"></image>
<view style="font-size: 22rpx;color: white;">{{item.showNum}}</view> <view style="font-size: 22rpx;color: white;">{{item.showNum}}</view>
</view> </view>
<view style="font-size: 22rpx;color: white;font-weight: 777;">{{item.vedioTotal}} <view style="font-size: 22rpx;color: white;font-weight: 777;">{{item.vedioTotal}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view style="font-size: 30rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.title}}</view> <view style="font-size: 30rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.title}}</view>
<!-- <view style="font-size: 22rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.vedioDesc}}</view> --> <!-- <view style="font-size: 22rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.vedioDesc}}</view> -->
</view> </view>
<view class="item-wrap" v-for="(item, index2) in dataList" :key="index2" v-if="index2 % 2 == 1" <view class="item-wrap" v-for="(item, index2) in dataList" :key="index2" v-if="index2 % 2 == 1"
@click="handleInfo(item)"> @click="handleInfo(item)">
<view style="position: relative;"> <view style="position: relative;">
<image class="img" :src="item.coverImage" mode="aspectFill"></image> <image class="img" :src="item.coverImage" mode="aspectFill"></image>
<view style=" <view style="
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
width: 95%; width: 95%;
padding: 10rpx; padding: 10rpx;
background-color: black; background-color: black;
opacity: 0.5; opacity: 0.5;
"> ">
<view style="display: flex;flex-direction: row;justify-content:space-between;"> <view style="display: flex;flex-direction: row;justify-content:space-between;">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image <image
style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;" style="width: 20rpx;height: 20rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="../../static/index/ic_index_play.png"></image> src="../../static/index/ic_index_play.png"></image>
<view style="font-size: 22rpx;color: white;">{{item.showNum}}</view> <view style="font-size: 22rpx;color: white;">{{item.showNum}}</view>
</view> </view>
<view style="font-size: 22rpx;color: white;font-weight: 777;">{{item.vedioTotal}} <view style="font-size: 22rpx;color: white;font-weight: 777;">{{item.vedioTotal}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view style="font-size: 30rpx;margin-top: 10rpx;margin-left: 12rpx;"> <view style="font-size: 30rpx;margin-top: 10rpx;margin-left: 12rpx;">
{{item.title}} {{item.title}}
</view> </view>
<!-- <view style="font-size: 22rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.vedioDesc}}</view> --> <!-- <view style="font-size: 22rpx;margin-top: 10rpx;margin-left: 12rpx;">{{item.vedioDesc}}</view> -->
</view> </view>
</view> </view>
</view> </view>
</z-paging> </z-paging>
<view v-if="newRecordBean!=null" <view v-if="newRecordBean!=null"
style="width: 97%;height: 150rpx;margin: 10rpx;opacity: 0.8;background-color: black;z-index: 20;position: absolute;bottom: 0;border-radius:10rpx;"> style="width: 97%;height: 150rpx;margin: 10rpx;opacity: 0.8;background-color: black;z-index: 20;position: absolute;bottom: 0;border-radius:10rpx;">
<view style="display: flex;margin-left: 10rpx;"> <view style="display: flex;margin-left: 10rpx;">
<view style="flex-grow: 2;display: flex;align-items: center;"> <view style="flex-grow: 2;display: flex;align-items: center;">
<image style="border-radius:10rpx; width: 100rpx;height: 130rpx;margin-top: 10rpx;" <image style="border-radius:10rpx; width: 100rpx;height: 130rpx;margin-top: 10rpx;"
:src="newRecordBean.coverImage" mode="aspectFill"></image> :src="newRecordBean.coverImage" mode="aspectFill"></image>
<view style="margin: 20rpx;"> <view style="margin: 20rpx;">
<view style="font-size: 30rpx; color: white;">{{newRecordBean.title}}</view> <view style="font-size: 30rpx; color: white;">{{newRecordBean.title}}</view>
<view style="font-size: 24rpx;margin-top: 6rpx;color: white;">上次观看至第{{newRecordBean.seeIndex}} <view style="font-size: 24rpx;margin-top: 6rpx;color: white;">上次观看至第{{newRecordBean.seeIndex}}
</view> </view>
<view style="font-size: 22rpx;" <view style="font-size: 22rpx;"
v-if="newRecordBean.orderTags!=null&&newRecordBean.orderTags.length>0"> v-if="newRecordBean.orderTags!=null&&newRecordBean.orderTags.length>0">
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
<block v-for="t in newRecordBean.orderTags" :key="newRecordBean.orderTags"> <block v-for="t in newRecordBean.orderTags" :key="newRecordBean.orderTags">
<view style="display:inline-block;margin-right: 4rpx;">{{t}} </view> <view style="display:inline-block;margin-right: 4rpx;">{{t}} </view>
</block> </block>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
</view> </view>
<view style="display: flex;flex-direction: column;align-items: flex-end;"> <view style="display: flex;flex-direction: column;align-items: flex-end;">
<image @click="handleBottomClose()" <image @click="handleBottomClose()"
style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin: 10rpx;" style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin: 10rpx;"
src="../../static/index/ic_quit_white.png" mode="aspectFill"></image> src="../../static/index/ic_quit_white.png" mode="aspectFill"></image>
<view @click="handleBottomPlay(newRecordBean)" style=" <view @click="handleBottomPlay(newRecordBean)" style="
width: 160rpx; width: 160rpx;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
text-align: center; text-align: center;
background-color: red; background-color: red;
border-radius:30rpx; border-radius:30rpx;
color: white; color: white;
font-size: 24rpx; font-size: 24rpx;
margin-right: 20rpx;"> margin-right: 20rpx;">
继续观看 继续观看
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="box-wrap"> <view class="box-wrap">
<image class="img1" @click="handleTaskPage" :src="boxImgUrl"></image> <image class="img1" @click="handleTaskPage" :src="boxImgUrl"></image>
</view> </view>
<!-- <uni-popup type="center" ref="select"> <!-- <uni-popup type="center" ref="select">
<view> <view>
<view style="font-size: 30rpx;font-weight: 777;color: white;">刚刚看的</view> <view style="font-size: 30rpx;font-weight: 777;color: white;">刚刚看的</view>
<view style="text-align: center;"> <view style="text-align: center;">
<view> <view>
<video :id="recommendBean.vedioId" :loop="true" :enable-progress-gesture="false" <video :id="recommendBean.vedioId" :loop="true" :enable-progress-gesture="false"
:show-loading="true" :show-fullscreen-btn="false" :show-loading="true" :show-fullscreen-btn="false"
style="width:100%; height:100%;background: #f56c6c;" :src="recommendBean.vedioUrl" style="width:100%; height:100%;background: #f56c6c;" :src="recommendBean.vedioUrl"
:poster="recommendBean.coverImage" play-btn-position="center" object-fit="contain" /> :poster="recommendBean.coverImage" play-btn-position="center" object-fit="contain" />
</view> </view>
<view>123</view> <view>123</view>
<view @click="handleVipPay" <view @click="handleVipPay"
style="width: 350rpx;height: 80rpx;background-color: #f2575b;border-radius:20rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;"> style="width: 350rpx;height: 80rpx;background-color: #f2575b;border-radius:20rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;">
立即试看 立即试看
</view> </view>
</view> </view>
</view> </view>
</uni-popup> --> </uni-popup> -->
</view> </view>
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import {
gotoVideoPlayerPage
import { } from "@/common/page-route.js"
navigateTo,
message, import {
alert, navigateTo,
loading message,
} from '../../utils/fun.js' alert,
import { loading
openUrl } from '../../utils/fun.js'
} from '../../utils/app+.js' import {
openUrl
const app = getApp(); } from '../../utils/app+.js'
export default { const app = getApp();
name: 'index',
mixins: [common], export default {
data() { name: 'index',
return { mixins: [common],
index: 0, data() {
index2: 0, return {
dataList: [], index: 0,
bannerList: [], index2: 0,
typesList: [], dataList: [],
topList: [], bannerList: [],
typeIndex: 0, typesList: [],
typeId: -1, topList: [],
newRecordBean: null, typeIndex: 0,
showMask: false, typeId: -1,
firstEnter: false, newRecordBean: null,
maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png', showMask: false,
maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png', firstEnter: false,
boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png', maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png',
statusBarHeight: app.globalData.statusBarHeight, maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png',
}; boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
}, statusBarHeight: app.globalData.statusBarHeight,
methods: { };
loadData(){ },
methods: {
}, loadData() {
showMaskFuc() {
let showFollowMask = uni.getStorageSync('show-follow-mask') || ''; },
showMaskFuc() {
if (showFollowMask == '1') { let showFollowMask = uni.getStorageSync('show-follow-mask') || '';
this.showMask = true
if (showFollowMask == '1') {
uni.setStorage({ this.showMask = true
key: 'show-follow-mask',
data: '2' uni.setStorage({
}); key: 'show-follow-mask',
} data: '2'
}, });
show() { }
// 显示引导图 },
this.showMaskFuc() show() {
// 显示引导图
// 匹配视频 this.showMaskFuc()
this.showFirstDialog();
// 匹配视频
// 轮播图 this.showFirstDialog();
this.post({
url: '/vedio/topTabs', // 轮播图
showLoading: false, this.post({
success: ({ url: '/vedio/topTabs',
data showLoading: false,
}) => { success: ({
this.bannerList = data.list; data
} }) => {
}); this.bannerList = data.list;
// 排行榜 }
this.post({ });
url: '/vedio/orders', // 排行榜
data: {}, this.post({
showLoading: false, url: '/vedio/orders',
success: ({ data: {},
data showLoading: false,
}) => { success: ({
this.topList = data.list; data
} }) => {
}); this.topList = data.list;
// 最近观看剧 }
this.post({ });
url: '/vedio/newest', // 最近观看剧
data: {}, this.post({
showLoading: false, url: '/vedio/newest',
success: ({ data: {},
data showLoading: false,
}) => { success: ({
if (data.vedio != null) { data
this.newRecordBean = data.vedio; }) => {
} if (data.vedio != null) {
} this.newRecordBean = data.vedio;
}); }
}
// 分类列表 });
this.post({
url: '/vedio/types', // 分类列表
data: {}, this.post({
showLoading: false, url: '/vedio/types',
success: ({ data: {},
data showLoading: false,
}) => { success: ({
if (data.list) { data
this.typeId = data.list[0].typeId }) => {
this.typesList = data.list if (data.list) {
this.typeId = data.list[0].typeId
if(!this.firstEnter){ this.typesList = data.list
this.firstEnter=true
setTimeout(() => { if (!this.firstEnter) {
if (this.$refs.paging != null) { this.firstEnter = true
this.$refs.paging.reload(); setTimeout(() => {
} if (this.$refs.paging != null) {
}, 500); this.$refs.paging.reload();
} }
} }, 500);
} }
}); }
}
}, });
hide() {
},
}, hide() {
queryList(page, size) {
let that = this },
// 推荐列表 queryList(page, size) {
this.post({ let that = this
url: '/vedio/listByType', // 推荐列表
data: { this.post({
page, url: '/vedio/listByType',
size, data: {
typeId: that.typeId page,
}, size,
showLoading: false, typeId: that.typeId
success: ({ },
data showLoading: false,
}) => { success: ({
data
// this.$refs.paging.complete(data.list); }) => {
this.$refs.paging.complete(data.list);
} // this.$refs.paging.complete(data.list);
}); this.$refs.paging.complete(data.list);
}, }
popHandleChange(e) { });
this.typeId = e.typeId },
if (this.$refs.paging != null) { popHandleChange(e) {
// this.$refs.paging.reload(); this.typeId = e.typeId
this.$refs.paging.refresh(); if (this.$refs.paging != null) {
} // this.$refs.paging.reload();
}, this.$refs.paging.refresh();
handleBanner(item) { }
// navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + },
// '&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId); handleBanner(item) {
}, gotoVideoPlayerPage(item)
handleInfo(item) { },
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + handleInfo(item) {
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId); gotoVideoPlayerPage(item)
}, },
handleTop(item) { handleTop(item) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + gotoVideoPlayerPage(item)
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId); },
}, handleBottomPlay(item) {
handleBottomPlay(item) { gotoVideoPlayerPage(item)
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + },
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId); handleBottomClose() {
}, this.newRecordBean = null;
handleBottomClose() { this.post({
this.newRecordBean = null; url: '/vedio/colseNewest',
this.post({ data: {},
url: '/vedio/colseNewest', showLoading: false,
data: {}, success: ({
showLoading: false, data
success: ({ }) => {}
data });
}) => {} },
}); handleSearchPage() {
}, navigateTo(`/pagesA/search/search`)
handleSearchPage() { },
navigateTo(`/pagesA/search/search`) handleTaskPage() {
}, navigateTo(`/pagesA/task/task`)
handleTaskPage() { },
navigateTo(`/pagesA/task/task`) showFirstDialog() {
}, let that = this;
showFirstDialog() { let loadEpisode_id = uni.getStorageSync('tt_episode_id') || '';
let that = this; let loadAlbum_id = uni.getStorageSync('tt_album_id') || '';
let loadEpisode_id = uni.getStorageSync('tt_episode_id') || ''; setTimeout(() => {
let loadAlbum_id = uni.getStorageSync('tt_album_id') || ''; that.post({
setTimeout(() => { url: '/vedio/firstVedio/douyin',
that.post({ data: {
url: '/vedio/firstVedio/douyin', episode_id: loadEpisode_id,
data: { album_id: loadAlbum_id
episode_id: loadEpisode_id, },
album_id: loadAlbum_id showLoading: false,
}, success: ({
showLoading: false, data
success: ({ }) => {
data if (data.vedioMsg != null) {
}) => {
if (data.vedioMsg != null) { gotoVideoPlayerPage(data.vedioMsg)
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(
JSON.stringify(data.vedioMsg)) + // 重置短视频挂载id
'&tt_album_id=' + data.vedioMsg.douyinAlbumId + uni.setStorage({
'&tt_episode_id=' + data.vedioMsg.douyinEpisodeId); key: 'tt_album_id',
data: ''
// 重置短视频挂载id });
uni.setStorage({ uni.setStorage({
key: 'tt_album_id', key: 'tt_episode_id',
data: '' data: ''
}); });
uni.setStorage({ }
key: 'tt_episode_id', }
data: '' });
}); }, 800);
} }
} }
}); };
}, 800); </script>
}
} <style lang="scss">
}; .body {
</script> // background-color: whitesmoke;
position: relative;
<style lang="scss"> }
.body {
// background-color: whitesmoke; .search-wrap {
position: relative; height: 80rpx;
} margin: 10rpx 0;
display: flex;
.search-wrap { flex-direction: row;
height: 80rpx; }
margin: 10rpx 0;
display: flex; .search-bar {
flex-direction: row; width: 100%;
} margin-left: 20rpx;
margin-right: 20rpx;
.search-bar { border-radius: 10rpx;
width: 100%; background-color: white;
margin-left: 20rpx; display: flex;
margin-right: 20rpx; flex-direction: row;
border-radius: 10rpx; align-items: center;
background-color: white; padding: 0 20rpx;
display: flex; }
flex-direction: row;
align-items: center; .show-mask {
padding: 0 20rpx; width: 100%;
} height: 100%;
background: rgba(0, 0, 0, 0.6);
.show-mask { position: absolute;
width: 100%; z-index: 999;
height: 100%; color: white;
background: rgba(0, 0, 0, 0.6); align-items: center;
position: absolute;
z-index: 999; image {
color: white; width: 90%;
align-items: center; }
}
image {
width: 90%; .item-wrap {
} width: 100%;
} border-radius: 10rpx;
background-color: #fff;
.item-wrap { break-inside: avoid;
width: 100%; margin-bottom: 20rpx;
border-radius: 10rpx; height: 500rpx;
background-color: #fff; }
break-inside: avoid;
margin-bottom: 20rpx; .img {
height: 500rpx; position: relative;
} border-radius: 10rpx;
width: 100%;
.img { height: 390rpx;
position: relative; }
border-radius: 10rpx;
width: 100%; .box-wrap {
height: 390rpx; height: 100rpx;
} width: 120rpx;
right: 10rpx;
.box-wrap { bottom: 240rpx;
height: 100rpx; position: absolute;
width: 120rpx; z-index: 999;
right: 10rpx;
bottom: 240rpx; .img1 {
position: absolute; width: 100rpx;
z-index: 999; height: 100rpx;
}
.img1 { }
width: 100rpx;
height: 100rpx;
}
}
</style> </style>
\ No newline at end of file
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
@ended="ended"> @ended="ended">
</tt-video-player> </tt-video-player>
</view> </view>
<view v-if="!isqp" class="userInfo flex"> <!-- <view v-if="!isqp" class="userInfo flex"> -->
<view v-if="false" class="userInfo flex">
<!-- 点赞 --> <!-- 点赞 -->
<view class="flex" style="opacity: 0.9; margin-top: 10rpx;"> <view class="flex" style="opacity: 0.9; margin-top: 10rpx;">
<image @click.stop="collect(list.vedioId,index)" v-if="list.collect==0" <image @click.stop="collect(list.vedioId,index)" v-if="list.collect==0"
...@@ -50,6 +51,9 @@ ...@@ -50,6 +51,9 @@
</template> </template>
<script> <script>
import {
gotoVideoPlayerPage
} from '../../common/page-route.js'
import common from '../../mixins/common.js' import common from '../../mixins/common.js'
import { import {
...@@ -238,9 +242,7 @@ ...@@ -238,9 +242,7 @@
this.isqp = e.detail.show this.isqp = e.detail.show
}, },
detail(detail) { detail(detail) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) + gotoVideoPlayerPage(detail)
'&tt_album_id=' + detail.douyinAlbumId + '&tt_episode_id=' + detail.douyinEpisodeId +
`&playNext=1`);
}, },
collect(vedioId, index) { collect(vedioId, index) {
this.originList[index].collect = 1 this.originList[index].collect = 1
......
<template>
<view>
<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">
<text class="title">恭喜你,获得免费看剧名额</text>
<text class="button" @click="showRewardAd">看广告免费解锁1集</text>
<text class="downtext">{{countDown}}s后自动进入广告,观看完成解锁第{{seq+1}}集剧情</text>
</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;">
<view style="font-size: 26rpx;font-weight: 700;">添加至桌面</view>
<view style="font-size: 22rpx;">下次看剧更方便</view>
</view>
<button @click="addShortcut" open-type="addShortcut" bindaddshortcut="eventHandler" style="font-size:26rpx;background-color:crimson;border-radius:5rpx;color:white;
height:55rpx;line-height:53rpx;margin-left:30rpx;font-weight:700;">立即添加</button>
<image @click="closeShortcutPop" style="width:30rpx;height:30rpx;" src="../../static/video/close.png">
</image>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
message
} from '../../utils/fun';
import {
REWARD_ID
} from '../../utils/adConstant.js';
const {
getPlayletManager
} = tt;
export default {
props: ["titles"],
data() {
return {
pm: null,
count: 0,
albumId: "",
seq: 0,
episodeId: "",
countDown: 3,
showRewardAdPop: false,
showAdForServer: false,
showShortcutPop: false,
canShowShortcut: false,
};
},
async beforeCreate() {
const pm = await getPlayletManager({
is: "playler", // 和插槽同名
});
pm.getPlayletInfo().then(res => {
this.albumId = res.albumId
this.seq = res.seq
this.episodeId = res.episodeId
});
this.pm = pm;
console.log(pm, this, "player_pm_this_beforeCreate");
pm.onPlay((e) => {
// 保存观看记录
console.error("触发开始播放onPlay回调:", e);
});
pm.onPause((e) => {
console.log("触发暂停播放onPause回调:", e);
});
pm.onEnded(async (e) => {
console.log("触发播放到末尾onEnded回调", e);
});
pm.onError((e) => {
console.error("报错了 报错了", e);
});
// 播放进度变化时
pm.onTimeUpdate((e) => {
// 播放进度变化时触发,返回当前播放时间点及视频总时长,单位:秒(s)。event.detail = { currentTime, duration }。
console.log("触发播放进度变化onTimeUpdate回调:", e);
// 播放到第10秒且今天没有弹出 ,弹出加入桌面
if ((e.currentTime > 10) && this.canShowShortcut) {
this.showShortcutPop = true
this.canShowShortcut = false
this.setShowShortcut()
}
});
pm.onWaiting((e) => {
console.log("触发视频出现缓冲onWaiting回调:", e);
});
pm.onPlayBackRateChange((e) => {
console.log("触发视频倍速改变onPlayBackRateChange回调:", e);
});
pm.onLoadedMetaData((e) => {
console.log("触发视频元数据加载完成onLoadedMetaData回调:", e);
});
pm.onSeekComplete((e) => {
console.log("触发seek完成onSeekComplete回调:", e);
});
pm.onMuteChange((e) => {
console.log("触发静音状态改变onMuteChange回调:", e);
});
pm.onControlTap((e) => {
switch (e.controlType) {
case "subscribe":
this.collect()
break
case "unsubscribe":
this.cancelCollect()
break
}
console.log("触发点击控件onControlTap回调:", e);
});
pm.onOpenCatalog((e) => {
console.log("触发点击选集onOpenCatalog回调:", e);
});
// 推荐位使用简单示例
pm.onChangeEpisode((e) => {
console.log("触发选集切换onChangeEpisode回调:", e);
this.albumId = e.albumId
this.seq = e.seq
this.episodeId = e.episodeId
if (e.status == 'lock') {
this.unlock()
} else {
this.commitVideo()
}
});
pm.onClickUnlock((e) => {
console.log("player解锁", e);
if (this.showAdForServer) {
this.showRewardAdPop = true
this.startCountdown()
} else {
this.pm.toggleCustomDialog()
}
});
pm.onTapCustomIcon((e) => {
console.log("触发点击自定义组件onTapCustomIcon回调:", e);
});
pm.onTapShare((e) => {
console.log("onTapShare", e);
return {
// 分享数据
title: `第 ${e.seq}集`,
desc: `这是默认的转发文案,用户可以直接发送,也可以在发布器内修改,分享的episodeId是 ${e.episodeId}`,
path: `pagesC/playlet/index?tt_album_id=${e.albumId}&tt_episode_id=${e.episodeId}`, // ?后面的参数会在转发页面打开时传入onLoad方法
imageUrl: "", // 支持本地或远程图片,默认是小程序 icon
templateId: "这是开发者后台设置的分享素材模板id",
};
});
pm.onShareSuccess((e) => {
console.log("分享成功onShareSuccess回调:", e);
});
pm.onShareFail((e) => {
console.log("分享失败onShareSuccess回调:", e);
});
},
created() {
console.log("playerCreated");
},
beforeMount() {
console.log("playerBeforeMount");
},
mounted() {
this.loadAdSwitch()
this.getShowShortcut()
console.log("playerMounted");
},
beforeUpdate() {
console.log("playerBeforeUpdate");
},
updated() {
console.log("playerUpdated");
this.count % 2 == 0 ?
this.pm.setPlayStatus("play") :
this.pm.setPlayStatus("pause");
},
beforeDestroy() {
console.log("playerBeforeDestroy");
},
destroyed() {
console.log("playerDestroyed ");
},
methods: {
eventHandler(e) {
this.showShortcutPop = false
if (e.detail.errNo) {
console.log("添加到桌面失败", e.detail);
} else {
console.log("添加到桌面成功");
}
},
closeShortcutPop() {
this.showShortcutPop = false
this.canShowShortcut = false
uni.setStorage({
key: 'close_shortcut',
data: "close"
});
},
cliPause() {
console.error(this.$props);
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
// 创建实例
this.ad = tt.createRewardedVideoAd({
adUnitId: REWARD_ID,
});
// 监听错误
this.ad.onError((err) => {
uni.hideLoading();
message.notify("网络太火爆了,请稍候重试")
switch (err.errCode) {
case 1004:
// 无合适的广告
break;
default:
// 更多请参考错误码文档
}
that.$nextTick(() => {
// 延迟渲染,否则位置错乱
that.pm.toggleCustomDialog()
})
});
// 监听视频播放完成
this.ad.onClose((data) => {
uni.hideLoading();
if (data.isEnded) {
message.notify("正在为您解锁剧集")
that.adUnlock()
} else {
message.notify("未观看完整视频")
that.$nextTick(() => {
// 延迟渲染,否则位置错乱
that.pm.toggleCustomDialog()
})
}
});
// do other thing
// 卸载 close 事件监听
// this.ad.offClose(closeHandler);
// 预加载资源
this.ad.load();
},
startCountdown() {
let that = this;
var countDownSeconds = 3
that.countDown = countDownSeconds
const timer = setInterval(() => {
if (countDownSeconds > 0) {
that.countDown = countDownSeconds
countDownSeconds--
} else {
clearInterval(timer)
if (that.showRewardAdPop) {
that.showRewardAd()
}
}
}, 1000)
},
showAdPop() {
this.showRewardAdPop = true
this.startCountdown()
},
closeAdPop() {
this.showRewardAdPop = false
},
showRewardAd() {
this.showRewardAdPop = false
// 播放激励视频
uni.showLoading({
title: '广告加载中'
});
this.ad.show();
},
collect() {
// 收藏
common.methods.post({
url: '/vedio/collect',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {}
});
},
cancelCollect() {
// 取消收藏
common.methods.post({
url: '/vedio/cancelCollect',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {}
});
},
commitVideo() {
common.methods.post({
url: '/vedio/reportIndex',
data: {
albumId: this.albumId,
vedioIndex: this.seq,
},
showLoading: false,
success: ({
data
}) => {}
});
},
unlock() {
let that = this
common.methods.post({
url: '/vedio/unlock',
data: {
albumId: this.albumId,
num: this.seq
},
showLoading: false,
success: ({
data
}) => {
message.notify(data.msg)
if (data.code == 200) {
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()
} else if (data.code == 303) {
this.pm.toggleCustomDialog()
}
}
});
},
adUnlock() {
let that = this
this.post({
url: '/vedio/unlockByAd',
data: {
adSource: 'csj',
albumId: this.albumId,
num: this.seq,
ecpm: ''
},
showLoading: false,
success: ({
data
}) => {
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()
} else if (data.code == 303) {
that.pm.toggleCustomDialog()
}
}
});
},
getShowShortcut() {
let closeShortcut = uni.getStorageSync('close_shortcut')
if (closeShortcut) {
this.canShowShortcut = false
return
}
let shortcutTime = uni.getStorageSync('shortcut_time')
if (shortcutTime) {
this.canShowShortcut = !this.isToday(shortcutTime)
} else {
this.canShowShortcut = true
}
},
setShowShortcut() {
uni.setStorage({
key: 'shortcut_time',
data: Date.now()
});
},
isToday(timestamp) {
const today = new Date();
const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate()).getTime();
return timestamp >= todayStart && timestamp < todayStart + 86400000; // 86400000 毫秒为一天
}
},
};
</script>
<style lang="scss">
.shortcut {
position: absolute;
top: 85%;
left: 40%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: row;
align-items: center;
// justify-content: space-between;
width: 65%;
height: 100rpx;
padding: 0 20rpx;
background-color: whitesmoke;
border-radius: 10rpx;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -60%);
width: 600rpx;
height: 800rpx;
display: flex;
flex-direction: column;
justify-content: center;
}
.ad-view {
width: 600rpx;
border-radius: 20rpx;
margin-bottom: 10px;
}
.content {
border-radius: 20rpx;
background-color: white;
display: flex;
width: 600rpx;
padding: 30rpx 0;
flex-direction: column;
align-items: center;
.title {
color: black;
font-size: 40rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
.button {
margin: 20rpx 20rpx;
border-radius: 10rpx;
background-color: orange;
color: white;
font-size: 36rpx;
}
.downtext {
color: darkgray;
font-size: 26rpx;
}
}
</style>
\ No newline at end of file
<template>
<view>
<button
class="reset-button button"
@click="onClick"
hover-class="button-hover"
:class="[shape == 'circle' ? 'round-circle' : '']"
>
<slot></slot>
</button>
</view>
</template>
<script>
/**
* m-field button 按钮组件
* @description 常用按钮组件。
* @tutorial https://ui.ymeoo.cn
* @property {String} color 按钮主题色
* @property {String} shape 设置为circle,则按钮两边为半圆形
* @event {Function} click 组件自定义点击事件
* @example <u-form-item label="姓名"><u-input v-model="form.name" /></u-form-item>
*/
export default {
name: 'q-button',
props: {
shape: {
type: String,
default: 'circle'
}
},
data() {
return {};
},
methods: {
onClick() {
this.$emit('click', '');
}
}
};
</script>
<style lang="scss" scoped>
// 去除button的所有默认样式
.reset-button {
padding: 0;
font-size: inherit;
line-height: inherit;
background-color: transparent;
color: inherit;
}
.reset-button::after {
border: none;
}
// button样式
.button {
display: block;
padding: 20rpx;
margin: 20rpx;
background-image: -moz-linear-gradient(135deg, rgb(0, 255, 255), rgb(29, 147, 251));
background-image: -webkit-linear-gradient(135deg, rgb(0, 255, 255), rgb(29, 147, 251));
background-image: linear-gradient(135deg, rgb(0, 255, 255), rgb(29, 147, 251));
color: #fff;
}
.button-hover {
background-color: #f5f5f5 !important;
}
.round-circle {
border-radius: 100rpx;
}
</style>
{ {
"uni-app": { "uni-app": {
"scripts": { "scripts": {}
"mp-dingtalk": {
"title": "钉钉小程序",
"env": {
"UNI_PLATFORM": "mp-alipay"
},
"define": {
"MP-DINGTALK": true
}
},
"mp-weixin-test": {
"title": "本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
},
"mp-app-test": {
"title": "App 本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
}
}
}, },
"dependencies": { "dependencies": {
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
......
{ {
"easycom": { "easycom": {
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue", "^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue",
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^n-(.*)": "@/nPro/$1/$1.vue", // 匹配nPro内的vue文件 "^n-(.*)": "@/nPro/$1/$1.vue", // 匹配nPro内的vue文件
"^nx-(.*)": "@/nProX/$1/$1.vue" // 匹配nProX内的vue文件 "^nx-(.*)": "@/nProX/$1/$1.vue" // 匹配nProX内的vue文件
} }
}, },
"pages": [ "pages": [
// #ifndef APP-PLUS // #ifndef APP-PLUS
{ {
"path": "pages/loading", "path": "pages/loading"
"style": { },
"navigationStyle": "default", // #endif
"navigationBarBackgroundColor": "#F2F1FF", {
"navigationBarTextStyle": "#000000" "path": "pages/home",
} "style": {
}, "navigationBarTitleText": "山梨剧场"
// #endif }
{ }, {
"path": "pages/home", "path": "pages/brower/brower"
"style": { }
"navigationBarTitleText": "山梨剧场", ],
"navigationStyle": "default", // 分包配置
"navigationBarBackgroundColor": "#ffffff", "subPackages": [{
"navigationBarTextStyle": "black" "root": "pagesA",
} "pages": [{
}, { "path": "vipPay/vipPay"
"path": "pages/brower/brower", }, {
"style": { "path": "search/search"
"navigationStyle": "default", }, {
"navigationBarBackgroundColor": "#ffffff", "path": "task/task"
"navigationBarTextStyle": "black" }]
} },
} {
], "root": "pagesC",
// 分包配置 "pages": [{
"subPackages": [{ "path": "ttvideo/ttVideoDetail",
"root": "pagesA", "style": {
"pages": [{ "backgroundColor": "#000000",
"path": "vipPay/vipPay", "navigationBarBackgroundColor": "#000000",
"style": { "navigationBarTextStyle": "#ffffff"
"navigationStyle": "default", }
"navigationBarBackgroundColor": "#ffffff", }, {
"navigationBarTextStyle": "black" "path": "playlet/index",
} "style": {
}, { "extends": "ext://industry/playlet-plugin",
"path": "search/search", "isPageExtension": true
"style": { }
"navigationStyle": "default", }]
"navigationBarBackgroundColor": "#ffffff", },
"navigationBarTextStyle": "black" {
} "root": "pagesD",
}, { "pages": [{
"path": "task/task", "path": "watchRecord/watchRecord",
"style": { "style": {
"navigationStyle": "default", "navigationBarTitleText": "观看记录"
"navigationBarBackgroundColor": "#ffffff", }
"navigationBarTextStyle": "black" }, {
} "path": "payRecord/payRecord",
}] "style": {
}, { "navigationBarTitleText": "我的订单"
"root": "pagesC", }
"pages": [{ }, {
"path": "ttvideo/ttVideoDetail", "path": "dotRecord/dotRecord",
"style": { "style": {
"backgroundColor": "#000000", "navigationBarTitleText": "看点记录"
"navigationStyle": "default", }
"navigationBarBackgroundColor": "#000000", }, {
"navigationBarTextStyle": "#ffffff" "path": "useDotRecord/useDotRecord",
} "style": {
}] "navigationBarTitleText": "消费记录",
}, "navigationStyle": "default",
{ "navigationBarBackgroundColor": "#ffffff",
"root": "pagesD", "navigationBarTextStyle": "black"
"pages": [{ }
"path": "watchRecord/watchRecord", }, {
"style": { "path": "invite/invite",
"navigationBarTitleText": "观看记录", "style": {
"navigationStyle": "default", "navigationBarTitleText": "邀好友得1000看点"
"navigationBarBackgroundColor": "#ffffff", }
"navigationBarTextStyle": "black" }, {
} "path": "cdkey/cdkey",
}, { "style": {
"path": "payRecord/payRecord", "navigationBarTitleText": "兑换会员"
"style": { }
"navigationBarTitleText": "我的订单", }]
"navigationStyle": "default", }
"navigationBarBackgroundColor": "#ffffff", ],
"navigationBarTextStyle": "black" // 分包预载配置
} "preloadRule": {
}, { // 当我们进入了pages/home页面以后就会预下载pagesA分包
"path": "dotRecord/dotRecord", "pages/home": {
"style": { "network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"navigationBarTitleText": "看点记录", "packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
"navigationStyle": "default", }
"navigationBarBackgroundColor": "#ffffff", },
"navigationBarTextStyle": "black" "globalStyle": {
} "backgroundColor": "#f5f5f5",
}, { "navigationStyle": "default",
"path": "useDotRecord/useDotRecord", "navigationBarTextStyle": "black",
"style": { "app-plus": {
"navigationBarTitleText": "消费记录", "bounce": "none",
"navigationStyle": "default", "scrollIndicator": "none"
"navigationBarBackgroundColor": "#ffffff", },
"navigationBarTextStyle": "black" "usingComponents": {
} "tt-video-player": "ext://industry/video-player"
}, { }
"path": "invite/invite", },
"style": { "condition": { //模式配置,仅开发期间生效
"navigationBarTitleText": "邀好友得1000看点", "current": 0, //当前激活的模式(list 的索引项)
"navigationStyle": "default", "list": [{
"navigationBarBackgroundColor": "#ffffff", "name": "", //模式名称
"navigationBarTextStyle": "black" "path": "", //启动页面,必选
} "query": "" //启动参数,在页面的onLoad函数里面得到
}, { }]
"path": "cdkey/cdkey", }
"style": {
"navigationStyle": "default",
"navigationBarTitleText": "兑换会员",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}]
}
],
// 分包预载配置
"preloadRule": {
// 当我们进入了pages/home页面以后就会预下载pagesA分包
"pages/home": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
}
},
"globalStyle": {
"backgroundColor": "#f5f5f5",
"navigationStyle": "default",
"app-plus": {
"bounce": "none",
"scrollIndicator": "none"
},
"usingComponents": {
"tt-video-player": "ext://industry/video-player"
}
},
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}]
}
} }
\ No newline at end of file
...@@ -79,6 +79,9 @@ ...@@ -79,6 +79,9 @@
</template> </template>
<script> <script>
import {
gotoVideoPlayerPage
} from '../../common/page-route';
import common from '@/mixins/common'; import common from '@/mixins/common';
import { import {
navigateTo, navigateTo,
...@@ -166,8 +169,7 @@ ...@@ -166,8 +169,7 @@
this.showEmpty = false this.showEmpty = false
}, },
handleListItem(item) { handleListItem(item) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + gotoVideoPlayerPage(item)
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId);
}, },
saveSearchWord(word) { saveSearchWord(word) {
// 校验是否保存过,保存过不保存 // 校验是否保存过,保存过不保存
......
<script>
import Player from "@/components/player/player.vue";
import Charge from "@/components/charge/charge.vue";
const {
PlayletExtension,
getPlayletManager
} = tt;
PlayletExtension();
import common from '@/mixins/common';
export default {
components: {
Player,
Charge
},
//采用uniapp的生命周期函数
onLoad(option) {
let data = JSON.parse(decodeURIComponent(option.data));
setTimeout(() => {
const p_m = getPlayletManager(this);
p_m.setCatalog({
freeList: data.douyinFreeList,
unlockList: data.douyinUnlockList,
lockList: data.douyinLockList,
});
}, 500)
},
onReady() {
const p_m = getPlayletManager(this);
p_m.onPlay((e) => {
console.error("可以播放了,可以播放了,可以播放了,可以播放了", e);
});
p_m.onError((e) => {
console.error("插件页onload 报错了 报错了", e);
});
p_m.onPause((e) => {
console.error("触发暂停播放onPause回调:", e);
});
},
onShow() {
console.log("show");
},
mounted() {
console.error(this, "this");
},
onShareAppMessage() {
console.log("share");
},
methods: {
cliPause(num) {
console.log(num, "cliPause");
}
},
};
</script>
\ No newline at end of file
...@@ -36,7 +36,9 @@ ...@@ -36,7 +36,9 @@
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import {
gotoVideoPlayerPage
} from "@/common/page-route.js"
import { import {
navigateTo, navigateTo,
message, message,
...@@ -79,8 +81,7 @@ ...@@ -79,8 +81,7 @@
}); });
}, },
handleInfo(item) { handleInfo(item) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) + gotoVideoPlayerPage(item)
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId);
}, },
handleXing(item) { handleXing(item) {
var that = this; var that = this;
......
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