This commit is contained in:
GaoHao
2024-12-19 14:52:58 +08:00
3 changed files with 140 additions and 53 deletions

31
main.js
View File

@@ -21,7 +21,7 @@ Vue.use(uView);
const app = new Vue({ const app = new Vue({
...App ...App
}) })
// http拦截器将此部分放在new Vue()和app.$mount()之间才能App.vue中正常使用 // http拦截器将此部分放在new Vue()和app.$mount()之间才能App.vue中正常使用
@@ -33,3 +33,32 @@ import httpApi from '@/common/http.api.js'
Vue.use(httpApi, app) Vue.use(httpApi, app)
app.$mount() app.$mount()
console.log(uni);
// #ifdef APP
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
if (isIos) {
const originNavigateTo = uni.navigateTo
uni.navigateTo = (params) => {
console.log("自定义 navigate 。。。。。。。。。。");
let jsonParam = JSON.parse(JSON.stringify(params))
if (isIos && jsonParam.url.includes('/me/detail/detail')) {
console.log('iOS 跳转视频也');
jsonParam.url = jsonParam.url.replace('/me/detail/detail', '/me/detail/detailIOS')
}
originNavigateTo(jsonParam)
}
}
// #endif

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="detail"> <view class="detail" :style="{paddingBottom:paddingBottom}">
<swiper @longpress="openBs()" :circular="true" class="swipers" @change="change" :current="current" <swiper @longpress="openBs()" :circular="true" class="swipers" @change="change" :current="current"
:vertical="true" :indicator-dots="false" :autoplay="false" :interval="3000" :duration="300"> :vertical="true" :indicator-dots="false" :autoplay="false" :interval="3000" :duration="300">
<swiper-item class="swipers-item" v-for="(item,index) in swiperList" :key="item.courseDetailsId"> <swiper-item class="swipers-item" v-for="(item,index) in swiperList" :key="item.courseDetailsId">
@@ -8,8 +8,7 @@
<video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" object-fit="contain" <video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" object-fit="contain"
v-if="current === index && item.videoUrl" :play-strategy="2" :show-loading="true" v-if="current === index && item.videoUrl" :play-strategy="2" :show-loading="true"
codec="software" :muted="false" :show-center-play-btn="true" :loop="true" @ended="ended" codec="software" :muted="false" :show-center-play-btn="true" :loop="true" @ended="ended"
@timeupdate="timeupdate" @timeupdate="timeupdate" @play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
@play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId" :enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
:id="'myVideo'+item.courseDetailsId" :src="item.videoUrl" :autoplay="item.autoPlay" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl" :autoplay="item.autoPlay"
class="swipers-items-video"></video> class="swipers-items-video"></video>
@@ -17,7 +16,8 @@
mode="aspectFill"> mode="aspectFill">
</image> </image>
<!-- 返回图标 --> <!-- 返回图标 -->
<image v-if="showBack" src="../static/nvueIcon/backs.png" @click="goBack()" class="swipers-items-back" mode=""> <image v-if="showBack" src="../static/nvueIcon/backs.png" @click="goBack()"
class="swipers-items-back" mode="">
</image> </image>
<!-- 右边操作 --> <!-- 右边操作 -->
<view class="swipers-items-right" :style="rightTop" v-if="showControls"> <view class="swipers-items-right" :style="rightTop" v-if="showControls">
@@ -143,7 +143,8 @@
<image class="list-title-rs" src="../../static/images/me/closeIconss.png" mode=""></image> <image class="list-title-rs" src="../../static/images/me/closeIconss.png" mode=""></image>
</view> </view>
</view> </view>
<text class="" style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;"> <text class=""
style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;">
{{this.courseDetailsId}} {{this.courseDetailsId}}
</text> </text>
<view class="pay-content"> <view class="pay-content">
@@ -303,7 +304,7 @@
export default { export default {
data() { data() {
return { return {
showBack:false, showBack: true,
nowBs: 1, //当前倍速 nowBs: 1, //当前倍速
subList: [{ subList: [{
name: '0.5x', name: '0.5x',
@@ -353,7 +354,7 @@
zongPrice: 0, //整部价格 zongPrice: 0, //整部价格
countPrice: 0, //单集价格 countPrice: 0, //单集价格
wallCurr: 0, wallCurr: 0,
wallet: [],· wallet: [],
productId: '', //默认苹果内购商品ID productId: '', //默认苹果内购商品ID
productIds: ['sixzuan', 'shierzuan'], //苹果内购商品 productIds: ['sixzuan', 'shierzuan'], //苹果内购商品
openLists: [], openLists: [],
@@ -365,9 +366,9 @@
iosPayId: '', iosPayId: '',
isCollect: false, isCollect: false,
playFlag: false, playFlag: false,
getRedEnvelopeTips: '' getRedEnvelopeTips: '',
scale: 1, scale: 1,
paddingBottom: '0',
}; };
}, },
computed: { computed: {
@@ -388,6 +389,7 @@
} }
}, },
onShow() { onShow() {
console.log("走了iOS播放器。。。。。。。。。。。。。。。");
//当应用从后台进入前台时自动播放 //当应用从后台进入前台时自动播放
if (this.videoContext) { if (this.videoContext) {
this.videoContext.play() this.videoContext.play()
@@ -438,46 +440,58 @@
// }]; // }];
// this.openWay = 3; // this.openWay = 3;
// } else { // } else {
this.openLists = [ this.openLists = [
// { // {
// image: '/static/images/pay/weixin.png', // image: '/static/images/pay/weixin.png',
// text: '微信', // text: '微信',
// id: 2 // id: 2
// }, // },
{ {
image: '/static/images/pay/zhifubao.png', image: '/static/images/pay/zhifubao.png',
text: '支付宝', text: '支付宝',
id: 1 id: 1
}, },
]; ];
this.openWay = 1; this.openWay = 1;
let syPaySel = uni.getStorageSync('syPaySel') let syPaySel = uni.getStorageSync('syPaySel')
// if (syPaySel === '是') { // if (syPaySel === '是') {
// let openListsItem = { // let openListsItem = {
// image: '/static/images/pay/shouyi.png', // image: '/static/images/pay/shouyi.png',
// text: '收益余额', // text: '收益余额',
// id: 4 // id: 4
// }; // };
// this.openLists.push(openListsItem) // this.openLists.push(openListsItem)
// } // }
// } // }
} }
// #endif // #endif
this.$nextTick(()=>{ this.$nextTick(() => {
this.closePopusPay() this.closePopusPay()
}) })
if(this.courseId){ if (this.courseId) {
this.getDataList(this.courseId, this.courseDetailsId); this.getDataList(this.courseId, this.courseDetailsId);
} }
httpsRequest.getT('app/course/getRedEnvelopeTips').then(res => { httpsRequest.getT('app/course/getRedEnvelopeTips').then(res => {
if (res.code == 0) { if (res.code == 0) {
this.getRedEnvelopeTips= res.data this.getRedEnvelopeTips = res.data
} }
}) })
this.getScale() this.getScale()
const sysInfo = uni.getSystemInfoSync()
console.log(sysInfo);
const padB = sysInfo.safeAreaInsets.bottom;
console.log('win height == ' + padB);
if (padB && padB > 0) {
this.paddingBottom = padB + 'px'
} else {
this.paddingBottom = '0'
}
console.log('this bottom padding = ' + this.paddingBottom);
}, },
onLoad(e) { onLoad(e) {
let that = this let that = this
@@ -511,7 +525,7 @@
/** /**
* 获取金币比例 * 获取金币比例
*/ */
getScale () { getScale() {
httpsRequest.getT("app/common/type/914", {}).then(res => { httpsRequest.getT("app/common/type/914", {}).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.scale = Number(res.data.value) this.scale = Number(res.data.value)
@@ -519,9 +533,9 @@
}); });
}, },
//播放时的回掉 //播放时的回掉
videoPlay(videoId,courseDetailsId) { videoPlay(videoId, courseDetailsId) {
this.courseDetailsId = courseDetailsId this.courseDetailsId = courseDetailsId
if ( !this.playFlag ) { if (!this.playFlag) {
this.playFlag = true this.playFlag = true
httpsRequest.getT('app/course/viewCourse', { httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId, courseId: this.courseId,
@@ -536,8 +550,8 @@
//播放进度变化回掉 //播放进度变化回掉
timeupdate(e) { timeupdate(e) {
if (e.detail.currentTime > e.detail.duration*0.9) { if (e.detail.currentTime > e.detail.duration * 0.9) {
if ( this.playFlag) { if (this.playFlag) {
this.playFlag = false this.playFlag = false
httpsRequest.getT('app/course/viewCourse', { httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId, courseId: this.courseId,
@@ -691,12 +705,12 @@
this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data));
}); });
} else if (this.openWay == 1) { } else if (this.openWay == 1) {
let paytype='h5' let paytype = 'h5'
// #ifdef APP // #ifdef APP
paytype='app' paytype = 'app'
// #endif // #endif
// APP支付宝支付 // APP支付宝支付
httpsRequest.getT("/app/wuyou/payOrder/"+ this.ordersId+'?payType='+paytype, {}).then(ret => { httpsRequest.getT("/app/wuyou/payOrder/" + this.ordersId + '?payType=' + paytype, {}).then(ret => {
plus.runtime.openURL(ret.data.h5Url) plus.runtime.openURL(ret.data.h5Url)
// this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); // this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data));
}); });
@@ -855,7 +869,7 @@
//显示/隐藏适配控制器的回调 //显示/隐藏适配控制器的回调
controlstoggles(e) { controlstoggles(e) {
this.showControls = e.detail.show this.showControls = e.detail.show
this.showBack=!this.showBack this.showBack = this.showControls
console.log(e.detail.show, '显示/隐藏控制栏') console.log(e.detail.show, '显示/隐藏控制栏')
}, },
//打开倍速弹框 //打开倍速弹框
@@ -943,7 +957,7 @@
if (type == 1) { //金币 if (type == 1) { //金币
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
} else if(type == 2){ //支付宝 } else if (type == 2) { //支付宝
this.closePay() //关闭购买选择弹窗 this.closePay() //关闭购买选择弹窗
this.payPrice = res.data.orders.payMoney //需要支付的价格 this.payPrice = res.data.orders.payMoney //需要支付的价格
this.openPopusPay() //显示充值弹窗 this.openPopusPay() //显示充值弹窗

View File

@@ -490,6 +490,50 @@
} }
}, {
"path": "detail/detailIOS",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#000000",
"style": {
"safeAreaInsetBottom": "none"
},
"app-plus": {
// "subNVues": [{
// "id": "pay", // 唯一标识
// "path": "detail/subNvue/pay", // 页面路径
// // "type": "popup",
// "style": {
// "position": "popup",
// "dock": "bottom",
// "width": "750rpx",
// "height": "150rpx",
// "background": "#fff"
// }
// }],
"bounce": "none",
"safearea": {
"bottom": {
"offset": "none"
}
}
}
// #ifndef MP-TOUTIAO
,
"navigationStyle": "custom"
// #endif
// #ifdef MP-TOUTIAO
,
"usingComponents": {
"video-player": "ext://industry/video-player"
}
// #endif
}
}, { }, {
"path": "wallet/wallet", "path": "wallet/wallet",
"style": { "style": {