index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. // h5
  4. const chatList = () => import('@/pages/h5/view/chatList.vue')
  5. const aboutMe = () => import('@/pages/h5/view/aboutMe.vue')
  6. const editMe = () => import('@/pages/h5/view/editMe.vue')
  7. const h5ChatRoom = () => import('@/pages/h5/view/chatRoom.vue')
  8. // pc
  9. const pcChatRoom = () => import('@/components/chatRoom/chatRoom.vue')
  10. const noChat = () => import('@/components/chatRoom/noChat.vue')
  11. Vue.use(Router)
  12. const pcRouter = new Router({
  13. routes: [{
  14. path: '/',
  15. alias: '/user/:id',
  16. name: 'noChat',
  17. component: noChat
  18. }, {
  19. path: '/group/:id',
  20. name: 'groupChat',
  21. component: pcChatRoom
  22. }, {
  23. path: '/pm/:id',
  24. name: 'pmChat',
  25. component: pcChatRoom
  26. }
  27. ]
  28. })
  29. const h5Router = new Router({
  30. routes: [{
  31. path: '/',
  32. alias: '/user/:id',
  33. name: 'chatList',
  34. component: chatList
  35. }, {
  36. path: '/me',
  37. name: 'aboutMe',
  38. component: aboutMe
  39. }, {
  40. path: '/editMe',
  41. name: 'editMe',
  42. component: editMe
  43. }, {
  44. path: '/group/:id',
  45. name: 'groupChat',
  46. component: h5ChatRoom
  47. }, {
  48. path: '/pm/:id',
  49. name: 'pmChat',
  50. component: h5ChatRoom
  51. }
  52. ]
  53. })
  54. // router.beforeEach((to, from, next) => {
  55. // // next()
  56. // let userId = $store.state.userId
  57. // let token = $store.state.token
  58. // if(userId && token)
  59. // })
  60. export {
  61. h5Router,
  62. pcRouter
  63. }