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.

234 lines
5.9 KiB

3 years ago
3 years ago
3 years ago
3 years ago
  1. import Vue from "vue";
  2. import VueRouter from "vue-router";
  3. // import HomeView from "../views/HomeView.vue";
  4. import login from "@/views/login.vue"
  5. Vue.use(VueRouter);
  6. const routes = [
  7. {
  8. path: "/",
  9. name: "login",
  10. component: login,
  11. },
  12. {
  13. path: "/about",
  14. name: "about",
  15. component: () =>
  16. import("../views/AboutView.vue"),
  17. },
  18. {
  19. path: "/login",
  20. name: "login",
  21. component: () =>
  22. import("../views/login.vue"),
  23. },
  24. {
  25. path: "/hoem",
  26. name: "hoem",
  27. component: () =>
  28. import(/* webpackChunkName: "about" */ "../views/hoem.vue"),
  29. children: [
  30. {
  31. path: "/my",
  32. name: "my",
  33. component: () => import('../views/my.vue')
  34. },
  35. {
  36. path: '/userlist',
  37. name: 'userlist',
  38. component: () => import('../views/userlist.vue')
  39. },
  40. {
  41. path: '/organization',
  42. name: 'organization',
  43. component: () => import('../views/organization.vue')
  44. },
  45. {
  46. path: '/dailyrecord',
  47. name: 'dailyrecord',
  48. component: () => import('../views/dailyrecord.vue')
  49. },
  50. {
  51. path: '/departmentset',
  52. name: 'departmentset',
  53. component: () => import('../views/departmentset.vue')
  54. },
  55. {
  56. path: '/medicalexaminatitype',
  57. name: 'medicalexaminatitype',
  58. component: () => import('../components/medicalexaminatitype.vue')
  59. },
  60. {
  61. path: '/gender',
  62. name: 'gender',
  63. component: () => import('../components/gender.vue')
  64. },
  65. {
  66. path: '/maritalstatus',
  67. name: 'maritalstatus',
  68. component: () => import('../components/maritalstatus.vue')
  69. },
  70. {
  71. path: '/nation',
  72. name: 'nation',
  73. component: () => import('../components/nation.vue')
  74. },
  75. {
  76. path: '/nativeplace',
  77. name: 'nativeplace',
  78. component: () => import('../components/nativeplace.vue')
  79. },
  80. {
  81. path: '/resultstatus',
  82. name: 'resultstatus',
  83. component: () => import('../components/resultstatus.vue')
  84. },
  85. {
  86. path: '/examinationcategory',
  87. name: 'examinationcategory',
  88. component: () => import('../components/examinationcategory.vue')
  89. },
  90. {
  91. path: '/personnelcategory',
  92. name: 'personnelcategory',
  93. component: () => import('../components/personnelcategory.vue')
  94. },
  95. {
  96. path: '/instrument',
  97. name: 'instrument',
  98. component: () => import('../components/instrument.vue')
  99. },
  100. {
  101. path: '/specimentype',
  102. name: 'specimentype',
  103. component: () => import('../components/specimentype.vue')
  104. },
  105. {
  106. path: '/unit',
  107. name: 'unit',
  108. component: () => import('../components/unit.vue')
  109. },
  110. {
  111. path: '/diagnosticsuffix',
  112. name: 'diagnosticsuffix',
  113. component: () => import('../components/diagnosticsuffix.vue')
  114. },
  115. {
  116. path: '/physicalcategory',
  117. name: 'physicalcategory',
  118. component: () => import('../components/physicalcategory.vue')
  119. },
  120. {
  121. path: '/medicalexamination',
  122. name: 'medicalexamination',
  123. component: () => import('../components/medicalexamination.vue')
  124. },
  125. {
  126. path: '/sepecimencontainer',
  127. name: 'sepecimencontainer',
  128. component: () => import('../components/sepecimencontainer.vue')
  129. },
  130. {
  131. path: '/commoncharacter',
  132. name: 'commoncharacter',
  133. component: () => import('../components/commoncharacter.vue')
  134. },
  135. {
  136. path: '/commoncused',
  137. name: 'commoncused',
  138. component: () => import('../components/commoncused.vue')
  139. },
  140. {
  141. path: '/customeersevice',
  142. name: 'customeersevice',
  143. component: () => import('../components/customeersevice.vue')
  144. },
  145. {
  146. path: '/projectresults',
  147. name: 'projectresults',
  148. component: () => import('../components/projectresults.vue')
  149. },
  150. {
  151. path: '/diagnosticleve',
  152. name: 'diagnosticleve',
  153. component: () => import('../components/diagnosticleve.vue')
  154. },
  155. {
  156. path: '/invoicecategory',
  157. name: 'invoicecategory',
  158. component: () => import('../views/feesettings/invoicecategory.vue')
  159. },
  160. {
  161. path: '/paymentmethod',
  162. name: 'paymentmethod',
  163. component: () => import('../views/feesettings/paymentmethod.vue')
  164. },
  165. {
  166. path: '/itemtype',
  167. name: 'itemtype',
  168. component: () => import('../views/feesettings/itemtype.vue')
  169. },
  170. {
  171. path: '/barcodegroupping',
  172. name: 'barcodegroupping',
  173. component: () => import('../views/feesettings/barcodegroupping.vue')
  174. },
  175. {
  176. path: '/groupsandproject',
  177. name: 'groupsandproject',
  178. component: () => import('../views/feesettings/groupsandproject.vue')
  179. },
  180. {
  181. path: '/projectitem',
  182. name: 'projectitem',
  183. component: () => import('../views/feesettings/projectitem.vue')
  184. },
  185. {
  186. path: '/referencerange',
  187. name: 'referencerange',
  188. component: () => import('../views/feesettings/referencerange.vue')
  189. },
  190. {
  191. path: '/diagnosis',
  192. name: 'diagnosis',
  193. component: () => import('../views/diagnosis.vue')
  194. },
  195. {
  196. path: '/projectresulttemplate',
  197. name: 'projectresulttemplate',
  198. component: () => import('../views/feesettings/projectresulttemplate.vue')
  199. },
  200. ]
  201. },
  202. ];
  203. const router = new VueRouter({
  204. routes,
  205. });
  206. router.beforeEach((to, form, next) => {
  207. let token = localStorage.getItem('token')
  208. let tokentype = localStorage.getItem('tokentype')
  209. if (to.path === '/login') {
  210. if (token != null) {
  211. next({
  212. path: '/'
  213. })
  214. } else {
  215. next()
  216. }
  217. } else {
  218. if (token == null) {
  219. next({
  220. path: '/login'
  221. })
  222. } else {
  223. next()
  224. }
  225. }
  226. })
  227. export default router;