朱思禹提交:提交体质健康项目相关代码

init
Administrator 4 years ago
parent 91ccbd892d
commit a7110c9965

@ -63,7 +63,7 @@ export default {
content:result.code === 5000?"请联系管理员":result.msg,
centered:true
})
success = false;
success = result.code !== 5000;
break;
}
}

@ -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>

@ -0,0 +1,23 @@
const InterfaceConfig = {
/*
* 1.4.1用户名密码登录接口
* login_name 必填 string 登录名称base64后传输
* login_pwd 必填 string 登录密码base64后传输
* */
loginByLoginNameAndPassword:{
url:'intellioa/sys/login/loginByLoginNameAndPassword',
method:'post',
isTestLogin:false
},
/*
* 1.4.2根据person_ididentity_id获取用户上下文信息
* person_id 必填 string 登录名称base64后传输
* identity_id 必填 string 登录密码base64后传输
* */
getPersonInfo:{
url:'intellioa/sys/base/getPersonInfo',
method:'get',
isTestLogin:true
}
};
export default InterfaceConfig;

@ -25,24 +25,35 @@ Vue.use(VueBus);
Vue.component('vueScroll', vuescroll)
Vue.component('MyIcon', MyIcon)
Vue.config.productionTip = false
Cookie.set('person_id','22933');
Cookie.set('person_name',Base64.encode('费利明'))
Cookie.set('org_id','400195');
Cookie.set('org_name',Base64.encode('研发测试学校'));
Cookie.set('role','city');
Cookie.set('district_id','315005');
Cookie.set('district_name',Base64.encode('南关区教育局'));
// Cookie.set('person_id','22933');
// Cookie.set('person_name',Base64.encode('费利明'))
// Cookie.set('org_id','28');
// Cookie.set('org_name',Base64.encode('研发测试学校'));
// Cookie.set('role','school');
// Cookie.set('district_id','315005');
// Cookie.set('district_name',Base64.encode('南关区教育局'));
router.beforeEach((to,from,next)=>{
let person_id = Cookie.get('person_id')
if (person_id && person_id !== ''){//登录过
let token = Cookie.get('token');
if (person_id && person_id !== '' && token && token !== ''){//登录过
if (!store.state.person_id || store.state.person_id === ''){
store.commit('setSingleParam',{key:'person_id',value:person_id});
store.commit('setSingleParam',{key:'person_name',value:Base64.decode(Cookie.get('person_name'))});
store.commit('setSingleParam',{key:'org_id',value:Cookie.get('org_id')});
store.commit('setSingleParam',{key:'org_name',value:Base64.decode(Cookie.get('org_name'))});
store.commit('setSingleParam',{key:'role',value:Cookie.get('role')});
store.commit('setSingleParam',{key:'district_id',value:Cookie.get('district_id')});
store.commit('setSingleParam',{key:'district_name',value:Base64.decode(Cookie.get('district_name'))});
let storeData = {
person_id:person_id,
org_id:Cookie.get('org_id'),
token:token,
role:Cookie.get('role'),
district_id:Cookie.get('district_id'),
identity_id:Cookie.get('identity_id'),
}
let person_name = Cookie.get('person_name');
let org_name = Cookie.get('org_name');
let district_name = Cookie.get('district_name');
storeData.person_name = person_name && person_name !== ''?Base64.decode(person_name):'';
storeData.org_name = org_name && org_name !== ''?Base64.decode(org_name):'';
storeData.district_name = district_name && district_name !== ''?Base64.decode(district_name):'';
store.commit('setParams',storeData);
resetRoutes(store);
}

@ -52,7 +52,8 @@
<router-view ></router-view>
</vue-scroll>
</div>
<div v-show="breadCrumb.length === 3" class="return-btn-style" @click="backBtnClick">
<div v-show="breadCrumb && Array.isArray(breadCrumb) && breadCrumb.length === 3"
class="return-btn-style" @click="backBtnClick">
<a-icon type="left" style="margin-right: 5px"></a-icon>
返回
</div>

@ -245,20 +245,16 @@
{value: 1048, name: '已上报学校'},
{value: 735, name: '未上报学校'},
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
label:{
show: true,
formatter: '{b} : \n\n{d}%',
},
labelLine :{show:true}
}
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
label:{
show: true,
formatter: '{b} : \n\n{d}%',
},
labelLine :{show:true}
}
]
},
@ -325,20 +321,16 @@
{value: 1048, name: '男'},
{value: 735, name: '女'},
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
label:{
show: true,
formatter: '{b} : {d}%'
},
labelLine :{show:true}
}
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
label:{
show: true,
formatter: '{b} : {d}%'
},
labelLine :{show:true}
}
]
}
@ -395,20 +387,16 @@
{value: 1048, name: '乡村数量'},
{value: 735, name: '城市数量'},
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
label:{
show: true,
formatter: '{b} : \n\n{d}%',
},
labelLine :{show:true}
}
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
label:{
show: true,
formatter: '{b} : \n\n{d}%',
},
labelLine :{show:true}
}
]
},

@ -4,6 +4,12 @@ import {menuConfig} from './menuConfig';
import _ from 'lodash';
Vue.use(VueRouter)
//以下几行解决控制台报错NavigationDuplicated: Avoided redundant navigation to current location
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
const createRouter = ()=> new VueRouter({
mode:'hash',

@ -14,12 +14,13 @@ const store = new Vuex.Store({
org_name:'',
org_id:'',
role:'',//school 学校 city 市教育局 county县域教育局
token:'',
menu:[],
breadCrumb:[]
},
mutations:{
setParams(state,params){
Object(state).keys().forEach((item)=>{
Object.keys(state).forEach((item)=>{
state[item] = params[item];
})
},

Loading…
Cancel
Save