index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import store from '@/store/index';
  4. const jwt = require('jsonwebtoken');
  5. const originalPush = VueRouter.prototype.push;
  6. VueRouter.prototype.push = function push(location) {
  7. return originalPush.call(this, location).catch((err) => err);
  8. };
  9. Vue.use(VueRouter);
  10. // 服务机构
  11. const fwjg = [
  12. // 服务机构-用户管理
  13. {
  14. path: '/adminCenter/organization',
  15. name: 'admin_organization',
  16. meta: { title: '企业' },
  17. component: () => import('../views/adminCenter/organization/index.vue'),
  18. },
  19. {
  20. path: '/adminCenter/organization/detail',
  21. name: 'admin_organization_detail',
  22. meta: { title: '企业-信息管理' },
  23. component: () => import('../views/adminCenter/organization/detail.vue'),
  24. },
  25. {
  26. path: '/adminCenter/mechanism',
  27. name: 'admin_mechanism',
  28. meta: { title: '机构' },
  29. component: () => import('../views/adminCenter/mechanism/index.vue'),
  30. },
  31. {
  32. path: '/adminCenter/mechanism/detail',
  33. name: 'admin_mechanism_detail',
  34. meta: { title: '机构-信息管理' },
  35. component: () => import('../views/adminCenter/mechanism/detail.vue'),
  36. },
  37. {
  38. path: '/adminCenter/expert',
  39. name: 'admin_expert',
  40. meta: { title: '专家' },
  41. component: () => import('../views/adminCenter/expert/index.vue'),
  42. },
  43. {
  44. path: '/adminCenter/expert/detail',
  45. name: 'admin_expert_detail',
  46. meta: { title: '专家-信息管理' },
  47. component: () => import('../views/adminCenter/expert/detail.vue'),
  48. },
  49. // 服务机构-技术超市
  50. {
  51. path: '/adminCenter/product',
  52. name: 'admin_product',
  53. meta: { title: '信息发布' },
  54. component: () => import('../views/adminCenter/product/index.vue'),
  55. },
  56. {
  57. path: '/adminCenter/product/detail',
  58. name: 'admin_product_detail',
  59. meta: { title: '信息发布-信息管理' },
  60. component: () => import('../views/adminCenter/product/detail.vue'),
  61. },
  62. {
  63. path: '/adminCenter/patent',
  64. name: 'admin_patent',
  65. meta: { title: '专利' },
  66. component: () => import('../views/adminCenter/patent/index.vue'),
  67. },
  68. {
  69. path: '/adminCenter/patent/detail',
  70. name: 'admin_patent_detail',
  71. meta: { title: '专利-信息管理' },
  72. component: () => import('../views/adminCenter/patent/detail.vue'),
  73. },
  74. // 服务机构-新闻资讯
  75. {
  76. path: '/adminCenter/news',
  77. name: 'admin_news',
  78. meta: { title: '新闻资讯' },
  79. component: () => import('../views/adminCenter/news/index.vue'),
  80. },
  81. {
  82. path: '/adminCenter/news/detail',
  83. name: 'admin_news_detail',
  84. meta: { title: '新闻资讯-信息管理' },
  85. component: () => import('../views/adminCenter/news/detail.vue'),
  86. },
  87. // 服务机构-宣传培训
  88. {
  89. path: '/adminCenter/online',
  90. name: 'admin_online',
  91. meta: { title: '宣传培训' },
  92. component: () => import('../views/adminCenter/online/index.vue'),
  93. },
  94. {
  95. path: '/adminCenter/online/detail',
  96. name: 'admin_online_detail',
  97. meta: { title: '宣传培训-信息管理' },
  98. component: () => import('../views/adminCenter/online/detail.vue'),
  99. },
  100. {
  101. path: '/adminCenter/openinfo',
  102. name: 'admin_openinfo',
  103. meta: { title: '信息公开' },
  104. component: () => import('../views/adminCenter/openinfo/index.vue'),
  105. },
  106. {
  107. path: '/adminCenter/openinfo/detail',
  108. name: 'admin_openinfo_detail',
  109. meta: { title: '信息公开-信息管理' },
  110. component: () => import('../views/adminCenter/openinfo/detail.vue'),
  111. },
  112. {
  113. path: '/adminCenter/online/file',
  114. name: 'admin_online_file',
  115. meta: { title: '线上管理' },
  116. component: () => import('../views/adminCenter/online/file.vue'),
  117. },
  118. // 服务机构-创新券
  119. {
  120. path: '/adminCenter/policy/list',
  121. name: 'admin_policy_list',
  122. meta: { title: '创新券' },
  123. component: () => import('../views/adminCenter/policy/list.vue'),
  124. },
  125. {
  126. path: '/adminCenter/policy/create',
  127. name: 'admin_policy_create',
  128. meta: { title: '创新券-信息管理' },
  129. component: () => import('../views/adminCenter/policy/create.vue'),
  130. },
  131. {
  132. path: '/adminCenter/policy/apply',
  133. name: 'admin_policy_apply',
  134. meta: { title: '创新券-申领管理' },
  135. component: () => import('../views/adminCenter/policy/apply.vue'),
  136. },
  137. {
  138. path: '/adminCenter/policy/apply_check',
  139. name: 'admin_policy_apply_check',
  140. meta: { title: '创新券-申领审核管理' },
  141. component: () => import('../views/adminCenter/policy/apply_check.vue'),
  142. },
  143. {
  144. path: '/adminCenter/policy/apply_info',
  145. name: 'admin_policy_apply_info',
  146. meta: { title: '创新券-申领审核结果管理' },
  147. component: () => import('../views/adminCenter/policy/apply_info.vue'),
  148. },
  149. // 服务机构-订单
  150. {
  151. path: '/adminCenter/order/list',
  152. name: 'admin_order_list',
  153. meta: { title: '服务订单' },
  154. component: () => import('../views/adminCenter/order/list.vue'),
  155. },
  156. {
  157. path: '/adminCenter/order/update',
  158. name: 'admin_order_update',
  159. meta: { title: '修改服务订单' },
  160. component: () => import('../views/adminCenter/order/update.vue'),
  161. },
  162. // 服务机构-高企申报
  163. {
  164. path: '/adminCenter/ticket',
  165. name: 'admin_ticket',
  166. meta: { title: '高企申报' },
  167. component: () => import('../views/adminCenter/ticket/index.vue'),
  168. },
  169. {
  170. path: '/adminCenter/ticket/detail',
  171. name: 'admin_ticket_detail',
  172. meta: { title: '高企申报-信息管理' },
  173. component: () => import('../views/adminCenter/ticket/detail.vue'),
  174. },
  175. {
  176. path: '/adminCenter/ticket/toGrant',
  177. name: 'admin_ticket_toGrant',
  178. meta: { title: '高企申报认定' },
  179. component: () => import('../views/adminCenter/ticket/toGrant.vue'),
  180. },
  181. ];
  182. // 企业
  183. const qy = [
  184. // 企业-基本信息
  185. {
  186. path: '/adminCenter/company/basic',
  187. name: 'company_basic_index',
  188. meta: { title: '企业基本信息' },
  189. component: () => import('../views/adminCenter/company/basic/index.vue'),
  190. },
  191. // 企业-信息发布
  192. {
  193. path: '/adminCenter/company/product',
  194. name: 'company_product_index',
  195. meta: { title: '信息发布' },
  196. component: () => import('../views/adminCenter/company/product/index.vue'),
  197. },
  198. {
  199. path: '/adminCenter/company/product/detail',
  200. name: 'company_product_index',
  201. meta: { title: '信息发布-信息管理' },
  202. component: () => import('../views/adminCenter/company/product/detail.vue'),
  203. },
  204. // 企业-高企申报
  205. {
  206. path: '/adminCenter/company/cognizance',
  207. name: 'company_cognizance_index',
  208. meta: { title: '高企申报' },
  209. component: () => import('../views/adminCenter/company/cognizance/index.vue'),
  210. },
  211. {
  212. path: '/adminCenter/company/cognizance/detail',
  213. name: 'company_cognizance_detail',
  214. meta: { title: '高企申报-信息管理' },
  215. component: () => import('../views/adminCenter/company/cognizance/detail.vue'),
  216. },
  217. {
  218. path: '/adminCenter/company/cognizance/info',
  219. name: 'company_cognizance_info',
  220. meta: { title: '高企申报-查看审核' },
  221. component: () => import('../views/adminCenter/company/cognizance/info.vue'),
  222. },
  223. // 企业-创新券申领
  224. {
  225. path: '/adminCenter/company/coupons',
  226. name: 'company_coupons_index',
  227. meta: { title: '创新券申领' },
  228. component: () => import('../views/adminCenter/company/coupons/index.vue'),
  229. },
  230. {
  231. path: '/adminCenter/company/coupons/detail',
  232. name: 'company_coupons_detail',
  233. meta: { title: '创新券申领-信息管理' },
  234. component: () => import('../views/adminCenter/company/coupons/detail.vue'),
  235. },
  236. {
  237. path: '/adminCenter/company/policyApply/index',
  238. name: 'company_policyApply_index',
  239. meta: { title: '创新券申领-审核结果' },
  240. component: () => import('../views/adminCenter/company/policy_apply/index.vue'),
  241. },
  242. {
  243. path: '/adminCenter/company/policyApply/info',
  244. name: 'company_policyApply_info',
  245. meta: { title: '创新券申领-审核信息结果' },
  246. component: () => import('../views/adminCenter/company/policy_apply/apply_info.vue'),
  247. },
  248. // 企业-服务订单
  249. {
  250. path: '/adminCenter/company/policyApply/order',
  251. name: 'company_policyApply_order',
  252. meta: { title: '服务订单' },
  253. component: () => import('../views/adminCenter/company/policy_apply/order_apply.vue'),
  254. },
  255. {
  256. path: '/adminCenter/company/policyApply/orderIndex',
  257. name: 'company_policyApply_orderIndex',
  258. meta: { title: '服务订单-审核结果' },
  259. component: () => import('../views/adminCenter/company/policy_apply/order_index.vue'),
  260. },
  261. ];
  262. // 机构
  263. const jg = [
  264. // 机构-基本信息
  265. {
  266. path: '/adminCenter/inter/basic',
  267. name: 'inter_basic_index',
  268. meta: { title: '机构基本信息' },
  269. component: () => import('../views/adminCenter/inter/basic/index.vue'),
  270. },
  271. // 机构-高企申报
  272. {
  273. path: '/adminCenter/inter/ticket',
  274. name: 'inter_ticket_index',
  275. meta: { title: '高企申报审核管理' },
  276. component: () => import('../views/adminCenter/inter/ticket/index.vue'),
  277. },
  278. {
  279. path: '/adminCenter/inter/ticket/detail',
  280. name: 'inter_ticket_detail',
  281. meta: { title: '高企申报-信息审核管理' },
  282. component: () => import('../views/adminCenter/inter/ticket/detail.vue'),
  283. },
  284. ];
  285. // 专家
  286. const zj = [
  287. // 专家-基本信息
  288. {
  289. path: '/adminCenter/experts/basic',
  290. name: 'experts_basic_index',
  291. meta: { title: '专家基本信息' },
  292. component: () => import('../views/adminCenter/experts/basic/index.vue'),
  293. },
  294. // 专家-信息发布
  295. {
  296. path: '/adminCenter/experts/product',
  297. name: 'experts_product_index',
  298. meta: { title: '信息发布' },
  299. component: () => import('../views/adminCenter/experts/product/index.vue'),
  300. },
  301. {
  302. path: '/adminCenter/experts/product/detail',
  303. name: 'experts_product_detail',
  304. meta: { title: '信息发布-信息管理' },
  305. component: () => import('../views/adminCenter/experts/product/detail.vue'),
  306. },
  307. ];
  308. const web = [
  309. {
  310. path: '/',
  311. name: 'index',
  312. meta: { title: '网站首页' },
  313. component: () => import('../views/index.vue'),
  314. },
  315. // 管理登录
  316. {
  317. path: '/login',
  318. name: 'login',
  319. meta: { title: '管理登录' },
  320. component: () => import('../views/login.vue'),
  321. },
  322. // 网址
  323. {
  324. path: '/website',
  325. name: 'website',
  326. component: () => import('../views/website.vue'),
  327. children: [
  328. {
  329. path: '/news/index',
  330. name: 'news_index',
  331. meta: { title: '新闻咨询' },
  332. component: () => import('../views/news/index.vue'),
  333. },
  334. {
  335. path: '/news/list',
  336. name: 'news_list',
  337. meta: { title: '新闻咨询-列表页' },
  338. component: () => import('../views/news/list.vue'),
  339. },
  340. {
  341. path: '/service/index',
  342. name: 'service_index',
  343. meta: { title: '科技服务' },
  344. component: () => import('../views/service/index.vue'),
  345. },
  346. {
  347. path: '/service/policy',
  348. name: 'service_policy',
  349. meta: { title: '科技服务-高企政策服务' },
  350. component: () => import('../views/service/policy.vue'),
  351. },
  352. {
  353. path: '/service/ticket',
  354. name: 'service_ticket',
  355. meta: { title: '科技服务-高企申报服务' },
  356. component: () => import('../views/service/ticket.vue'),
  357. },
  358. {
  359. path: '/service/register',
  360. name: 'service_register',
  361. meta: { title: '用户注册' },
  362. component: () => import('../views/service/register.vue'),
  363. },
  364. {
  365. path: '/market/index',
  366. name: 'market_index',
  367. meta: { title: '技术超市' },
  368. component: () => import('../views/market/index.vue'),
  369. },
  370. {
  371. path: '/market/list',
  372. name: 'market_list',
  373. meta: { title: '技术超市-列表页' },
  374. component: () => import('../views/market/list.vue'),
  375. },
  376. {
  377. path: '/train/index',
  378. name: 'train_index',
  379. meta: { title: '宣传培训' },
  380. component: () => import('../views/train/index.vue'),
  381. },
  382. {
  383. path: '/dynamic/index',
  384. name: 'dynamic_index',
  385. meta: { title: '数据动态' },
  386. component: () => import('../views/dynamic/index.vue'),
  387. },
  388. ],
  389. },
  390. // 宣传培训详情页
  391. {
  392. path: '/train/detail',
  393. name: 'train_detail',
  394. meta: { title: '宣传培训-详情页' },
  395. component: () => import('../views/train/detail.vue'),
  396. },
  397. // 管理中心
  398. {
  399. path: '/adminCenter/homeIndex',
  400. name: 'adminCenter',
  401. component: () => import('../views/adminCenter/index.vue'),
  402. children: [
  403. {
  404. path: '/adminCenter/homeIndex',
  405. name: 'admin_homeIndex',
  406. meta: { title: '首页' },
  407. component: () => import('../views/adminCenter/homeIndex/index.vue'),
  408. },
  409. ...fwjg,
  410. ...qy,
  411. ...jg,
  412. ...zj,
  413. ],
  414. },
  415. ];
  416. const routes = [...web];
  417. const router = new VueRouter({
  418. mode: 'history',
  419. base: process.env.VUE_APP_ROUTER,
  420. routes,
  421. });
  422. router.beforeEach((to, from, next) => {
  423. document.title = `${to.meta.title} `;
  424. const token = localStorage.getItem('token');
  425. if (to.path == '/adminCenter/homeIndex') {
  426. if (!token) {
  427. next('/login');
  428. } else {
  429. let user = jwt.decode(token);
  430. store.commit('setUser', user, { root: true });
  431. next();
  432. }
  433. } else {
  434. let user = jwt.decode(token);
  435. store.commit('setUser', user, { root: true });
  436. next();
  437. }
  438. });
  439. export default router;