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"
},
{
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-ios"
}
]

11
main.js
View File

@@ -34,8 +34,6 @@ Vue.use(httpApi, app)
app.$mount()
console.log(uni);
// #ifdef APP
const sysInfo = uni.getSystemInfoSync();
@@ -44,15 +42,10 @@ let isIos = sysInfo.platform == 'ios'
if (isIos) {
const originNavigateTo = uni.navigateTo
uni.navigateTo = (params) => {
console.log("自定义 navigate 。。。。。。。。。。");
uni.navigateTo = (params) => {
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')
}

View File

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

View File

@@ -145,7 +145,7 @@
</view>
<text class=""
style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;">
{{this.courseDetailsId}}
{{getRedEnvelopeTips}}
</text>
<view class="pay-content">
<view class="pay-content-item" @click="payVideo(1)">
@@ -154,7 +154,7 @@
{{countPrice*scale}}金币解锁整部视频
</text>
</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">
{{countPrice}}元解锁单集视频
</text>
@@ -369,6 +369,7 @@
getRedEnvelopeTips: '',
scale: 1,
paddingBottom: '0',
isShowMoneyPay: true,
};
},
computed: {
@@ -492,6 +493,13 @@
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) {
let that = this
@@ -711,7 +719,10 @@
// #endif
// APP支付宝支付
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));
});
} else if (this.openWay == 3) {
@@ -1051,7 +1062,7 @@
// const index = this.meunList.findIndex(menu => menu.courseDetailsId === item.courseDetailsId);
// this.videoList = [this.meunList[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')
return;
}
@@ -1399,8 +1410,8 @@
} else { //不能播放则需要购买
this.openPay()
}
if ( t == 'select') {
this.selectPlay(this.videoList[this.current],this.current,true)
if (t == 'select') {
this.selectPlay(this.videoList[this.current], this.current, true)
}
this.$forceUpdate();
//插入历史记录

View File

@@ -185,8 +185,8 @@
<!-- 追剧悬浮 -->
<!-- <drag-button v-if="shodrag && shodrags" @clickClose="clickClose" :videoInfo="videoInfo" :isDock="true"
:existTabBar="true" @btnClick="btnClick" /> -->
<u-image @click="goMsg('/me/choujiang/choujiang')" :src="`../../static/red-pack-new.gif`"
style="width: 200rpx;height: 200rpx;position: fixed;right: 30rpx;bottom: 180rpx;"></u-image>
<u-image v-if="isShowMoneyPay" @click="goMsg('/me/choujiang/choujiang')" :src="`../../static/red-pack-new.gif`"
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image>
<!-- #ifdef H5 -->
<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;">
@@ -209,6 +209,7 @@
import recommendVideo from '../../components/recommendVideo/recommendVideo.vue'
import activityComp from '../../components/activityComp/activityComp.vue'
import dragButton from "@/components/drag-button/drag-button.vue";
import httpsRequest from '../../common/httpRequest.js'
export default {
components: {
videoList,
@@ -260,6 +261,7 @@
isWeixin: false,
isIos: true,
scrollTop: 0,
isShowMoneyPay: true,
};
},
onShareAppMessage(res) {
@@ -279,7 +281,6 @@
}
},
onPageScroll(e) {
console.log(e);
this.scrollTop = e.scrollTop
},
onLoad(options) {
@@ -293,6 +294,7 @@
// #endif
console.log(options, '22222222222222222')
if (uni.getStorageSync('qdCode')) {
this.qdCode = uni.getStorageSync('qdCode')
}
@@ -435,6 +437,14 @@
this.shodrag = false
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() {
if (this.page < this.pages) {

View File

@@ -53,7 +53,7 @@
我的积分
</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">
{{userInfo.amount || '0.00'}}
</view>
@@ -146,7 +146,7 @@
转盘抽奖
</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')">
<view class="tool-box-content-item-img">
<image src="../../static/images/me/vfx.png" mode=""></image>
@@ -184,7 +184,7 @@
观看历史
</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')">
<view class="tool-box-content-item-img">
<image src="../../static/images/me/vtd.png" mode=""></image>
@@ -257,6 +257,7 @@
<script>
import ttMsg from '../../components/ttMsg/ttMsg.vue'
import httpsRequest from '../../common/httpRequest.js'
export default {
components: {
ttMsg
@@ -292,6 +293,7 @@
kmPaySel: '否',
isWxIosPay: true, //微信下是否显示支付功能
userInfo: {},
isShowMoneyPay: true,
}
},
onLoad() {
@@ -354,6 +356,15 @@
this.rate = 0
}
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: {
//兑换卡密

View File

@@ -9,10 +9,10 @@
export default {
data() {
return {
ordersId:'',
timer:null,
maxAjaxNum:5,
ajaxNum:0,
ordersId: '',
timer: null,
maxAjaxNum: 5,
ajaxNum: 0,
url: null, //要打开的外部链接
viewerUrl: '/hybrid/html/web/viewer.html',
webviewStyles: {
@@ -22,38 +22,41 @@
}
},
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
},
onReady() {},
onShow() {
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);
if(res.data ==1){
if (res.data == 1) {
uni.hideLoading()
uni.showToast({
title:'支付成功',
icon:'none'
})
this.timer= setTimeout(()=>{
clearTimeout(this.timer)
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
console.log("is ios ", isIos);
if (isIos) {
uni.navigateBack()
},500)
}else{
uni.showToast({
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
uni.showLoading({
title:'支付中'
title: '支付中'
})
// #endif
}
@@ -69,29 +72,8 @@
onLoad: function(option) {
console.log(option)
this.url = option.url
this.ordersId=option.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
this.ordersId = option.ordersId
console.log('this.ordersId' + this.ordersId);
}
}
</script>