feat: 注册
This commit is contained in:
parent
dff16ba630
commit
109f121f05
|
@ -20,7 +20,7 @@ export function getUnitNameByInvitationCode (parameter) {
|
|||
return request({
|
||||
url: userApi.getUnitNameByInvitationCode,
|
||||
method: 'post',
|
||||
data: parameter
|
||||
params: parameter
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ export function logout () {
|
|||
})
|
||||
}
|
||||
export function getSmsCaptcha (parameter) {
|
||||
return axios({
|
||||
return request({
|
||||
url: '/getSmsCaptcha',
|
||||
method: 'get',
|
||||
params: parameter
|
||||
|
|
|
@ -310,7 +310,7 @@
|
|||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
// 默认选中的多选框
|
||||
const type = data.type.split(',')
|
||||
const type = data.type && data.type.split(',') || []
|
||||
const typeIntArr = []// 保存转换后的整型字符串
|
||||
type.forEach(item => {
|
||||
typeIntArr.push(+item)
|
||||
|
|
|
@ -84,7 +84,10 @@
|
|||
'password2',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '至少6位密码,区分大小写' },
|
||||
{
|
||||
required: true,
|
||||
message: '请输入至少包括大写、小写、数字、特殊符号中的三种,密码长度至少为8位。',
|
||||
},
|
||||
{ validator: this.handlePasswordCheck },
|
||||
],
|
||||
validateTrigger: ['change', 'blur'],
|
||||
|
@ -153,7 +156,13 @@
|
|||
size="large"
|
||||
disabled
|
||||
placeholder="输入邀请码以后自动绑定"
|
||||
:value="unitInfo.name"
|
||||
v-decorator="[
|
||||
'orgName',
|
||||
{
|
||||
rules: [{ required: true, message: '输入邀请码以后自动绑定' }],
|
||||
validateTrigger: ['blur'],
|
||||
},
|
||||
]"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
|
@ -175,7 +184,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import storage from 'store'
|
||||
import { getSmsCaptcha, getUnitNameByInvitationCode, reqRegister } from '@/api/login'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
|
||||
const levelNames = {
|
||||
0: '低',
|
||||
|
@ -275,14 +286,11 @@ export default {
|
|||
},
|
||||
|
||||
handlePasswordInputClick () {
|
||||
if (!this.isMobile()) {
|
||||
this.state.passwordLevelChecked = true
|
||||
return
|
||||
}
|
||||
this.state.passwordLevelChecked = false
|
||||
},
|
||||
|
||||
handleSubmit () {
|
||||
const _this = this
|
||||
const {
|
||||
form: { validateFields },
|
||||
state
|
||||
|
@ -290,16 +298,12 @@ export default {
|
|||
validateFields({ force: true }, (err, values) => {
|
||||
if (!err) {
|
||||
state.passwordLevelChecked = false
|
||||
this.setRegister(values)
|
||||
_this.setRegister(values)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 注册
|
||||
setRegister (data) {
|
||||
if (!this.uniInfo.id) {
|
||||
this.$message.warning('请输入正确的邀请码~')
|
||||
return
|
||||
}
|
||||
const params = {
|
||||
name: data.name,
|
||||
userName: data.username,
|
||||
|
@ -309,7 +313,12 @@ export default {
|
|||
}
|
||||
reqRegister(params).then(res => {
|
||||
this.$message.success('注册成功!')
|
||||
this.$router.push({ name: 'registerResult', query: data })
|
||||
storage.set(ACCESS_TOKEN, res.token, 24 * 60 * 60 * 1000)
|
||||
this.$store.state.token = res.token
|
||||
this.$router.push({
|
||||
name: 'registerResult',
|
||||
query: { username: data.username, personId: res.personId }
|
||||
})
|
||||
})
|
||||
},
|
||||
getCaptcha (e) {
|
||||
|
@ -359,10 +368,19 @@ export default {
|
|||
const { value } = e.target
|
||||
if (value && value.length === 6) {
|
||||
getUnitNameByInvitationCode({ invitationCode: value }).then(res => {
|
||||
this.unitInfo = res.data
|
||||
this.unitInfo = {
|
||||
name: res.orgName,
|
||||
id: res.orgId
|
||||
}
|
||||
this.form.setFieldsValue({
|
||||
orgName: res.orgName
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.unitInfo = {}
|
||||
this.form.setFieldsValue({
|
||||
orgName: ''
|
||||
})
|
||||
}
|
||||
},
|
||||
requestFailed (err) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import PersonForm from '@/views/person/PersonOrgForm.vue'
|
||||
import PersonForm from '@/views/person/PersonForm.vue'
|
||||
|
||||
export default {
|
||||
name: 'RegisterResult',
|
||||
|
@ -26,12 +26,12 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
email () {
|
||||
const v = (this.form && this.form.email) || 'xxx'
|
||||
const v = (this.form && this.form.username) || 'xxx'
|
||||
return `你的账户:${v} 注册成功`
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.form = this.$route.params
|
||||
this.form = this.$route.query
|
||||
},
|
||||
methods: {
|
||||
goHomeHandle () {
|
||||
|
@ -39,7 +39,7 @@ export default {
|
|||
},
|
||||
goUserInfo () {
|
||||
// 打开编辑弹出框
|
||||
this.$refs.personForm.registerEdit({})
|
||||
this.$refs.personForm.edit({id: this.form.personId})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ const vueConfig = {
|
|||
// 如果需要开启代理,请移除mockjs /src/main.jsL11
|
||||
proxy: {
|
||||
'/dawa': { // 捕获API的标志,如果API中有这个字符串,那么就开始匹配代理
|
||||
target: 'http://a.3a6.cn/dawa', // 地址可以是域名,也可以是IP地址。比如API请求/api/getList, 会被代理到请求http://www.baidu.com/api/getList 。
|
||||
// target: 'http://localhost:8000/dawa', // 地址可以是域名,也可以是IP地址。比如API请求/api/getList, 会被代理到请求http://www.baidu.com/api/getList 。
|
||||
// target: 'http://a.3a6.cn/dawa', // 地址可以是域名,也可以是IP地址。比如API请求/api/getList, 会被代理到请求http://www.baidu.com/api/getList 。
|
||||
target: 'http://192.168.2.140:8080', // 地址可以是域名,也可以是IP地址。比如API请求/api/getList, 会被代理到请求http://www.baidu.com/api/getList 。
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
|
|
Loading…
Reference in New Issue