{"remainingRequest":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\reform-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\reform-fvue\\node_modules\\eslint-loader\\index.js??ref--13-0!D:\\jenkins\\workspace\\reform-fvue\\src\\router.js","dependencies":[{"path":"D:\\jenkins\\workspace\\reform-fvue\\src\\router.js","mtime":1685326978145},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\eslint-loader\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.string.starts-with\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.regexp.search\";\nimport _toConsumableArray from \"D:/jenkins/workspace/reform-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport Vue from 'vue';\nimport Router from 'vue-router';\nimport store from '@/store';\nimport NotFound from '@/views/NotFound.vue';\nimport Login from '@/views/Login.vue';\nimport Jump from '@/views/Jump.vue';\nimport MobileAuth from '@/views/MobileAuth.vue';\nimport YKZAuth from '@/views/YKZAuth.vue';\nimport MobileAuthSelf from '@/views/MobileAuthSelf.vue';\nimport req from '@/request.js';\nimport uc from '@/api/uc.js';\nimport { Message } from 'element-ui';\nimport { Loading } from 'element-ui'; //路由\n\nimport mainRouter from '@/module_router.js';\nimport Layout from '@/components/layout/Layout.vue';\nVue.use(Router);\nvar router = new Router({\n mode: 'history',\n base: process.env.BASE_URL,\n routes: [{\n path: '/',\n redirect: {\n name: 'login'\n }\n }, {\n path: '/login',\n name: 'login',\n component: Login,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/Jump',\n name: 'Jump',\n component: Jump,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/MobileAuth',\n name: 'MobileAuth',\n component: MobileAuth,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/YKZAuth',\n name: 'YKZAuth',\n component: YKZAuth,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/MobileAuthSelf',\n name: 'MobileAuthSelf',\n component: MobileAuthSelf,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/resetPwdView',\n name: 'resetPwdView',\n props: true,\n component: function component() {\n return import('@/views/ResetPwdView.vue');\n },\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '*',\n component: NotFound,\n meta: {\n single: true\n }\n }, {\n path: '/MajorProjectsView',\n name: 'MajorProjectsView',\n component: function component() {\n return import('@/views/BigScreen/MajorProjectsView.vue');\n }\n }, // {\n // path: '/MajorProjectsViewDataFinish',\n // name: 'MajorProjectsViewDataFinish',\n // component: () => import('@/views/BigScreen/MajorProjectsViewDataFinish.vue')\n // },\n {\n path: '/MajorProjectsSubView',\n name: 'MajorProjectsSubView',\n component: function component() {\n return (// import('@/views/BigScreen/MajorProjectsSubView/index.vue')\n import('@/views/BigScreen/MajorProjectsSubView.vue')\n );\n }\n }, {\n path: '/DistrictReformView',\n name: 'DistrictReformView',\n component: function component() {\n return import('@/views/BigScreen/DistrictReformView.vue');\n }\n }, {\n path: '/DistrictReformSubView',\n name: 'DistrictReformSubView',\n component: function component() {\n return import('@/views/BigScreen/DistrictReformSubView.vue');\n }\n }, {\n path: '/DetailComponent',\n name: 'DetailComponent',\n component: function component() {\n return import('@/views/BigScreen/DetailComponentPage.vue');\n }\n }, {\n path: '/MajorProjectsMobile',\n name: 'MajorProjectsMobile',\n component: function component() {\n return import('@/views/MobileScreen/MajorProjectsMobile.vue');\n }\n }, {\n path: '/DistrictReformMobile',\n name: 'DistrictReformMobile',\n component: function component() {\n return import('@/views/MobileScreen/DistrictReformMobile.vue');\n }\n }, {\n path: '/platLayout',\n name: 'platLayout',\n component: Layout,\n meta: {\n single: true,\n anonymous: true\n },\n children: [{\n path: 'PersonalInfo',\n name: 'PersonalInfoInner',\n props: true,\n component: function component() {\n return import('@/views/PersonalInfo.vue');\n }\n }, {\n path: 'resetPwdView',\n name: 'resetPwdViewInner',\n props: true,\n component: function component() {\n return import('@/views/ResetPwdView.vue');\n }\n }].concat(_toConsumableArray(mainRouter))\n }]\n});\n\nvar createRouter = function createRouter() {\n return new Router({\n mode: 'history',\n routes: []\n });\n}; //重写动态添加路由方法\n\n\nrouter.$addRoutes = function (params) {\n var newRouter = createRouter();\n router.matcher = newRouter.matcher; //重置路由规则\n\n router.addRoutes(params); // 添加路由\n}; //动态新增二级路由\n\n\nrouter.addList = function (path, list) {\n var isAddPath = false;\n var isChildren = false;\n return isChildren;\n};\n\nvar registerRouteFresh = true;\n\nvar ssoRedirect = function ssoRedirect() {\n if (window.ssoConfig.mode == 'cas') {\n var service = window.location.href;\n localStorage.setItem('service', service);\n window.location.href = window.ssoConfig.url + '?service=' + service;\n } else if (window.ssoConfig.mode == 'oauth') {\n if (!window.ssoConfig.clientId) {\n throw 'oauth模式下必须提供clientId';\n }\n\n var _service = window.location.href;\n localStorage.setItem('service', _service);\n window.location.href = \"\".concat(window.ssoConfig.url, \"?response_type=code&client_id=\").concat(window.ssoConfig.clientId, \"&redirect_uri=\").concat(_service);\n }\n};\n\nvar handelShortUrl = function handelShortUrl(to, from, next) {\n req.get('${portal}/portal/shorturlManage/v1/getLongUrlByShortUrl?shortUrl=' + to.fullPath.substr(1), '', false).then(function (resp) {\n if (resp && resp.data && resp.data.state) {\n store.dispatch('login/validAndCompletedCurrent', resp.data.value.guestToken).then(function () {\n next({\n path: resp.data.value.url\n });\n }).catch(function () {\n logoutAndCleanUp(to, from, next);\n });\n } else {\n next({\n path: '/messageFillPage/' + resp.data.message\n });\n }\n }).catch(function () {\n logoutAndCleanUp(to, from, next);\n });\n};\n\nvar logoutAndCleanUp = function logoutAndCleanUp(to, from, next) {\n store.dispatch('login/logoutAndCleanUp').then(function () {\n if (window.ssoConfig.mode && window.ssoConfig.mode != 'jwt' && !ticket) {\n ssoRedirect();\n } else if (!window.ssoConfig.mode || window.ssoConfig.mode == 'jwt') {\n next({\n path: '/login',\n query: {\n redirect: to.fullPath\n }\n });\n } else {\n throw '登录失败';\n }\n });\n}; // 移除url后面的指定参数\n\n\nvar removeUrlParams = function removeUrlParams(param) {\n var query = window.location.search.substring(1);\n\n if (!query) {\n return;\n }\n\n var vars = query.split('&');\n var newVars = [];\n\n for (var i = 0; i < vars.length; i++) {\n var pair = vars[i].split('=');\n\n if (pair[0] != param) {\n newVars.push(vars[i]);\n }\n }\n\n console.log(newVars);\n setTimeout(function () {\n var path = \"\".concat(window.location.pathname).concat(newVars.length > 0 ? '?' : '').concat(newVars.join('&'));\n window.history.replaceState(null, null, path);\n }, 1000);\n};\n\nvar ykzLogin = function ykzLogin(code, type, next) {\n store.dispatch('login/loginByYKZ', code).then(function (user) {\n if (user.state === undefined) {\n if (user.loginStatus) {\n store.dispatch('login/getAllDict');\n store.dispatch('menu/actionFrontMenus').then(function (res) {\n if (type) {\n next({\n path: '/MajorProjectsMobile'\n });\n } else {\n var path = '';\n var dataArr = res && res.filter(function (item) {\n return item.alias === 'bigScreen';\n });\n\n if (dataArr && dataArr.length !== 0) {\n if (dataArr[0].children.length !== 0) {\n path = \"/\".concat(dataArr[0].children[0].alias);\n }\n } else {\n var dataMenus = res && res.filter(function (item) {\n return item.alias === 'normal';\n });\n\n if (dataMenus && dataMenus.length !== 0) {\n if (dataMenus[0].children.length !== 0) {\n path = \"/platLayout/\".concat(dataMenus[0].children[0].children[0].alias);\n } else {\n path = \"/platLayout/\".concat(dataMenus[0].children[0].alias);\n }\n }\n }\n\n next({\n path: path\n });\n }\n });\n } else {\n var route = {\n name: 'YKZAuth',\n query: {\n binding: true\n },\n params: {\n account: user.account,\n openid: user.openid\n }\n };\n if (type) route.query.type = type;\n next(route);\n }\n } else if (user.state === false) {\n var _route = {\n path: '/YKZAuth',\n query: {\n msg: user.message\n }\n };\n if (type) _route.query.type = type;\n next(_route);\n }\n });\n};\n\nvar tokenLogin = function tokenLogin(userInfo, type, next) {\n store.dispatch('login/loginByPrincipal', userInfo).then(function (loginStatus) {\n if (loginStatus && loginStatus == true) {\n store.dispatch('login/getAllDict');\n store.dispatch('menu/actionFrontMenus').then(function (res) {\n if (type) {\n next({\n path: '/MajorProjectsMobile'\n });\n } else {\n next({\n path: \"/\".concat(res[0].children[0].alias)\n });\n }\n });\n }\n });\n};\n\nrouter.beforeEach(function (to, from, next) {\n // 愉快政单点登录\n if (to.name == 'YKZAuth' && to.query.auth_code) {\n var code = to.query.auth_code; // 愉快政登录code\n\n var type = to.query.type; // 愉快政跳转类型, 移动端或者pc\n\n ykzLogin(code, type, next);\n } // 大屏跳转\n\n\n if (to.name == 'Jump' && to.query.tokenKey) {\n var _type = to.query.type;\n tokenLogin({\n account: 'guest',\n password: '123456'\n }, _type, next);\n }\n\n store.dispatch('menu/getAllmenus', {}).then(function (menus) {\n //href菜单不进这段代码\n if (to.fullPath.indexOf('href') == -1) {\n var alias = to.fullPath.split('/')[1];\n\n for (var i = 0; i < menus.length; i++) {\n if (menus[i].alias === alias) {\n store.dispatch('menu/getCurrentMenu', {\n alias: menus[i].alias,\n name: menus[i].name\n });\n break;\n }\n }\n }\n });\n\n if (to.fullPath.startsWith('/surl/')) {\n handelShortUrl(to, from, next);\n return;\n } // 1.当前为单点登录模式,且要路由到login页面,则做单点登录重定向;\n\n\n if (to.name == 'login' && window.ssoConfig.mode && window.ssoConfig.mode != 'jwt') {\n // 单点登录时如果已经携带了code或者ticket时,如果是/login路径需要跳转到默认页面(解决反复跳转的问题)\n if ((window.ssoConfig.mode == 'cas' || window.ssoConfig.mode == 'oauth') && (to.query.code || to.query.ticket)) {\n window.location.href = window.location.href.replace('/login', '');\n return;\n } else {\n ssoRedirect();\n }\n }\n\n if (from.name != 'defStart' || to.name != 'instStart') {\n sessionStorage.removeItem('formImportTempRefId');\n sessionStorage.removeItem('formImportTempJson');\n }\n\n if (sessionStorage.menu_alias && to.fullPath && to.fullPath.split('/')[1] == 'home') {\n sessionStorage.menu_alias = '';\n }\n\n if (to.matched.some(function (record) {\n return !record.meta.anonymous;\n })) {\n var _ticket = to.query.token; // 2.当前已经从单点页面重定向回来了,且在url地址中携带了ticket或code;\n\n if (window.ssoConfig.mode == 'cas') {\n _ticket = to.query.ticket;\n } else if (window.ssoConfig.mode == 'oauth') {\n _ticket = to.query.code;\n }\n\n store // 3.携带ticket做用户鉴权;\n .dispatch('login/validAndCompletedCurrent', _ticket).then(function () {\n store._vm.$root.$emit('login-completed');\n\n if (registerRouteFresh) {\n if (sessionStorage.menu_alias) {\n var path = '/' + sessionStorage.menu_alias;\n var isChildren = router.addList(path, router.options.routes); //动态新增二级路由\n //当前点击菜单的路由别名不存在 router.js 里面\n // if (!isChildren) {\n // let alias_new = {\n // path: path,\n // name: 'alias_new',\n // component: resolve =>\n // require(['@/views/menuContent.vue'], resolve),\n // children: []\n // }\n // router.options.routes.push(alias_new)\n // router.addList(path, router.options.routes) //动态新增二级路由\n // }\n\n router.replace({\n path: to.path,\n query: to.query\n });\n }\n\n registerRouteFresh = false;\n }\n\n next(); // url地址带token的方式认证成功后删除url中的token\n // removeUrlParams('tokenKey')\n }).catch(function () {\n // 4.鉴权失败时根据当前模式重定向到对应页面。\n logoutAndCleanUp(to, from, next);\n });\n } else {\n next();\n }\n});\nexport default router;",null]}