You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

router.js 6.9 KiB

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