吆喝
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
// api请求前缀
|
||||
webUrl: 'https://wx.yaohe.hnjrdzkj.xyz', //
|
||||
imgUrl: 'https://wx.yaohe.hnjrdzkj.xyz/', //
|
||||
staticUrl: 'https://wx.yaohe.hnjrdzkj.xyz/img/', //
|
||||
mini_appid: 'wx94a6522b1d640c3b',
|
||||
TabbarIndex: 2
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
page{
|
||||
background: #F8F8F9;
|
||||
}
|
||||
|
||||
button::after{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.over-hide{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.flex{display: flex;}
|
||||
.flex.space{justify-content: space-between;}
|
||||
.flex.center{justify-content: center;}
|
||||
.flex.alcenter{align-items: center;}
|
||||
.flex.alend{align-items:flex-end}
|
||||
.flex.start{justify-content: flex-start;}
|
||||
.flex.end{justify-content: flex-end;}
|
||||
.flex.wrap{flex-direction: row;flex-wrap: wrap;}
|
||||
.flex .col1{width: 100%;}
|
||||
.flex .col2{width: 50%;}
|
||||
.flex .col3{width: 33.33%;}
|
||||
.flex .col4{width: 25%;}
|
||||
.flex .col5{width:20%;}
|
||||
|
||||
.ft10{font-size: 20rpx;}
|
||||
.ft12{font-size: 24rpx;}
|
||||
.ft14{font-size: 28rpx;}
|
||||
.ft16{font-size: 32rpx;}
|
||||
.ft18{font-size: 36rpx;}
|
||||
.ft20{font-size: 40rpx;}
|
||||
.ft22{font-size: 44rpx;}
|
||||
.ft24{font-size: 48rpx;}
|
||||
.ft28{font-size: 56rpx;}
|
||||
.ft32{font-size: 64rpx;}
|
||||
.ft36{font-size: 72rpx;}
|
||||
.ft40{font-size: 80rpx;}
|
||||
.ft50{font-size: 100rpx;}
|
||||
.ft60{font-size: 120rpx;}
|
||||
.ft80{font-size: 160rpx;}
|
||||
|
||||
/*字体加粗*/
|
||||
.ftw400{font-weight: 400;}
|
||||
.ftw500{font-weight: 500;}
|
||||
.ftw600{font-weight: 600;}
|
||||
|
||||
.ft-italic{font-style: italic;}
|
||||
|
||||
.text-over{ overflow: hidden; text-overflow: ellipsis;white-space: nowrap;}
|
||||
.text-over1{ overflow: hidden; text-overflow: ellipsis;white-space: nowrap;}
|
||||
.text-over2{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;}
|
||||
.text-over3{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;}
|
||||
.text-over4{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 4;-webkit-box-orient: vertical;}
|
||||
.text-over5{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;}
|
||||
.text-over6{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 6;-webkit-box-orient: vertical;}
|
||||
.text-over7{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 7;-webkit-box-orient: vertical;}
|
||||
.text-over8{overflow: hidden; text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 8;-webkit-box-orient: vertical;}
|
||||
.text-center{text-align: center;}
|
||||
.text-right{text-align: right;}
|
||||
.text-line{text-decoration:line-through;}
|
||||
.text-line-down{text-decoration: underline;}
|
||||
|
||||
.lh16{line-height: 32rpx;}
|
||||
.lh18{line-height: 36rpx;}
|
||||
.lh20{line-height: 40rpx;}
|
||||
.lh22{line-height: 44rpx;}
|
||||
.lh24{line-height: 48rpx;}
|
||||
.lh26{line-height: 52rpx;}
|
||||
.lh28{line-height: 56rpx;}
|
||||
.lh30{line-height: 60rpx;}
|
||||
.lh32{line-height: 64rpx;}
|
||||
.lh36{line-height: 72rpx;}
|
||||
.lh40{line-height: 80rpx;}
|
||||
|
||||
.cl-w{color:#FFFFFF;}
|
||||
.cl-w9{color:rgba(255,255,255,0.9)}
|
||||
.cl-w8{color:rgba(255,255,255,0.8)}
|
||||
.cl-main{color:#2E2F33;}
|
||||
.cl-default{color:#000000;}
|
||||
.cl-info2{color:#5C5E66;}
|
||||
.cl-info{color:#666666;}
|
||||
.cl-placeholder{color:#CCCCCC;}
|
||||
.cl-light{color:#E4E6ED;}
|
||||
.cl-notice{color:#AEB2C1;}
|
||||
.cl-price{color:#FF3D3D;}
|
||||
.cl-999{color:#999999;}
|
||||
.cl-333{color:#333333;}
|
||||
|
||||
.cl-yellow{color:#FFE5AD;}
|
||||
.cl-green{color:#00C657;}
|
||||
.cl-manage{color:#5E40FF;}
|
||||
.cl-orange{color:#FF6600}
|
||||
.cl-blue{color:#1890FF}
|
||||
|
||||
.bg-w{background: #FFFFFF;}
|
||||
.bg-default{background: #F7F7F7;}
|
||||
.bg-manage{background: #5E40FF;}
|
||||
|
||||
.mt2{margin-top: 4rpx;}
|
||||
.mt4{margin-top: 8rpx;}
|
||||
.mt5{margin-top: 10rpx;}
|
||||
.mt6{margin-top: 12rpx;}
|
||||
.mt7{margin-top: 15rpx;}
|
||||
.mt8{margin-top: 16rpx;}
|
||||
.mt10{margin-top: 20rpx;}
|
||||
.mt12{margin-top: 24rpx;}
|
||||
.mt14{margin-top: 28rpx;}
|
||||
.mt15{margin-top: 30rpx;}
|
||||
.mt16{margin-top: 32rpx;}
|
||||
.mt18{margin-top: 36rpx;}
|
||||
.mt20{margin-top: 40rpx;}
|
||||
.mt24{margin-top: 48rpx;}
|
||||
.mt25{margin-top: 50rpx;}
|
||||
.mt30{margin-top: 60rpx;}
|
||||
.mt32{margin-top: 64rpx;}
|
||||
.mt40{margin-top: 80rpx;}
|
||||
.mt60{margin-top: 120rpx;}
|
||||
|
||||
.mb4{margin-bottom: 8rpx;}
|
||||
.mb5{margin-bottom: 10rpx;}
|
||||
.mb7{margin-bottom: 15rpx;}
|
||||
.mb10{margin-bottom: 20rpx;}
|
||||
.mb15{margin-bottom: 30rpx;}
|
||||
.mb16{margin-bottom: 32rpx;}
|
||||
.mb20{margin-bottom: 40rpx;}
|
||||
.mb24{margin-bottom: 48rpx;}
|
||||
.mb25{margin-bottom: 50rpx;}
|
||||
.mb30{margin-bottom: 60rpx;}
|
||||
|
||||
.ml4{margin-left: 8rpx;}
|
||||
.ml5{margin-left: 10rpx;}
|
||||
.ml7{margin-left: 15rpx;}
|
||||
.ml10{margin-left: 20rpx;}
|
||||
.ml15{margin-left: 30rpx;}
|
||||
.ml20{margin-left: 40rpx;}
|
||||
.ml25{margin-left: 50rpx;}
|
||||
.ml30{margin-left: 60rpx;}
|
||||
.ml60{margin-left: 120rpx;}
|
||||
|
||||
.mr5{margin-right: 10rpx;}
|
||||
.mr7{margin-right: 15rpx;}
|
||||
.mr10{margin-right: 20rpx;}
|
||||
.mr15{margin-right: 30rpx;}
|
||||
.mr20{margin-right: 40rpx;}
|
||||
.mr25{margin-right: 50rpx;}
|
||||
.mr30{margin-right: 60rpx;}
|
||||
.mr60{margin-right: 120rpx;}
|
||||
|
||||
/**一般PADDING需要用到的值,其他的不通用的单独设置**/
|
||||
.pt5{padding-top: 10rpx;}
|
||||
.pt10{padding-top: 20rpx;}
|
||||
.pt12{padding-top: 24rpx;}
|
||||
.pt15{padding-top: 30rpx;}
|
||||
.pt16{padding-top: 32rpx;}
|
||||
.pt18{padding-top: 36rpx;}
|
||||
.pt20{padding-top: 40rpx;}
|
||||
.pt24{padding-top: 48rpx;}
|
||||
.pt30{padding-top: 60rpx;}
|
||||
.pt32{padding-top: 64rpx;}
|
||||
.pt40{padding-top: 80rpx;}
|
||||
.pt60{padding-top: 120rpx;}
|
||||
.pt80{padding-top: 160rpx;}
|
||||
|
||||
.pb5{padding-bottom: 10rpx;}
|
||||
.pb10{padding-bottom: 20rpx;}
|
||||
.pb12{padding-bottom: 24rpx;}
|
||||
.pb15{padding-bottom: 30rpx;}
|
||||
.pb16{padding-bottom: 32rpx;}
|
||||
.pb20{padding-bottom: 40rpx;}
|
||||
.pb24{padding-bottom: 48rpx;}
|
||||
.pb30{padding-bottom: 60rpx;}
|
||||
.pb32{padding-bottom: 64rpx;}
|
||||
|
||||
.pd5{padding: 10rpx;}
|
||||
.pd10{padding: 20rpx;}
|
||||
.pd15{padding:30rpx;}
|
||||
.pd20{padding: 40rpx;}
|
||||
.pd30{padding: 60rpx;}
|
||||
.pd32{padding: 64rpx;}
|
||||
|
||||
.plr5{padding:0rpx 10rpx;}
|
||||
.plr10{padding:0rpx 20rpx;}
|
||||
.plr15{padding:0rpx 30rpx;}
|
||||
.plr20{padding:0rpx 40rpx;}
|
||||
.plr30{padding: 0rpx 60rpx;}
|
||||
.plr40{padding: 0rpx 80rpx;}
|
||||
|
||||
.pr5{padding-right: 10rpx;}
|
||||
.pr10{padding-right: 20rpx;}
|
||||
.pr15{padding-right: 30rpx;}
|
||||
.pr20{padding-right: 40rpx;}
|
||||
.pr30{padding-right: 60rpx;}
|
||||
|
||||
.pl5{padding-left: 10rpx;}
|
||||
.pl10{padding-left: 20rpx;}
|
||||
.pl15{padding-left: 30rpx;}
|
||||
.pl20{padding-left: 40rpx;}
|
||||
.pl30{padding-left: 60rpx;}
|
||||
.pd0_15{
|
||||
padding: 0px 30rpx;
|
||||
}
|
||||
.pd5_15{
|
||||
padding: 10rpx 30rpx;
|
||||
}
|
||||
.pd10_15{
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
.pd12_10{
|
||||
padding: 24rpx 20rpx;
|
||||
}
|
||||
.pd20_15{
|
||||
padding: 40rpx 30rpx;
|
||||
}
|
||||
.pd16_15{
|
||||
padding: 32rpx 30rpx;
|
||||
}
|
||||
.pd16_20{
|
||||
padding: 32rpx 40rpx;
|
||||
}
|
||||
.pd24_15{
|
||||
padding: 48rpx 30rpx;
|
||||
}
|
||||
.pd24_20{
|
||||
padding: 48rpx 40rpx;
|
||||
}
|
||||
/*缩小*/
|
||||
.scale6{transform: scale(.6);}
|
||||
.scale8{transform: scale(.8);}
|
||||
|
||||
/*透明度*/
|
||||
.op3{opacity: .3;}
|
||||
.op5{opacity: .5;}
|
||||
.op8{opacity: .8;}
|
||||
.op9{opacity: .9;}
|
||||
|
||||
.picker-view{
|
||||
height: 400rpx;
|
||||
}
|
||||
.picker-view .item{
|
||||
line-height: 100rpx;
|
||||
font-size: 32rpx;
|
||||
color:#333333;
|
||||
}
|
||||
|
||||
.box{
|
||||
width:100%;
|
||||
background:#FFFFFF;
|
||||
box-shadow:0rpx 8rpx 40rpx 0rpx rgba(0,0,0,0.04);
|
||||
border-radius:32rpx;
|
||||
}
|
||||
.box.noshadow{
|
||||
box-shadow:none;
|
||||
}
|
||||
|
||||
.bd-line{
|
||||
height: 2rpx;
|
||||
width: 100%;
|
||||
background: #E4E6ED;
|
||||
}
|
||||
.bd-bottom{
|
||||
border-bottom: 2rpx solid rgba(230, 230, 230, 0.8);
|
||||
}
|
||||
.bd-left{
|
||||
border-left: 2upx solid rgba(230, 230, 230, 0.4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.form-footer-h{
|
||||
height: 140rpx;
|
||||
height: calc(140rpx + constant(safe-area-inset-bottom));
|
||||
height: calc(140rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.form-footer{
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: #FFFFFF;
|
||||
box-shadow:0rpx -4rpx 16rpx 0rpx rgba(0,0,0,0.04);
|
||||
}
|
||||
.form-footer-main{
|
||||
width: 100%;
|
||||
height: 140rpx;
|
||||
}
|
||||
.form-footer-item{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: #FFFFFF;
|
||||
line-height: 1;
|
||||
color:#AEB2C1;
|
||||
}
|
||||
|
||||
.btn-big,.btn-manage,.btn-mid,.btn-manage-mid,.btn-small,.btn-mini,.btn-manage-small,.btn-manage-mini{
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
border-radius:50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #000000;
|
||||
background: #FFFFFF;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
transition: all 0.4s;
|
||||
}
|
||||
.btn-big.dis,.btn-manage.dis,.btn-mid.dis,.btn-manage-mid.dis,.btn-small.dis,.btn-mini.dis,.btn-manage-small.dis,.btn-manage-mini.dis{
|
||||
background:#F0F1F5;
|
||||
color:#AEB2C1;
|
||||
}
|
||||
|
||||
.btn-manage,.btn-manage-mid,.btn-manage-small,.btn-manage-mini{
|
||||
background:#5E40FF;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
.btn-mid,.btn-manage-mid{
|
||||
width: 300rpx;
|
||||
height: 80rpx;
|
||||
border-radius:40rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.btn-manage.plan,.btn-manage-mid.plan,.btn-manage-small.plan,.btn-manage-mini.plan{
|
||||
border:2rpx solid #5E40FF;
|
||||
background: #FFFFFF;
|
||||
color:#5E40FF;
|
||||
}
|
||||
.btn-big.plan,.btn-mid.plan,.btn-small.plan,.btn-mini.plan{
|
||||
border:2rpx solid #E4E6ED;
|
||||
background: #FFFFFF;
|
||||
color:#353535;
|
||||
}
|
||||
.btn-small,.btn-mini,.btn-manage-small,.btn-manage-mini{
|
||||
width: 176rpx;
|
||||
font-size: 28rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
}
|
||||
.btn-mini,.btn-manage-mini{
|
||||
width: 120rpx;
|
||||
}
|
||||
/* 全局loading动画 */
|
||||
.loading_page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.loading_page image{
|
||||
width: 58rpx;
|
||||
height: 58rpx;
|
||||
position: relative;
|
||||
margin-top: 100rpx;
|
||||
/* #ifdef h5 */
|
||||
margin-top: 0;
|
||||
/* #endif */
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
import {httpRequest} from "./request.js";
|
||||
const login={
|
||||
wxLogin(){
|
||||
return new Promise((resolve,reject)=>{
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
httpRequest({
|
||||
url:'/api/user/getOpenid',
|
||||
data:{
|
||||
code: res.code, //wx.login 登录成功后的code
|
||||
ad_code: uni.getStorageSync('get_ad_code'),
|
||||
invite: uni.getStorageSync("invite_number")
|
||||
},
|
||||
|
||||
}).then((opRes)=>{
|
||||
uni.setStorageSync("openid", opRes.data.openid)
|
||||
if (opRes.msg == '登录成功') {
|
||||
uni.setStorageSync("userinfo", opRes.data.userinfo);
|
||||
uni.setStorageSync("token", opRes.data.userinfo.token);
|
||||
uni.setStorageSync("config", opRes.data.config);
|
||||
resolve('login success')
|
||||
} else {
|
||||
this.Loginops(opRes).then(opRes => {
|
||||
resolve('login success')
|
||||
}).catch(logPErr => {
|
||||
reject(logPErr)
|
||||
})
|
||||
}
|
||||
}).catch(opErr=>{
|
||||
reject(opErr)
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
},
|
||||
Loginops(openData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url:'/api/user/getphone',
|
||||
method: 'GET',
|
||||
data: {
|
||||
openid: openData.data.openid,
|
||||
pid: '0',
|
||||
invite: uni.getStorageSync('invite_number') ||'',
|
||||
ad_code: uni.getStorageSync('get_ad_code') || ''
|
||||
},
|
||||
}).then(uRes=>{
|
||||
if(uRes.code ==1){
|
||||
uni.setStorageSync("userinfo", uRes.data.userinfo);
|
||||
uni.setStorageSync("token", uRes.data.userinfo.token);
|
||||
uni.setStorageSync("config", uRes.data.config);
|
||||
resolve('login success')
|
||||
}
|
||||
}).catch(uErr=>{
|
||||
reject(uErr)
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
export default login
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
import {httpRequest} from "@/utils/request";
|
||||
|
||||
const pays = {
|
||||
beansPay(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url: '/api/pay/videopay',
|
||||
data: data,
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
serverCreatOrder(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url: '/api/pay/payInfo',
|
||||
data: data,
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
wxIosCreatOrder(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url: '/api/pay/beansPay',
|
||||
data: data,
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 小程序虚拟支付(小程序android)
|
||||
wxAppletAndroidPay(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.requestVirtualPayment({
|
||||
signData: JSON.stringify({
|
||||
buyQuantity: data.signData.buyQuantity,
|
||||
currencyType: data.signData.currencyType,
|
||||
env: data.signData.env,
|
||||
goodsPrice: data.signData.goodsPrice,
|
||||
offerId: data.signData.offerId,
|
||||
outTradeNo: data.signData.outTradeNo,
|
||||
platform: data.signData.platform,
|
||||
productId: data.signData.productId,
|
||||
attach: data.signData.attach,
|
||||
}),
|
||||
paySig: data.paySig,
|
||||
signature: data.signature,
|
||||
mode: 'short_series_coin',
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err){
|
||||
reject(err)
|
||||
},
|
||||
})
|
||||
// uni.requestPayment({
|
||||
// provider: 'wxpay',
|
||||
// appId: data.appId,
|
||||
// timeStamp: data.timeStamp + '',
|
||||
// nonceStr: data.nonceStr,
|
||||
// package: data.package,
|
||||
// signType: 'MD5',
|
||||
// paySign: data.sign,
|
||||
// success: function(res1) {
|
||||
// resolve(res1)
|
||||
// },
|
||||
// fail: function(err1) {
|
||||
// reject(err1)
|
||||
// }
|
||||
// });
|
||||
})
|
||||
},
|
||||
// 小程序IOS支付
|
||||
wxAppletIosPay(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log('wxAppletIosPay')
|
||||
console.log(data)
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
appId: data.appId,
|
||||
timeStamp: data.timeStamp + '',
|
||||
nonceStr: data.nonceStr,
|
||||
package: data.package,
|
||||
signType: 'MD5',
|
||||
paySign: data.sign,
|
||||
success: function(res1) {
|
||||
resolve(res1)
|
||||
},
|
||||
fail: function(err1) {
|
||||
reject(err1)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
// 拉卡拉支付
|
||||
lakalaPay(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url: '/api/pay/payInfo',
|
||||
data: data,
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
export default {
|
||||
pays
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
var playletPlugin = requirePlugin("playlet-plugin");
|
||||
import configs from '@/utils/config.js';
|
||||
import {httpRequest} from '@/utils/request'
|
||||
import {login} from './login'
|
||||
import PAY from '@/utils/pay'
|
||||
// 点击按钮触发此函数跳转到播放器页面
|
||||
function navigateToPlayer(obj) {
|
||||
// 下面的${dramaId}变量,需要替换成小程序管理后台的媒资管理上传的剧的dramaId
|
||||
// 变量${srcAppid}是提审方appid
|
||||
// 变量${serialNo}第几集
|
||||
// 变量${extParam}是分享参数,分享的卡片和二维码会在分享的链接上携带此参数
|
||||
const { extParam, dramaId, srcAppid=configs.mini_appid,serialNo=1 } = obj
|
||||
wx.navigateTo({
|
||||
url: `plugin-private://wx94a6522b1d640c3b/pages/playlet/playlet?dramaId=${dramaId}&srcAppid=${srcAppid}&serialNo=${serialNo}&extParam=${extParam || ''}`
|
||||
})
|
||||
}
|
||||
function deepClone(obj) {
|
||||
if (typeof obj !== 'object' || !obj) return obj
|
||||
let newObj = obj instanceof Array ? [] : {}
|
||||
for (let key in obj) {
|
||||
if (typeof obj[key] === 'object') {
|
||||
newObj[key] = deepClone(obj[key])
|
||||
} else {
|
||||
newObj[key] = obj[key]
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
}
|
||||
|
||||
const proto = {
|
||||
data: { // 可通过this.data访问
|
||||
playerId: '',//播放器id
|
||||
arr: [],
|
||||
vid:"",//剧id
|
||||
info:{},
|
||||
mid:"",//剧集id
|
||||
userInfo:{},
|
||||
is_record:0,//是否追剧 0未追 1已追
|
||||
pay_oid:'',
|
||||
},
|
||||
_onPlayerLoad(info) {
|
||||
let that = this,
|
||||
shareInterval = null;
|
||||
console.log("_onPlayerLoad",info);
|
||||
if(info.extParam){
|
||||
if(info.extParam.indexOf("%")<0){
|
||||
this.data.info = info;
|
||||
}else if(info.extParam){
|
||||
info.extParam = decodeURIComponent(info.extParam )
|
||||
this.data.info = info;
|
||||
}else{}
|
||||
this.data.vid = JSON.parse(info.extParam).vid;
|
||||
if(JSON.parse(info.extParam).g_order_id){//存储分享后的gid
|
||||
uni.setStorageSync('g_order_id',JSON.parse(info.extParam).g_order_id);
|
||||
uni.setStorageSync('g_order_vid',JSON.parse(info.extParam).vid);
|
||||
}
|
||||
}
|
||||
this.data.playerId = info.playerId
|
||||
const pm = playletPlugin.PlayletManager.getPageManager(info.playerId)
|
||||
this.pm = pm
|
||||
|
||||
let user = uni.getStorageSync('userinfo');
|
||||
if(user.token){
|
||||
this.data.userInfo = uni.getStorageSync('userinfo');
|
||||
console.log('onPlayerLoad info', info, 'data', this.data)
|
||||
that.getVideoId();
|
||||
that.getEncryptData({serialNo: info.serialNo}).then(setRes => {
|
||||
// encryptedData是后台加密后的数据,具体实现见官方文档的加密章节
|
||||
let lists = [setRes.data];
|
||||
pm.setCanPlaySerialList({
|
||||
data: setRes.encryptedData,
|
||||
freeList:lists
|
||||
// freeList: [{ // 1~10集是免费剧,data里面的字段也必须至少设置1~10集可播放
|
||||
// start_serial_no: setRes.data.start_serial_no,
|
||||
// end_serial_no: setRes.data.end_serial_no
|
||||
// }],
|
||||
})
|
||||
});
|
||||
}else{
|
||||
login.wxLogin().then(res=>{
|
||||
this.data.userInfo = uni.getStorageSync('userinfo');
|
||||
console.log('onPlayerLoad info', info, 'data', this.data)
|
||||
that.getVideoId();
|
||||
that.getEncryptData({serialNo: info.serialNo}).then(setRes => {
|
||||
// encryptedData是后台加密后的数据,具体实现见官方文档的加密章节
|
||||
let lists = [setRes.data];
|
||||
pm.setCanPlaySerialList({
|
||||
data: setRes.encryptedData,
|
||||
freeList:lists
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 需要解锁的事件
|
||||
pm.onCheckIsCanPlay(this.onCheckIsCanPlay);
|
||||
// 页面返回事件
|
||||
pm.onBack(this.pageBack)
|
||||
// 支付回调事件
|
||||
pm.onCustomEvent('chargeEnd', this.chargeEnd)
|
||||
pm.setVisualEffectOnCapture({
|
||||
visualEffect: 'none',
|
||||
})
|
||||
// 参考文档章节“数据上报”
|
||||
pm.onDataReport((obj) => {
|
||||
if(obj.event === playletPlugin.REPORT_DATA_EVENTS.LIKE || obj.event === playletPlugin.REPORT_DATA_EVENTS.UNLIKE){//监听点赞、取消点赞操作
|
||||
console.log("user like")
|
||||
this.userLikeChange();
|
||||
}else if(obj.event === playletPlugin.REPORT_DATA_EVENTS.FAV || obj.event === playletPlugin.REPORT_DATA_EVENTS.UNFAV){//监听在追,取消在追操作
|
||||
console.log("user zhui ju")
|
||||
this.changeStar()
|
||||
}else if(obj.event === playletPlugin.REPORT_DATA_EVENTS.CHANGE_SERIAL){//监听切换剧集操作
|
||||
console.log("user changePlay log")
|
||||
this.changePlayLog()
|
||||
}else if(obj.event === playletPlugin.REPORT_DATA_EVENTS.SHARE){//监听分享操作
|
||||
console.log("user share")
|
||||
}else {
|
||||
// console.log("其他操作")
|
||||
}
|
||||
|
||||
})
|
||||
// 设置右侧固定运营位置跳转路径
|
||||
pm.setActivityInfo({
|
||||
url: ''
|
||||
})
|
||||
// 设置运营区域
|
||||
pm.updateOpenArea({
|
||||
showLeft: false,
|
||||
showRight: false,
|
||||
leftsideAreaList: [
|
||||
{
|
||||
left: 16, // 类似绝对定位的样式
|
||||
top: 20,
|
||||
width: 72,
|
||||
height: 32
|
||||
},
|
||||
],
|
||||
ext: 'extInfo',
|
||||
})
|
||||
},
|
||||
_initShare() {
|
||||
const pm = this.pm
|
||||
// 关于分享的处理
|
||||
// 开启分享以及withShareTicket
|
||||
pm.setDramaFlag({
|
||||
share: true,
|
||||
withShareTicket: true
|
||||
})
|
||||
// 获取分享参数,页面栈只有短剧播放器一个页面的时候可获取到此参数
|
||||
// 例如从分享卡片进入、从投流广告直接跳转到播放器页面,从二维码直接进入播放器页面等情况
|
||||
playletPlugin.getShareParams().then(res => {
|
||||
console.log('getLaunch options query res', res)
|
||||
// 关于extParam的处理,需要先做decodeURIComponent之后才能得到原值
|
||||
const extParam = decodeURIComponent(res.extParam)
|
||||
console.log('getLaunch options extParam', extParam)
|
||||
// 如果设置了withShareTicket为true,可通过文档的方法获取更多信息
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html
|
||||
const enterOptions = wx.getEnterOptionsSync()
|
||||
console.log('getLaunch options shareTicket', enterOptions.shareTicket)
|
||||
}).catch(err => {
|
||||
console.log('getLaunch options query err', err)
|
||||
})
|
||||
this.getVideoId()
|
||||
// 设置分享参数
|
||||
pm.setExtParam(JSON.stringify({
|
||||
vid:this.data.vid,
|
||||
fxpid:this.data.userInfo.id,
|
||||
invite:this.data.userInfo.invite||''
|
||||
}))
|
||||
},
|
||||
// 检测是否可以播放
|
||||
onCheckIsCanPlay(param) {
|
||||
var that = this;
|
||||
let intervalTime=null;
|
||||
console.log('onCheckIsCanPlay param',param);
|
||||
if(uni.getStorageSync('userinfo').token){
|
||||
that.getVideoId().then(video=>{
|
||||
that.beansPay(video.data.id,param.serialNo);
|
||||
})
|
||||
}else{
|
||||
intervalTime = setInterval(()=>{
|
||||
if(uni.getStorageSync('userinfo').token){
|
||||
clearInterval(intervalTime)
|
||||
that.getVideoId().then(video=>{
|
||||
that.beansPay(video.data.id,param.serialNo);
|
||||
})
|
||||
}else {
|
||||
console.log('no users login')}
|
||||
},100)
|
||||
}
|
||||
},
|
||||
getEncryptData(obj) {
|
||||
const {code, serialNo } = obj;
|
||||
let that = this;
|
||||
// TODO: 此接口请求后台,返回下面的setCanPlaySerialList接口需要的加密参数
|
||||
const { srcAppid, dramaId } = this.pm.getInfo()
|
||||
|
||||
console.log('getEncryptData start', srcAppid, dramaId, serialNo)
|
||||
return new Promise((resolve, reject) => {
|
||||
// 获取免费剧集列表(包含用户已经支付的 )
|
||||
wx.login({
|
||||
success(res) {
|
||||
// console.log('code',res.code)
|
||||
httpRequest({
|
||||
url:"/api/video/videoInfoWechatV1",
|
||||
method:"GET",
|
||||
data:{
|
||||
code:res.code,
|
||||
vid:that.data.vid,
|
||||
oid:that.data.pay_oid
|
||||
}
|
||||
}).then(res=>{
|
||||
console.log('videoPlayer getCanPlayList res', res)
|
||||
resolve({
|
||||
data:res.data.data,
|
||||
encryptedData: res.data.enData
|
||||
})
|
||||
}).catch(err=>{
|
||||
reject(err)
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
pageBack(){
|
||||
let that = this;
|
||||
if(that.data.is_record==1){
|
||||
// that.pm.navigateBack()
|
||||
that.pm.switchTab({
|
||||
url: '/pages/tabs/home'
|
||||
})
|
||||
}else{
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
content:"是否将此剧加入追剧列表",
|
||||
success(modelRes){
|
||||
if(modelRes.confirm){
|
||||
console.log('success');
|
||||
that.changeStar();
|
||||
}
|
||||
that.pm.switchTab({
|
||||
url: '/pages/tabs/home'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
getVideoId(){
|
||||
let that = this;
|
||||
let infos = this.pm.getInfo();
|
||||
console.log('getVideoId start',infos);
|
||||
// 获取当前需支付剧集ID(媒资库的ID不能用,需要用我们自己的剧集ID)
|
||||
return new Promise((resolve, reject) => {
|
||||
httpRequest({
|
||||
url:"/api/video/dramaIdToVideoId",
|
||||
method:"GET",
|
||||
data:{
|
||||
drama_id:infos.dramaId,
|
||||
no:infos.serialNo
|
||||
}
|
||||
}).then(res=>{
|
||||
this.data.mid = res.data.id;
|
||||
if(res.data.drama_vid != that.data.vid){
|
||||
that.data.vid = res.data.drama_vid
|
||||
}
|
||||
this.data.is_record = res.data.is_record
|
||||
resolve(res)
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 金豆购买剧集
|
||||
beansPay(mid,serialNo){
|
||||
let buyData = uni.getStorageSync("buydata");
|
||||
let that = this;
|
||||
console.log('beansPay begin',mid,serialNo)
|
||||
let upData={
|
||||
sum:1,
|
||||
buytype:"金豆",
|
||||
pricebuy:buyData.isvip ==2?buyData.vippriceq:buyData.priceq,
|
||||
token:uni.getStorageSync("userinfo").token,
|
||||
uid:uni.getStorageSync("userinfo").id,
|
||||
ad_code:uni.getStorageSync('get_ad_code'),
|
||||
lx:2,//1 全章购买 2单集购买
|
||||
smid:mid,//单集ID
|
||||
wxlx:'wxxcx',
|
||||
id:that.data.vid ,//剧ID
|
||||
openid: uni.getStorageSync("openid")
|
||||
}
|
||||
// 支付
|
||||
PAY.pays.beansPay(upData).then((res)=>{
|
||||
console.log('beansPay res',res)
|
||||
that.getEncryptData({serialNo: serialNo}).then(enRes => {
|
||||
that.pm.isCanPlay({
|
||||
data: enRes.encryptedData,
|
||||
serialNo: serialNo,
|
||||
status:res.code ==1?1:2
|
||||
})
|
||||
})
|
||||
}).catch(err=>{
|
||||
if(err.msg =='金豆不足'){
|
||||
that.getEncryptData({serialNo: serialNo}).then(enRes => {
|
||||
that.pm.isCanPlay({
|
||||
data: enRes.encryptedData,
|
||||
serialNo: serialNo,
|
||||
status:2
|
||||
})
|
||||
})
|
||||
}
|
||||
console.log('jinDouPay fail',err)
|
||||
})
|
||||
|
||||
},
|
||||
// 更新喜欢状态
|
||||
userLikeChange(){
|
||||
let that = this;
|
||||
that.getVideoId({dramaId:that.data.info.dramaId,serialNo:that.data.info.serialNo}).then(res=>{
|
||||
httpRequest({
|
||||
url:"/api/user/tapLove",
|
||||
method:"GET",
|
||||
data:{
|
||||
vid:that.data.vid,
|
||||
mid:res.data.id
|
||||
}
|
||||
}).then(res=>{
|
||||
console.log('userLikeChange res',res)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 更新追剧状态
|
||||
changeStar(){
|
||||
let that = this;
|
||||
let subData = {
|
||||
vid:that.data.vid,
|
||||
token:uni.getStorageSync("userinfo").token,
|
||||
uid:uni.getStorageSync("userinfo").id,
|
||||
mid:""
|
||||
}
|
||||
that.getVideoId({dramaId:that.data.info.dramaId,serialNo:that.data.info.serialNo}).then(res=>{
|
||||
|
||||
httpRequest({
|
||||
url:"/api/user/videorecord",
|
||||
method:"GET",
|
||||
data:{
|
||||
vid:that.data.vid,
|
||||
mid:res.data.id
|
||||
}
|
||||
}).then(rest=>{
|
||||
console.log('userLikeChange res',rest)
|
||||
}).catch(errs=>{
|
||||
console.log(errs)
|
||||
})
|
||||
|
||||
})
|
||||
},
|
||||
// 更新播放记录
|
||||
changePlayLog(){
|
||||
let that = this;
|
||||
that.getVideoId({dramaId:that.data.info.dramaId,serialNo:that.data.info.serialNo}).then(res=>{
|
||||
console.log('changePlayLog mid',res)
|
||||
httpRequest({
|
||||
url:"/api/video/bfjl",
|
||||
method:"GET",
|
||||
data:{
|
||||
vid:that.data.vid,
|
||||
mid:res.data.id
|
||||
}
|
||||
}).then(rest=>{
|
||||
console.log('changePlayLog res',rest)
|
||||
}).catch(errs=>{
|
||||
console.log('change PlayLog fail',errs)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 支付完
|
||||
chargeEnd(payRes){
|
||||
let that = this;
|
||||
console.log("paySuccess",payRes)
|
||||
let share_g_order_vid = uni.getStorageSync('g_order_vid');
|
||||
if(payRes.status == "paySuccess"){
|
||||
that.data.pay_oid = payRes.oid;
|
||||
this.onCheckIsCanPlay({dramaId:that.data.info.dramaId,serialNo:payRes.serialNo,oid:payRes.oid })
|
||||
that.pm.setExtParam(JSON.stringify({
|
||||
vid:this.data.vid,
|
||||
fxpid:this.data.userInfo.id,
|
||||
invite:this.data.userInfo.invite||'',
|
||||
g_order_id:payRes.gOrderId,
|
||||
g_order_vid:payRes.vid
|
||||
|
||||
}))
|
||||
that.pm.hideChargeDialog();
|
||||
if(payRes.gOrderId && share_g_order_vid != payRes.vid){
|
||||
that.pm.updateOpenArea({showLeft: true});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function PlayerManager() {
|
||||
var newProto = Object.assign({}, proto)
|
||||
for (const k in newProto) {
|
||||
if (typeof newProto[k] === 'function') {
|
||||
this[k] = newProto[k].bind(this)
|
||||
} else if (typeof newProto[k] === 'object') {
|
||||
if (!newProto[k]) {
|
||||
this[k] = newProto[k]
|
||||
} else {
|
||||
this[k] = deepClone(newProto[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerManager.navigateToPlayer = navigateToPlayer
|
||||
module.exports = PlayerManager
|
||||
@@ -0,0 +1,87 @@
|
||||
import config from "./config.js";
|
||||
// 获取当前运行环境
|
||||
// 同步获取系统信息
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const os = systemInfo.osName;
|
||||
const os_type = getType();
|
||||
function getType() {
|
||||
// #ifdef APP
|
||||
return 1
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
return 1
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
return 3
|
||||
// #endif
|
||||
// #ifdef MP-TOUTIAO
|
||||
return 4
|
||||
// #endif
|
||||
}
|
||||
|
||||
const options = {
|
||||
url: String,
|
||||
method: String,
|
||||
data: Object,
|
||||
header: Object,
|
||||
isLoading: Boolean,
|
||||
isAllLink: Boolean
|
||||
}
|
||||
function httpRequest(options = options) {
|
||||
let token = uni.getStorageSync('token');
|
||||
token = token?token:uni.getStorageSync('userinfo').token
|
||||
const OS = uni.getSystemInfoSync();
|
||||
// let token = '0fea3d3d-9c6b-446c-a5df-57779c70a273';
|
||||
return new Promise((resolve, reject) => {
|
||||
if (options.isLoading) {
|
||||
uni.showLoading()
|
||||
}
|
||||
uni.request({
|
||||
url: options.isAllLink ? options.url : config.webUrl + options.url,
|
||||
method: options.method || "GET",
|
||||
data: options.data || {},
|
||||
header: {
|
||||
'token': token || "",
|
||||
'os':os,
|
||||
'os_type':os_type,
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.code == 401) {
|
||||
console.log('no login')
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: "请登录后再进行操作",
|
||||
confirmText: "确定",
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
let nowPage = getCurrentPages();
|
||||
let pageNum = nowPage.length - 1;
|
||||
console.log(nowPage)
|
||||
uni.setStorageSync('loginPage', nowPage[pageNum].route)
|
||||
uni.navigateTo({url: "/pagesA/login/login"})
|
||||
}
|
||||
}
|
||||
})
|
||||
reject(res.data)
|
||||
} else if (res.data.code == 0) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
resolve(res.data);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
reject(error);
|
||||
},
|
||||
complete: (req) => {
|
||||
if (options.isLoading) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
module.exports = {
|
||||
httpRequest
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
share: {
|
||||
// 转发的标题 (默认标题)
|
||||
title: '灵图剧场影视',
|
||||
// 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
path: 'pages/client/member/index',
|
||||
//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,
|
||||
//支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
imageUrl: ''
|
||||
},
|
||||
userinfo:uni.getStorageSync('userinfo')
|
||||
}
|
||||
},
|
||||
/*
|
||||
在要分享的页面 生命周期中 设计当前页面分享标题
|
||||
onLoad() {
|
||||
this.share.title = "当前页面分享标题"
|
||||
},
|
||||
*/
|
||||
// 发送给朋友
|
||||
onShareAppMessage(res) {
|
||||
// 来自页面内的按钮的转发
|
||||
if (res.from == 'button') {
|
||||
console.log("按钮转发--配置");
|
||||
}
|
||||
// 获取加载的页面
|
||||
let pages = getCurrentPages(),
|
||||
// 获取当前页面的对象
|
||||
view = pages[pages.length - 1];
|
||||
// this.share.path = `/${view.route}`;
|
||||
let invite = this.userinfo.invite?this.userinfo.invite:"";
|
||||
this.share.path = '/pages/client/index?invite='+invite;
|
||||
|
||||
//转发参数
|
||||
return this.share;
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline(res) {
|
||||
// 获取加载的页面
|
||||
let pages = getCurrentPages(),
|
||||
// 获取当前页面的对象
|
||||
view = pages[pages.length - 1];
|
||||
// console.log("获取加载的页面", pages);
|
||||
console.log("当前页面的对象", view.options);
|
||||
// this.share.path = `/${view.route}`; //分享当前页面
|
||||
let obj = view.options;
|
||||
const paramsArray = Object.entries(obj).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
||||
// 将数组连接成一个字符串,使用 '&' 或其他分隔符
|
||||
const pathParamsString = paramsArray.join('&');
|
||||
console.log( pathParamsString);
|
||||
let invite = this.userinfo.invite?this.userinfo.invite:"";
|
||||
this.share.query = `${pathParamsString}&invite=${invite}`
|
||||
// this.share.path = `/${view.route}?invite=${invite}` //指定分享页面
|
||||
//转发参数
|
||||
return this.share;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user