14 changed files with 265 additions and 317 deletions
@ -1,169 +0,0 @@ |
|||||
// 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 () { |
|
||||
|
|
||||
} |
|
||||
}) |
|
@ -1,27 +0,0 @@ |
|||||
<!--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> |
|
@ -1,2 +1,27 @@ |
|||||
<!--pages/topics/activity/activitySign/index.wxml--> |
<!--pages/topics/activity/activitySign/index.wxml--> |
||||
<text>pages/topics/activity/activitySign/index.wxml</text> |
<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> |
@ -1 +1,5 @@ |
|||||
/* pages/topics/activity/index.wxss */ |
/* pages/topics/activity/index.wxss */ |
||||
|
.container{ |
||||
|
padding: 0 30rpx; |
||||
|
box-sizing: border-box; |
||||
|
} |
Loading…
Reference in new issue