
import index from './modules/index';
import order from './modules/order';
import setting from './modules/setting';
import product from './modules/product';
import BasicLayout from '@/layouts/basic-layout';
import frameOut from './modules/frameOut';
import capital from './modules/capital';
import Setting from '@/setting';


/**
 * 在主框架内显示
 */

const frameIn = [{
		path: '/',
		meta: {
			title: '百达福生'
		},
		redirect: {
			name: 'home_index'
		},
		component: BasicLayout,
		children: [
			
			// 刷新页面 必须保留
			{
				path: 'refresh',
				name: 'refresh',
				hidden: true,
				component: {
					beforeRouteEnter(to, from, next) {
						next(instance => instance.$router.replace(from.fullPath));
					},
					render: h => h()
				}
			},
			// 页面重定向 必须保留
			{
				path: 'redirect/:route*',
				name: 'redirect',
				hidden: true,
				component: {
					beforeRouteEnter(to, from, next) {
						next(instance => instance.$router.replace(JSON.parse(from.params.route)));
					},
					render: h => h()
				}
			}
		]
	},
  {
    path: Setting.roterPre,
    redirect: {
			name: 'home_index'
		}
  },
	// {
	//     path: '/store/system/user',
	//     name: `systemUser`,
	//     meta: {
	//         auth: true,
	//         title: '个人中心'
	//     },
	//     component: () => import('@/pages/setting/user/index')
	// },
	{
		path: '/store/system.User/list.html',
		name: `changeUser`,
		meta: {
			title: '选择用户'
		},
		component: () => import('@/components/userList/index')
	},
	{
		path: '/supplier/widget.images/index.html',
		name: `images`,
		meta: {
			auth: true,
			title: '上传图片'
		},
		component: () => import('@/components/uploadPictures/widgetImg')
	},
	index,
	order,
	setting,
	product,
	capital
];

/**
 * 在主框架之外显示
 */
const pre = 'kefu_';

const frameOuts = frameOut;




/**
 * 错误页面
 */

const errorPage = [
	{
        path: `${Setting.roterPre}/other`,
        name: 'other',
        meta: {
            title: 'other'
        },
        component: () => import('@/pages/system/error/other')
    },{
		path: `${Setting.roterPre}/403`,
		name: '403',
		meta: {
			title: '403'
		},
		component: () => import('@/pages/system/error/403')
	},
	{
		path: `${Setting.roterPre}/500`,
		name: '500',
		meta: {
			title: '500'
		},
		component: () => import('@/pages/system/error/500')
	},
	{
		path: `${Setting.roterPre}/*`,
		name: '404',
		meta: {
			title: '404'
		},
		component: () => import('@/pages/system/error/404')
	}
];

// 导出需要显示菜单的
export const frameInRoutes = frameIn;

// 重新组织后导出
export default [
	...frameIn,
	...frameOuts,
	...errorPage
];
