Commit fb799d06 authored by 周远喜's avatar 周远喜

okk

parent 2c1ac014
......@@ -37,7 +37,6 @@ export default {
watch: {
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
$route(to, from) {
console.warn("to,from", to, from, menuSider);
let path = to.matched[to.matched.length - 1].path;
if (!Setting.dynamicSiderMenu) {
let headerName = getHeaderName(path, menuSider);
......@@ -56,8 +55,15 @@ export default {
const openNames = getSiderSubmenu(path, menuSider);
this.$store.commit("admin/menu/setOpenNames", openNames);
}
}else{
let menus=this.$store.state.admin.menu.sider
console.warn(menus);
this.$store.commit("admin/menu/setActivePath", to.path);
const openNames = getSiderSubmenu(path, menus);
console.log("openNames",openNames,path)
this.$store.commit("admin/menu/setOpenNames", openNames);
}
// this.appRouteChange(to, from);
this.appRouteChange(to, from);
}
},
methods: {
......@@ -124,6 +130,11 @@ export default {
if (name.charAt(name.length - 1) == "-") {
name = name.substr(0, name.length - 1);
}
datas.meta={
auth:false,
title:datas.title,
closable:true
}
datas.name = name;
if (datas.children != null) {
this.toMenu(datas.children);
......
......@@ -94,6 +94,7 @@ export default {
this.$store.dispatch("admin/user/set", user, { root: true });
// 用户登录后从持久化数据加载一系列的设置
this.$store.dispatch("load");
this.$store.commit('setUserInfo',user);
}
}
};
......
......@@ -143,7 +143,8 @@ import PhotosensitiveDetails from './components/photosensitiveDetails.vue' //报
import MetalQuotationGeneration from './components/metalQuotationGeneration.vue' //生成报价单弹框
import PhotosensitiveGeneration from './components/photosensitiveGeneration.vue' //生成报价单弹框
var userId = JSON.parse(sessionStorage.getItem('userInfo')).userId
var userId = 1;
// var userId = JSON.parse(sessionStorage.getItem('userInfo')).userId
export default {
components: {
DrawerSet,
......
......@@ -24,6 +24,7 @@ function errorLog (err) {
// 打印到控制台
if (process.env.NODE_ENV === 'development') {
util.log.error('>>>>>> Error >>>>>>');
console.warn(err.response);
console.log(err);
}
// 显示提示,可配置使用 iView 的 $Message 还是 $Notice 组件来显示
......@@ -133,6 +134,7 @@ service.interceptors.response.use(
}
}
errorLog(error);
// console.warn("Erro:",error)
return Promise.reject(error);
}
);
......
......@@ -41,7 +41,6 @@ export default ({
if (Setting.showProgressBar) iView.LoadingBar.finish();
// 多页控制 打开新的页面
store.dispatch('admin/page/open', to);
console.info("log",to)
// 更改标题
util.title({
title: to.meta.title
......
......@@ -3,6 +3,7 @@ import Api from '@/plugins/request'
export const state=()=>({
counter:0,
dictionary: new Map(),//所有字典项
userMap:[],//所有用户缓存;
})
export const getters={
dictionaryByKey: (state) => (key) => {
......@@ -13,18 +14,47 @@ export const getters={
return items;
}
return result;
},
getUser:state=>key=>{
// try{
// if(state.userMap.has(key)){
// return state.userMap.get(key);
// }
// }catch(e){
// console.log(e);
// }
let user=state.userMap.filter(u=>{return u.id==key});
if(user.length>0){
return user[0]
}else{
return null;
}
}
}
export const mutations={
increment(state){
state.counter++
},
setUserInfo(state, userInfo) {
state.userInfo = userInfo;
sessionStorage.setItem("userInfo", JSON.stringify(userInfo));
sessionStorage.setItem("token", userInfo.token);
},
addUser(state,user){
state.userMap.push(user);
},
setDictionary(state, dictionary) {
state.dictionary = dictionary;
},
}
export const actions={
async loadUser({commit},key){
let { result } = await this.$api.get(`${systemUrl}/user/getuser`,{id:key});
console.warn("result",result)
commit("addUser",result);
},
async loadDictionary({ commit }) {
let url = `${systemUrl}/Dictionary/GetAll`
let { result } = await Api.get(url);
......
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