极光推送权限修改

This commit is contained in:
@fawn-nine
2023-04-23 15:11:26 +08:00
parent ee74da48cc
commit db2beb84e5
2 changed files with 101 additions and 54 deletions

View File

@@ -20,30 +20,29 @@
<view class="cf_radio"> <view class="cf_radio">
<u-radio-group v-model="payType"> <u-radio-group v-model="payType">
<!-- #ifdef APP-ANDROID -->
<view style="width: 100%;" > <view style="width: 100%;" v-if="isAndroid">
<view v-for="(item, index) in paylist" @click="choseType(item.id)" <view v-for="(item, index) in paylist" @click="choseType(item.id)"
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'"> :class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
<image :src="item.img"></image> <image :src="item.img"></image>
{{item.title}} {{item.title}}
<u-radio v-if="isAndroid" :key="index" activeColor="#fe6e09" :name='item.id' <u-radio :key="index" activeColor="#fe6e09" :name='item.id'
style="float: right;margin-top: 5rpx;"></u-radio> style="float: right;margin-top: 5rpx;"></u-radio>
</view> </view>
</view> </view>
<!-- #endif -->
<!-- #ifdef APP-IOS --> <view style="width: 100%;" v-else>
<view style="width: 100%;" >
<view v-for="(item, index) in iosPaylist" @click="choseType(item.id)" <view v-for="(item, index) in iosPaylist" @click="choseType(item.id)"
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'"> :class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
<image :src="item.img"></image> <image :src="item.img"></image>
{{item.title}} {{item.title}}
<u-radio v-if="isAndroid" :key="index" activeColor="#fe6e09" :name='item.id' <u-radio :key="index" activeColor="#fe6e09" :name='item.id'
style="float: right;margin-top: 5rpx;"></u-radio> style="float: right;margin-top: 5rpx;"></u-radio>
</view> </view>
</view> </view>
<!-- #endif -->
</u-radio-group> </u-radio-group>
</view> </view>
</view> </view>
@@ -57,12 +56,11 @@
<view>* 我已阅读并同意<span class="highlight" @click="showXieyi">增值服务协议</span></view> <view>* 我已阅读并同意<span class="highlight" @click="showXieyi">增值服务协议</span></view>
</view> </view>
<view class="char_btn"> <view class="char_btn">
<!-- #ifdef APP-ANDROID -->
<view @click="kaiChar">立即充值</view> <view @click="kaiChar">立即充值</view>
<!-- #endif -->
<!-- #ifdef APP-IOS --> <!-- <view @click="iosPay" >立即充值</view> -->
<view @click="iosPay" >立即充值</view>
<!-- #endif -->
</view> </view>
<!-- 充值协议 --> <!-- 充值协议 -->
<u-popup :show="xieyiShow" :round="10" @close="xieyiShow=false"> <u-popup :show="xieyiShow" :round="10" @close="xieyiShow=false">
@@ -143,6 +141,7 @@
onShow() { onShow() {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.getDevName()
// this.requestIapOrder() // this.requestIapOrder()
}, },
computed: { computed: {
@@ -182,8 +181,7 @@
// 判断是否苹果支付 // 判断是否苹果支付
if (channels[i].id === 'appleiap') { if (channels[i].id === 'appleiap') {
that.iapChannel = channels[i] that.iapChannel = channels[i]
that.requestOrder() that.requestOrder()
consle.log(666666666)
} }
} }
}) })
@@ -191,7 +189,7 @@
}, },
requestOrder() { requestOrder() {
uni.showLoading({ uni.showLoading({
title: '到这...', title: '获取商品信息',
mask: true mask: true
}) })
const that = this const that = this
@@ -227,20 +225,21 @@
provider: 'appleiap', provider: 'appleiap',
orderInfo: { orderInfo: {
productid: id, productid: id,
username: 'ordersn', // 用户标识 // username: 'ordersn', // 用户标识
username: that.orderSn, // 用户标识
optimize: false // 设置 optimize: true 解决丢单问题 optimize: false // 设置 optimize: true 解决丢单问题
}, },
success: (res => { success: (res => {
console.log(res,'成功的返回值1') // 成功的返回值 console.log(res,'成功的返回值') // 成功的返回值
uni.hideLoading() uni.hideLoading()
let data= { let data= {
receipt:res.transactionReceipt, // 校验体 receipt:res.transactionReceipt, // 校验体
TransactionID: this.orderSn, orderId: this.orderSn,
transactionId: res.transactionIdentifier //交易id transactionIdentifier: res.transactionIdentifier //交易id
} }
const orderId = this.orderId //这个订单id 是由后端返回的 // const orderId = this.orderId //这个订单id 是由后端返回的
const transactionId = res.transactionIdentifier //交易id // const transactionIdentifier = res.transactionIdentifier //交易id
const payload = res.transactionReceipt //校验体 // const payload = res.transactionReceipt //校验体
$http.request({ $http.request({
url: "/apple/applePay", url: "/apple/applePay",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
@@ -249,12 +248,31 @@
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
}).then(res => { }).then(res => {
console.log(res) // 发送给后台逻辑处理
uni.showToast({
title: '充值成功'
})
// 进行后续操作 // 进行后续操作
///that.getUserInfo() console.log(res)
let data= {
// receipt: 'MIIUKAYJKoZIhvcNAQcCoIIUGTCCFBUCAQExCzAJBgUrDgMCGgUAMIIDZgYJKoZIhvcNAQcBoIIDVwSCA1MxggNPMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgELAgEBBAMCAQAwCwIBDwIBAQQDAgEAMAsCARACAQEEAwIBADALAgEZAgEBBAMCAQMwDAIBCgIBAQQEFgI0KzAMAgEOAgEBBAQCAgCJMA0CAQMCAQEEBQwDMTEwMA0CAQ0CAQEEBQIDAf4oMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDI2MDAYAgEEAgECBBAX4ibAXjZ7IAwLx10evzedMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBBQIBAQQUYpDtGI14h',
transactionId: res.transactionIdentifier, // 支付交易id
// userId: that.userInfo.id,
// productId: 'add69',
orderId: res.payment.username // 系统订单号
receiptData: res.transactionReceipt //苹果返回状态码
}
$http.request({
url: "/Ipa/veri",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
// alert(res)
uni.showToast({
title: '充值成功'
})
})
}) })
}), }),
fail: (e) => { fail: (e) => {
@@ -266,8 +284,6 @@
} }
}) })
}, },
getDevName() { getDevName() {
// 获取使用环境 // 获取使用环境
if (uni.getSystemInfoSync().platform === 'android') { if (uni.getSystemInfoSync().platform === 'android') {
@@ -304,8 +320,7 @@
}, },
//ios充值 //ios充值
iosPay() { iosPay() {
if(this.radioValue == '1'){ // if(this.radioValue == '1'){
let that = this let that = this
let data = { let data = {
@@ -332,22 +347,25 @@
// this.topay(15) // this.topay(15)
this.iphonepay() this.iphonepay()
}) })
}else{ // }else{
uni.showToast({ // uni.showToast({
title:'请勾选服务协议', // title:'请勾选服务协议',
icon:'error' // icon:'error'
}) // })
} // }
}, },
// 充值 // 充值
kaiChar() { kaiChar() {
if(this.radioValue == '1'){ if(this.radioValue == '1'){
uni.showLoading({
title:'支付中,请勿离开',
icon:'loading'
})
let that = this let that = this
let data = { let data = {
userId: that.userInfo.id, //下单人ID userId: that.userInfo.id, //下单人ID
userPhone: that.userInfo.tel, //收货人手机号 userPhone: that.userInfo.tel, //收货人手机号
paymentMethod: that.payType, //1支付宝,2微信3ios内购 paymentMethod: that.payType, //2支付宝,1微信3ios内购
orderMoney: that.stepsCj.money * 1, //订单金额 orderMoney: that.stepsCj.money * 1, //订单金额
districtMoney: 0, //优惠金额 districtMoney: 0, //优惠金额
realMoney: that.stepsCj.money * 1, //实收金额 realMoney: that.stepsCj.money * 1, //实收金额
@@ -359,11 +377,13 @@
url: "book/buyorder/rechargeSave", url: "book/buyorder/rechargeSave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data, data,
header: { //默认 无 说明:请求头 header: { //默认 无 说明:请求头1
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
}).then(res => { }).then(res => {
uni.hideLoading()
if (res.code == 0) { if (res.code == 0) {
if(that.payType == 2){
setPay({ setPay({
typePay: 'alipay', typePay: 'alipay',
subject: 'point', subject: 'point',
@@ -384,12 +404,22 @@
}); });
} }
}) })
}else if(that.payType == 1){
// 微信支付
uni.showToast({
title:'微信支付',
none: 'none'
})
}else if(that.payType == 3){
console.log('苹果支付',)
that.iosPay()
}
} }
}) })
}else{ }else{
uni.showToast({ uni.showToast({
title:'请勾选 已阅读会员服务协议', title:'请勾选 已阅读会员服务协议',
icon:'error' icon:'none'
}) })
return false return false
} }

