|
|
@@ -7,7 +7,16 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- info:{}
|
|
|
+ info:{},
|
|
|
+ labels: {
|
|
|
+ company: '单位', name: '姓名', tax_company: '发票单位', idcard: '身份证号',
|
|
|
+ email: '邮箱', sex: '性别', age: '年龄', title: '职称',
|
|
|
+ remark1: '备注1', remark2: '备注2', remark3: '备注3', phone:'手机号'
|
|
|
+ },
|
|
|
+ sex_array: ['男', '女'],
|
|
|
+ sex: -1,
|
|
|
+ phone:'',
|
|
|
+ show:0
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -17,29 +26,151 @@ Page({
|
|
|
var that = this;
|
|
|
wx.showNavigationBarLoading()
|
|
|
var that = this;
|
|
|
- wx.request({
|
|
|
- url: host + '/api/detail',
|
|
|
- method: 'GET',
|
|
|
- data: {
|
|
|
- type: 'activity',
|
|
|
- id: options.id
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'uid',
|
|
|
+ success: res => {
|
|
|
+ if (res.data) {
|
|
|
+ this.setData({
|
|
|
+ user_id: res.data
|
|
|
+ })
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/detail',
|
|
|
+ method: 'GET',
|
|
|
+ data: {
|
|
|
+ type: 'activity',
|
|
|
+ id: options.id,
|
|
|
+ uid: res.data
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ wx.hideNavigationBarLoading();
|
|
|
+ if(res.data.code != 0){
|
|
|
+ wx.showToast({
|
|
|
+ title: '服务器开小差啦!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const info = res.data.data
|
|
|
+ if (info.sign_note) { info.sign_note = info.sign_note.replace(/\\n/, '\n') }
|
|
|
+ that.setData({
|
|
|
+ info: info
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function () {
|
|
|
+ wx.hideLoading();
|
|
|
+ wx.showToast({
|
|
|
+ title: '服务器开小差啦!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
+ })
|
|
|
+ },
|
|
|
+ close: function () {
|
|
|
+ this.setData({
|
|
|
+ show: 0
|
|
|
+ })
|
|
|
+ },
|
|
|
+ open: function () {
|
|
|
+ this.setData({
|
|
|
+ show: 1
|
|
|
+ })
|
|
|
+ },
|
|
|
+ phoneChange: function (e) {
|
|
|
+ this.setData({
|
|
|
+ phone: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ sendcode: function () {
|
|
|
+ if (this.data.phone.length < 11) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请输入正确的手机号',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/phcode',
|
|
|
+ method: 'POST',
|
|
|
+ data: { phone: this.data.phone },
|
|
|
success: function (res) {
|
|
|
- wx.hideNavigationBarLoading();
|
|
|
- that.setData({
|
|
|
- info: res.data.data
|
|
|
- })
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '验证码已发送',
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '发送失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- fail: function () {
|
|
|
- wx.hideLoading();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ bindSexChange: function (e) {
|
|
|
+ this.setData({
|
|
|
+ sex: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //提交报名信息
|
|
|
+ submit: function (e) {
|
|
|
+ var form = e.detail.value;
|
|
|
+ var list = this.data.list, index = this.data.index;
|
|
|
+ if (this.data.info.signup_fields.indexOf('sex') >= 0) {
|
|
|
+ form.sex = this.data.sex > -1 ? this.data.sex:''
|
|
|
+ }
|
|
|
+ form.uid = this.data.user_id;
|
|
|
+ form.conference_id = this.data.info.id;
|
|
|
+ form.conference_name = this.data.info.name;
|
|
|
+ form.type ='activity';
|
|
|
+ console.log(form)
|
|
|
+ var fields = this.data.info.signup_fields;
|
|
|
+ for(let i=0;i<fields.length;i++){
|
|
|
+ if (!form[fields[i]]){
|
|
|
wx.showToast({
|
|
|
- title: '服务器开小差啦!',
|
|
|
+ title: '请输入' + this.data.labels[fields[i]]+'!',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
+ return;
|
|
|
}
|
|
|
+ }
|
|
|
+ if (!form.code) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请输入验证码!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在提交',
|
|
|
})
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/user/signup',
|
|
|
+ method: 'POST',
|
|
|
+ data: form,
|
|
|
+ success: (res => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ wx.hideLoading()
|
|
|
+ this.setData({
|
|
|
+ show: 0
|
|
|
+ })
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '../order/order',
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '提交失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|