iOS 适配

This commit is contained in:
GYJ
2024-12-19 16:22:50 +08:00
parent a147eaab4f
commit 206546aed8
7 changed files with 89 additions and 77 deletions

View File

@@ -22,7 +22,7 @@
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
} }
] ]

11
main.js
View File

@@ -34,8 +34,6 @@ Vue.use(httpApi, app)
app.$mount() app.$mount()
console.log(uni);
// #ifdef APP // #ifdef APP
const sysInfo = uni.getSystemInfoSync(); const sysInfo = uni.getSystemInfoSync();
@@ -44,15 +42,10 @@ let isIos = sysInfo.platform == 'ios'
if (isIos) { if (isIos) {
const originNavigateTo = uni.navigateTo const originNavigateTo = uni.navigateTo
uni.navigateTo = (params) => { uni.navigateTo = (params) => {
console.log("自定义 navigate 。。。。。。。。。。");
let jsonParam = JSON.parse(JSON.stringify(params)) let jsonParam = JSON.parse(JSON.stringify(params))
if (isIos && jsonParam.url.includes('/me/detail/detail')) { if (isIos && jsonParam.url.includes('/me/detail/detail')) {
console.log('iOS 跳转视频也');
jsonParam.url = jsonParam.url.replace('/me/detail/detail', '/me/detail/detailIOS') jsonParam.url = jsonParam.url.replace('/me/detail/detail', '/me/detail/detailIOS')
} }

View File

@@ -27,8 +27,8 @@
"VideoPlayer" : {}, "VideoPlayer" : {},
"Camera" : {}, "Camera" : {},
"Record" : {}, "Record" : {},
"Push" : {}, "OAuth" : {},
"OAuth" : {} "Push" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {
@@ -63,7 +63,12 @@
}, },
/* ios */ /* ios */
"ios" : { "ios" : {
"dSYMs" : false "dSYMs" : false,
"urltypes" : "com.hnsiyao.duanju",
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "获取您的相册读取权限,目的是为了在我的资料页面使用相册读取功能,修改上传头像",
"NSCameraUsageDescription" : "获取您的摄像头权限,目的是为了在我的资料页面使用摄像头功能,修改上传头像"
}
}, },
/* SDK */ /* SDK */
"sdkConfigs" : { "sdkConfigs" : {

View File

@@ -145,7 +145,7 @@
</view> </view>
<text class="" <text class=""
style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;"> style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;">
{{this.courseDetailsId}} {{getRedEnvelopeTips}}
</text> </text>
<view class="pay-content"> <view class="pay-content">
<view class="pay-content-item" @click="payVideo(1)"> <view class="pay-content-item" @click="payVideo(1)">
@@ -154,7 +154,7 @@
{{countPrice*scale}}金币解锁整部视频 {{countPrice*scale}}金币解锁整部视频
</text> </text>
</view> </view>
<view class="pay-content-item" @click="payVideo(2)"> <view v-if="isShowMoneyPay" class="pay-content-item" @click="payVideo(2)">
<text class="pay-content-items"> <text class="pay-content-items">
{{countPrice}}元解锁单集视频 {{countPrice}}元解锁单集视频
</text> </text>
@@ -369,6 +369,7 @@
getRedEnvelopeTips: '', getRedEnvelopeTips: '',
scale: 1, scale: 1,
paddingBottom: '0', paddingBottom: '0',
isShowMoneyPay: true,
}; };
}, },
computed: { computed: {
@@ -492,6 +493,13 @@
console.log('this bottom padding = ' + this.paddingBottom); console.log('this bottom padding = ' + this.paddingBottom);
httpsRequest.getT("app/common/type/919", {}).then(res => {
if (res.code == 0) {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
}, },
onLoad(e) { onLoad(e) {
let that = this let that = this
@@ -711,7 +719,10 @@
// #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)
uni.navigateTo({
url: '/pages/pays/pays?ordersId=' + this.ordersId + '&url=' + ret.data.h5Url
});
// this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); // this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data));
}); });
} else if (this.openWay == 3) { } else if (this.openWay == 3) {
@@ -1051,7 +1062,7 @@
// const index = this.meunList.findIndex(menu => menu.courseDetailsId === item.courseDetailsId); // const index = this.meunList.findIndex(menu => menu.courseDetailsId === item.courseDetailsId);
// this.videoList = [this.meunList[index]] // this.videoList = [this.meunList[index]]
this.current = index this.current = index
if ( this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type ) { if (this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type) {
this.getDataList(this.courseId, this.courseDetailsId, true, 'select') this.getDataList(this.courseId, this.courseDetailsId, true, 'select')
return; return;
} }
@@ -1399,8 +1410,8 @@
} else { //不能播放则需要购买 } else { //不能播放则需要购买
this.openPay() this.openPay()
} }
if ( t == 'select') { if (t == 'select') {
this.selectPlay(this.videoList[this.current],this.current,true) this.selectPlay(this.videoList[this.current], this.current, true)
} }
this.$forceUpdate(); this.$forceUpdate();
//插入历史记录 //插入历史记录

