123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <template>
- <div class="login">
- <div class="login-par">
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" label-width="0px" class="demo-ruleForm login-container">
- <!-- <div class="login-logo">
- <img src="../assets/image/login_logo.png" style="width:80px;height:80px;"/>
- </div> -->
- <h3 class="title">注册</h3>
- <el-form-item class="login-input" prop="companyName">
- <el-input type="text" v-model="ruleForm.companyName" autocomplete="off" placeholder="公司名" clearable prefix-icon="el-icon-s-home"></el-input>
- </el-form-item>
- <el-form-item class="login-input" prop="name">
- <el-input type="text" v-model="ruleForm.name" autocomplete="off" placeholder="姓名" clearable prefix-icon="el-icon-user-solid"></el-input>
- </el-form-item>
- <el-form-item class="login-input" prop="phone">
- <el-input type="text" v-model="ruleForm.phone" autocomplete="off" placeholder="手机号" clearable prefix-icon="el-icon-mobile-phone"></el-input>
- </el-form-item>
- <el-form-item class="login-input" prop="vcode">
- <el-input type="text" v-model="ruleForm.vcode" autocomplete="off" placeholder="验证码" clearable prefix-icon="iconfont firerock-iconyanzhengma">
- <el-button slot="append" @click="sendVcode" :disabled="ruleForm.phone=='' || showTimer">发送验证码<span v-if="showTimer">({{countNum}})</span></el-button>
- </el-input>
- </el-form-item>
- <el-form-item class="login-input" prop="password">
- <el-input type="password" v-model="ruleForm.password" autocomplete="off" placeholder="设置密码,长度不低于6位" clearable prefix-icon="iconfont firerock-iconmima">
- </el-input>
- </el-form-item>
- <el-form-item class="login-input" prop="repwd">
- <el-input type="password" v-model="ruleForm.repwd" autocomplete="off" placeholder="重复密码" clearable prefix-icon="iconfont firerock-iconmima">
- </el-input>
- </el-form-item>
-
- <el-form-item class="login-input" prop="type" style="text-align:center;">
- <el-divider ></el-divider>
- <div style="margin-top:10px;">
- <span>选择版本: </span><el-select v-model="ruleForm.type" style="width:250px;">
- <el-option v-for="item in typeList" :value="item.id" :label="item.name" :key="item.id"></el-option>
- </el-select>
- </div>
- </el-form-item>
- <div class="login-button" style="width:100%;margin-top:20px;">
- <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit" :loading="logining">注册</el-button>
- </div>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- typeList:[{id:0,name:'工时统计表简易版'},{id:1,name:'工时统计基础版'},
- {id:2,name:'项目管理专业版'},{id:3,name:'工程管理专业版'}],
- logining: false,
- showTimer: false,
- countNum: 60,
- // 登录信息
- ruleForm: {
- companyName: '',
- name: '',
- phone: '',
- type:2,
- },
- rules: {
- companyName: [{ required: true, message: '请输入公司名', trigger: 'blur' },],
- name: [{ required: true, message: '请输入姓名', trigger: 'blur' },],
- phone: [{ required: true, message: '请输入手机号', trigger: 'blur' },],
- vcode: [{ required: true, message: '请输入验证码', trigger: 'blur' },],
- password: [{ required: true, message: '请设置密码,长度不低于6位', trigger: 'blur' },],
- repwd: [{ required: true, message: '请重复输入密码', trigger: 'blur' },]
- }
- };
- },
- methods: {
- //开始倒计时
- countDown() {
- if (this.countNum > 0) {
- this.countNum--;
- } else {
- clearInterval(this.timer);
- this.showTimer = false;
- }
- },
- sendVcode() {
- if (this.ruleForm.phone.length != 11) {
- this.$message({
- message: '手机号码格式不正确',
- type: 'error'
- });
- } else {
- this.http.post('/user/sendVcode', {mobile: this.ruleForm.phone} , res => {
- this.logining = false;
- if (res.code == "ok") {
- this.$message({
- message: '发送成功',
- type: 'success'
- });
- this.showTimer = true;
- this.countNum = 60;
- this.timer = setInterval(this.countDown, 1000);
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.logining = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- }
- },
- handleReset2() {
- this.$refs.ruleForm.resetFields();
- },
- handleSubmit(ev) {
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- if (this.ruleForm.password.length < 6) {
- this.$message({
- message: '密码长度不能少于6位',
- type: 'error'
- });
- return;
- }
- //检查两次密码是否一致
- if (this.ruleForm.password != this.ruleForm.repwd) {
- this.$message({
- message: '两次输入的密码不一致',
- type: 'error'
- });
- return;
- }
- var _this = this;
- this.logining = true;
- this.http.post(this.port.manage.register, this.ruleForm , res => {
- this.logining = false;
- if (res.code == "ok") {
- this.$message({
- message: '注册成功',
- type: 'success'
- });
- this.$router.push({ path: '/login' });
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.logining = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- }
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .login {
- height: 100%;
- .login-par {
- width: 100%;
- min-height: 100%;
- background: #f0f2f5 url('../assets/image/background.png') no-repeat 50%;
- background-size: 100%;
- padding: 110px 0 144px;
- position: relative;
- box-sizing: border-box;
- .login-logo {
- text-align: center;
- margin: 0 0 20px 0;
- }
- .login-container {
- -webkit-border-radius: 5px;
- border-radius: 5px;
- -moz-border-radius: 5px;
- background-clip: padding-box;
- width: 450px;
- height: 495px;
- padding: 25px 35px 25px 35px;
- background: #fff;
- border: 1px solid #eaeaea;
- box-shadow: 0 0 5px #cac6c6;
- border-top: 10px solid #20a0ff;
- margin:auto;
- .title {
- font-size: 20px;
- margin: 0px auto 30px auto;
- text-align: center;
- color: #505458;
- }
- .remember {
- margin: 0px 0px 35px 0px;
- }
- .login-input {
- margin: 15px 0 0 0;
- }
- .login-button {
- margin: 50px 0 0 0;
- }
- .login-button .el-button {
- padding: 14px;
- }
- }
- }
- }
- </style>
|