|
@@ -9,7 +9,7 @@
|
|
|
成果评价系统
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="tabs">
|
|
|
- <el-tabs v-model="active" type="card">
|
|
|
+ <el-tabs v-model="active" type="card" @tab-click="changeActive">
|
|
|
<el-tab-pane label="个人用户" name="first">
|
|
|
<el-col :span="24" class="two">
|
|
|
<el-form :model="webForm" :rules="rules" ref="webForm" label-width="100px">
|
|
@@ -99,52 +99,42 @@ export default {
|
|
|
expert: {},
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ async created() {
|
|
|
+ await this.changeActive();
|
|
|
+ await this.enterListen();
|
|
|
+ },
|
|
|
methods: {
|
|
|
...personal(['perLogin']),
|
|
|
...organization(['orgLogin']),
|
|
|
...adminLogin(['login']),
|
|
|
...achieveExpert({ expertLogin: 'login' }),
|
|
|
// 个人登录
|
|
|
- webLogin(formName) {
|
|
|
- this.$refs[formName].validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- let data = this.webForm;
|
|
|
- data.type = '4';
|
|
|
- if (data.type == '4') {
|
|
|
- let res = await this.perLogin({ user: data });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message.success('登录成功');
|
|
|
- this.$router.push('/homeIndex');
|
|
|
- }
|
|
|
- } else if (data.type == '5') {
|
|
|
- data.institution_code = data.phone;
|
|
|
- let res = await this.orgLogin({ user: data });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message.success('登录成功');
|
|
|
- this.$router.push('/homeIndex');
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
+ async webLogin() {
|
|
|
+ let data = this.webForm;
|
|
|
+ console.log(data);
|
|
|
+ data.type = '4';
|
|
|
+ if (data.type == '4') {
|
|
|
+ let res = await this.perLogin({ user: data });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message.success('登录成功');
|
|
|
+ this.$router.push('/homeIndex');
|
|
|
}
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ data.institution_code = data.phone;
|
|
|
+ let res = await this.orgLogin({ user: data });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message.success('登录成功');
|
|
|
+ this.$router.push('/homeIndex');
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 管理登录
|
|
|
- adminLogin(formName) {
|
|
|
- this.$refs[formName].validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- let res = await this.login({ user: this.form });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message.success('登录成功');
|
|
|
- this.$router.push('/homeIndex');
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
+ async adminLogin() {
|
|
|
+ let res = await this.login({ user: this.form });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message.success('登录成功');
|
|
|
+ this.$router.push('/homeIndex');
|
|
|
+ }
|
|
|
},
|
|
|
// 专家登陆
|
|
|
async toExpertLogin() {
|
|
@@ -155,6 +145,29 @@ export default {
|
|
|
this.$router.push('/homeIndex');
|
|
|
}
|
|
|
},
|
|
|
+ enterListen() {
|
|
|
+ var lett = this;
|
|
|
+ document.onkeydown = function(e) {
|
|
|
+ var key = window.event.keyCode;
|
|
|
+ if (key == 13) {
|
|
|
+ if (lett.active == 'first') {
|
|
|
+ lett.webLogin();
|
|
|
+ } else if (lett.active == 'second') {
|
|
|
+ lett.adminLogin();
|
|
|
+ } else if (lett.active == 'third') {
|
|
|
+ lett.toExpertLogin();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 选择类型
|
|
|
+ changeActive(active) {
|
|
|
+ if (active == undefined) {
|
|
|
+ this.$set(this, `active`, 'first');
|
|
|
+ } else {
|
|
|
+ this.$set(this, `active`, active.name);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
|