|
|
|
@ -1,12 +1,147 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="login-div-style">
|
|
|
|
|
<div class="title-style">长春市学生体质健康信息化管理系统</div>
|
|
|
|
|
<div class="div-style clearfix">
|
|
|
|
|
<span class="span-style">用户名:</span>
|
|
|
|
|
<a-input class="input-style" placeholder="请输入用户名" :allowClear="true" v-model="account" @change="(evt)=>onChange(evt,'account')"></a-input>
|
|
|
|
|
<div class="tips-style" :style="{visibility:accountTips === true?'visible':'hidden'}">请输入用户名</div>
|
|
|
|
|
<span class="span-style">密码:</span>
|
|
|
|
|
<a-input-password class="input-style" :allowClear="true" placeholder="请输入密码" v-model="pass" @change="(evt)=>onChange(evt,'pass')"></a-input-password>
|
|
|
|
|
<div class="tips-style" :style="{visibility:passTips === true?'visible':'hidden'}">请输入密码</div>
|
|
|
|
|
<a-button type="primary" class="btn-style" @click="onLogin">登录</a-button>
|
|
|
|
|
<div class="tips-style">{{loginTips}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {Input,Button} from 'ant-design-vue';
|
|
|
|
|
import Base64 from '../../../global-llibs/base64';
|
|
|
|
|
import Interface from '../../../global-llibs/axios-config';
|
|
|
|
|
import InterfaceConfig from './interfaceConfig';
|
|
|
|
|
import Cookie from '../../../global-llibs/cookie';
|
|
|
|
|
import {resetRoutes} from '../router';
|
|
|
|
|
let fromRouteName = "";
|
|
|
|
|
export default {
|
|
|
|
|
name: "Login"
|
|
|
|
|
name: "Login",
|
|
|
|
|
data:function(){
|
|
|
|
|
return{
|
|
|
|
|
account:"",
|
|
|
|
|
pass:"",
|
|
|
|
|
accountTips:false,
|
|
|
|
|
passTips:false,
|
|
|
|
|
loginTips:'',
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components:{
|
|
|
|
|
AInput:Input,
|
|
|
|
|
AInputPassword:Input.Password,
|
|
|
|
|
AButton:Button
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
onLogin:function(){
|
|
|
|
|
if (this.account.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '') === ''){
|
|
|
|
|
this.accountTips = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.pass.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '') === ''){
|
|
|
|
|
this.passTips = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Interface.callInterface([{
|
|
|
|
|
url:InterfaceConfig.loginByLoginNameAndPassword.url,
|
|
|
|
|
params:{
|
|
|
|
|
login_name:Base64.encode(this.account),
|
|
|
|
|
login_pwd:Base64.encode(this.pass)
|
|
|
|
|
}
|
|
|
|
|
}],(result)=>{
|
|
|
|
|
if(result[0].data.code === 2000){
|
|
|
|
|
let storeData = {
|
|
|
|
|
person_id:result[0].data.data.user_id,
|
|
|
|
|
identity_id:result[0].data.data.user_identity_id,
|
|
|
|
|
token:result[0].data.data.access_token,
|
|
|
|
|
}
|
|
|
|
|
Cookie.set('person_id',result[0].data.data.user_id);
|
|
|
|
|
Cookie.set('identity_id',result[0].data.data.user_identity_id);
|
|
|
|
|
Cookie.set('token',result[0].data.data.access_token);
|
|
|
|
|
Interface.callInterface([{
|
|
|
|
|
url:InterfaceConfig.getPersonInfo.url,
|
|
|
|
|
params:{
|
|
|
|
|
person_id:result[0].data.data.user_id,
|
|
|
|
|
identity_id:result[0].data.data.user_identity_id,
|
|
|
|
|
},
|
|
|
|
|
method:InterfaceConfig.getPersonInfo.method,
|
|
|
|
|
isTestLogin:InterfaceConfig.getPersonInfo.isTestLogin
|
|
|
|
|
}],(result)=>{
|
|
|
|
|
if (result[0].data.code === 2000){
|
|
|
|
|
storeData.person_name = result[0].data.data.person_info.user_name;
|
|
|
|
|
storeData.org_id = result[0].data.data.org_info.org_name;
|
|
|
|
|
storeData.org_name = result[0].data.data.org_info.org_name;
|
|
|
|
|
|
|
|
|
|
Cookie.set('person_name',Base64.encode(result[0].data.data.person_info.user_name));
|
|
|
|
|
Cookie.set('org_id',result[0].data.data.org_info.org_name);
|
|
|
|
|
Cookie.set('org_name',Base64.encode(result[0].data.data.org_info.org_name));
|
|
|
|
|
|
|
|
|
|
let orgLevel = parseInt(result[0].data.data.org_info.org_level);
|
|
|
|
|
if(orgLevel === 5){
|
|
|
|
|
Cookie.set('role','school');
|
|
|
|
|
storeData.role = 'school';
|
|
|
|
|
}else if(orgLevel >= 3){
|
|
|
|
|
Cookie.set('role','county');
|
|
|
|
|
storeData.role = 'county';
|
|
|
|
|
}else{
|
|
|
|
|
Cookie.set('role','city');
|
|
|
|
|
storeData.role = 'city';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result[0].data.data.have_parent_flag === 1 && orgLevel === 5){
|
|
|
|
|
Cookie.set('district_id',result[0].data.data.parent_org_info.org_id);
|
|
|
|
|
Cookie.set('district_name',Base64.encode(result[0].data.data.parent_org_info.org_name));
|
|
|
|
|
storeData.district_id = result[0].data.data.parent_org_info.org_id;
|
|
|
|
|
storeData.district_name = result[0].data.data.parent_org_info.org_name;
|
|
|
|
|
}else{
|
|
|
|
|
Cookie.set('district_id','');
|
|
|
|
|
Cookie.set('district_name','')
|
|
|
|
|
storeData.district_id = '';
|
|
|
|
|
storeData.district_name = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$store.commit('setParams',storeData);
|
|
|
|
|
resetRoutes(this.$store);
|
|
|
|
|
this.$router.replace({name:fromRouteName !== 'login'?fromRouteName:'main'}).catch(err => err);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.loginTips = result[0].data.msg;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onChange:function(evt,type){
|
|
|
|
|
if (type === 'account'){//用户名
|
|
|
|
|
if (this.account.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '') !== '' && this.accountTips === true){
|
|
|
|
|
this.accountTips = false;
|
|
|
|
|
}
|
|
|
|
|
}else{//密码
|
|
|
|
|
if (this.pass.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '') !== '' && this.passTips === true){
|
|
|
|
|
this.passTips = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
|
if (from.name && from.name !== ''){
|
|
|
|
|
fromRouteName = from.name;
|
|
|
|
|
}else{
|
|
|
|
|
let ary = from.path.split('/');
|
|
|
|
|
fromRouteName = ary[ary.length - 1];
|
|
|
|
|
if (fromRouteName === ''){
|
|
|
|
|
fromRouteName = 'main';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
@ -14,17 +149,56 @@
|
|
|
|
|
.login-div-style{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-image: url("../assets/loginBg.png");
|
|
|
|
|
background-size: cover;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
/*background-image: url("../assets/loginBg.png");*/
|
|
|
|
|
/*background-size: cover;*/
|
|
|
|
|
/*background-repeat: no-repeat;*/
|
|
|
|
|
position: relative;
|
|
|
|
|
padding-top: 100px;
|
|
|
|
|
.title-style{
|
|
|
|
|
position: absolute;
|
|
|
|
|
color:#36FEFE;
|
|
|
|
|
/*position: absolute;*/
|
|
|
|
|
/*color:#36FEFE;*/
|
|
|
|
|
font-size: 25px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
width: 220px;
|
|
|
|
|
/*width: 220px;*/
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 100px;
|
|
|
|
|
}
|
|
|
|
|
.div-style{
|
|
|
|
|
width: 500px;
|
|
|
|
|
padding: 32px 20px 0 20px;
|
|
|
|
|
border: 1px solid #e5e5e5;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
margin: auto;
|
|
|
|
|
.span-style{
|
|
|
|
|
float: left;
|
|
|
|
|
width: 100px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
letter-spacing: 5px;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
}
|
|
|
|
|
.input-style{
|
|
|
|
|
float: left;
|
|
|
|
|
width: 330px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
}
|
|
|
|
|
.tips-style{
|
|
|
|
|
float: left;
|
|
|
|
|
width: 330px;
|
|
|
|
|
margin-left: 120px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
color:red;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
.btn-style{
|
|
|
|
|
float: left;
|
|
|
|
|
width: 330px;
|
|
|
|
|
margin-left: 120px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|