{"remainingRequest":"D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\eslint-loader\\index.js??ref--13-0!D:\\jenkins\\workspace\\ljzc-fvue\\src\\router.js","dependencies":[{"path":"D:\\jenkins\\workspace\\ljzc-fvue\\src\\router.js","mtime":1701311301319},{"path":"D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\ljzc-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\ljzc-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 \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"D:/jenkins/workspace/ljzc-fvue/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport \"core-js/modules/es6.array.find\";\nimport \"core-js/modules/es7.array.includes\";\nimport \"core-js/modules/es6.string.includes\";\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/ljzc-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/index.vue';\nimport Jump from '@/views/Jump.vue';\nimport NoAuth from '@/views/NoAuth.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 qs from 'qs';\nimport uc from '@/api/uc.js';\nimport { Message } from 'element-ui';\nimport { Loading } from 'element-ui';\nvar noRightPath = 'http://23.99.8.1:8080/fvue/NotFound';\nvar noRightPathMobile = 'http://23.99.8.1:8080/mobilevue/NotFound'; //路由\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: '/JumpDetailComponent',\n name: 'JumpDetailComponent',\n component: Jump,\n meta: {\n single: true,\n anonymous: true\n }\n }, {\n path: '/NoAuth',\n name: 'NoAuth',\n component: NoAuth,\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: '/DistrictReformView',\n name: 'DistrictReformView',\n component: function component() {\n return import('@/views/BigScreen/DistrictReformView.vue');\n }\n }, {\n path: '/MunicipalReform',\n name: 'MunicipalReform',\n component: function component() {\n return import('@/views/BigScreen/MunicipalReform.vue');\n }\n }, {\n path: '/ProvincialReform',\n name: 'ProvincialReform',\n component: function component() {\n return import('@/views/BigScreen/ProvincialReform.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: () =>\n // // import('@/views/BigScreen/MajorProjectsSubView/index.vue')\n // import('@/views/BigScreen/MajorProjectsSubView.vue')\n // },\n // {\n // path: '/DistrictReformSubView',\n // name: 'DistrictReformSubView',\n // component: () => import('@/views/BigScreen/DistrictReformSubView.vue')\n // },\n // {\n // path: '/DetailComponent',\n // name: 'DetailComponent',\n // component: () => import('@/views/BigScreen/DetailComponentPage.vue'),\n // },\n // {\n // path: '/reportPreview',\n // name: 'reportPreview',\n // component: () => import('@/views/BigScreen/components/subComponents/reportPreview.vue'),\n // },\n // {\n // path: '/MajorProjectsMobile',\n // name: 'MajorProjectsMobile',\n // component: () => import('@/views/MobileScreen/MajorProjectsMobile.vue'),\n // },\n // {\n // path: '/DistrictReformMobile',\n // name: 'DistrictReformMobile',\n // component: () => 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' // query: {\n // redirect: to.fullPath\n // }\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 searchDateOrigin;\n\nvar analysisQuarter = function analysisQuarter(quarter) {\n console.log(quarter, 'quarter');\n searchDateOrigin = sessionStorage.getItem('searchDate');\n console.log(searchDateOrigin, 'searchDateOrigin');\n\n if (quarter) {\n var splitArr = quarter.split('Q');\n var searchDate = {\n year: parseInt(splitArr[0]),\n quarter: parseInt(splitArr[1]),\n month: 3 * splitArr[1] - 2\n };\n sessionStorage.setItem('searchDate', JSON.stringify(searchDate));\n }\n};\n\nvar resetQuarter = function resetQuarter() {\n if (searchDateOrigin) {\n sessionStorage.setItem('searchDate', searchDateOrigin);\n }\n};\n\nvar reportLogin = function reportLogin(ykzEmployeeCode, type, next) {\n var data = qs.stringify({\n ykzEmployeeCode: ykzEmployeeCode\n });\n store.dispatch('login/loginByReports', data).then(function (res) {\n console.log(res.loginStatus);\n\n if (res && res.loginStatus) {\n store.dispatch('login/getAllDict');\n store.dispatch('menu/actionFrontMenus').then(function (res) {\n if (type == 'mobile') {\n next({\n path: '/DistrictReformMobile'\n });\n } else {\n next({\n path: \"/\".concat(res[0].children[0].alias)\n });\n }\n });\n }\n }).catch(function (err) {\n if (type == 'mobile') {\n window.location.href = noRightPathMobile;\n } else {\n window.location.href = noRightPath;\n }\n\n return;\n var route = {\n path: '/NoAuth'\n };\n\n if (type) {\n route.query = {\n type: type\n };\n }\n\n next(route);\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: '/DistrictReformMobile'\n });\n } else {\n next({\n path: \"/\".concat(res[0].children[0].alias)\n });\n }\n });\n }\n });\n};\n\nvar reportDetailLogin = function reportDetailLogin(ykzEmployeeCode, quarter, next, type) {\n var data = qs.stringify({\n ykzEmployeeCode: ykzEmployeeCode\n });\n store.dispatch('login/loginByReports', data).then(function (res) {\n console.log(res.loginStatus);\n\n if (res && res.loginStatus) {\n analysisQuarter(quarter);\n store.dispatch('login/getAllDict');\n store.dispatch('menu/actionFrontMenus').then(function (res) {\n console.log(res);\n\n if (type == 'mobile') {\n next({\n path: '/DistrictReformMobile'\n });\n } else {\n next({\n path: \"/reportPreview\"\n });\n }\n });\n }\n }).catch(function (err) {\n if (type == 'mobile') {\n window.location.href = noRightPathMobile;\n } else {\n window.location.href = noRightPath;\n }\n\n return;\n var route = {\n path: '/NoAuth'\n };\n\n if (type) {\n route.query = {\n type: type\n };\n }\n\n next(route);\n });\n}; // 登录后可以任意访问\n\n\nvar noAuthAfterLogin = [// {\n// alias: \"MajorProjectsMobile\",\n// name: '移动端重大项目'\n// }, {\n// alias: \"DistrictReformMobile\",\n// name: '移动端区县报表'\n// },\n{\n alias: 'PersonalInfoInner',\n name: '个人中心'\n}, {\n alias: 'resetPwdViewInner',\n name: '重置密码'\n}]; // 非后台配置的静态菜单\n\nvar staticMenus = [{\n alias: 'MajorProjectsSubView',\n name: '重大项目子页面',\n parentAlias: 'MajorProjectsView'\n}, {\n alias: 'DistrictReformSubView',\n name: '区县报表子页面',\n parentAlias: 'DistrictReformView'\n}, {\n alias: 'DetailComponent',\n name: '报表下转详情',\n parentAlias: 'bigscreen'\n}, {\n alias: 'ReformProjectDetails',\n name: '自主探索改革项目清单',\n parentAlias: 'worktable'\n}, {\n alias: 'SatisfactionApplication',\n name: '区县满意度表单',\n parentAlias: 'SatisfactionSurveys'\n}, {\n alias: 'SatisfactionApplication',\n name: '区县满意度表单',\n parentAlias: 'SatisfactionAudits'\n}, {\n alias: 'SatisfactionApplication',\n name: '区县满意度表单',\n parentAlias: 'AuditConfirmation'\n}, {\n alias: 'reportPreview',\n name: '报表详情',\n parentAlias: 'bigscreen'\n}];\nvar allAlias = []; // 判断用户菜单中是否拥有当前路由菜单\n\nvar filterUserMenus = function filterUserMenus(to, from, next) {\n return new Promise(function (resolve, reject) {\n store.dispatch('menu/actionFrontMenus').then(function (res) {\n var _menus;\n\n console.log(to);\n var menus = [];\n if (res && res.length) menus = _toConsumableArray(res);\n\n (_menus = menus).push.apply(_menus, noAuthAfterLogin); // 加上不需权限的菜单\n\n\n var targetAlias = to.name;\n console.log(targetAlias);\n allAlias = []; // 遍历当前用户所有菜单 监测权限并收集所有alias\n\n var hasCurrentRouterMenu = menusFilter(menus, targetAlias); // 监测当前菜单是不是静态权限菜单\n\n var targetMenu = staticMenus.filter(function (item) {\n return item.alias.toLowerCase() == targetAlias.toLowerCase();\n });\n\n if (targetMenu.length) {\n // 当前用户是否拥有当前静态权限菜单的父级菜单权限\n hasCurrentRouterMenu = targetMenu.some(function (item) {\n if (allAlias.includes(item.parentAlias.toLowerCase())) {\n return true;\n }\n });\n }\n\n resolve(hasCurrentRouterMenu);\n });\n });\n}; // 遍历查到路由别名是否存在于用户菜单中\n\n\nvar menusFilter = function menusFilter(menuData, alias) {\n var res = menuData.find(function (item) {\n allAlias.push(item.alias.toLowerCase());\n return item.alias.toLowerCase() == alias.toLowerCase();\n });\n\n if (res) {\n return true;\n } else {\n for (var i = 0; i < menuData.length; i++) {\n if (menuData[i].children && menuData[i].children.length) {\n res = menusFilter(menuData[i].children, alias);\n\n if (res) {\n return true;\n }\n }\n }\n\n return false;\n }\n};\n\nrouter.beforeEach( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(to, from, next) {\n var code, type, _type, ykzEmployeeCode, _ykzEmployeeCode, quarter, _ticket, hasMenus;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n console.log(to);\n console.log(to.name, from.name, 'to,from'); // 愉快政单点登录\n\n if (to.name == 'YKZAuth' && to.query.auth_code) {\n code = to.query.auth_code; // 愉快政登录code\n\n type = to.query.type; // 愉快政跳转类型, 移动端或者pc\n\n ykzLogin(code, type, next);\n } // 大屏跳转\n\n\n if (to.name == 'Jump' && to.query.userinfo) {\n _type = to.query.type;\n ykzEmployeeCode = to.query.userinfo;\n reportLogin(ykzEmployeeCode, _type, next);\n } // 报表详跳转\n\n\n if (to.name == 'JumpDetailComponent' && to.query.userinfo) {\n // let type = to.query.type\n _ykzEmployeeCode = to.query.userinfo;\n quarter = to.query.quarter;\n reportDetailLogin(_ykzEmployeeCode, quarter, next // type,\n );\n } // // 大屏跳转\n // if (to.name == 'Jump' && to.query.tokenKey) {\n // let type = to.query.type\n // tokenLogin(\n // {\n // account: 'guest',\n // password: '123456',\n // },\n // type,\n // next\n // )\n // }\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 _context.next = 9;\n break;\n }\n\n handelShortUrl(to, from, next);\n return _context.abrupt(\"return\");\n\n case 9:\n if (!(to.name == 'login' && window.ssoConfig.mode && window.ssoConfig.mode != 'jwt')) {\n _context.next = 16;\n break;\n }\n\n if (!((window.ssoConfig.mode == 'cas' || window.ssoConfig.mode == 'oauth') && (to.query.code || to.query.ticket))) {\n _context.next = 15;\n break;\n }\n\n window.location.href = window.location.href.replace('/login', '');\n return _context.abrupt(\"return\");\n\n case 15:\n ssoRedirect();\n\n case 16:\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 _context.next = 30;\n break;\n }\n\n _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\n hasMenus = true;\n _context.next = 24;\n return filterUserMenus(to, from, next);\n\n case 24:\n hasMenus = _context.sent;\n console.log(hasMenus, 'hasMenus');\n\n if (!hasMenus) {\n //鉴权失败时根据当前模式重定向到对应页面。\n logoutAndCleanUp(to, from, next);\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 _context.next = 31;\n break;\n\n case 30:\n next();\n\n case 31:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function (_x, _x2, _x3) {\n return _ref.apply(this, arguments);\n };\n}());\nexport default router;",null]}