17 changed files with 460 additions and 149 deletions
@ -1,3 +1,5 @@ |
|||||
{ |
{ |
||||
"usingComponents": {} |
"usingComponents": { |
||||
|
"cell": "../../topics/activity/cell/index" |
||||
|
} |
||||
} |
} |
@ -0,0 +1,169 @@ |
|||||
|
// 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: '' |
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
console.log(options) |
||||
|
this.setData({ |
||||
|
aId: options.activityId |
||||
|
}) |
||||
|
this.initFormData() |
||||
|
// console.log(this.data.aId)
|
||||
|
}, |
||||
|
initFormData() { |
||||
|
let { |
||||
|
nickName, |
||||
|
phone |
||||
|
} = store.readUserInfo() |
||||
|
this.setData({ |
||||
|
username: nickName, |
||||
|
phone: phone |
||||
|
}) |
||||
|
}, |
||||
|
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 |
||||
|
}) |
||||
|
}, |
||||
|
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() { |
||||
|
topicModel.onlineSign(this.data.aId, 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 () { |
||||
|
|
||||
|
} |
||||
|
}) |
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"enablePullDownRefresh": false, |
||||
|
"navigationBarTitleText":"在线报名", |
||||
|
"usingComponents": { |
||||
|
"e-ibutton": "/components/image-button/index" |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
<!--pages/topics/activity/activitySign/index.wxml--> |
||||
|
<view class="container"> |
||||
|
<view class="select-view"> |
||||
|
<view class="select-con"> |
||||
|
<text>姓名</text> |
||||
|
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeUsername' placeholder="请输入姓名" |
||||
|
placeholder-style='text-align:right;color:#ACACAE;' value="{{username}}"/> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="select-view"> |
||||
|
<view class="select-con"> |
||||
|
<text>工作单位</text> |
||||
|
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeCompany' placeholder="请输入工作单位" |
||||
|
placeholder-style='text-align:right;color:#ACACAE;' value="{{company}}"/> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="select-view"> |
||||
|
<view class="select-con"> |
||||
|
<text>联系电话</text> |
||||
|
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changePhone' placeholder="请输入联系电话" |
||||
|
placeholder-style='text-align:right;color:#ACACAE;' value="{{phone}}"/> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="btnView"> |
||||
|
<e-ibutton title="提交" bind:onTap="submit" /> |
||||
|
</view> |
@ -0,0 +1,33 @@ |
|||||
|
/* pages/topics/activity/activitySign/index.wxss */ |
||||
|
.container{ |
||||
|
padding: 26rpx 30rpx 0 30rpx; |
||||
|
} |
||||
|
.select-view{ |
||||
|
display: flex; |
||||
|
padding: 32rpx 0; |
||||
|
border-bottom: 1px solid #ededed; |
||||
|
font-size: 34rpx; |
||||
|
/* btnView是position:fix,所以为防止遮挡,设置街道选择盒子下边框margin-bottom为100px */ |
||||
|
/* margin-bottom: 100px; */ |
||||
|
} |
||||
|
.select-con{ |
||||
|
margin-left:20px; |
||||
|
flex:1; |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
input{ |
||||
|
flex:1; |
||||
|
margin-left:20px; |
||||
|
margin-top: 3px; |
||||
|
} |
||||
|
.btnView{ |
||||
|
position: fixed; |
||||
|
height:50px; |
||||
|
padding: 10px 20px 20px 20px; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
background-color: white; |
||||
|
} |
Loading…
Reference in new issue