Commit 1b5afb1b authored by xinzhedeai's avatar xinzhedeai

首页区分跳转问题处理,登录错误提示新增, 数据概览页面init

parent 979ae3bb
......@@ -58,28 +58,26 @@ export const constantRouterMap = [
//component: Layout,
component: HomeLayout,
redirect: "noredirect",
hidden:true,
hidden:false,
children: [
{
path: "enterprise",
component: resolve => require(["@/views/system/home/enterprise"], resolve),
component: resolve => require([localStorage.getItem('groupIdByloginType')*1 === 1 ? "@/views/system/home/enterprise" : "@/views/system/home/tech"], resolve),
name: "首页-企业",
meta: { title: "首页", affix:true , icon: "index"}
}
]
},
// {
// path: "tech",
// component: resolve => require(["@/views/system/home/tech"], resolve),
// name: "首页-科技局",
// meta: { title: "首页", affix:true , icon: "index"}
// },
{
path: "/home",
//component: Layout,
component: HomeLayout,
redirect: "noredirect",
hidden:true,
children: [
{
path: "tech",
component: resolve => require(["@/views/system/home/tech"], resolve),
name: "首页-科技局",
meta: { title: "首页", affix:true , icon: "index"}
path: "overview",
component: resolve => require(["@/views/system/home/overview"], resolve),
name: "概览",
hidden: true,
meta: { title: "数据概览", icon: "index"}
}
]
},
......
import { login, getInfo, logout } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { Message } from 'element-ui';
const user = {
state: {
token: getToken(),
......@@ -34,7 +34,7 @@ const user = {
const rememberMe = userInfo.rememberMe;
return new Promise((resolve, reject) => {
login(userInfo).then(res => {
if(/* res.head.code === '0000' || */ !res.code){
if(!res.code){ // 登录成功不返回code状态码。
var body = res.body || res;
setToken(body.token, rememberMe);
commit('SET_TOKEN', body.token);
......@@ -42,8 +42,14 @@ const user = {
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
commit('SET_LOAD_MENUS', true);
};
resolve(res)
}else{
Message({
message: res.msg,
type: 'warning', // 可以是 'success', 'warning', 'info', 'error'
});
resolve(null)
}
}).catch(error => {
reject(error)
})
......
......@@ -409,15 +409,16 @@ export default {
},
methods: {
goBackendHome(){
if(localStorage.getItem('groupIdByloginType')*1 == 1){ // 孵化器用户
// if(localStorage.getItem('groupIdByloginType')*1 == 1){ // 孵化器用户
// location.href = '/home/enterprise'
// return
// }
// if(localStorage.getItem('groupIdByloginType')*1 == 2){ // 科技据用户
// location.href = '/home/tech'
// return
// }
// location.reload()
location.href = '/home/enterprise'
return
}
if(localStorage.getItem('groupIdByloginType')*1 == 2){ // 科技据用户
location.href = '/home/tech'
return
}
location.reload()
},
// 首页
module0(m, t, f, dmIndex, view){
......
This diff is collapsed.
......@@ -165,29 +165,35 @@ export default {
Cookies.remove('password')
Cookies.remove('rememberMe')
}
this.$store.dispatch('Login', user).then(() => {
this.$store.dispatch('Login', user).then((res) => {
if(!res){ // 登录失败
this.loading = false
if (this.userStyle) {
if (this.userStyle === '应急局' && this.user.enterpriseId !== 0) {
this.$message.error('您是企业用户,请使用企业端登录')
setTimeout(() => {
this.$store.dispatch('LogOut').then(() => {
location.reload()
})
}, 1000)
return
}
if (this.userStyle === '企业' && this.user.enterpriseId === 0) {
this.$message.error('您是应急局用户,请使用应急局端登录')
setTimeout(() => {
this.$store.dispatch('LogOut').then(() => {
location.reload()
})
}, 1000)
return
}
this.getCode()
}
this.$router.push({ path: /* 记住上次退出时的页面 */ /* this.redirect || */'/home4Login' })
this.$router.push({ path: '/edge/Screen' }) // 跳转大屏
// debugger
// this.loading = false
// if (this.userStyle) {
// if (this.userStyle === '应急局' && this.user.enterpriseId !== 0) {
// this.$message.error('您是企业用户,请使用企业端登录')
// setTimeout(() => {
// this.$store.dispatch('LogOut').then(() => {
// location.reload()
// })
// }, 1000)
// return
// }
// if (this.userStyle === '企业' && this.user.enterpriseId === 0) {
// this.$message.error('您是应急局用户,请使用应急局端登录')
// setTimeout(() => {
// this.$store.dispatch('LogOut').then(() => {
// location.reload()
// })
// }, 1000)
// return
// }
// }
// this.$router.push({ path: /* 记住上次退出时的页面 */ /* this.redirect || */'/home4Login' })
}).catch(() => {
this.loading = false
this.getCode()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment