import Vue from 'vue'
import Router from 'vue-router'
import OidcCallback from '@/views/OidcCallback'
import oidcRedirect from '@/views/OidcRedirect'

Vue.use(Router)
import Layout from '../views/layout/Layout'

export const constantRouterMap = [
    {path: '/login', component: () => import('@/views/login/index'), meta: {sortNo: 0}, hidden: true},
    {path: '/register', component: () => import('@/views/login/register'), meta: {sortNo: 0}, hidden: true},
    {path: '/404', component: () => import('@/views/errorPage/404'), meta: {sortNo: 0}, hidden: true},
    {path: '/401', component: () => import('@/views/errorPage/401'), meta: {sortNo: 0}, hidden: true},
    {
        path: '/oidc-callback',
        name: 'oidcCallback',
        component: OidcCallback,
        meta: {
            sortNo: 0,
            isOidcCallback: true,
            isPublic: true
        }
    },
    {
        path: '/oidcRedirect', // oidc临时跳转页面
        name: 'oidcRedirect',
        meta: {sortNo: 0},
        component: oidcRedirect
    },
    {
        path: '/',
        component: Layout,
        redirect: 'dashboard',
        name: 'layout',
        meta: {sortNo: 0},
        children: [{
            path: '/dashboard',
            name: 'dashboard',
            hidden: true,
            meta: {title: '首页', icon: 'zhuyeicon', sortNo: 0}, // iconfont icon-
            // component: () => import('@/views/dashboard/index')
            component:()=>import('@/views/shopsmanage/index.vue')
        }, 
        // {
        //     path: '/interpretation',
        //     name: 'interpretation',
        //     meta: {title: '案件判读', icon: 'zhuyeicon', sortNo: 0}, // iconfont icon-
        //     // component: () => import('@/views/dashboard/index')
        //     component:()=>import('@/views/interpretation/index.vue')
        // },
        {
            path: '/profile',
            name: 'profile',
            hidden: true,
            meta: {title: '个人中心', icon: 'guide', sortNo: 0},
            component: () => import('@/views/usermanager/profile')
        }, {
            path: '/addarticle',
            name: 'addarticle',
            hidden: true,
            meta: {title: '个人中心', icon: 'guide', sortNo: 0},
            component: () => import('@/views/articlemanagement/widget/AddForm')
        }]
    }
]

var router = new Router({
    // mode: 'history', //后端支持可开
    scrollBehavior: () => ({y: 0}),
    routes: constantRouterMap
})

export default router
