解决冲突
This commit is contained in:
		
							parent
							
								
									25b403cde9
								
							
						
					
					
						commit
						6e737a3fa7
					
				@ -7,7 +7,6 @@ var BASE = {
 | 
				
			|||||||
      buyer: "http://localhost:8888",
 | 
					      buyer: "http://localhost:8888",
 | 
				
			||||||
      seller: "http://localhost:8889",
 | 
					      seller: "http://localhost:8889",
 | 
				
			||||||
      manager: "http://localhost:8887"
 | 
					      manager: "http://localhost:8887"
 | 
				
			||||||
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    API_PROD: {
 | 
					    API_PROD: {
 | 
				
			||||||
      common: "https://common-api.pickmall.cn",
 | 
					      common: "https://common-api.pickmall.cn",
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,10 @@ export const getHomeNotice = params => {
 | 
				
			|||||||
  return getRequest("/other/article/getByPage?type=STORE_ARTICLE&pageSize=15");
 | 
					  return getRequest("/other/article/getByPage?type=STORE_ARTICLE&pageSize=15");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 获取全部权限数据
 | 
				
			||||||
 | 
					export const getCurrentPermissionList = (params) => {
 | 
				
			||||||
 | 
					  return getRequest("/menu/memberMenu", params);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 登陆
 | 
					// 登陆
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@ import { getCurrentPermissionList } from "@/api/index";
 | 
				
			|||||||
import lazyLoading from './lazyLoading.js';
 | 
					import lazyLoading from './lazyLoading.js';
 | 
				
			||||||
import Cookies from "js-cookie";
 | 
					import Cookies from "js-cookie";
 | 
				
			||||||
import { result } from './routerJson.js';
 | 
					import { result } from './routerJson.js';
 | 
				
			||||||
 | 
					import { getCurrentPermissionList } from "@/api/index";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const config = require('@/config/index')
 | 
					const config = require('@/config/index')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -330,19 +331,18 @@ util.initRouter = function (vm) { // 初始化路由
 | 
				
			|||||||
    if (!vm.$store.state.app.added) {
 | 
					    if (!vm.$store.state.app.added) {
 | 
				
			||||||
        // 加载菜单
 | 
					        // 加载菜单
 | 
				
			||||||
        getCurrentPermissionList().then(res => {
 | 
					        getCurrentPermissionList().then(res => {
 | 
				
			||||||
 | 
					            console.log(res)
 | 
				
			||||||
            if (!res.success) return false; 
 | 
					            if (!res.success) return false; 
 | 
				
			||||||
          let menuData = result;
 | 
					                let menuData = res.result;
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // 格式化数据,设置 空children 为 null
 | 
					                // 格式化数据,设置 空children 为 null
 | 
				
			||||||
                for (let i = 0; i < menuData.length; i++) {
 | 
					                for (let i = 0; i < menuData.length; i++) {
 | 
				
			||||||
            let t = menuData[i].children;
 | 
					                    let t = menuData[i].children
 | 
				
			||||||
                    for (let k = 0; k < t.length; k++) {
 | 
					                    for (let k = 0; k < t.length; k++) {
 | 
				
			||||||
                        let tt = t[k].children;
 | 
					                        let tt = t[k].children;
 | 
				
			||||||
                        for (let z = 0; z < tt.length; z++) {
 | 
					                        for (let z = 0; z < tt.length; z++) {
 | 
				
			||||||
                tt[z].children = null;
 | 
					                            tt[z].children = null
 | 
				
			||||||
                            // 给所有三级路由添加字段,显示一级菜单name,方便点击页签时的选中筛选
 | 
					                            // 给所有三级路由添加字段,显示一级菜单name,方便点击页签时的选中筛选
 | 
				
			||||||
                tt[z].firstRouterName = menuData[i].name;
 | 
					                            tt[z].firstRouterName = menuData[i].name
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -352,20 +352,15 @@ util.initRouter = function (vm) { // 初始化路由
 | 
				
			|||||||
                util.initAllMenuData(constRoutes, menuData);
 | 
					                util.initAllMenuData(constRoutes, menuData);
 | 
				
			||||||
                util.initRouterNode(otherRoutes, otherRouter);
 | 
					                util.initRouterNode(otherRoutes, otherRouter);
 | 
				
			||||||
                // 添加所有主界面路由
 | 
					                // 添加所有主界面路由
 | 
				
			||||||
          vm.$store.commit(
 | 
					                vm.$store.commit('updateAppRouter', constRoutes.filter(item => item.children.length > 0));
 | 
				
			||||||
            "updateAppRouter",
 | 
					 | 
				
			||||||
            constRoutes.filter(item => item.children.length > 0)
 | 
					 | 
				
			||||||
          );
 | 
					 | 
				
			||||||
                // 添加全局路由
 | 
					                // 添加全局路由
 | 
				
			||||||
          vm.$store.commit("updateDefaultRouter", otherRoutes);
 | 
					                vm.$store.commit('updateDefaultRouter', otherRoutes);
 | 
				
			||||||
                // 添加菜单路由
 | 
					                // 添加菜单路由
 | 
				
			||||||
                util.initMenuData(vm, menuData);
 | 
					                util.initMenuData(vm, menuData);
 | 
				
			||||||
                // 缓存数据 修改加载标识
 | 
					                // 缓存数据 修改加载标识
 | 
				
			||||||
          window.localStorage.setItem("menuData", JSON.stringify(menuData));
 | 
					                window.localStorage.setItem('menuData', JSON.stringify(menuData));
 | 
				
			||||||
          vm.$store.commit("setAdded", true);
 | 
					                vm.$store.commit('setAdded', true);
 | 
				
			||||||
        });
 | 
					        })
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        // 读取缓存数据
 | 
					        // 读取缓存数据
 | 
				
			||||||
        let data = window.localStorage.getItem('menuData');
 | 
					        let data = window.localStorage.getItem('menuData');
 | 
				
			||||||
@ -384,7 +379,8 @@ util.initAllMenuData = function (constRoutes, data) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    let allMenuData = [];
 | 
					    let allMenuData = [];
 | 
				
			||||||
    data.forEach(e => {
 | 
					    data.forEach(e => {
 | 
				
			||||||
        if (e.type == -1) {
 | 
					        if (e.level == 0) {
 | 
				
			||||||
 | 
					            console.log(e)
 | 
				
			||||||
            e.children.forEach(item => {
 | 
					            e.children.forEach(item => {
 | 
				
			||||||
                allMenuData.push(item);
 | 
					                allMenuData.push(item);
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
@ -453,8 +449,8 @@ util.initRouterNode = function (routers, data) {  // data为所有子菜单数
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (var item of data) {
 | 
					    for (var item of data) {
 | 
				
			||||||
        let menu = Object.assign({}, item);
 | 
					        let menu = Object.assign({}, item);
 | 
				
			||||||
        menu.component = lazyLoading(menu.component);
 | 
					        menu.component = lazyLoading(menu.frontRoute);
 | 
				
			||||||
 | 
					        console.log(menu.component);
 | 
				
			||||||
        if (item.children && item.children.length > 0) {
 | 
					        if (item.children && item.children.length > 0) {
 | 
				
			||||||
            menu.children = [];
 | 
					            menu.children = [];
 | 
				
			||||||
            util.initRouterNode(menu.children, item.children);
 | 
					            util.initRouterNode(menu.children, item.children);
 | 
				
			||||||
@ -462,7 +458,7 @@ util.initRouterNode = function (routers, data) {  // data为所有子菜单数
 | 
				
			|||||||
        let meta = {};
 | 
					        let meta = {};
 | 
				
			||||||
        // 给页面添加标题
 | 
					        // 给页面添加标题
 | 
				
			||||||
        meta.title = menu.title ? menu.title + " - " + config.title + "商家后台" : null;
 | 
					        meta.title = menu.title ? menu.title + " - " + config.title + "商家后台" : null;
 | 
				
			||||||
        meta.firstRouterName = menu.firstRouterName
 | 
					        meta.firstRouterName = item.firstRouterName
 | 
				
			||||||
        meta.keepAlive = menu.keepAlive ? true : false
 | 
					        meta.keepAlive = menu.keepAlive ? true : false
 | 
				
			||||||
        menu.meta = meta;
 | 
					        menu.meta = meta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user