市北人才赋能平台 --小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

179 lines
3.4 KiB

// pages/topics/activity/activitySign/index.js
import {
store
} from '../../../../utils/store.js'
import {
TopicModel
} from '../../../../models/topic.js'
let topicModel = new TopicModel()
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
aId: '',
username: '',
company: '',
phone: '',
id:'',
remark:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
aId: options.activityId
})
this.initFormData()
// console.log(this.data.aId)
},
initFormData() {
let {
// nickName,
phone,
id
} = store.readUserInfo()
console.log(store.readUserInfo())
this.setData({
// username: nickName,
phone: phone,
id:id
})
},
changeCompany: function (e) {
var company = e.detail.value;
this.setData({
company: company
})
},
changeUsername: function (e) {
var username = e.detail.value;
this.setData({
username: username
})
},
changePhone: function (e) {
let isPhoneFlag = this.isPhone(e.detail.value)
if (!isPhoneFlag) {
wx.showToast({
title: '请输入正确格式的手机号',
icon: 'none',
duration: 2000,
})
return;
}
this.setData({
phone: e.detail.value
})
},
changeRemark:function(e){
this.setData({
remark: e.detail.value
})
},
isPhone(value) {
if (!/^1(3|4|5|7|8)\d{9}$/.test(value)) {
return false
} else {
return true
}
},
submit() {
var th = this;
if (this.data.username === '') {
wx.showModal({
title: '提示',
content: '请输入您的真实姓名',
showCancel: false
})
return
}
if (this.data.phone === '') {
wx.showModal({
title: '提示',
content: '请输入联系电话',
showCancel: false
})
return
}
this.onlineSignApi()
},
//在线报名
onlineSignApi() {
console.log(this.data.aId,this.data.id,this.data.phone,this.data.username,this.data.company,this.data.remark)
topicModel.onlineSign(this.data.aId,this.data.remark,this.data.id,this.data.phone,this.data.username,this.data.company, res => {
if (res.code == 200) {
console.log(res.code);
wx.showModal({
title: res.message,
showCancel: false, //是否显示取消按钮
confirmText: "确定", //默认是“确定”
success: function (res) {
app.globalData.currentTab = "5"
wx.switchTab({
url: '../../../topics/index'
})
},
})
}
if (res.code != 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})