Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

305 linhas
7.1 KiB

  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. import constants from '@/utils/constants'
  4. Vue.use(Router)
  5. const router = new Router({
  6. // mode: 'history',
  7. mode: 'hash',
  8. routes: [{
  9. path: '/',
  10. name: 'login',
  11. component: () => import('@/views/login'),
  12. },
  13. {
  14. path: '/demo',
  15. name: 'demo',
  16. component: () => import('@/views/demo'),
  17. },
  18. {
  19. path:'/projdetail',
  20. name: 'projdetail',
  21. // component: () => import('@/views/components_web/projDetail/projDetail')
  22. component: () => import('@/views/main_web/project')
  23. },
  24. {
  25. path: '/watch',
  26. name: 'watch',
  27. component: () => import('@/views/main_web/watchall/watchall')
  28. },
  29. {
  30. path: '/notification',
  31. name: 'notification',
  32. component: () => import('@/components/notification/notification')
  33. },
  34. {
  35. path:'/newproject',
  36. name:'newproject',
  37. component: ()=> import('@/views/components_web/project/newProj')
  38. },
  39. {
  40. path: '/watchlink',
  41. name: 'watchlink',
  42. component: () => import('@/views/main_web/watchall/watchlink')
  43. },
  44. {
  45. path: '/platform',
  46. name: 'platform',
  47. component: () => import('@/views/platform_center'),
  48. },
  49. {
  50. path: '/index',
  51. name: 'index',
  52. component: () => import('@/views/main_web/index'),
  53. },
  54. {
  55. path: '/projnotice',
  56. name: 'projnotice',
  57. component: () => import('@/views/main_web/projnotice'),
  58. },
  59. {
  60. path: '/email',
  61. name: 'email',
  62. component: () => import('@/views/components_web/head/email'),
  63. },
  64. {
  65. path: '/workspace',
  66. name: 'workspace',
  67. component: () => import('@/views/main_web/workspace'),
  68. },
  69. // {
  70. // path: '/workspace.old',
  71. // name: 'workspace.old',
  72. // component: () => import('@/views/main_web/workspace/workspace.new'),
  73. // },
  74. // {
  75. // path: '/project',
  76. // name: 'project',
  77. // component: () => import('@/views/main_web/project'),
  78. // },
  79. {
  80. path: '/recycle',
  81. name: 'recycle',
  82. component: () => import('@/views/main_web/workspace/recyclebin'),
  83. },
  84. {
  85. path: '/history',
  86. name: 'history',
  87. component: () => import('@/views/main_web/workspace/components/file-milestone'),
  88. },
  89. {
  90. path: '/cloud',
  91. name: 'cloud',
  92. component: () => import('@/views/main_web/cloud'),
  93. },
  94. {
  95. path: '/cloudrecycle',
  96. name: 'cloudrecycle',
  97. component: () => import('@/views/main_web/cloudrecycle'),
  98. },
  99. {
  100. path: '/cloudsource',
  101. name: 'cloudsource',
  102. component: () => import('@/views/main_web/cloudsource'),
  103. },
  104. // 探索者后台
  105. {
  106. path: '/company',
  107. name: 'company',
  108. component: () => import('@/views/manage_company'),
  109. redirect: { name: 'company_home' },
  110. children: [
  111. {
  112. path: 'home',
  113. name: 'company_home',
  114. component: () => import('@/views/manage_company/message'),
  115. },
  116. {
  117. path: 'message',
  118. name: 'company_message',
  119. component: () => import('@/views/manage_company/message_detail'),
  120. },
  121. {
  122. path: 'user',
  123. name: 'company_user',
  124. component: () => import('@/views/manage_company/user'),
  125. },
  126. {
  127. path: 'project',
  128. name: 'company_project',
  129. component: () => import('@/views/manage_company/project'),
  130. },
  131. {
  132. path: 'template',
  133. name: 'company_template',
  134. component: () => import('@/views/manage_company/template'),
  135. },
  136. {
  137. path: 'template/detail',
  138. name: 'company_template_detail',
  139. component: () => import('@/views/manage_company/template/detail'),
  140. },
  141. {
  142. path: 'template/market',
  143. name: 'company_template_market',
  144. component: () => import('@/views/manage_company/template/market'),
  145. },
  146. {
  147. path: 'setting',
  148. name: 'company_setting',
  149. component: () => import('@/views/manage_company/setting'),
  150. },
  151. {
  152. path: 'app',
  153. name: 'company_app',
  154. component: () => import('@/views/manage_company/app'),
  155. },
  156. ]
  157. },
  158. // {
  159. // path: '/company',
  160. // name: 'company',
  161. // component: () => import('@/views/manage_company/message'),
  162. // },
  163. // {
  164. // path: '/company/message',
  165. // name: 'company_message',
  166. // component: () => import('@/views/manage_company/message_detail'),
  167. // },
  168. // {
  169. // path: '/company/user',
  170. // name: 'company_user',
  171. // component: () => import('@/views/manage_company/user'),
  172. // },
  173. // {
  174. // path: '/company/project',
  175. // name: 'company_project',
  176. // component: () => import('@/views/manage_company/project'),
  177. // },
  178. // {
  179. // path: '/company/template',
  180. // name: 'company_template',
  181. // component: () => import('@/views/manage_company/template'),
  182. // },
  183. // {
  184. // path: '/company/template/detail',
  185. // name: 'company_template_detail',
  186. // component: () => import('@/views/manage_company/template_detail'),
  187. // },
  188. // {
  189. // path: '/company/template/market',
  190. // name: 'company_template_market',
  191. // component: () => import('@/views/manage_company/template_market'),
  192. // },
  193. // {
  194. // path: '/company/setting',
  195. // name: 'company_setting',
  196. // component: () => import('@/views/manage_company/setting'),
  197. // },
  198. // {
  199. // path: '/company/app',
  200. // name: 'company_app',
  201. // component: () => import('@/views/manage_company/app'),
  202. // },
  203. /* 模板平台 */
  204. {
  205. path: '/template',
  206. name: 'template',
  207. component: resolve => require(['@/views/manage_template/index'], resolve)
  208. },
  209. {
  210. path: '/template/create',
  211. name: 'template_create',
  212. component: resolve => require(['@/views/manage_template/create_template'], resolve)
  213. },
  214. // 探索者总后台
  215. {
  216. path: '/system',
  217. // name: 'system',
  218. component: () => import('@/views/manage_system'),
  219. redirect: { name: 'system_customer' },
  220. children: [{
  221. path: 'customer',
  222. name: 'system_customer',
  223. component: () => import('@/views/manage_system/customer'),
  224. },{
  225. path: 'template',
  226. name: 'system_template',
  227. component: () => import('@/views/manage_system/template'),
  228. },
  229. {
  230. path: 'runmanage',
  231. name: 'system_runmanage',
  232. component: () => import('@/views/manage_system/runmanage'),
  233. },
  234. {
  235. path: 'template/matrix',
  236. name: 'system_template_matrix',
  237. component: () => import('@/views/manage_system/template/matrix'),
  238. },
  239. {
  240. path: 'template/mind',
  241. name: 'system_template_mind',
  242. component: () => import('@/views/manage_system/template/mind'),
  243. },
  244. {
  245. path: 'template/tempfile',
  246. name: 'system_template_file',
  247. component: () => import('@/views/manage_system/template_file'),
  248. },
  249. {
  250. path: 'appcenter',
  251. name: 'system_appcenter',
  252. component: () => import('@/views/manage_system/appcenter'),
  253. },
  254. {
  255. path: 'appinfo',
  256. name: 'system_appinfo',
  257. component: () => import('@/views/manage_system/appinfo'),
  258. },
  259. {
  260. path: 'setting',
  261. name: 'system_setting',
  262. component: () => import('@/views/manage_system/setting'),
  263. },{
  264. path: '*',
  265. redirect: { name: 'system_customer' },
  266. }]
  267. },
  268. // {
  269. // path: '/system/template',
  270. // name: 'system_template',
  271. // component: () => import('@/views/manage_system/template'),
  272. // },
  273. // 页面未找到时提示(这个页面要放在最后)
  274. {
  275. path: '*',
  276. name: 'notfound',
  277. component: () => import('@/views/components_web/notFound/notFound'),
  278. }
  279. ]
  280. })
  281. // 添加路由验证
  282. router.beforeEach((to, from, next) => {
  283. if (to.path === '/') {
  284. next()
  285. } else {
  286. if (!sessionStorage.getItem('userId')) {
  287. next({
  288. path: '/'
  289. })
  290. } else {
  291. next()
  292. }
  293. }
  294. })
  295. // 导航后置守卫,可以在确定导航到目标页面时再更改title
  296. router.afterEach((to) => {
  297. window.document.title = constants[to.name] || 'LOCKING | 云建筑'
  298. })
  299. export default router