135 lines
2.6 KiB
JavaScript
135 lines
2.6 KiB
JavaScript
// pages/train/access.js
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
|
|
},
|
|
bindzwrsInput: function (e) {
|
|
this.data.knownum = e.detail.value
|
|
},
|
|
bindpxscInput: function (e) {
|
|
this.data.duration = e.detail.value
|
|
},
|
|
bindpxxgInput: function (e) {
|
|
this.data.pxxg = e.detail.value
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
trainname:options.trainname,
|
|
pxid:options.pxid
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
submit: function () {
|
|
var that = this;
|
|
if (!that.data.duration) {
|
|
that.Tap1('请输入培训时长!')
|
|
}
|
|
else if (!that.data.knownum) {
|
|
that.Tap1('请输入掌握人数!')
|
|
} else if (!that.data.pxxg) {
|
|
that.Tap1('请输入培训效果!')
|
|
} else {
|
|
that.accesspx()
|
|
}
|
|
|
|
},
|
|
Tap1: function (x) {
|
|
wx.showModal({
|
|
title: "系统提示",
|
|
content: x,
|
|
showCancel: false,
|
|
confirmText: "确定"
|
|
})
|
|
},
|
|
accesspx: function () {
|
|
// let pxlx = []
|
|
// let x = this.data.pxlxArray
|
|
// for (var i = 0, len = x.length; i < len; ++i) {
|
|
// if (x[i].checked = true) {
|
|
// pxlx.push(x[i].id)
|
|
// }
|
|
// }
|
|
var pxdata = {
|
|
trainid: this.data.pxid,
|
|
duration: this.data.duration,
|
|
knownum: this.data.knownum,
|
|
pxxg: this.data.pxxg
|
|
}
|
|
|
|
|
|
wx.showLoading({
|
|
title: '正在提交...',
|
|
})
|
|
wx.request({
|
|
url: getApp().globalData.serverUrl + 'accesstrain?trainid='+this.data.pxid,
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded', //
|
|
'Cookie': getApp().globalData.sessionId,
|
|
},
|
|
method: 'POST',
|
|
data: pxdata,
|
|
success: res => {
|
|
if (res.statusCode === 200) {
|
|
wx.hideLoading();
|
|
wx.navigateBack()
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
}) |