import config from "@/config"
import tool from "@/utils/tool";


var dashboard = "/";
var userType = tool.data.get("USER_TYPE");
if (!userType) {
	dashboard = "/dashboard";
}
if (userType == 1) {
	dashboard = "/manage/dashboard";
} else if (userType == 2) {
	dashboard = "/merchant/dashboard";
} else if (userType == 3) {
	dashboard = "/store/dashboard";
} else if (userType == 4) {
	dashboard = "/factory/dashboard";
}

//系统路由
const routes = [
	{
		name: "layout",
		path: "/",
		component: () => import(/* webpackChunkName: "layout" */ '@/layout'),
		redirect: config.DASHBOARD_URL || dashboard,
		children: []
	},
	{
		path: "/login",
		component: () => import(/* webpackChunkName: "login" */ '@/views/login'),
		meta: {
			title: "登录"
		}
	},
	{
		path: "/forget",
		component: () => import(/* webpackChunkName: "resetPassword" */ '@/views/login/forget'),
		meta: {
			title: "重置密码"
		}
	}
]

export default routes;
