加入表单验证

This commit is contained in:
fengachen
2021-10-19 15:37:14 +08:00
parent 27a0dc96b1
commit c13697c557
11 changed files with 745 additions and 280 deletions
+129 -9
View File
@@ -1,6 +1,10 @@
// pages/addCompany/addCompany.js
import signUpApi from '../../assets/js/http/signUp'
import {
dutyCode,
postcode
} from '../../utils/validate'
Page({
/**
@@ -8,31 +12,78 @@ Page({
*/
data: {
// 是否是国际研讨会报名的选择
prepage:''
prepage: '',
flag: false
},
// 返回选择单位
backCompanyList(){
backCompanyList() {
wx.navigateTo({
url: '../companyList/companyList',
})
},
// 确定
addCompany(e){
addCompany(e) {
const formData = e.detail.value
const that = this
console.log(formData);
// 企业名称
if (formData.companyName === '') {
wx.showToast({
title: '请输入企业名称',
icon: 'none',
duration: 800
})
return
}
// 信用代码
if (formData.dutyCode === '') {
wx.showToast({
title: '请输入信用代码',
icon: 'none',
duration: 800
})
return
}
// 公司地址
if (formData.companyAddress === '') {
wx.showToast({
title: '请输入公司地址',
icon: 'none',
duration: 800
})
return
}
// 邮编
if (formData.postalCode === '') {
wx.showToast({
title: '请输入邮编',
icon: 'none',
duration: 800
})
return
}
if(this.data.flag){
wx.showToast({
title: '信息输入有误',
icon: 'none',
duration: 800
})
return
}
const that = this
signUpApi.addCompanyNoLimit(formData).then(res => {
if(res.success){
if (res.success) {
wx.showToast({
title: res.message,
icon: "none",
duration: 800,
});
if(that.data.prepage === 'guoji' ){
if (that.data.prepage === 'guoji') {
wx.navigateTo({
url: '../signUpPageGuoji/signUpPageGuoji',
})
}else{
} else {
wx.navigateTo({
url: '../signUpPage/signUpPage',
})
@@ -43,12 +94,81 @@ Page({
})
},
// 信用代码验证
validateDutyCode(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (dutyCode(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 邮编验证
validatePostCode(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (postcode(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
prepage:options.prepage
prepage: options.prepage
})
},
@@ -100,4 +220,4 @@ Page({
onShareAppMessage: function () {
}
})
})
+10 -10
View File
@@ -6,7 +6,7 @@
<view class="wx-form-item">
<view class="wx-form-label validate">企业名称:</view>
<view class="wx-form-value">
<input name="companyName" placeholder="请输入企业名称" />
<input name="companyName" placeholder="请输入企业名称" maxlength="50" />
<text class="hint">请确保与发票抬头企业名称一致</text>
</view>
</view>
@@ -14,56 +14,56 @@
<view class="wx-form-item">
<view class="wx-form-label validate">信用代码:</view>
<view class="wx-form-value">
<input name="dutyCode" placeholder="请输入信用代码" />
<input name="dutyCode" name="postCode" bindblur="validateDutyCode" data-message='请输入信用代码' data-errmsg='请输入正确的信用代码' placeholder="请输入信用代码" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">公司地址:</view>
<view class="wx-form-value">
<input name="companyAddress" placeholder="请输入公司地址" />
<input name="companyAddress" placeholder="请输入公司地址" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">公司电话:</view>
<view class="wx-form-value">
<input name="companyPhone" placeholder="请输入公司电话" />
<input name="companyPhone" placeholder="请输入公司电话" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">银行户名:</view>
<view class="wx-form-value">
<input name="bankAccountName" placeholder="请输入银行户名" />
<input name="bankAccountName" placeholder="请输入银行户名" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">邮编:</view>
<view class="wx-form-value">
<input name="postalCode" placeholder="请输入邮编" />
<input name="postalCode" placeholder="请输入邮编" maxlength="6" type="number" bindblur="validatePostCode" data-message='请输入邮编' data-errmsg='请输入正确的邮编' />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">银行账号:</view>
<view class="wx-form-value">
<input name="bankAccount" placeholder="请输入银行账号" />
<input name="bankAccount" placeholder="请输入银行账号" maxlength="50" type="number" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">开户行:</view>
<view class="wx-form-value">
<input name="openingBank" placeholder="请输入开户行" />
<input name="openingBank" placeholder="请输入开户行" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">备注:</view>
<view class="wx-form-value">
<textarea name="remarks" placeholder="请输入备注" name="remark" />
<textarea name="remarks" placeholder="请输入备注" name="remark" maxlength="200" />
</view>
</view>
@@ -72,4 +72,4 @@
</view>
</form>
</view>
</view>
+186 -16
View File
@@ -1,6 +1,11 @@
// pages/addPerson/addPerson.js
import signUpApi from '../../assets/js/http/signUp'
import {
isEmail,
phoneReg,
postcode
} from '../../utils/validate'
Page({
/**
@@ -8,39 +13,204 @@ Page({
*/
data: {
// 上一个页面选中的企业
selectedCompany:{},
selectedCompany: {},
// 是否是国际研讨会的选择
prepage:""
prepage: "",
data: false
},
// 返回联系人列表
backPersonList(){
// 返回联系人列表
backPersonList() {
wx.navigateTo({
url: '../personList/personList',
})
},
// 邮编验证
validateEmail(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (isEmail(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 邮编验证
validatePostCode(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (postcode(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 手机号验证
validatePhone(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (phoneReg(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 添加参会人
addPerson(e){
addPerson(e) {
const that = this
console.log(that.data.prepage);
console.log(e);
const formData = e.detail.value
console.log(formData);
// 姓名
if (formData.companyName === '') {
wx.showToast({
title: '请输入企业名称',
icon: 'none',
duration: 800
})
return
}
// 邮政编码
if (formData.postalCode === '') {
wx.showToast({
title: '请输入邮编',
icon: 'none',
duration: 800
})
return
}
// 手机号
if (formData.phone === '') {
wx.showToast({
title: '请输入手机号',
icon: 'none',
duration: 800
})
return
}
// 性别
if (formData.gender === '') {
wx.showToast({
title: '请选择性别',
icon: 'none',
duration: 800
})
return
}
// 通讯地址
if (formData.contactAddress === '') {
wx.showToast({
title: '请输入通讯地址',
icon: 'none',
duration: 800
})
return
}
// 邮箱
if (formData.email === '') {
wx.showToast({
title: '请输入邮箱',
icon: 'none',
duration: 800
})
return
}
if (this.data.flag) {
wx.showToast({
title: '信息输入有误',
icon: 'none',
duration: 800
})
return
}
// 参数需要传入公司id
formData.companyId = this.data.selectedCompany.id
signUpApi.addPersonNoLimit(formData).then(res => {
if(res.success){
if (res.success) {
wx.showToast({
title: res.message,
icon: "none",
duration: 800,
});
if(that.data.prepage === 'guoji' ){
if (that.data.prepage === 'guoji') {
wx.navigateTo({
url: '../signUpPageGuoji/signUpPageGuoji',
})
}else{
} else {
wx.navigateTo({
url: '../signUpPage/signUpPage',
})
@@ -57,11 +227,11 @@ Page({
const that = this
// 从缓存中拿 上个页面选中的企业
wx.getStorage({
key:'selectedCompany',
key: 'selectedCompany',
success(res) {
that.setData({
selectedCompany:JSON.parse(res.data),
prepage:options.prepage
selectedCompany: JSON.parse(res.data),
prepage: options.prepage
})
}
})
@@ -115,4 +285,4 @@ Page({
onShareAppMessage: function () {
}
})
})
+9 -9
View File
@@ -6,39 +6,39 @@
<view class="wx-form-item">
<view class="wx-form-label">企业名称:</view>
<view class="wx-form-value">
<input disabled name="companyName" value="{{selectedCompany.companyName}}" placeholder="请输入企业名称" />
<input disabled name="companyName" maxlength="50" value="{{selectedCompany.companyName}}" placeholder="请输入企业名称" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">姓名:</view>
<view class="wx-form-value">
<input name="name" placeholder="请输入姓名" />
<input name="name" placeholder="请输入姓名" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">邮政编码:</view>
<view class="wx-form-value">
<input name="postalCode" placeholder="请输入邮政编码" />
<input name="postalCode" placeholder="请输入邮政编码" type="number" maxlength="6" bindblur="validatePostCode" data-message='请输入邮政编码' data-errmsg="请输入正确的邮政编码" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">手机号:</view>
<view class="wx-form-value">
<input name="phone" placeholder="请输入手机号" />
<input name="phone" placeholder="请输入手机号" type="number" bindblur="validatePhone" data-message='请输入手机号' data-errmsg="请输入正确的手机号" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label">职务:</view>
<view class="wx-form-value">
<input name="post" placeholder="请输入职务" />
<input name="post" placeholder="请输入职务" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">性别:</view>
<view class="wx-form-value">
@@ -54,14 +54,14 @@
<view class="wx-form-item">
<view class="wx-form-label validate">通讯地址:</view>
<view class="wx-form-value">
<input name="contactAddress" placeholder="请输入通讯地址" />
<input name="contactAddress" placeholder="请输入通讯地址" maxlength="50" />
</view>
</view>
<view class="wx-form-item">
<view class="wx-form-label validate">邮箱:</view>
<view class="wx-form-value">
<input name="email" placeholder="请输入邮箱" />
<input name="email" bindblur="validateEmail" data-message='请输入邮箱' data-errmsg="请输入正确的邮箱" placeholder="请输入邮箱" maxlength="50" />
</view>
</view>
@@ -69,7 +69,7 @@
<view class="wx-form-item">
<view class="wx-form-label">备注:</view>
<view class="wx-form-value">
<textarea name="remarks" placeholder="请输入备注" name="remark" />
<textarea name="remarks" placeholder="请输入备注" name="remark" maxlength="200" />
</view>
</view>
+1 -1
View File
@@ -85,4 +85,4 @@ Page({
onShareAppMessage: function () {
}
})
})
+1 -1
View File
@@ -1,4 +1,4 @@
{
"navigationBarTitleText": "会议详情",
"usingComponents": {}
}
}
@@ -1,151 +0,0 @@
page{
box-sizing: border-box;
background-color: #F5F5F5;
}
.basic-info .title{
height: 40px;
}
.basic-info .title text{
display: block;
border-left: 3px solid #069F99;
height: 14px;
padding-left: 10px;
border-radius: 2px;
display: flex;
justify-content: center;
align-items: center;
color: #333;
font-size: 15px;
font-weight: 500;
}
.basic-info view{
background-color: #FFF;
padding: 15px;
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
color: #333;
font-size: 14px;
border-bottom: 0.5px solid #f5f5f5;
position: relative;
}
.basic-info view:last-child{
border-bottom: 0;
}
.meeting-name{
margin-bottom: 10px;
}
.meeting-files{
margin-top: 10px;
flex-direction: column;
align-items: flex-start !important;
height: auto !important;
}
.basic-info .meeting-files .file-name{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
box-sizing: border-box;
padding: 0;
height: 40px;
margin-top: 10px;
}
.file-name view{
padding: 0;
height: 30px;
line-height: 30px;
border-bottom: 0;
}
.file-name view image{
width: 30px;
height: 30px;
margin-right: 10px;
}
.basic-info .meeting-files .file-name .look-file{
color: #069F99;
}
.warning-text{
position: absolute !important;
top: 5px;
left: 75px;
color: #FF5E60 !important;
font-size: 10px !important;
padding: 0 !important;
}
.warning-text image{
width: 10px;
height: 10px;
}
.pay-prove-box{
display: flex !important;
flex-direction: column !important;
justify-content: flex-start !important;
align-items: flex-start !important;
padding: 0;
height: 120px !important;
}
.pay-prove-box .pay-prove-content{
margin-top: 20px;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 0;
height: 80px;
}
.pay-prove-box .pay-prove-content .pay-prove{
width: 80px;
height: 80px;
margin-right: 10px;
position: relative !important;
background-color: #D1D1D1;
padding: 0;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
}
.pay-prove-box .pay-prove-content .pay-prove image{
width: 80px;
height: 80px;
}
.pay-prove-box .pay-prove-content .pay-prove .delete-image{
width: 12px;
height: 12px;
color: #fff;
background-color: #FF5E60;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 7px;
position: absolute;
top: -3px;
right: -3px;
}
.sign-up-empty{
height: 60px;
width: 100%;
display: block;
margin-top: 10px;
}
.sign-up{
width: 100%;
padding: 10px 15px;
box-sizing: border-box;
background-color: #fff;
position: fixed;
bottom: 0;
}
.sign-up text{
background-color: #069F99;
height: 40px;
border-radius: 10px;
color: #fff;
font-size: 16px;
font-weight: 600;
display: block;
text-align: center;
line-height: 40px;
}
+223 -46
View File
@@ -1,72 +1,180 @@
// pages/signUpPage/signUpPage.js
import signUpApi from '../../assets/js/http/signUp'
import {
phoneReg,
postcode
} from '../../utils/validate'
Page({
/**
* 页面的初始数据
*/
data: {
// 参会身份
identifyList:[
{value: '2', name: '参会人'},
{value: '1', name: '嘉宾'},
{value: '3', name: '内部企业'},
identifyList: [{
value: '2',
name: '参会人'
},
{
value: '1',
name: '嘉宾'
},
{
value: '3',
name: '内部企业'
},
],
// 缴费方式
paymentMethodList:[
{value: '1', name: '汇款'},
{value: '2', name: '线上缴费'},
{value: '3', name: '打包'},
paymentMethodList: [{
value: '1',
name: '汇款'
},
{
value: '2',
name: '线上缴费'
},
{
value: '3',
name: '打包'
},
],
// 是否需要发票
needInvoiceList:[
{value: '0', name: '不需要'},
{value: '1', name: '增值税普通发票'},
{value: '2', name: '增值税专用发票'},
needInvoiceList: [{
value: '0',
name: '不需要'
},
{
value: '1',
name: '增值税普通发票'
},
{
value: '2',
name: '增值税专用发票'
},
],
// 是否住酒店
needCheckInHotel:[
{value: '1', name: ''},
{value: '0', name: ''},
needCheckInHotel: [{
value: '1',
name: ''
},
{
value: '0',
name: '否'
},
],
// 是否选择发票的选中的索引
index:-1,
index: -1,
// 抵达时间
arrivalTime:'请选择抵达时间',
arrivalTime: '请选择抵达时间',
// 离开时间
departureTime:'请选择离开时间',
departureTime: '请选择离开时间',
// 选中的参会单位
selectedCompany:{},
selectedCompany: {},
// 选中的联系人
selectedPerson:{},
selectedPerson: {},
// 选中的邮寄联系人
selectedPostPerson:{},
selectedPostPerson: {},
// 选中的会议
selectedMeeting:{}
selectedMeeting: {},
// 是否正确填写信息
flag: false
},
// 是否需要发票的选择
needInvoiceChange(e){
needInvoiceChange(e) {
this.setData({
index:e.detail.value
index: e.detail.value
})
},
// 抵达时间选择
bindDateChangeArriveTime(e){
bindDateChangeArriveTime(e) {
this.setData({
arrivalTime:e.detail.value
arrivalTime: e.detail.value
})
},
// 离开时间选择
bindDateChangeLeaveTime(e){
bindDateChangeLeaveTime(e) {
this.setData({
departureTime:e.detail.value
departureTime: e.detail.value
})
},
// 确定
formSubmit(e){
formSubmit(e) {
console.log(e);
const formData = Object.assign({}, e.detail.value)
if (this.data.flag) {
wx.showToast({
title: '信息输入有误',
icon: 'error',
duration: 2000
})
return
}
// 参会身份验证
if (formData.identity === '') {
wx.showToast({
title: '请选择参会身份',
icon: 'none',
duration: 2000
})
return
}
// 缴费方式
if (formData.payMode === '') {
wx.showToast({
title: '请选择缴费方式',
icon: 'none',
duration: 2000
})
return
}
// 是否需要发票
if (formData.needInvoice === -1) {
wx.showToast({
title: '请选择发票',
icon: 'none',
duration: 2000
})
return
}
// 邮寄联系人
if (formData.postContactId === undefined) {
wx.showToast({
title: '请选择邮寄联系人',
icon: 'none',
duration: 2000
})
return
}
// 邮寄地址
if (formData.postContactAddress === '') {
wx.showToast({
title: '请输入邮寄地址',
icon: 'none',
duration: 2000
})
return
}
// 邮编
if (formData.postCode === '') {
wx.showToast({
title: '请输入邮编',
icon: 'none',
duration: 2000
})
return
}
// 是否住酒店
if (formData.checkInHotel === '') {
wx.showToast({
title: '请选择是否住酒店',
icon: 'none',
duration: 2000
})
return
}
const formData = Object.assign({},e.detail.value)
// 会议id
formData.meetingId = this.data.selectedMeeting.id
formData.meetingId = this.data.selectedMeeting.id
// 参会人id
formData.companyContactId = this.data.selectedPerson.id
// 邮寄联系人id
@@ -78,7 +186,7 @@ Page({
console.log(formData);
signUpApi.signUpMeeting(formData).then(res => {
if(res.success){
if (res.success) {
// 成功 清除缓存 跳转报名成功页面
wx.removeStorage({
key: 'selectedCompany',
@@ -91,7 +199,7 @@ Page({
})
wx.removeStorage({
key: 'currentMeetingInfo',
success(){
success() {
// 跳转报名成功页面
wx.navigateTo({
url: '../signUpSuccess/signUpSuccess',
@@ -102,19 +210,19 @@ Page({
})
},
// 选择参会单位
selectCompany(){
selectCompany() {
wx.navigateTo({
url: '../companyList/companyList',
})
},
// 选择参会人
selectPerson(e){
selectPerson(e) {
console.log(this.data.selectedCompany);
if(!!this.data.selectedCompany.id){
if (!!this.data.selectedCompany.id) {
wx.navigateTo({
url: `../personList/personList?companyId=${this.data.selectedCompany.id}&selectType=${e.currentTarget.dataset.selecttype}`,
})
}else{
} else {
wx.showToast({
title: '请先选择参会单位',
icon: "none",
@@ -134,44 +242,113 @@ Page({
// 从缓存中拿选中的企业
const that = this
wx.getStorage({
key:'selectedCompany',
key: 'selectedCompany',
success(res) {
that.setData({
selectedCompany:JSON.parse(res.data)
selectedCompany: JSON.parse(res.data)
})
}
})
// 从缓存中拿选中的联系人
wx.getStorage({
key:'selectedPerson',
key: 'selectedPerson',
success(res) {
that.setData({
selectedPerson:res.data
selectedPerson: res.data
})
}
})
// 从缓存中拿选中的邮寄联系人
wx.getStorage({
key:'selectedPostPerson',
key: 'selectedPostPerson',
success(res) {
that.setData({
selectedPostPerson:res.data
selectedPostPerson: res.data
})
}
})
// 从缓存中拿选中的会议的信息
wx.getStorage({
key:'currentMeetingInfo',
key: 'currentMeetingInfo',
success(res) {
console.log(res,'meetingInfo');
console.log(res, 'meetingInfo');
that.setData({
selectedMeeting:res.data
selectedMeeting: res.data
})
}
})
},
// 手机号验证
validatePhone(e) {
console.log(e);
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (phoneReg(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 邮编验证
validatePostCode(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (postcode(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
+7 -7
View File
@@ -5,17 +5,17 @@
<!-- 如果是小程序消息进入的报名页面 需要回显企业与参会人 参会企业不可更改 -->
<view class="form-item">
<text class="item-label flex-1">参会单位:</text>
<input placeholder-class="text-right" bindtap="selectCompany" name="selectedCompany.companyName" bindinput="bindInputPhone" value="{{selectedCompany.companyName}}" placeholder="请选择参会单位" />
<input placeholder-class="text-right" bindfocus="selectCompany" name="selectedCompany.companyName" bindinput="bindInputPhone" value="{{selectedCompany.companyName}}" placeholder="请选择参会单位" />
</view>
<view class="form-item">
<text class="item-label flex-1">参会人:</text>
<input placeholder-class="text-right" bindtap="selectPerson" data-selectType='1' bindinput="bindInputPhone" value="{{selectedPerson.name}}" placeholder="请选择参会人" />
<input placeholder-class="text-right" bindfocus="selectPerson" data-selectType='1' bindinput="bindInputPhone" value="{{selectedPerson.name}}" placeholder="请选择参会人" />
</view>
<view class="form-item">
<text class="item-label flex-1">手机号:</text>
<input placeholder-class="text-right" name="phone" bindinput="bindInputPhone" value="{{phone}}" placeholder="请输入手机号" />
<input placeholder-class="text-right" bindblur="validatePhone" data-type="phone" data-message='请输入手机号' data-errmsg='请输入正确的手机号' type="number" maxlength="11" name="phone" bindinput="bindInputPhone" value="{{phone}}" placeholder="请输入手机号" />
</view>
<view class="form-item-radio">
@@ -23,7 +23,7 @@
<text class="item-label flex-1 validate">参会身份:</text>
</view>
<view>
<radio-group name='identity' bindchange="identifyRadioChange">
<radio-group name='identity' bindchange="validateIdentity">
<label class="radio radio-item" wx:for="{{identifyList}}" wx:key="item">
<radio class="radio-scale" value="{{item.value}}"/>{{item.name}}
</label>
@@ -56,17 +56,17 @@
<view class="form-item">
<text class="item-label flex-1 validate">邮寄联系人:</text>
<input placeholder-class="text-right" data-selectType='2' name="phone" bindtap="selectPerson" value="{{selectedPostPerson.name}}" placeholder="请选择邮寄联系人" />
<input placeholder-class="text-right" data-selectType='2' name="phone" bindfocus="selectPerson" value="{{selectedPostPerson.name}}" placeholder="请选择邮寄联系人" />
</view>
<view class="form-item">
<text class="item-label flex-1 validate">邮寄地址:</text>
<input placeholder-class="text-right" name="postContactAddress" bindinput="bindInputPhone" placeholder="请输入邮寄地址" />
<input placeholder-class="text-right" name="postContactAddress" maxlength="50" bindinput="bindInputPhone" placeholder="请输入邮寄地址" />
</view>
<view class="form-item">
<text class="item-label flex-1 validate">邮编:</text>
<input placeholder-class="text-right" name="postCode" bindinput="bindInputPhone" placeholder="请输入邮编" />
<input placeholder-class="text-right" name="postCode" bindblur="validatePostCode" data-message='请输入邮编' data-errmsg='请输入正确的邮编' type="number" maxlength="6" placeholder="请输入邮编" />
</view>
<view class="form-item-radio">
+165 -16
View File
@@ -1,7 +1,14 @@
// pages/signUpPageGuoji/signUpPageGuoji.js
import MeetingApi from "../../assets/js/http/meetingApi"
import signUpApi from "../../assets/js/http/signUp"
import {baseUrl,URL_CONFIG} from '../../assets/js/http/api'
import {
phoneReg,
postcode
} from '../../utils/validate'
import {
baseUrl,
URL_CONFIG
} from '../../assets/js/http/api'
Page({
/**
@@ -57,11 +64,11 @@ Page({
// 是否选择发票的选中的索引
index: -1,
// 上传图片的id
imageIds:'',
imageIds: '',
// 记录临时的文件名 用于回显 小程序上传后后端的名会乱码
tempFiles:'点击上传',
tempFiles: '点击上传',
// ppt Id
speechPpt:'',
speechPpt: '',
// 嘉宾身份
guestType: -1,
// 缴费方式
@@ -101,6 +108,7 @@ Page({
name: '否'
},
],
flag:false
},
// 抵达时间选择
bindDateChangeArriveTime(e) {
@@ -251,15 +259,15 @@ Page({
// 获取图片的id
getImagesId(e) {
this.setData({
imageIds:e.detail.join(',')
imageIds: e.detail.join(',')
})
},
// ppt的上传
uploadPPT(){
uploadPPT() {
const that = this
wx.chooseMessageFile({
count: 1, //能选择文件的数量
type: 'file', //能选择文件的类型,我这里只允许上传文件.还有视频,图片,或者都可以
count: 1, //能选择文件的数量
type: 'file', //能选择文件的类型,我这里只允许上传文件.还有视频,图片,或者都可以
success(res) {
console.log(res);
var size = res.tempFiles[0].size;
@@ -267,7 +275,7 @@ Page({
var temporaryPdfArr = [];
temporaryPdfArr.push(res.tempFiles[0]);
var filePath = res.tempFiles[0].path;
if (size > 10485760 ) { //限制了文件的大小和具体文件类型
if (size > 10485760) { //限制了文件的大小和具体文件类型
wx.showToast({
title: '文件大小不能超过10MB',
icon: "none",
@@ -281,9 +289,9 @@ Page({
});
// 如果多个文件 要循环上传
wx.uploadFile({
url: baseUrl + URL_CONFIG + 'sys/common/upload', //上传的路径
filePath: filePath, //刚刚在data保存的文件路径
name: 'file', //后台获取的凭据
url: baseUrl + URL_CONFIG + 'sys/common/upload', //上传的路径
filePath: filePath, //刚刚在data保存的文件路径
name: 'file', //后台获取的凭据
success(res) {
var fileBackDa = JSON.parse(res.data);
console.log(fileBackDa);
@@ -292,8 +300,8 @@ Page({
wx.hideLoading(); //隐藏提示框
//上传成功,
that.setData({
tempFiles:name,
speechPpt:fileBackDa.result.id
tempFiles: name,
speechPpt: fileBackDa.result.id
});
}
})
@@ -301,6 +309,75 @@ Page({
}
})
},
// 手机号验证
validatePhone(e) {
console.log(e);
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (phoneReg(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 邮编验证
validatePostCode(e) {
let value = e.detail.value
let {
message,
errmsg
} = e.currentTarget.dataset
if (value === '' || value === undefined) {
wx.showToast({
title: message,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
return
} else if (postcode(value)) {
this.setData({
flag: false
})
} else {
wx.showToast({
title: errmsg,
icon: 'none',
duration: 800
})
this.setData({
flag: true
})
}
},
// 返回一一个邀请码的数组用于校验输入的邀请码显示不同的字段 1VIP 2演讲嘉宾 3特邀嘉宾 4 合作伙伴
validateCodeArr(obj) {
let {
@@ -343,8 +420,80 @@ Page({
},
// 确定
formSubmit(e) {
console.log(e);
const formData = Object.assign({}, e.detail.value)
console.log(e);
if (this.data.flag) {
wx.showToast({
title: '信息输入有误',
icon: 'error',
duration: 2000
})
return
}
// 参会身份验证
if (formData.identity === '') {
wx.showToast({
title: '请选择参会身份',
icon: 'none',
duration: 2000
})
return
}
// 缴费方式
if (formData.payMode === '') {
wx.showToast({
title: '请选择缴费方式',
icon: 'none',
duration: 2000
})
return
}
// 是否需要发票
if (formData.needInvoice === -1) {
wx.showToast({
title: '请选择发票',
icon: 'none',
duration: 2000
})
return
}
// 邮寄联系人
if (formData.postContactId === undefined) {
wx.showToast({
title: '请选择邮寄联系人',
icon: 'none',
duration: 2000
})
return
}
// 邮寄地址
if (formData.postContactAddress === '') {
wx.showToast({
title: '请输入邮寄地址',
icon: 'none',
duration: 2000
})
return
}
// 邮编
if (formData.postCode === '') {
wx.showToast({
title: '请输入邮编',
icon: 'none',
duration: 2000
})
return
}
// 是否住酒店
if (formData.checkInHotel === '') {
wx.showToast({
title: '请选择是否住酒店',
icon: 'none',
duration: 2000
})
return
}
// 会议id
formData.meetingId = '1449638073563172866'
// 参会人id
@@ -485,4 +634,4 @@ Page({
onShareAppMessage: function () {
}
})
})
+14 -14
View File
@@ -5,20 +5,20 @@
<!-- 如果是小程序消息进入的报名页面 需要回显企业与参会人 参会企业不可更改 -->
<view class="form-item">
<text class="item-label flex-1">参会单位:</text>
<input placeholder-class="text-right" data-page='guoji' bindtap="selectCompany"
<input placeholder-class="text-right" data-page='guoji' bindfocus="selectCompany"
name="selectedCompany.companyName" bindinput="bindInputPhone" value="{{selectedCompany.companyName}}"
placeholder="请选择参会单位" />
</view>
<view class="form-item">
<text class="item-label flex-1">参会人:</text>
<input placeholder-class="text-right" data-page='guoji' bindtap="selectPerson" data-selectType='1'
<input placeholder-class="text-right" data-page='guoji' bindfocus="selectPerson" data-selectType='1'
bindinput="bindInputPhone" value="{{selectedPerson.name}}" placeholder="请选择参会人" />
</view>
<view class="form-item">
<text class="item-label flex-1">手机号:</text>
<input placeholder-class="text-right" name="phone" bindinput="bindInputPhone" value="{{phone}}"
<input placeholder-class="text-right" bindblur="validatePhone" data-type="phone" data-message='请输入手机号' data-errmsg='请输入正确的手机号' type="number" maxlength="11" name="phone" bindinput="bindInputPhone" value="{{phone}}"
placeholder="请输入手机号" />
</view>
@@ -75,7 +75,7 @@
<view class="form-item">
<text class="item-label flex-1 validate">邮寄联系人:</text>
<input placeholder-class="text-right" data-page='guoji' data-selectType='2' name="phone"
bindtap="selectPerson" value="{{selectedPostPerson.name}}" placeholder="请选择邮寄联系人" />
bindfocus="selectPerson" value="{{selectedPostPerson.name}}" placeholder="请选择邮寄联系人" />
</view>
<view class="form-item">
@@ -86,7 +86,7 @@
<view class="form-item">
<text class="item-label flex-1 validate">邮编:</text>
<input placeholder-class="text-right" name="postCode" bindinput="bindInputPhone" placeholder="请输入邮编" />
<input placeholder-class="text-right" name="postCode" bindblur="validatePostCode" data-message='请输入邮编' data-errmsg='请输入正确的邮编' type="number" maxlength="6" name="postCode" bindinput="bindInputPhone" placeholder="请输入邮编" />
</view>
<view class="form-item-radio">
@@ -136,24 +136,24 @@
<view class="form-item">
<text class="item-label flex-1 validate">演讲题目:</text>
<text class="item-label flex-1">演讲题目:</text>
<input placeholder-class="text-right" name="speechTopic" placeholder="请输入演讲题目" />
</view>
<view class="form-item-radio">
<text class="item-label flex-1 validate">演讲PPT</text>
<text class="item-label flex-1">演讲PPT</text>
<view style="margin-top:20rpx" bindtap="uploadPPT">{{tempFiles}} </view>
</view>
<view class="form-item-radio">
<text class="item-label flex-1 validate">照片:</text>
<text class="item-label flex-1">照片:</text>
<image-upload style="margin-top:20rpx" bindgetIds='getImagesId' maxLength='1'></image-upload>
</view>
<view class="form-item-radio">
<text class="item-label flex-1 validate">个人简介:</text>
<text class="item-label flex-1">个人简介:</text>
<textarea name="profile" placeholder="请输入个人简介" name="remark" />
</view>
@@ -307,18 +307,18 @@
<view class="form-item">
<text class="item-label flex-1 validate">演讲题目:</text>
<text class="item-label flex-1">演讲题目:</text>
<input placeholder-class="text-right" name="speechTopic" placeholder="请输入演讲题目" />
</view>
<view class="form-item-radio">
<text class="item-label flex-1 validate">演讲PPT</text>
<text class="item-label flex-1">演讲PPT</text>
<view style="margin-top:20rpx" bindtap="uploadPPT">{{tempFiles}} </view>
</view>
<view class="form-item-radio">
<text class="item-label flex-1 validate">照片:</text>
<text class="item-label flex-1">照片:</text>
<!-- <input placeholder-class="text-right" name="postContactAddress" bindinput="bindInputPhone"
placeholder="请上传" /> -->
<image-upload style="margin-top:20rpx" bindgetIds='getImagesId' maxLength='1'></image-upload>
@@ -326,7 +326,7 @@
<view class="form-item-radio">
<text class="item-label flex-1 validate">个人简介:</text>
<text class="item-label flex-1">个人简介:</text>
<textarea name="profile" placeholder="请输入个人简介" name="remark" />
</view>
@@ -572,4 +572,4 @@
</view>
</form>
</view>
</view>