|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
import { login, login2, logout, getInfo, loginNoCaptcha } from "@/api/login";
|
|
|
|
|
import { xzTree, listDist } from "@/api/yingji/keyEnterprise";
|
|
|
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
|
|
|
import Cookies from 'js-cookie'
|
|
|
|
|
const user = {
|
|
|
|
|
state: {
|
|
|
|
|
token: getToken(),
|
|
|
|
@ -16,24 +15,24 @@ const user = {
|
|
|
|
|
newRouter: [],
|
|
|
|
|
old1: [],
|
|
|
|
|
new1: [],
|
|
|
|
|
district:[],
|
|
|
|
|
district: [],
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mutations: {
|
|
|
|
|
setOld: (state, route) => {
|
|
|
|
|
state.old1 = route
|
|
|
|
|
state.old1 = route;
|
|
|
|
|
},
|
|
|
|
|
SET_DISTRICT: (state,data) => {
|
|
|
|
|
state.district = data
|
|
|
|
|
SET_DISTRICT: (state, data) => {
|
|
|
|
|
state.district = data;
|
|
|
|
|
},
|
|
|
|
|
setNew: (state, route) => {
|
|
|
|
|
state.new1 = route
|
|
|
|
|
state.new1 = route;
|
|
|
|
|
},
|
|
|
|
|
getOldRouter: (state, route) => {
|
|
|
|
|
state.oldRouter = route
|
|
|
|
|
state.oldRouter = route;
|
|
|
|
|
},
|
|
|
|
|
getNewRouter: (state, route) => {
|
|
|
|
|
state.newRouter = route
|
|
|
|
|
state.newRouter = route;
|
|
|
|
|
},
|
|
|
|
|
get_dept: (state, id) => {
|
|
|
|
|
state.dept = id;
|
|
|
|
@ -74,7 +73,7 @@ const user = {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
LoginNoCaptcha({commit},userInfo) {
|
|
|
|
|
LoginNoCaptcha({ commit }, userInfo) {
|
|
|
|
|
const username = userInfo.username.trim();
|
|
|
|
|
const password = userInfo.password;
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
@ -90,7 +89,7 @@ const user = {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获取行政区划
|
|
|
|
|
Getdistrict({ commit }){
|
|
|
|
|
Getdistrict({ commit }) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
xzTree()
|
|
|
|
|
.then((res) => {
|
|
|
|
@ -170,20 +169,20 @@ const user = {
|
|
|
|
|
icon1: require("../../assets/images/qiye.png"),
|
|
|
|
|
icon2: require("../../assets/images/qiye-change.png"),
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
let arr2 = []
|
|
|
|
|
let A1 = []
|
|
|
|
|
let A2 = []
|
|
|
|
|
let toRouter = ''
|
|
|
|
|
commit("getOldRouter", arr1)
|
|
|
|
|
];
|
|
|
|
|
let arr2 = [];
|
|
|
|
|
let A1 = [];
|
|
|
|
|
let A2 = [];
|
|
|
|
|
let toRouter = "";
|
|
|
|
|
commit("getOldRouter", arr1);
|
|
|
|
|
arr1.forEach((value) => {
|
|
|
|
|
A1.push(value.path)
|
|
|
|
|
})
|
|
|
|
|
commit("setOld", A1)
|
|
|
|
|
if (res.roles.indexOf('admin') != -1) {
|
|
|
|
|
commit("getNewRouter", arr1)
|
|
|
|
|
commit("setNew", A1)
|
|
|
|
|
toRouter = arr1
|
|
|
|
|
A1.push(value.path);
|
|
|
|
|
});
|
|
|
|
|
commit("setOld", A1);
|
|
|
|
|
if (res.roles.indexOf("admin") != -1) {
|
|
|
|
|
commit("getNewRouter", arr1);
|
|
|
|
|
commit("setNew", A1);
|
|
|
|
|
toRouter = arr1;
|
|
|
|
|
} else {
|
|
|
|
|
//区级和镇级
|
|
|
|
|
if (user.dept.parentId != 0) {
|
|
|
|
@ -191,15 +190,15 @@ const user = {
|
|
|
|
|
return value.path == "/planManage";
|
|
|
|
|
});
|
|
|
|
|
arr2.forEach((value) => {
|
|
|
|
|
A2.push(value.path)
|
|
|
|
|
})
|
|
|
|
|
commit("getNewRouter", arr2)
|
|
|
|
|
commit("setNew", A2)
|
|
|
|
|
toRouter = arr2
|
|
|
|
|
A2.push(value.path);
|
|
|
|
|
});
|
|
|
|
|
commit("getNewRouter", arr2);
|
|
|
|
|
commit("setNew", A2);
|
|
|
|
|
toRouter = arr2;
|
|
|
|
|
} else {
|
|
|
|
|
commit("getNewRouter", arr1)
|
|
|
|
|
commit("setNew", A1)
|
|
|
|
|
toRouter = arr1
|
|
|
|
|
commit("getNewRouter", arr1);
|
|
|
|
|
commit("setNew", A1);
|
|
|
|
|
toRouter = arr1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -221,7 +220,6 @@ const user = {
|
|
|
|
|
commit("SET_TOKEN", "");
|
|
|
|
|
commit("SET_ROLES", []);
|
|
|
|
|
commit("SET_PERMISSIONS", []);
|
|
|
|
|
Cookies.remove('token')
|
|
|
|
|
removeToken();
|
|
|
|
|
resolve();
|
|
|
|
|
})
|
|
|
|
@ -230,15 +228,6 @@ const user = {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 前端 登出
|
|
|
|
|
FedLogOut({ commit }) {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
commit("SET_TOKEN", "");
|
|
|
|
|
removeToken();
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|