|
@@ -1,31 +1,62 @@
|
|
|
<template>
|
|
|
- <div id="login">
|
|
|
+ <div id="Login">
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" class="main">
|
|
|
- <div class="w_1200">
|
|
|
- <el-col :span="24" class="login">
|
|
|
- <div class="ms-title">后台管理系统</div>
|
|
|
- <el-form :model="form" :rules="rules" ref="login" label-width="0px" class="ms-content">
|
|
|
- <el-form-item prop="username">
|
|
|
- <el-input v-model="form.tel" placeholder="请输入手机号">
|
|
|
- <el-button slot="prepend" icon="el-icon-user"></el-button>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="password">
|
|
|
- <el-input type="password" placeholder="请输入密码" v-model="form.pwd">
|
|
|
- <el-button slot="prepend" icon="el-icon-lock"></el-button>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <div class="login-btn">
|
|
|
- <el-button type="primary" @click="submitForm()">登录</el-button>
|
|
|
- </div>
|
|
|
- </el-form>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <div class="w_1200">
|
|
|
+ <el-col :span="24" class="info">
|
|
|
+ <el-col :span="24" class="login">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ 用户权限管理系统
|
|
|
</el-col>
|
|
|
- </div>
|
|
|
+ <el-tabs v-model="activeName" class="tabs">
|
|
|
+ <el-tab-pane label="平台用户" name="first">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <el-form ref="form" :model="form" :rules="rule" label-width="100px">
|
|
|
+ <el-form-item label="用户名" prop="phone">
|
|
|
+ <el-input type="phone" v-model="form.phone" autocomplete="off" placeholder="请输入手机号/统一社会信用代码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登录密码" prop="passwd">
|
|
|
+ <el-input v-model="form.passwd" placeholder="请输入登录密码" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户类别" prop="role">
|
|
|
+ <el-radio-group v-model="form.role">
|
|
|
+ <el-radio label="4">个人用户</el-radio>
|
|
|
+ <el-radio label="5">机构用户</el-radio>
|
|
|
+ <el-radio label="6">专家用户</el-radio>
|
|
|
+ <el-radio label="2">VIP用户</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-col :span="24" class="userSubmit">
|
|
|
+ <el-button type="primary" @click="userSubmit">登录</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="管理登录" name="second">
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <el-form ref="adminform" :model="adminform" :rules="adminRules" label-width="130px">
|
|
|
+ <el-form-item label="手机号&机构代码" prop="phone">
|
|
|
+ <el-input v-model="adminform.phone" placeholder="请输入手机号&机构代码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登录密码" prop="passwd">
|
|
|
+ <el-input v-model="adminform.passwd" placeholder="请输入登录密码" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户类别" prop="role">
|
|
|
+ <el-radio v-model="adminform.role" label="1">合作机构&业务管理员</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-col :span="24" class="adminSubmit">
|
|
|
+ <el-button type="primary" @click="adminSubmit">登录</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <el-col :span="24" class="btn">
|
|
|
+ <el-button type="primary" size="mini">去注册</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -35,40 +66,55 @@
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: login } = createNamespacedHelpers('login');
|
|
|
export default {
|
|
|
- metaInfo: { title: '登录' },
|
|
|
- name: 'login',
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ name: 'Login',
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
return {
|
|
|
+ activeName: 'first',
|
|
|
+ // 平台用户登录
|
|
|
form: {},
|
|
|
- rules: {
|
|
|
- tel: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
|
|
- pwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
|
|
+ rule: {
|
|
|
+ phone: [{ required: true, message: '请输入手机号/统一社会信用代码', trigger: 'blur' }],
|
|
|
+ passwd: [{ required: true, message: '请输入登录密码', trigger: 'blur' }],
|
|
|
+ role: [{ type: 'array', required: true, message: '请至少选择一个用户类别', trigger: 'change' }],
|
|
|
+ },
|
|
|
+ // 管理用户登录
|
|
|
+ adminform: {},
|
|
|
+ adminRules: {
|
|
|
+ phone: [{ required: true, message: '请输入手机号/统一社会信用代码', trigger: 'blur' }],
|
|
|
+ passwd: [{ required: true, message: '请输入登录密码', trigger: 'blur' }],
|
|
|
+ role: [{ type: 'array', required: true, message: '请至少选择一个用户类别', trigger: 'change' }],
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
|
methods: {
|
|
|
...login(['login']),
|
|
|
- submitForm() {
|
|
|
- this.$refs.login.validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- // let res = await this.login({ user: this.form });
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- localStorage.setItem('user', JSON.stringify(this.form));
|
|
|
- this.$message.success('登录成功');
|
|
|
- this.$router.push('/homeIndex');
|
|
|
- // }
|
|
|
- } else {
|
|
|
- this.$message.error('请输入账号和密码');
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
+ userSubmit() {
|
|
|
+ let data = this.form;
|
|
|
+ localStorage.setItem('user', JSON.stringify(data));
|
|
|
+ this.$message.success('登录成功');
|
|
|
+ this.$router.push('/homeIndex');
|
|
|
+ },
|
|
|
+ async adminSubmit() {
|
|
|
+ let data = this.adminform;
|
|
|
+ if (data.role == null) {
|
|
|
+ data.role = '0';
|
|
|
+ }
|
|
|
+ let res = await this.login({ user: data });
|
|
|
+ if (res.uid) {
|
|
|
+ this.$router.push('/homeIndex');
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -82,43 +128,55 @@ export default {
|
|
|
height: 100vh;
|
|
|
background-repeat: no-repeat;
|
|
|
background-size: cover;
|
|
|
- .login {
|
|
|
- position: absolute;
|
|
|
- left: 50%;
|
|
|
- top: 50%;
|
|
|
- width: 350px;
|
|
|
- margin: -190px 0 0 -175px;
|
|
|
- border-radius: 5px;
|
|
|
- background: hsla(0, 0%, 100%, 0.3);
|
|
|
- overflow: hidden;
|
|
|
- .ms-title {
|
|
|
- width: 100%;
|
|
|
- line-height: 50px;
|
|
|
- text-align: center;
|
|
|
- font-size: 20px;
|
|
|
- color: #fff;
|
|
|
- border-bottom: 1px solid #ddd;
|
|
|
- }
|
|
|
- .ms-content {
|
|
|
- padding: 30px 30px;
|
|
|
- }
|
|
|
- .login-btn {
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .login-btn button {
|
|
|
- width: 100%;
|
|
|
- height: 36px;
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- .login-tips {
|
|
|
- font-size: 12px;
|
|
|
- line-height: 30px;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
- /deep/.js .el-form-item__content {
|
|
|
- padding: 0 25px;
|
|
|
- .el-radio {
|
|
|
- color: #fff;
|
|
|
+ .info {
|
|
|
+ padding: 15% 25% 0 25%;
|
|
|
+ .login {
|
|
|
+ height: 500px;
|
|
|
+ background-color: #ffffff9f;
|
|
|
+ border-radius: 10px;
|
|
|
+ .top {
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .tabs {
|
|
|
+ height: 400px;
|
|
|
+ overflow: hidden;
|
|
|
+ border-bottom: 1px dashed #000;
|
|
|
+ padding: 0 5%;
|
|
|
+ /deep/.el-tabs__nav {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ /deep/.el-tabs__active-bar {
|
|
|
+ left: 33%;
|
|
|
+ }
|
|
|
+ /deep/.el-tabs__item {
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .one {
|
|
|
+ padding: 10% 0;
|
|
|
+ .userSubmit {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .two {
|
|
|
+ padding: 10% 0;
|
|
|
+ .adminSubmit {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .btn {
|
|
|
+ text-align: right;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ padding: 0 10px;
|
|
|
}
|
|
|
}
|
|
|
}
|