View File

@@ -692,7 +692,7 @@ import { nextTick } from "vue";
'lineHeight':'', 'lineHeight':'',
'oldReadPage':0 'oldReadPage':0
}, },
setShow: true, // 设置显示? setShow: false, // 设置显示?
clientlast: null, //开始位置 clientlast: null, //开始位置
touchNum: 0, //点击次数 touchNum: 0, //点击次数
touchTime: null, //定时器清除 touchTime: null, //定时器清除
@@ -3178,13 +3178,22 @@ import { nextTick } from "vue";
musicPlaying:false, musicPlaying:false,
fontSize:'', fontSize:'',
lineHeight:'', lineHeight:'',
containerStyle: '' containerStyle: '',
devName:false,
letterSpacing:1,
} }
}, },
mounted() { mounted() {
this.onTurn(); this.onTurn();
this.isAndroid()
console.log(this.devName,'devName')
}, },
methods: { methods: {
isAndroid() { //判断是否为安卓手机
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
this.devName = isAndroid
},
updateReaderSet(newVal, oldVal){ updateReaderSet(newVal, oldVal){
// 阅读器设置更新 // 阅读器设置更新
$("#flipbook .paragraph").css({fontSize:newVal.fontSize+"px", lineHeight:newVal.lineHeight*newVal.fontSize+"px"}) $("#flipbook .paragraph").css({fontSize:newVal.fontSize+"px", lineHeight:newVal.lineHeight*newVal.fontSize+"px"})
@@ -3233,7 +3242,7 @@ import { nextTick } from "vue";
}, },
updateSimulationText(newVal, oldVal) { updateSimulationText(newVal, oldVal) {
$("#flipbook").turn('pages',1) // 内容变化时保留1页 $("#flipbook").turn('pages',1) // 内容变化时保留1页1
$("#flipbook").turn('pages',newVal.SimulationText.length) $("#flipbook").turn('pages',newVal.SimulationText.length)
// this.onTurn(); // this.onTurn();
// this.SimulationText = newVal // this.SimulationText = newVal
@@ -3242,22 +3251,24 @@ import { nextTick } from "vue";
this.lineHeight = newVal.lineHeight this.lineHeight = newVal.lineHeight
newVal.background == 1 ? this.containerStyle = "#f7faf9" : this.containerStyle = "#000" newVal.background == 1 ? this.containerStyle = "#f7faf9" : this.containerStyle = "#000"
//$(".myPage p").css({backgroundColor:this.containerStyle}) //$(".myPage p").css({backgroundColor:this.containerStyle})
this.devName ? this.letterSpacing = 2 : this.letterSpacing = 1
console.log(this.letterSpacing,'-----------------------------')
for (var i=0; i<newVal.SimulationText.length;i++) { for (var i=0; i<newVal.SimulationText.length;i++) {
var tagHtml = ""; var tagHtml = "";
var conntentHtml = ""; var conntentHtml = "";
for (var j=0; j<newVal.SimulationText[i].length; j++) { for (var j=0; j<newVal.SimulationText[i].length; j++) {
var classname = '' var classname = ''
var styleconteent = '' var styleconteent = ''
newVal.SimulationText[i][j].class == 'jushou' ? classname = 'shouhang' : '' newVal.SimulationText[i][j].class == 'jushou' ? classname = 'shouhang' : 'notshouhang'
newVal.SimulationText[i][j].class == 'jushou' ? styleconteent = "';text-indent:2em ;font-size:"+newVal.fontSize+"px; color: #5d5d5d; line-height:"+newVal.lineHeight*newVal.fontSize+"px;'": styleconteent = "'font-size:"+newVal.fontSize+"px ; line-height:"+newVal.lineHeight*newVal.fontSize+"px; color: #5d5d5d; text-align:justify'" newVal.SimulationText[i][j].class == 'jushou' ? styleconteent = "'text-indent:2em ;font-size:"+newVal.fontSize+"px; color: #5d5d5d; line-height:"+newVal.lineHeight*newVal.fontSize+"px;'": styleconteent = "'font-size:"+newVal.fontSize+"px ; line-height:"+newVal.lineHeight*newVal.fontSize+"px; color: #5d5d5d;'"
conntentHtml += "<p class='paragraph " + classname + " paragraph" + newVal.SimulationText[i][j].paragraph +"' style="+styleconteent+">" + newVal.SimulationText[i][j].list + "</p>" conntentHtml += "<p class='paragraph " + classname + " paragraph" + newVal.SimulationText[i][j].paragraph +"' style="+styleconteent+">" + newVal.SimulationText[i][j].list + "</p>"
} }
var page1 = i+1 var page1 = i+1
var btnStyle = "display: block; padding: 20rpx; border: 1px solid #333; text-align: center;" var btnStyle = "display: block; padding: 20rpx; border: 1px solid #333; text-align: center;"
var tagHtml = "<div style='padding:0 18px; position:relative; background-color:"+this.containerStyle+"; height:inherit'>"+ conntentHtml +"<div style='text-align:center; color:#777 ; position: absolute;bottom: 5px; left: 0;text-align: center; width: 100%;' >"+page1+"/"+ newVal.SimulationText.length +"</div></div>"; var tagHtml = "<div style='padding:0 10px;letter-spacing:"+ this.letterSpacing +"px; position:relative; background-color:"+this.containerStyle+"; height:inherit'>"+ conntentHtml +"<div style='text-align:center; color:#777 ; position: absolute;bottom: 5px; left: 0;text-align: center; width: 100%;' >"+page1+"/"+ newVal.SimulationText.length +"</div></div>";
// $("#flipbook").append(tagHtml); // $("#flipbook").append(tagHtml);
if (!$("#flipbook").turn('hasPage', i+2)) { if (!$("#flipbook").turn('hasPage', i+2)) {
// Create an element for this page // Create an element for this page.
var element = $('<div />').html(''); var element = $('<div />').html('');
// Add the page // Add the page
$("#flipbook").turn('addPage', element, i+2); $("#flipbook").turn('addPage', element, i+2);
@@ -3266,6 +3277,7 @@ import { nextTick } from "vue";
} }
// 如果有阅读缓存 // 如果有阅读缓存
if(newVal.oldReadPage>0){ if(newVal.oldReadPage>0){
// alert('读取历史阅读进度')
$("#flipbook").turn('page', newVal.oldReadPage+1) $("#flipbook").turn('page', newVal.oldReadPage+1)
}else{ }else{
$("#flipbook").turn('page', 2) $("#flipbook").turn('page', 2)
@@ -3326,7 +3338,7 @@ import { nextTick } from "vue";
} else { } else {
clearTimeout(this.touchTime) clearTimeout(this.touchTime)
this.touchTime = setTimeout(() => { this.touchTime = setTimeout(() => {
//双击或多次点击事件 //双击或多次点击事件
this.touchNum = 0 this.touchNum = 0
}, 250) }, 250)
//console.log('单击') //console.log('单击')
@@ -3361,6 +3373,11 @@ import { nextTick } from "vue";
</script> </script>
<style> <style>
/* .container1{background-color: #000;} */ /* .container1{background-color: #000;} */
.notshouhang:after {
display: inline-block;
width: 100%;
content: '';
}
.buts{width: 100%; display:flex; } .buts{width: 100%; display:flex; }
.buts span{display: block; padding: 20rpx; border: 1px solid #333; text-align: center;} .buts span{display: block; padding: 20rpx; border: 1px solid #333; text-align: center;}
</style> </style>