blob: 85cc08bb6b19fc2d70ce13f26882fb91ed403d6f [file] [log] [blame]
// pages/signxy/signxy.js
Page({
/**
* 页面的初始数据
*/
data: {
url: '',
signMsg: '',
disabled: false,
xy: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var signed = wx.getStorageSync("signed");
if (wx.$isEmpty(signed) || signed != 'yes') {
this.setData({
signMsg: '我已阅读并同意该协议',
disabled: false
})
} else {
this.setData({
signMsg: '您已签约',
disabled: true
})
return;
}
// var that = this;
// wx.showLoading("加载中");
// wx.$doPost('/v1/bxy', {}, function(ok, ret, err) {
// wx.hideLoading();
// if (ok) {
// if (ret.data.code == 200) {
// // var text = ret.data.page;
// // that.setData({
// // xy: text.replace('/br/g', ' ')
// // })
// // this.setData({
// // url: ret.data.data.url
// // })
// // if (wx.$isEmpty(ret.data.signed) || ret.data.data.signed != 'yes') {
// // } else {
// // }
// } else {
// wx.showModal({
// title: '错误',
// content: ret.data.msg,
// })
// }
// } else {
// wx.showModal({
// title: '错误',
// content: '',
// })
// }
// })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
signXY: function() {
wx.showLoading({
title: '正在请求',
})
var param = {
"agree": 'yes'
}
wx.$doPost('/v1/signbxy', param, function(ok, ret, err) {
wx.hideLoading();
if (ok) {
if (ret.data.code == 200) {
wx.setStorageSync("signed", ret.data.signed);
wx.redirectTo({
url: '../index/index',
})
} else {
wx.showModal({
title: '错误',
content: ret.data.msg,
})
}
} else {
wx.showModal({
title: '错误',
content: ret.data.status,
})
}
})
}
})