196 lines
3.8 KiB
JavaScript
196 lines
3.8 KiB
JavaScript
// packageC/Myshaky/sign_in/sign_in.js
|
|
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
id: "",
|
|
name: "",
|
|
mobile: "",
|
|
nickName: "",
|
|
uid: "",
|
|
kFootshow: true,
|
|
fromStatus:false
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
if (options.id) {
|
|
this.setData({
|
|
id: options.id
|
|
});
|
|
}
|
|
if (options.scene) {
|
|
let scene = decodeURIComponent(options.scene);
|
|
if (scene) {
|
|
var info_arr = [];
|
|
info_arr = scene.split(',');
|
|
for (let i = 0; i < info_arr.length; i++) {
|
|
let chil_arr = [];
|
|
chil_arr = info_arr[i].split('=');
|
|
if (chil_arr[0] == "mid") {
|
|
app._setMid(chil_arr[1]);
|
|
}
|
|
if (chil_arr[0] == "id") {
|
|
this.setData({
|
|
id: chil_arr[1]
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.test();
|
|
this.getData();
|
|
},
|
|
tabrshowbtn(e) {
|
|
let bol = e.detail;
|
|
if (bol) {
|
|
this.setData({
|
|
kFootshow: false
|
|
});
|
|
}
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
test() {
|
|
let urlStr = app.getNetAddresss("plugin.activity-apply.api.Activity.getActivityEnrol");
|
|
let that = this;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
activity_id: that.data.id,
|
|
},
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
getData() {
|
|
let urlStr = app.getNetAddresss("plugin.activity-apply.api.Activity.getActivity");
|
|
let that = this;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
activity_id: that.data.id,
|
|
},
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
if(res.data.pay_order.sign == 1){
|
|
that.setData({
|
|
fromStatus:true
|
|
})
|
|
}
|
|
that.setData({
|
|
name: res.data.title,
|
|
nickName: res.data.member.nickname,
|
|
mobile: res.data.member.mobile,
|
|
uid: res.data.member.uid
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
submit() {
|
|
let json = {
|
|
activity_id: this.data.id,
|
|
member_id: this.data.uid
|
|
};
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.activity-apply.api.activity.saveSign");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: json,
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
that.getData();
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
}
|
|
}); |