Commit cc436b4e authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 2bcc4c1b
{ {
"name" : "reader", "name" : "reader",
"appid" : "__UNI__1EF86FE", "appid" : "__UNI__C390C5A",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : 1000, "versionCode" : 1000,
......
...@@ -70,6 +70,14 @@ ...@@ -70,6 +70,14 @@
"navigationBarBackgroundColor": "#ffffff", "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
},{
"path": "vipAppPay/vipAppPay",
"style": {
"navigationBarTitleText": "会员中心",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
} }
] ]
}, { }, {
......
<template> <template>
<view class="body"> <view v-if="sourceType!='android'" class="body">
<image style="width: 170rpx;height: 170rpx;margin-top: 30%;" src="../static/images/logo.png" mode="widthFix" /> <image style="width: 170rpx;height: 170rpx;margin-top: 30%;" src="../static/images/logo.png" mode="widthFix" />
<view style="color: black;margin-top: 30rpx;font-size: 40rpx;font-size: 50rpx;">{{appName}}</view> <view style="color: black;margin-top: 30rpx;font-size: 40rpx;font-size: 50rpx;">{{appName}}</view>
<view style="color: #FECF02;margin-top: 10rpx;font-size: 40rpx;font-size: 40rpx;">欢迎使用</view> <view style="color: #FECF02;margin-top: 10rpx;font-size: 40rpx;font-size: 40rpx;">欢迎使用</view>
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
{{slotParam}} {{slotParam}}
</view> </view>
</uni-popup> </uni-popup>
</view>
<view v-else class="show-mask flex-v" @click="getVipParams">
<view class="body2">
<text @click="getVipParams" style="font-size: 46rpx;color: black;">发起支付</text>
</view>
</view> </view>
</template> </template>
...@@ -38,12 +44,15 @@ ...@@ -38,12 +44,15 @@
data() { data() {
return { return {
tips1: '', tips1: '',
sourceType: '',
slotParam: '', slotParam: '',
vipList: [],
appName: '河狸小故事' appName: '河狸小故事'
} }
}, },
onLoad(options) { onLoad(options) {
this.tips1 = options.tips1 this.tips1 = options.tips1;
}, },
onShow(options) { onShow(options) {
this.ttLoging() this.ttLoging()
...@@ -52,6 +61,7 @@ ...@@ -52,6 +61,7 @@
ttLoging() { ttLoging() {
var that = this; var that = this;
var obj = wx.getLaunchOptionsSync() var obj = wx.getLaunchOptionsSync()
this.sourceType = obj.query.source_type;
var tips2 = ''; // 投放测试 var tips2 = ''; // 投放测试
var thirdParam = ""; var thirdParam = "";
...@@ -89,16 +99,98 @@ ...@@ -89,16 +99,98 @@
}) => { }) => {
app.globalData.userId = data.idcode; app.globalData.userId = data.idcode;
saveToken(data.token) saveToken(data.token)
setTimeout(() => { // saveToken(
redirectTo('home?activiteFlag='+data.activiteFlag+"&idcode="+data.idcode); // 'A5CFAE67AF32E71D10CA6127546E82C20A8DE7C0EAAA5697BEEC2AC2E333F9945F433703067DF5142735505C42F58997'
// redirectTo('/pagesA/vipPay/vipPay'); // )
}, 1000);
// that.handlePay()
if (data.activiteFlag == 101) {
that.handlePay()
} else {
setTimeout(() => {
redirectTo('home?activiteFlag=' + data
.activiteFlag + "&idcode=" + data.idcode);
}, 1000);
}
} }
}); });
}, },
fail: function(err) { fail: function(err) {}
});
},
handlePay() {
let that = this;
this.post({
url: '/vip/getVipProducts/cyc/forVApp',
showLoading: false,
success: ({
data
}) => {
that.vipList = data.list;
} }
}); });
},
getVipParams() {
let that = this;
if (that.vipList != null && that.vipList.length > 0) {
let vipBean = that.vipList[0];
that.post({
url: '/vip/getVipPayParams/wechatForVApp',
data: {
pid: vipBean.pid,
payChannel: 'WEIXIN'
},
showLoading: true,
success: ({
data
}) => {
if (vipBean.firstPayPrice == 0) {
//签约
that.wxSign(data, vipBean.largeType);
} else {
//普通支付
that.wxPay(data, vipBean.largeType);
}
}
});
} else {
message.notify('网络加载中,请稍后')
}
},
wxSign(wxData, largeType) {
let that = this;
// 发起微信签约
wx.navigateToMiniProgram({
appId: "wxbd687630cd02ce1d",
path: 'pages/index/index',
extraData: wxData.params,
success(res) {},
fail(res) {
// 未成功跳转到签约小程序
// console.log("wxSign fail=", res);
}
})
},
wxPay(wxData) {
let wxParams = wxData.params;
let that = this;
// 发起微信支付
wx.requestPayment({
timeStamp: wxParams.timeStamp,
nonceStr: wxParams.nonceStr,
package: wxParams.packageStr,
signType: wxParams.signType,
paySign: wxParams.paySign,
success(res) {},
fail(res) {
// message.notify('取消支付')
}
})
} }
} }
}; };
...@@ -110,6 +202,16 @@ ...@@ -110,6 +202,16 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
}
.body2 {
width: 90%;
height: 90%;
background-color: white;
display: flex;
flex-direction: column;
align-items: center;
margin: 30rpx;
border-radius: 20rpx;
} }
.text-box { .text-box {
...@@ -119,4 +221,70 @@ ...@@ -119,4 +221,70 @@
background-color: white; background-color: white;
color: black; color: black;
} }
.loading {
text-align: center;
.logo {
position: absolute;
top: 40%;
width: 100%;
transform: translateY(-50%);
image {
width: 170rpx;
height: 170rpx;
margin-bottom: 52rpx;
}
.animation {
font-size: 72rpx;
margin-top: 200rpx;
text {
text-align: center;
display: inline-block;
animation: spring 1s ease-in-out infinite;
}
}
}
}
@keyframes spring {
0% {
transform: scaleX(1);
}
30% {
transform: scale3d(1.25, 0.75, 1);
}
40% {
transform: scale3d(0.75, 1.25, 1);
}
50% {
transform: scale3d(1.15, 0.85, 1);
}
65% {
transform: scale3d(0.95, 1.05, 1);
}
75% {
transform: scale3d(1.05, 0.95, 1);
}
to {
transform: scaleX(1);
}
}
.show-mask {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
color: white;
align-items: center;
}
</style> </style>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment