Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1
This commit is contained in:
commit
3fd4aa63f4
@ -295,3 +295,12 @@ export function sendEmailVfcode(params) {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** 新注册接口 */
|
||||
export function registerUserNew(data) {
|
||||
return request({
|
||||
url: `/api/userinfo/register2`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import MenuBar from './dispatchWorkMenuBar';
|
||||
import MenuStationStand from './menuStationStand';
|
||||
import MenuSwitch from './menuSwitch';
|
||||
// import MenuSwitch from './menuSwitch';
|
||||
import MenuSignal from './menuSignal';
|
||||
import MenuSection from './menuSection';
|
||||
import MenuTrain from './menuTrain';
|
||||
@ -32,7 +32,7 @@ export default {
|
||||
components: {
|
||||
MenuBar,
|
||||
MenuStationStand,
|
||||
MenuSwitch,
|
||||
// MenuSwitch,
|
||||
MenuSignal,
|
||||
MenuSection,
|
||||
MenuTrain,
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="menuBarFoShan">
|
||||
<menu-bar ref="menuBar" :menu-normal="menuNormal" style="width:100%" />
|
||||
<station-control ref="stationControl" :work="'dispatchWork'" />
|
||||
<station-control ref="stationControl" :work="'localWork'" />
|
||||
<view-train-id ref="viewTrainId" />
|
||||
<help-about ref="helpAbout" />
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<!-- 忘记密码 -->
|
||||
<forget-password ref="forgetPassword" />
|
||||
<!-- 注册用户 -->
|
||||
<register-user ref="registerUser" />
|
||||
<register-user ref="registerUser" :project="backProject" />
|
||||
<!-- 选择组织 -->
|
||||
<OrgSelect ref="orgSelect" @select="selectOrgnization" />
|
||||
</div>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<span>注册途径:</span>
|
||||
</template>
|
||||
<el-radio-group v-model="form.type" size="small" @change="changeType">
|
||||
<el-radio label="phone" border>手机号注册</el-radio>
|
||||
<el-radio label="mobile" border>手机号注册</el-radio>
|
||||
<el-radio label="email" border>邮箱注册</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
@ -26,11 +26,11 @@
|
||||
</template>
|
||||
<el-input v-model="form.email" size="small" style="width:260px" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'phone'" prop="phone">
|
||||
<el-form-item v-if="form.type === 'mobile'" prop="mobile">
|
||||
<template slot="label">
|
||||
<span>手机号:</span>
|
||||
</template>
|
||||
<el-input v-model="form.phone" size="small" style="width: 260px;" />
|
||||
<el-input v-model="form.mobile" size="small" style="width: 260px;" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="nickname">
|
||||
<template slot="label">
|
||||
@ -47,11 +47,11 @@
|
||||
<el-form-item label="密码确认:" prop="repeatPassword">
|
||||
<el-input v-model="form.repeatPassword" autocomplete="new-password" show-password size="small" style="width:260px" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="vfCode">
|
||||
<el-form-item prop="verificationCode">
|
||||
<template slot="label">
|
||||
<span>验证码:</span>
|
||||
</template>
|
||||
<el-input v-model="form.vfCode" size="small" style="display: inline-block;width:140px" />
|
||||
<el-input v-model="form.verificationCode" size="small" style="display: inline-block;width:140px" />
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@ -66,7 +66,7 @@
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<div style="display: flex;justify-content: space-around;margin-top:40px;">
|
||||
<el-button type="primary" size="small" @click="submitForm()">立即创建</el-button>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="submitForm()">立即创建</el-button>
|
||||
<el-button size="small" @click="doClose()">返回登录</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
@ -74,10 +74,17 @@
|
||||
</template>
|
||||
<script>
|
||||
import md5 from 'js-md5';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { registerUser } from '@/api/management/user';
|
||||
import { registerUserNew, sendPhoneVfcode, sendEmailVfcode } from '@/api/management/user';
|
||||
export default {
|
||||
name: 'RegisterUser',
|
||||
props: {
|
||||
project: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var validateEmail = (rule, value, callback) => {
|
||||
const regu = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||
@ -88,7 +95,7 @@ export default {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
var validatePhone = (rule, value, callback) => {
|
||||
var validateMobile = (rule, value, callback) => {
|
||||
const regu = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
|
||||
const re = new RegExp(regu);
|
||||
if (!re.test(value)) {
|
||||
@ -111,7 +118,7 @@ export default {
|
||||
}
|
||||
};
|
||||
var validateVfCode = (rule, value, callback) => {
|
||||
if (this.form.vfCode.length !== 4) {
|
||||
if (this.form.verificationCode.length !== 4) {
|
||||
callback(new Error('验证码长度错误'));
|
||||
} else {
|
||||
callback();
|
||||
@ -122,21 +129,22 @@ export default {
|
||||
passWordCodeTime: 0,
|
||||
passWordTime: null,
|
||||
message: '',
|
||||
loading:false,
|
||||
operation: '',
|
||||
title: '账号注册',
|
||||
form: {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
type: 'mobile',
|
||||
mobile: '',
|
||||
email: '',
|
||||
nickname: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode:''
|
||||
verificationCode:''
|
||||
},
|
||||
rules: {
|
||||
phone: [
|
||||
mobile: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{ validator: validatePhone, trigger: 'blur' }
|
||||
{ validator: validateMobile, trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
||||
@ -156,7 +164,7 @@ export default {
|
||||
{ validator: validateRepeatPassword, trigger: 'blur' },
|
||||
{ min: 5, max: 20, message: '长度在 5 到 20 个字符', trigger: 'blur' }
|
||||
],
|
||||
vfCode: [
|
||||
verificationCode: [
|
||||
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
||||
{ validator: validateVfCode, trigger: 'blur' }
|
||||
]
|
||||
@ -171,26 +179,26 @@ export default {
|
||||
methods: {
|
||||
doShow() {
|
||||
this.form = {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
type: 'mobile',
|
||||
mobile: '',
|
||||
email: '',
|
||||
nickname: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode: ''
|
||||
verificationCode: ''
|
||||
};
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
this.form = {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
type: 'mobile',
|
||||
mobile: '',
|
||||
email: '',
|
||||
nickname: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode: ''
|
||||
verificationCode: ''
|
||||
};
|
||||
this.$refs.ruleForm.clearValidate();
|
||||
},
|
||||
@ -199,15 +207,15 @@ export default {
|
||||
},
|
||||
async sendVfcode() {
|
||||
const reguEmail = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||
const reguPhone = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
|
||||
const rePhone = new RegExp(reguPhone);
|
||||
const reguMobile = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
|
||||
const reMobile = new RegExp(reguMobile);
|
||||
const reEmail = new RegExp(reguEmail);
|
||||
if (this.form.type === 'phone' && this.form.phone && rePhone.test(this.form.phone)) {
|
||||
if (this.form.type === 'mobile' && this.form.mobile && reMobile.test(this.form.mobile)) {
|
||||
const random = Math.floor(Math.random() * 10000 + 1);
|
||||
const timeCount = Date.parse(new Date()) / 1000;
|
||||
const pass = `${timeCount}86${this.form.phone}${random}`;
|
||||
const pass = `${timeCount}86${this.form.mobile}${random}`;
|
||||
const param = {
|
||||
mobile: this.form.phone,
|
||||
mobile: this.form.mobile,
|
||||
nationCode: '86',
|
||||
rd: random + '',
|
||||
time: timeCount + '',
|
||||
@ -223,7 +231,7 @@ export default {
|
||||
this.passWordTime = null;
|
||||
}
|
||||
}, 1000);
|
||||
// await sendPhoneVfcode(param);
|
||||
await sendPhoneVfcode(param);
|
||||
} catch (error) {
|
||||
this.$message.info(this.$t('global.codeFaile'));
|
||||
}
|
||||
@ -239,26 +247,43 @@ export default {
|
||||
this.passWordTime = null;
|
||||
}
|
||||
}, 1000);
|
||||
// await sendEmailVfcode(param);
|
||||
await sendEmailVfcode(param);
|
||||
} catch (error) {
|
||||
this.$message.info(this.$t('global.codeFaile'));
|
||||
}
|
||||
} else {
|
||||
this.$refs.ruleForm.validateField('email');
|
||||
this.$refs.ruleForm.validateField('phone');
|
||||
this.$refs.ruleForm.validateField('mobile');
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
if (valid) {
|
||||
const project = getSessionStorage('project');
|
||||
// ProjectCode[project] || ''
|
||||
const data = { email: this.form.email, nickname: this.form.nickname, password: md5(this.form.password), source:project };
|
||||
registerUser(data).then(resp => {
|
||||
const data = {
|
||||
nickname: this.form.nickname,
|
||||
verificationCode:this.form.verificationCode,
|
||||
password: md5(this.form.password),
|
||||
source:this.project
|
||||
};
|
||||
if (this.form.type == 'mobile') {
|
||||
data.mobile = this.form.mobile;
|
||||
data.nationCode = '86';
|
||||
} else {
|
||||
data.email = this.form.email;
|
||||
}
|
||||
this.loading = true;
|
||||
registerUserNew(data).then(resp => {
|
||||
this.loading = false;
|
||||
this.$message.success('账号注册成功!' );
|
||||
this.doClose();
|
||||
}).catch(error => {
|
||||
this.$message.error('账号注册失败:' + error.message);
|
||||
this.loading = false;
|
||||
if (error.code == '10012') {
|
||||
this.$message.error('账号注册失败:账号已存在');
|
||||
} else {
|
||||
this.$message.error('账号注册失败:' + error.message);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user