【add】 国际研讨会 报名的时候增加 邀请码的校验规则
This commit is contained in:
@@ -49,6 +49,9 @@ const vipMemberCost = '10000'
|
|||||||
// 判断当前企业是否是内部企业
|
// 判断当前企业是否是内部企业
|
||||||
const judgeInternalEnterprise = (param) => getAction('/company/payCompanyManagement/getInternalEnterprise', param)
|
const judgeInternalEnterprise = (param) => getAction('/company/payCompanyManagement/getInternalEnterprise', param)
|
||||||
|
|
||||||
|
// 国际研讨会-判断当前的邀请码是否可用
|
||||||
|
const judgeMeetingCode = (param) => getAction('/meeting/payMeetingSituation/validInvitationCode', param)
|
||||||
|
|
||||||
export {
|
export {
|
||||||
queryCommonProjectById,
|
queryCommonProjectById,
|
||||||
getMeetInfoById,
|
getMeetInfoById,
|
||||||
@@ -72,5 +75,6 @@ export {
|
|||||||
queryContactByName,
|
queryContactByName,
|
||||||
commonMemberCost,
|
commonMemberCost,
|
||||||
vipMemberCost,
|
vipMemberCost,
|
||||||
judgeInternalEnterprise
|
judgeInternalEnterprise,
|
||||||
|
judgeMeetingCode
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<!--邀请码的组件,将两个输入框 合并成一个-->
|
||||||
|
<template>
|
||||||
|
<div class="invite-code-item">
|
||||||
|
<a-input
|
||||||
|
placeholder="请输入上半部分"
|
||||||
|
:maxLength="50"
|
||||||
|
@change="inputChange"
|
||||||
|
@blur="inputBlurFunc"
|
||||||
|
v-model="code"
|
||||||
|
></a-input>
|
||||||
|
<span class="split-span"> - </span>
|
||||||
|
<a-input
|
||||||
|
placeholder="请输入下半部分"
|
||||||
|
:maxLength="50"
|
||||||
|
@change="inputChange"
|
||||||
|
@blur="inputBlurFunc"
|
||||||
|
v-model="randomCode"
|
||||||
|
></a-input>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'InviteCode',
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: [String, Object],
|
||||||
|
required: false,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
code: '',
|
||||||
|
randomCode: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: 'change'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
inputChange(event) {
|
||||||
|
event.target.value = event.target.value.trim()
|
||||||
|
},
|
||||||
|
inputBlurFunc() {
|
||||||
|
if(this.code && this.randomCode) {
|
||||||
|
this.$emit('change', `${this.code}-${this.randomCode}`)
|
||||||
|
this.$emit('change-value', `${this.code}-${this.randomCode}`)
|
||||||
|
} else {
|
||||||
|
this.$emit('change', undefined)
|
||||||
|
this.$emit('change-value', undefined)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.invite-code-item{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.ant-input{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.split-span{
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -163,12 +163,16 @@
|
|||||||
|
|
||||||
<a-col :xxl="8" :xl="12" :sm="24" v-if="inviteCodeBool">
|
<a-col :xxl="8" :xl="12" :sm="24" v-if="inviteCodeBool">
|
||||||
<a-form-item label="邀请码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-form-item label="邀请码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
<a-input placeholder="请输入邀请码"
|
<!-- <div class="code-form-item">-->
|
||||||
:maxLength='50'
|
<!-- <a-input-->
|
||||||
@change="event => event.target.value = event.target.value.trim()"
|
<!-- placeholder="请输入邀请码"-->
|
||||||
@blur="validateCode"
|
<!-- :maxLength="50"-->
|
||||||
v-decorator="[ 'code',
|
<!-- @change="event => event.target.value = event.target.value.trim()"-->
|
||||||
validatorRules.code]"></a-input>
|
<!-- @blur="validateCode"-->
|
||||||
|
<!-- v-decorator="[ 'code',validatorRules.code]"-->
|
||||||
|
<!-- ></a-input>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<invite-code v-decorator="[ 'code', validatorRules.code]" @change-value="validateCode"></invite-code>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -227,7 +231,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getMeetInfoById,validateStandard, judgeInternalEnterprise} from '@api/incomePaymentsApi'
|
import {getMeetInfoById,validateStandard, judgeInternalEnterprise, judgeMeetingCode} from '@api/incomePaymentsApi'
|
||||||
import SelectContacts from '@comp/company/SelectContacts'
|
import SelectContacts from '@comp/company/SelectContacts'
|
||||||
import CompanySelect from '@comp/company/CompanySelect'
|
import CompanySelect from '@comp/company/CompanySelect'
|
||||||
import {httpAction} from '@api/manage'
|
import {httpAction} from '@api/manage'
|
||||||
@@ -238,6 +242,7 @@ import {getContactsById} from '@api/incomePaymentsApi'
|
|||||||
import OtherMeetingForm from '@comp/signUpForm/OtherMeetingForm'
|
import OtherMeetingForm from '@comp/signUpForm/OtherMeetingForm'
|
||||||
import SeminarVipForm from '@comp/signUpForm/SeminarVipForm'
|
import SeminarVipForm from '@comp/signUpForm/SeminarVipForm'
|
||||||
import SeminarPartnerForm from '@comp/signUpForm/SeminarPartnerForm'
|
import SeminarPartnerForm from '@comp/signUpForm/SeminarPartnerForm'
|
||||||
|
import InviteCode from './InviteCode'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -250,7 +255,8 @@ export default {
|
|||||||
SeminarVipForm,
|
SeminarVipForm,
|
||||||
PreviewFile,
|
PreviewFile,
|
||||||
JImageUpload,
|
JImageUpload,
|
||||||
CompanySelect
|
CompanySelect,
|
||||||
|
InviteCode
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -295,8 +301,8 @@ export default {
|
|||||||
validateTrigger: 'change'
|
validateTrigger: 'change'
|
||||||
},
|
},
|
||||||
code: {
|
code: {
|
||||||
rules: [{required: true, message: '请输入邀请码'}],
|
rules: [{required: true, validator: this.checkCode}],
|
||||||
validateTrigger: 'blur'
|
validateTrigger: 'change'
|
||||||
},
|
},
|
||||||
companyContactId: {
|
companyContactId: {
|
||||||
rules: [{required: true, message: '请选择参会人'}],
|
rules: [{required: true, message: '请选择参会人'}],
|
||||||
@@ -670,7 +676,8 @@ export default {
|
|||||||
this.form.validateFields(['code'],(err) => {
|
this.form.validateFields(['code'],(err) => {
|
||||||
if(!err){
|
if(!err){
|
||||||
// 获取邀请码
|
// 获取邀请码
|
||||||
let code = this.form.getFieldValue('code')
|
let currentCode = this.form.getFieldValue('code')
|
||||||
|
let code = currentCode.substring(0, currentCode.indexOf('-'))
|
||||||
switch (code) {
|
switch (code) {
|
||||||
// 合作伙伴
|
// 合作伙伴
|
||||||
case this.currentMeetingInfo.cooperativeInvitationCode:
|
case this.currentMeetingInfo.cooperativeInvitationCode:
|
||||||
@@ -705,10 +712,11 @@ export default {
|
|||||||
* 校验邀请码是否正确 给出提示
|
* 校验邀请码是否正确 给出提示
|
||||||
* */
|
* */
|
||||||
validateCode() {
|
validateCode() {
|
||||||
let code = this.form.getFieldValue('code')
|
let currentCode = this.form.getFieldValue('code')
|
||||||
if(code === undefined || code === ''){
|
if(currentCode === undefined || currentCode === ''){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let code = currentCode.substring(0, currentCode.indexOf('-'))
|
||||||
let flag = false
|
let flag = false
|
||||||
switch (code) {
|
switch (code) {
|
||||||
// 合作伙伴
|
// 合作伙伴
|
||||||
@@ -745,6 +753,22 @@ export default {
|
|||||||
},
|
},
|
||||||
addContactsOk() {
|
addContactsOk() {
|
||||||
this.$refs.selectContacts.getContactsList()
|
this.$refs.selectContacts.getContactsList()
|
||||||
|
},
|
||||||
|
// 验证邀请码输入是否正确的方法
|
||||||
|
checkCode(rules, value, callback) {
|
||||||
|
if (value) {
|
||||||
|
let params = {
|
||||||
|
meetingId: this.currentMeetingInfo.id,
|
||||||
|
randomCode: value
|
||||||
|
}
|
||||||
|
judgeMeetingCode(params).then(res => {
|
||||||
|
res['success'] ? callback() : callback(res['message'])
|
||||||
|
}).catch(err => {
|
||||||
|
callback(err.message || err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
callback('请输入邀请码')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -885,4 +909,18 @@ export default {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 邀请码内部的样式问题
|
||||||
|
.code-form-item{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.ant-input{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.split-span{
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user