index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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/coupons',
  121. name: 'admin_coupons_index',
  122. meta: { title: '创新券' },
  123. component: () => import('../views/adminCenter/coupons/index.vue'),
  124. },
  125. {
  126. path: '/adminCenter/coupons/detail',
  127. name: 'admin_policy_detail',
  128. meta: { title: '创新券-信息管理' },
  129. component: () => import('../views/adminCenter/coupons/detail.vue'),
  130. },
  131. {
  132. path: '/adminCenter/coupons/apply',
  133. name: 'admin_coupons_apply',
  134. meta: { title: '创新券-申领管理' },
  135. component: () => import('../views/adminCenter/coupons/apply.vue'),
  136. },
  137. {
  138. path: '/adminCenter/coupons/apply_check',
  139. name: 'admin_coupons_apply_check',
  140. meta: { title: '创新券-申领审核管理' },
  141. component: () => import('../views/adminCenter/coupons/apply_check.vue'),
  142. },
  143. {
  144. path: '/adminCenter/coupons/apply_info',
  145. name: 'admin_coupons_apply_info',
  146. meta: { title: '创新券-申领审核结果查看' },
  147. component: () => import('../views/adminCenter/coupons/apply_info.vue'),
  148. },
  149. // 服务机构-高企申报
  150. {
  151. path: '/adminCenter/declare',
  152. name: 'admin_declare_index',
  153. meta: { title: '高企申报' },
  154. component: () => import('../views/adminCenter/declare/index.vue'),
  155. },
  156. {
  157. path: '/adminCenter/declare/check',
  158. name: 'admin_declare_check',
  159. meta: { title: '高企申报-申报确认' },
  160. component: () => import('../views/adminCenter/declare/check.vue'),
  161. },
  162. // 服务机构-兑付管理
  163. {
  164. path: '/adminCenter/cashing/coupons',
  165. name: 'admin_cashing_coupons',
  166. meta: { title: '创新券兑付' },
  167. component: () => import('../views/adminCenter/cashing/coupons/index.vue'),
  168. },
  169. {
  170. path: '/adminCenter/cashing/coupons/detail',
  171. name: 'admin_cashing_coupons_detail',
  172. meta: { title: '创新券兑付-审核管理' },
  173. component: () => import('../views/adminCenter/cashing/coupons/detail.vue'),
  174. },
  175. // 服务机构-订单
  176. // {
  177. // path: '/adminCenter/order/list',
  178. // name: 'admin_order_list',
  179. // meta: { title: '服务订单' },
  180. // component: () => import('../views/adminCenter/order/list.vue'),
  181. // },
  182. // {
  183. // path: '/adminCenter/order/update',
  184. // name: 'admin_order_update',
  185. // meta: { title: '修改服务订单' },
  186. // component: () => import('../views/adminCenter/order/update.vue'),
  187. // },
  188. // 服务机构-高企申报
  189. // {
  190. // path: '/adminCenter/ticket',
  191. // name: 'admin_ticket',
  192. // meta: { title: '高企申报' },
  193. // component: () => import('../views/adminCenter/ticket/index.vue'),
  194. // },
  195. // {
  196. // path: '/adminCenter/ticket/detail',
  197. // name: 'admin_ticket_detail',
  198. // meta: { title: '高企申报-信息管理' },
  199. // component: () => import('../views/adminCenter/ticket/detail.vue'),
  200. // },
  201. // {
  202. // path: '/adminCenter/ticket/toGrant',
  203. // name: 'admin_ticket_toGrant',
  204. // meta: { title: '高企申报认定' },
  205. // component: () => import('../views/adminCenter/ticket/toGrant.vue'),
  206. // },
  207. ];
  208. // 企业
  209. const qy = [
  210. // 企业-基本信息
  211. {
  212. path: '/adminCenter/company/basic',
  213. name: 'company_basic_index',
  214. meta: { title: '企业基本信息' },
  215. component: () => import('../views/adminCenter/company/basic/index.vue'),
  216. },
  217. // 企业-信息发布
  218. {
  219. path: '/adminCenter/company/product',
  220. name: 'company_product_index',
  221. meta: { title: '信息发布' },
  222. component: () => import('../views/adminCenter/company/product/index.vue'),
  223. },
  224. {
  225. path: '/adminCenter/company/product/detail',
  226. name: 'company_product_index',
  227. meta: { title: '信息发布-信息管理' },
  228. component: () => import('../views/adminCenter/company/product/detail.vue'),
  229. },
  230. // 企业-创新券申领
  231. {
  232. path: '/adminCenter/company/coupons',
  233. name: 'company_coupons_index',
  234. meta: { title: '创新券' },
  235. component: () => import('../views/adminCenter/company/coupons/index.vue'),
  236. },
  237. {
  238. path: '/adminCenter/company/coupons/apply',
  239. name: 'company_coupons_apply',
  240. meta: { title: '创新券申领' },
  241. component: () => import('../views/adminCenter/company/coupons/apply.vue'),
  242. },
  243. {
  244. path: '/adminCenter/company/coupons/couponsResult',
  245. name: 'company_coupons_couponsResult',
  246. meta: { title: '创新券申领-审核结果' },
  247. component: () => import('../views/adminCenter/company/coupons/couponsResult.vue'),
  248. },
  249. {
  250. path: '/adminCenter/company/coupons/couponsResult_info',
  251. name: 'company_coupons_couponsResult_info',
  252. meta: { title: '创新券申领-审核结果查看' },
  253. component: () => import('../views/adminCenter/company/coupons/couponsResult_info.vue'),
  254. },
  255. // 企业-高企申报
  256. {
  257. path: '/adminCenter/company/declare',
  258. name: 'company_declare_index',
  259. meta: { title: '高企申报' },
  260. component: () => import('../views/adminCenter/company/declare/index.vue'),
  261. },
  262. {
  263. path: '/adminCenter/company/declare/detail',
  264. name: 'company_declare_detail',
  265. meta: { title: '高企申报-信息管理' },
  266. component: () => import('../views/adminCenter/company/declare/detail.vue'),
  267. },
  268. {
  269. path: '/adminCenter/company/declare/info',
  270. name: 'company_declare_info',
  271. meta: { title: '高企申报-审核结果' },
  272. component: () => import('../views/adminCenter/company/declare/info.vue'),
  273. },
  274. // 企业-兑付管理
  275. {
  276. path: '/adminCenter/company/cashing/coupons',
  277. name: 'company_cashing_coupons',
  278. meta: { title: '创新券兑付' },
  279. component: () => import('../views/adminCenter/company/cashing/coupons/index.vue'),
  280. },
  281. {
  282. path: '/adminCenter/company/cashing/coupons/detail',
  283. name: 'company_cashing_coupons_detail',
  284. meta: { title: '创新券兑付-申请兑付' },
  285. component: () => import('../views/adminCenter/company/cashing/coupons/detail.vue'),
  286. },
  287. {
  288. path: '/adminCenter/company/cashing/couponsResult',
  289. name: 'company_cashing_couponsResult',
  290. meta: { title: '创新券兑付' },
  291. component: () => import('../views/adminCenter/company/cashing/coupons/couponsResult.vue'),
  292. },
  293. // // 企业-创新券申领
  294. // {
  295. // path: '/adminCenter/company/coupons',
  296. // name: 'company_coupons_index',
  297. // meta: { title: '创新券申领' },
  298. // component: () => import('../views/adminCenter/company/coupons/index.vue'),
  299. // },
  300. // {
  301. // path: '/adminCenter/company/coupons/detail',
  302. // name: 'company_coupons_detail',
  303. // meta: { title: '创新券申领-信息管理' },
  304. // component: () => import('../views/adminCenter/company/coupons/detail.vue'),
  305. // },
  306. // {
  307. // path: '/adminCenter/company/policyApply/index',
  308. // name: 'company_policyApply_index',
  309. // meta: { title: '创新券申领-审核结果' },
  310. // component: () => import('../views/adminCenter/company/policy_apply/index.vue'),
  311. // },
  312. // {
  313. // path: '/adminCenter/company/policyApply/info',
  314. // name: 'company_policyApply_info',
  315. // meta: { title: '创新券申领-审核信息结果' },
  316. // component: () => import('../views/adminCenter/company/policy_apply/apply_info.vue'),
  317. // },
  318. // // 企业-服务订单
  319. // {
  320. // path: '/adminCenter/company/policyApply/order',
  321. // name: 'company_policyApply_order',
  322. // meta: { title: '服务订单' },
  323. // component: () => import('../views/adminCenter/company/policy_apply/order_apply.vue'),
  324. // },
  325. // {
  326. // path: '/adminCenter/company/policyApply/orderIndex',
  327. // name: 'company_policyApply_orderIndex',
  328. // meta: { title: '服务订单-审核结果' },
  329. // component: () => import('../views/adminCenter/company/policy_apply/order_index.vue'),
  330. // },
  331. ];
  332. // 机构
  333. const jg = [
  334. // 机构-基本信息
  335. {
  336. path: '/adminCenter/inter/basic',
  337. name: 'inter_basic_index',
  338. meta: { title: '机构基本信息' },
  339. component: () => import('../views/adminCenter/inter/basic/index.vue'),
  340. },
  341. // 机构-政策服务
  342. {
  343. path: '/adminCenter/inter/declare',
  344. name: 'inter_declare_index',
  345. meta: { title: '高企申报' },
  346. component: () => import('../views/adminCenter/inter/declare/index.vue'),
  347. },
  348. {
  349. path: '/adminCenter/inter/declare/detail',
  350. name: 'inter_declare_detail',
  351. meta: { title: '高企申报-信息审核' },
  352. component: () => import('../views/adminCenter/inter/declare/detail.vue'),
  353. },
  354. ];
  355. // 专家
  356. const zj = [
  357. // 专家-基本信息
  358. {
  359. path: '/adminCenter/experts/basic',
  360. name: 'experts_basic_index',
  361. meta: { title: '专家基本信息' },
  362. component: () => import('../views/adminCenter/experts/basic/index.vue'),
  363. },
  364. // 专家-信息发布
  365. {
  366. path: '/adminCenter/experts/product',
  367. name: 'experts_product_index',
  368. meta: { title: '信息发布' },
  369. component: () => import('../views/adminCenter/experts/product/index.vue'),
  370. },
  371. {
  372. path: '/adminCenter/experts/product/detail',
  373. name: 'experts_product_detail',
  374. meta: { title: '信息发布-信息管理' },
  375. component: () => import('../views/adminCenter/experts/product/detail.vue'),
  376. },
  377. ];
  378. const web = [
  379. {
  380. path: '/',
  381. name: 'index',
  382. meta: { title: '网站首页' },
  383. component: () => import('../views/index.vue'),
  384. },
  385. // 管理登录
  386. {
  387. path: '/login',
  388. name: 'login',
  389. meta: { title: '管理登录' },
  390. component: () => import('../views/login.vue'),
  391. },
  392. // 网址
  393. {
  394. path: '/website',
  395. name: 'website',
  396. component: () => import('../views/website.vue'),
  397. children: [
  398. {
  399. path: '/news/index',
  400. name: 'news_index',
  401. meta: { title: '新闻咨询' },
  402. component: () => import('../views/news/index.vue'),
  403. },
  404. {
  405. path: '/news/list',
  406. name: 'news_list',
  407. meta: { title: '新闻咨询-列表页' },
  408. component: () => import('../views/news/list.vue'),
  409. },
  410. {
  411. path: '/service/index',
  412. name: 'service_index',
  413. meta: { title: '科技服务' },
  414. component: () => import('../views/service/index.vue'),
  415. },
  416. {
  417. path: '/service/policy',
  418. name: 'service_policy',
  419. meta: { title: '科技服务-高企政策服务' },
  420. component: () => import('../views/service/policy.vue'),
  421. },
  422. {
  423. path: '/service/ticket',
  424. name: 'service_ticket',
  425. meta: { title: '科技服务-高企申报服务' },
  426. component: () => import('../views/service/ticket.vue'),
  427. },
  428. {
  429. path: '/service/register',
  430. name: 'service_register',
  431. meta: { title: '用户注册' },
  432. component: () => import('../views/service/register.vue'),
  433. },
  434. {
  435. path: '/market/index',
  436. name: 'market_index',
  437. meta: { title: '技术超市' },
  438. component: () => import('../views/market/index.vue'),
  439. },
  440. {
  441. path: '/market/list',
  442. name: 'market_list',
  443. meta: { title: '技术超市-列表页' },
  444. component: () => import('../views/market/list.vue'),
  445. },
  446. {
  447. path: '/train/index',
  448. name: 'train_index',
  449. meta: { title: '宣传培训' },
  450. component: () => import('../views/train/index.vue'),
  451. },
  452. {
  453. path: '/dynamic/index',
  454. name: 'dynamic_index',
  455. meta: { title: '数据动态' },
  456. component: () => import('../views/dynamic/index.vue'),
  457. },
  458. ],
  459. },
  460. // 宣传培训详情页
  461. {
  462. path: '/train/detail',
  463. name: 'train_detail',
  464. meta: { title: '宣传培训-详情页' },
  465. component: () => import('../views/train/detail.vue'),
  466. },
  467. // 管理中心
  468. {
  469. path: '/adminCenter/homeIndex',
  470. name: 'adminCenter',
  471. component: () => import('../views/adminCenter/index.vue'),
  472. children: [
  473. {
  474. path: '/adminCenter/homeIndex',
  475. name: 'admin_homeIndex',
  476. meta: { title: '首页' },
  477. component: () => import('../views/adminCenter/homeIndex/index.vue'),
  478. },
  479. ...fwjg,
  480. ...qy,
  481. ...jg,
  482. ...zj,
  483. ],
  484. },
  485. ];
  486. const routes = [...web];
  487. const router = new VueRouter({
  488. mode: 'history',
  489. base: process.env.VUE_APP_ROUTER,
  490. routes,
  491. });
  492. router.beforeEach((to, from, next) => {
  493. document.title = `${to.meta.title} `;
  494. const token = localStorage.getItem('token');
  495. if (to.path == '/adminCenter/homeIndex') {
  496. if (!token) {
  497. next('/login');
  498. } else {
  499. let user = jwt.decode(token);
  500. store.commit('setUser', user, { root: true });
  501. next();
  502. }
  503. } else {
  504. let user = jwt.decode(token);
  505. store.commit('setUser', user, { root: true });
  506. next();
  507. }
  508. });
  509. export default router;