index.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. Vue.use(VueRouter)
  4. const originalPush = VueRouter.prototype.push
  5. VueRouter.prototype.push = function push(location) {
  6. return originalPush.call(this, location).catch(err => err)
  7. }
  8. const routes = [{
  9. path: '/',
  10. redirect: '/projectApplication'
  11. },
  12. {
  13. name: 'login',
  14. path: '/login',
  15. component: () =>
  16. import ('@/views/login.vue'),
  17. meta: { isAuth: false }
  18. },
  19. { //成果展示
  20. name: 'resultShowDetail',
  21. path: '/resultShowDetail',
  22. component: () =>
  23. import ('@/views/resultShow/resultShowDetail.vue'),
  24. meta: { isAuth: true }
  25. },
  26. { //测试
  27. name: 'test',
  28. path: '/test',
  29. component: () =>
  30. import ('@/views/test.vue'),
  31. meta: { isAuth: true }
  32. },
  33. { //测试2
  34. name: 'Word',
  35. path: '/Word',
  36. component: () =>
  37. import ('@/views/Word.vue'),
  38. meta: { isAuth: true }
  39. },
  40. {
  41. name: 'home',
  42. path: '/home',
  43. component: () =>
  44. import ('@/views/home.vue'),
  45. meta: { isAuth: true },
  46. children: [{ //创客活动
  47. name: 'makerActvity',
  48. path: '/makerActvity',
  49. component: () =>import ('@/views/activityManage/makerActvity.vue'),
  50. meta: { isAuth: true }
  51. },
  52. { //创客活动详情
  53. name: 'makerActivityWordDetail',
  54. path: '/makerActvityWordDetail',
  55. component: () =>import ('@/views/activityManage/makerActivityWordDetail.vue'),
  56. meta: { isAuth: true }
  57. },
  58. { //项目立项申请
  59. name: 'projectApplication',
  60. path: '/projectApplication',
  61. component: () =>import ('@/views/projectApply/projectApplication.vue'),
  62. meta: { isAuth: true }
  63. },
  64. { //新学生项目立项申请
  65. name: 'newStudentProjectApply',
  66. path: '/newStudentProjectApply',
  67. component: () =>import ('@/views/projectApply/newStudentProjectApply.vue'),
  68. meta: { isAuth: true }
  69. },
  70. { //新创客活动
  71. name: 'newMarkerActivity',
  72. path: '/newMarkerActivity',
  73. component: () =>import ('@/views/activityManage/newMarkerActivity'),
  74. meta: { isAuth: true }
  75. },
  76. { //新个人创客
  77. name: 'newNomMarkerActivity',
  78. path: '/newNomMarkerActivity',
  79. component: () =>import ('@/views/activityManage/newNomMarkerActivity.vue'),
  80. meta: { isAuth: true }
  81. },
  82. { //项目查看详细
  83. name: 'projectApplicationDetailMain',
  84. path: '/projectApplicationDetailMain',
  85. component: () =>import ('@/views/projectApply/projectApplicationDetailMain.vue'),
  86. meta: { isAuth: true }
  87. },
  88. { //创业公司登记
  89. name: 'firm',
  90. path: '/firm',
  91. component: () =>import ('@/views/firm.vue'),
  92. meta: { isAuth: true }
  93. },
  94. { //创客资金主页面
  95. name: 'makerfund',
  96. path: '/makerfund',
  97. component: () =>import ('@/views/fundManage/makerfund.vue'),
  98. meta: { isAuth: true }
  99. },
  100. { //新创客活动资金申请
  101. name: 'newMarkerfundApply',
  102. path: '/newMarkerfundApply',
  103. component: () =>import ('@/views/fundManage/newMarkerfundApply.vue'),
  104. meta: { isAuth: true }
  105. },
  106. { //新个人创客资金申请
  107. name: 'newNomMarkerFundApply',
  108. path: '/newNomMarkerFundApply',
  109. component: () =>import ('@/views/fundManage/newNomMarkerFundApply.vue'),
  110. meta: { isAuth: true }
  111. },
  112. { //创客资金详情
  113. name: 'makerfundDetails',
  114. path: '/makerfundDetails',
  115. component: () =>import ('@/views/fundManage/makerfundDetails.vue'),
  116. meta: { isAuth: true }
  117. },
  118. { //消息通知
  119. name: 'messageNotification',
  120. path: '/messageNotification',
  121. component: () =>import ('@/views/messageNotification.vue'),
  122. meta: { isAuth: true }
  123. },
  124. { //项目管理
  125. name: 'ProjectManagement',
  126. path: '/ProjectManagement',
  127. component: () =>import ('@/views/projectManage/ProjectManagement.vue'),
  128. meta: { isAuth: true }
  129. },
  130. { //项目管理父查看详情
  131. name: 'ProjectManagementMain',
  132. path: '/ProjectManagementMain',
  133. component: () =>import ('@/views/projectManage/ProjectManagementMain.vue'),
  134. meta: { isAuth: true }
  135. },
  136. { //项目资金管理
  137. name: 'ProjectManagementFundDetail',
  138. path: '/ProjectManagementFundDetail',
  139. component: () =>import ('@/views/projectManage/ProjectManagementFundDetail.vue'),
  140. meta: { isAuth: true }
  141. },
  142. // { //项目资金管理
  143. // name: 'ProjectManagementFund2',
  144. // path: '/ProjectManagementFund2',
  145. // component: () =>import ('@/views/projectManage/ProjectManagementFund2.vue'),
  146. // meta: { isAuth: true }
  147. // },
  148. { //项目结项
  149. name: 'projectSettlement',
  150. path: '/projectSettlement',
  151. component: () =>import ('@/views/projectSettlement/projectSettlement.vue'),
  152. meta: { isAuth: true }
  153. },
  154. { //项目结项查看详细
  155. name:"projectSettlementDetailMain",
  156. path:"/projectSettlementDetailMain",
  157. component:()=>import('@/views/projectSettlement/projectSettlementDetailMain.vue'),
  158. meta:{isAuth:true}
  159. },
  160. { //成果展示
  161. name: 'resultsShow',
  162. path: '/resultsShow',
  163. component: () =>import ('@/views/resultShow/resultsShow.vue'),
  164. meta: { isAuth: true }
  165. },
  166. { //数据检测
  167. name: 'echarts',
  168. path: '/echarts',
  169. component: () =>import ('@/views/echarts/echarts.vue'),
  170. meta: { isAuth: true }
  171. },
  172. {//创客空间项目申请
  173. name:"/MakerSpaceApply",
  174. path:"/MakerSpaceApply",
  175. component:()=>import('@/views/projectApply/MakerSpaceApply.vue'),
  176. meta:{isAuth:true}
  177. },
  178. ]
  179. }
  180. ]
  181. const router = new VueRouter({
  182. mode: 'history',
  183. base: process.env.BASE_URL,
  184. routes,
  185. })
  186. // router.beforeEach((to,from,next)=>{
  187. // if(to.meta.isAuth){
  188. // if(localStorage.getItem('isAuth') === "true"){
  189. // next();
  190. // }else{
  191. // return next('/login')
  192. // }
  193. // }else{
  194. // next()
  195. // }
  196. // }
  197. // )
  198. // router.beforeEach(function(to, from, next) {
  199. // if (to.meta.isAuth) {
  200. // //页面是否登录
  201. // if (localStorage.getItem("token")) {
  202. // //本地存储中是否有token(uid)数据
  203. // next(); //表示已经登录
  204. // } else {
  205. // //next可以传递一个路由对象作为参数 表示需要跳转到的页面
  206. // next({
  207. // name: "login"
  208. // });
  209. // }
  210. // } else {
  211. // //表示不需要登录
  212. // next(); //继续往后走
  213. // }
  214. // });
  215. export default router