View File

@@ -185,8 +185,8 @@
<!-- 追剧悬浮 --> <!-- 追剧悬浮 -->
<!-- <drag-button v-if="shodrag && shodrags" @clickClose="clickClose" :videoInfo="videoInfo" :isDock="true" <!-- <drag-button v-if="shodrag && shodrags" @clickClose="clickClose" :videoInfo="videoInfo" :isDock="true"
:existTabBar="true" @btnClick="btnClick" /> --> :existTabBar="true" @btnClick="btnClick" /> -->
<u-image @click="goMsg('/me/choujiang/choujiang')" :src="`../../static/red-pack-new.gif`" <u-image v-if="isShowMoneyPay" @click="goMsg('/me/choujiang/choujiang')" :src="`../../static/red-pack-new.gif`"
style="width: 200rpx;height: 200rpx;position: fixed;right: 30rpx;bottom: 180rpx;"></u-image> style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<div v-if="isWeixin" <div v-if="isWeixin"
style="width: 100%;height: 100%;position: fixed;top: 0;z-index: 999;background: url('../../static/images/open_guide.png') no-repeat center bottom / cover;"> style="width: 100%;height: 100%;position: fixed;top: 0;z-index: 999;background: url('../../static/images/open_guide.png') no-repeat center bottom / cover;">
@@ -209,6 +209,7 @@
import recommendVideo from '../../components/recommendVideo/recommendVideo.vue' import recommendVideo from '../../components/recommendVideo/recommendVideo.vue'
import activityComp from '../../components/activityComp/activityComp.vue' import activityComp from '../../components/activityComp/activityComp.vue'
import dragButton from "@/components/drag-button/drag-button.vue"; import dragButton from "@/components/drag-button/drag-button.vue";
import httpsRequest from '../../common/httpRequest.js'
export default { export default {
components: { components: {
videoList, videoList,
@@ -260,6 +261,7 @@
isWeixin: false, isWeixin: false,
isIos: true, isIos: true,
scrollTop: 0, scrollTop: 0,
isShowMoneyPay: true,
}; };
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
@@ -279,7 +281,6 @@
} }
}, },
onPageScroll(e) { onPageScroll(e) {
console.log(e);
this.scrollTop = e.scrollTop this.scrollTop = e.scrollTop
}, },
onLoad(options) { onLoad(options) {
@@ -293,6 +294,7 @@
// #endif // #endif
console.log(options, '22222222222222222')
if (uni.getStorageSync('qdCode')) { if (uni.getStorageSync('qdCode')) {
this.qdCode = uni.getStorageSync('qdCode') this.qdCode = uni.getStorageSync('qdCode')
} }
@@ -435,6 +437,14 @@
this.shodrag = false this.shodrag = false
this.videoInfo = [] this.videoInfo = []
} }
httpsRequest.getT("app/common/type/919", {}).then(res => {
if (res.code == 0) {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
}, },
onReachBottom() { onReachBottom() {
if (this.page < this.pages) { if (this.page < this.pages) {

View File

@@ -53,7 +53,7 @@
我的积分 我的积分
</view> </view>
</view> --> </view> -->
<view class="statistics-box-item" @click="goNav('/me/invite/cashDetail')"> <view v-if="isShowMoneyPay" class="statistics-box-item" @click="goNav('/me/invite/cashDetail')">
<view class="statistics-box-item-top"> <view class="statistics-box-item-top">
{{userInfo.amount || '0.00'}} {{userInfo.amount || '0.00'}}
</view> </view>
@@ -146,7 +146,7 @@
转盘抽奖 转盘抽奖
</view> </view>
</view> --> </view> -->
<view class="tool-box-content-item flex align-center justify-center flex-wrap" <view v-if="isShowMoneyPay" class="tool-box-content-item flex align-center justify-center flex-wrap"
@click="goNav('/me/invite/index')"> @click="goNav('/me/invite/index')">
<view class="tool-box-content-item-img"> <view class="tool-box-content-item-img">
<image src="../../static/images/me/vfx.png" mode=""></image> <image src="../../static/images/me/vfx.png" mode=""></image>
@@ -184,7 +184,7 @@
观看历史 观看历史
</view> </view>
</view> </view>
<view v-if="rate>0" class="tool-box-content-item flex align-center justify-center flex-wrap" <view v-if="rate>0 && isShowMoneyPay" class="tool-box-content-item flex align-center justify-center flex-wrap"
@click="goNav('/me/invite/inviteDet')"> @click="goNav('/me/invite/inviteDet')">
<view class="tool-box-content-item-img"> <view class="tool-box-content-item-img">
<image src="../../static/images/me/vtd.png" mode=""></image> <image src="../../static/images/me/vtd.png" mode=""></image>
@@ -257,6 +257,7 @@
<script> <script>
import ttMsg from '../../components/ttMsg/ttMsg.vue' import ttMsg from '../../components/ttMsg/ttMsg.vue'
import httpsRequest from '../../common/httpRequest.js'
export default { export default {
components: { components: {
ttMsg ttMsg
@@ -292,6 +293,7 @@
kmPaySel: '否', kmPaySel: '否',
isWxIosPay: true, //微信下是否显示支付功能 isWxIosPay: true, //微信下是否显示支付功能
userInfo: {}, userInfo: {},
isShowMoneyPay: true,
} }
}, },
onLoad() { onLoad() {
@@ -354,6 +356,15 @@
this.rate = 0 this.rate = 0
} }
this.avatar = uni.getStorageSync('avatar') ? uni.getStorageSync('avatar') : '../../static/images/logo.png' this.avatar = uni.getStorageSync('avatar') ? uni.getStorageSync('avatar') : '../../static/images/logo.png'
httpsRequest.getT("app/common/type/919", {}).then(res => {
console.log(res);
if (res.code == 0) {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
}, },
methods: { methods: {
//兑换卡密 //兑换卡密

View File

@@ -9,10 +9,10 @@
export default { export default {
data() { data() {
return { return {
ordersId:'', ordersId: '',
timer:null, timer: null,
maxAjaxNum:5, maxAjaxNum: 5,
ajaxNum:0, ajaxNum: 0,
url: null, //要打开的外部链接 url: null, //要打开的外部链接
viewerUrl: '/hybrid/html/web/viewer.html', viewerUrl: '/hybrid/html/web/viewer.html',
webviewStyles: { webviewStyles: {
@@ -22,38 +22,41 @@
} }
}, },
onReady() { onReady() {},
// #ifdef APP-PLUS
// console.log('App plus2')
// var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
// setTimeout(function() {
// wv = currentWebview.children()[0]
// wv.setStyle({
// scalable: true
// })
// }, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},
onShow() { onShow() {
console.log(this.ordersId); console.log(this.ordersId);
httpsRequest.getT("/app/wuyou/queryOrder/"+this.ordersId, {}).then(res => { httpsRequest.getT("/app/wuyou/queryOrder/" + this.ordersId, {}).then(res => {
console.log(res.data); console.log(res.data);
if(res.data ==1){ if (res.data == 1) {
uni.hideLoading() uni.hideLoading()
uni.showToast({ const sysInfo = uni.getSystemInfoSync();
title:'支付成功', let isIos = sysInfo.platform == 'ios'
icon:'none' console.log("is ios ", isIos);
}) if (isIos) {
this.timer= setTimeout(()=>{
clearTimeout(this.timer)
uni.navigateBack() uni.navigateBack()
},500) uni.showToast({
}else{ title: '支付成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: '支付成功',
icon: 'none'
})
this.timer = setTimeout(() => {
clearTimeout(this.timer)
uni.navigateBack()
}, 500)
}
} else {
// #ifdef APP // #ifdef APP
uni.showLoading({ uni.showLoading({
title:'支付中' title: '支付中'
}) })
// #endif // #endif
} }
@@ -69,29 +72,8 @@
onLoad: function(option) { onLoad: function(option) {
console.log(option) console.log(option)
this.url = option.url this.url = option.url
this.ordersId=option.ordersId this.ordersId = option.ordersId
console.log('this.ordersId'+this.ordersId); console.log('this.ordersId' + this.ordersId);
// this.url="https://jiaoyu.xianmxkj.com/file/uploadPath/2023/03/08/b6c0dd4821cc9ce70c897adca3ad22c2.pdf"
// h5使用h5访问的时候记得跨域
// #ifdef H5
// this.url="https://jiaoyu.xianmxkj.com/file/uploadPath/2023/03/08/b6c0dd4821cc9ce70c897adca3ad22c2.pdf"
// this.url = `${this.viewerUrl}?file=${encodeURIComponent(option.url)}`;
// this.url = `${this.viewerUrl}?file=${'https://jiaoyu.xianmxkj.com/file/uploadPath/2023/03/08/b6c0dd4821cc9ce70c897adca3ad22c2.pdf'}`;
// #endif
// 在安卓和ios手机上
// 判断是手机系统安卓使用pdf.js
// #ifdef APP-PLUS
// if(plus.os.name === 'Android') {
// this.url = `${this.viewerUrl}?file=${encodeURIComponent(option.url)}`;
// }
// // ios直接访问pdf所在路径
// else {
// this.url = encodeURIComponent(option.url);
// }
// #endif
} }
} }
</script> </script>