Commit 7de55db2 by shijiuyan

1

parent bac032f6
...@@ -82,13 +82,14 @@ Page({ ...@@ -82,13 +82,14 @@ Page({
success: function (resp) { success: function (resp) {
console.log(resp) console.log(resp)
if(resp.data.status=='OK'){ if(resp.data.status=='OK'){
if(resp.data.haveBuy&&!resp.data.is_free || resp.data.is_free){ if (resp.data.result.courseMediaDat.haveBuy && !resp.data.result.courseMediaDat.is_free || resp.data.result.courseMediaDat.is_free){
that.setData({ that.setData({
play:1, play:1,
playUrl:resp.data.result.courseMediaDat.media playUrl:resp.data.result.courseMediaDat.media
}) })
}else{ }else{
that.setData({ that.setData({
playUrl: resp.data.result.courseMediaDat.media,
fufeiPage:1, fufeiPage:1,
money: resp.data.result.courseMediaDat.price money: resp.data.result.courseMediaDat.price
}) })
...@@ -192,8 +193,45 @@ Page({ ...@@ -192,8 +193,45 @@ Page({
}) })
}, },
surefufei(){ surefufei(){
this.setData({ var that=this;
fufeiPage: 0 wx.getStorage({
key: 'config',
success: function(res) {
if(res){
wx.request({
url: app.url + 'ajax_buy_course_media.php',
data: {
unionId:res.data.unionId,
openId:res.data.openId,
mediaId: that.data.mediaId
},
success:function(resp){
console.log(resp)
if(resp.data.status=='OK'){
var result = JSON.parse(resp.data.result);
wx.requestPayment({
timeStamp: result.timeStamp,
nonceStr: result.nonceStr,
package: result.package,
signType: 'MD5',
paySign: result.paySign,
success(res) {
that.setData({
fufeiPage: 0,
play:1
}) })
},
fail(res) { }
})
}
}
})
}
},
})
// this.setData({
// fufeiPage: 0
// })
} }
}) })
\ No newline at end of file
...@@ -29,10 +29,17 @@ Page({ ...@@ -29,10 +29,17 @@ Page({
var that=this; var that=this;
//获取用户当前的经纬度信息并调用接口判断用户身份 //获取用户当前的经纬度信息并调用接口判断用户身份
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
var location = wx.getStorageSync('location'); setTimeout(function(){
var latitude = location.latitude; wx.getStorage({
var longitude = location.longitude; key: 'location',
wx: wx.request({ success: function(resp) {
var location = resp.data;
var latitude = resp.data.latitude;
var longitude = resp.data.longitude;
wx.showToast({
title: config.unionId,
})
wx.request({
url: app.url + 'ajax_get_user_role.php', url: app.url + 'ajax_get_user_role.php',
data: { data: {
unionId: config.unionId, unionId: config.unionId,
...@@ -44,8 +51,9 @@ Page({ ...@@ -44,8 +51,9 @@ Page({
dataType: 'json', dataType: 'json',
success: function (res) { success: function (res) {
console.log(res) console.log(res)
if(res.statusCode==200){ if (res.statusCode == 200) {
//保存用户当前的省市区县信息 //保存用户当前的省市区县信息
location.province = res.data.result.province location.province = res.data.result.province
location.city = res.data.result.city location.city = res.data.result.city
location.district = res.data.result.district location.district = res.data.result.district
...@@ -61,7 +69,7 @@ Page({ ...@@ -61,7 +69,7 @@ Page({
}) })
//未注册用户的话。跳转到社会人士注册页面 //未注册用户的话。跳转到社会人士注册页面
if (res.data.status =="REGIST") { if (res.data.status == "REGIST") {
//页面跳转 //页面跳转
wx.redirectTo({ wx.redirectTo({
url: '../socialUserRegister/socialUserRegister', url: '../socialUserRegister/socialUserRegister',
...@@ -69,11 +77,11 @@ Page({ ...@@ -69,11 +77,11 @@ Page({
} }
that.setData({ that.setData({
roleTitle: res.data.result.name, roleTitle: res.data.result.name,
role:res.data.result.role, role: res.data.result.role,
childAge: res.data.result.childAge childAge: res.data.result.childAge
}) })
//菜单控制[亲子活动] //菜单控制[亲子活动]
if (res.data.result.role == 1 || res.data.result.childAge==1) { if (res.data.result.role == 1 || res.data.result.childAge == 1) {
that.setData({ that.setData({
showFamily: true showFamily: true
}) })
...@@ -97,6 +105,10 @@ Page({ ...@@ -97,6 +105,10 @@ Page({
complete: function (res) { }, complete: function (res) { },
}) })
}, },
})
},1000);
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -32,6 +32,8 @@ Page({ ...@@ -32,6 +32,8 @@ Page({
onShow: function () { onShow: function () {
//如果用户已经注册则跳转到首页 //如果用户已经注册则跳转到首页
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
setTimeout(
function(){
if (config.registed == true) { if (config.registed == true) {
//跳转到首页 //跳转到首页
wx.switchTab({ wx.switchTab({
...@@ -39,6 +41,10 @@ Page({ ...@@ -39,6 +41,10 @@ Page({
}); });
} }
}, },
200
)
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
......
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