index.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. import {
  2. createWebHistory,
  3. createRouter
  4. } from 'vue-router'
  5. /* Layout */
  6. import Layout from '@/layout'
  7. import main from '@/layout/components/AppMain.vue'
  8. /**
  9. * Note: 路由配置项
  10. *
  11. * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
  12. * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
  13. * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
  14. * // 若你想不管路由下面的 children 声明的个数都显示你的根路由
  15. * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
  16. * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
  17. * name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  18. * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
  19. * roles: ['admin', 'common'] // 访问路由的角色权限
  20. * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
  21. * meta : {
  22. noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  23. title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
  24. icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
  25. breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
  26. activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
  27. }
  28. */
  29. // 公共路由
  30. export const constantRoutes = [{
  31. path: '/redirect',
  32. component: Layout,
  33. hidden: true,
  34. children: [{
  35. path: '/redirect/:path(.*)',
  36. component: () => import('@/views/redirect/index.vue')
  37. }]
  38. },
  39. {
  40. path: '/login',
  41. component: () => import('@/views/login'),
  42. hidden: true
  43. },
  44. {
  45. path: '/register',
  46. component: () => import('@/views/register'),
  47. hidden: true
  48. },
  49. {
  50. path: "/:pathMatch(.*)*",
  51. component: () => import('@/views/error/404'),
  52. hidden: true
  53. },
  54. {
  55. path: '/401',
  56. component: () => import('@/views/error/401'),
  57. hidden: true
  58. },
  59. {
  60. path: '',
  61. component: () => import('@/layout/indexCommon.vue'),
  62. redirect: '/index',
  63. hidden: true,
  64. children: [{
  65. path: 'index',
  66. component: () => import('@/views/liveChat/index.vue'),
  67. name: 'index',
  68. meta: {
  69. title: '返回',
  70. icon: 'dashboard',
  71. affix: true
  72. }
  73. },
  74. {
  75. path: 'swagger',
  76. component: () => import('@/views/tool/swagger/index.vue'),
  77. name: 'swagger',
  78. redirect: 'noredirect',
  79. meta: {
  80. title: '接口',
  81. icon: 'dashboard'
  82. },
  83. },
  84. {
  85. path: 'recent',
  86. component: () => import('@/views/biz/recent/index.vue'),
  87. name: 'recent',
  88. meta: {
  89. title: '最近文件',
  90. icon: 'dashboard'
  91. },
  92. },
  93. {
  94. path: 'search',
  95. component: () => import('@/views/search/index.vue'),
  96. name: 'search',
  97. meta: {
  98. title: '全文搜索',
  99. icon: 'dashboard'
  100. },
  101. },
  102. {
  103. path: "/myfile",
  104. component: () => import("@/views/myfile/MyFile"),
  105. name: "myfile",
  106. meta: {
  107. title: "我的文件",
  108. icon: "myfile"
  109. }
  110. },
  111. {
  112. path: "/myjoin",
  113. component: () => import("@/views/myjoin/MyJoin"),
  114. name: "myjoin",
  115. meta: {
  116. title: "我的协作",
  117. icon: "myjoin"
  118. }
  119. },
  120. {
  121. path: "/department",
  122. component: () => import("@/views/department/MyFile"),
  123. name: "department",
  124. meta: {
  125. title: "部门文件",
  126. icon: "department"
  127. }
  128. },
  129. {
  130. path: "/publicment",
  131. component: () => import("@/views/publicment/MyFile"),
  132. name: "publicment",
  133. meta: {
  134. title: "公共文件",
  135. icon: "becommon"
  136. }
  137. },
  138. {
  139. path: "/collect",
  140. component: () => import("@/views/collect/index.vue"),
  141. name: "collect",
  142. meta: {
  143. title: "收藏文件",
  144. icon: "department"
  145. }
  146. },
  147. {
  148. path: "/ws",
  149. component: () => import("@/views/biz/test/index.vue"),
  150. name: "ws",
  151. meta: {
  152. title: "聊天",
  153. icon: "department"
  154. }
  155. },
  156. {
  157. path: "/transFile",
  158. component: () => import("@/views/transFile/index.vue"),
  159. name: "transFile",
  160. meta: {
  161. title: "聊天",
  162. icon: "department"
  163. }
  164. },
  165. {
  166. path: "/highsearch",
  167. component: () => import("@/views/highSearch/HighSearch.vue"),
  168. name: "highsearch",
  169. meta: {
  170. title: "高级搜索",
  171. icon: "department"
  172. }
  173. },{
  174. path: "/identifyFont",
  175. component: () => import("@/components/IdentifyFont/IdentifyFont.vue"),
  176. name: "iodentifyFont",
  177. meta: {
  178. title: "图文识别",
  179. icon: "department"
  180. }
  181. },{
  182. path: "/fileEdit",
  183. name: "fileEdit",
  184. component: () => import("@/views/myfile/components/FileEdit.vue"),
  185. children: [{
  186. path: '/fileEdit:docId(\\d+)',
  187. component: () => import("@/views/myfile/components/FileEdit.vue"),
  188. name: 'fileEdit',
  189. meta: {
  190. title: '文件预览',
  191. activeMenu: '/fileEdit'
  192. }
  193. }]
  194. },{
  195. path: "/allback",
  196. component: () => import("@/views/highSearch/SupplierAllBack.vue"),
  197. name: "allback",
  198. meta: { title: "kongbaiye", icon: "department" }
  199. },{
  200. path: "/admin",
  201. component: Layout,
  202. redirect: '/admin/index',
  203. children: [{
  204. path: 'index',
  205. // component: () => import('@/layout/index.vue'),
  206. name: 'adminIndex',
  207. meta: {
  208. title: '首页',
  209. icon: 'dashboard',
  210. affix: true
  211. },
  212. },]
  213. }
  214. ]
  215. },
  216. {
  217. path: '/admin',
  218. component: Layout,
  219. redirect: '/admin/index',
  220. children: [{
  221. path: 'index',
  222. // component: () => import('@/layout/index.vue'),
  223. name: 'adminIndex',
  224. meta: {
  225. title: '首页',
  226. icon: 'dashboard',
  227. affix: true
  228. },
  229. },
  230. // 其他 admin 下的子路由
  231. {
  232. path: '/onlyoffice/',
  233. component: () => import('@/views/biz/onlyoffice/index'),
  234. name: 'onlyoffice',
  235. meta: {
  236. title: '在线编辑',
  237. icon: 'dashboard'
  238. },
  239. hidden:true
  240. },
  241. ]
  242. },
  243. // {
  244. // path: '/file',
  245. // component: Layout,
  246. // redirect: '/index',
  247. // children: [
  248. // // {
  249. // // path: 'swagger',
  250. // // component: () => import('@/views/tool/swagger/index.vue'),
  251. // // name: 'swagger',
  252. // // meta: { title: '接口', icon: 'dashboard' },
  253. {
  254. path: '/file',
  255. component: Layout,
  256. redirect: '/index',
  257. children: [
  258. // {
  259. // path: 'swagger',
  260. // component: () => import('@/views/tool/swagger/index.vue'),
  261. // name: 'swagger',
  262. // meta: { title: '接口', icon: 'dashboard' },
  263. // },
  264. ]
  265. },
  266. // // },
  267. // // {
  268. // // path: "/myfile",
  269. // // component: () => import("@/views/myfile/MyFile"),
  270. // // name: "myfile",
  271. // // meta: { title: "我的文件", icon: "myfile" }
  272. // // },
  273. // // {
  274. // // path: "/department",
  275. // // component: () => import("@/views/department/Department"),
  276. // // name: "department",
  277. // // meta: { title: "部门文件", icon: "department" }
  278. // // }
  279. // ]
  280. // },
  281. {
  282. path: '/user',
  283. component: Layout,
  284. hidden: true,
  285. redirect: 'noredirect',
  286. children: [{
  287. path: 'profile',
  288. component: () => import('@/views/system/user/profile/index'),
  289. name: 'Profile',
  290. meta: {
  291. title: '个人中心',
  292. icon: 'user'
  293. }
  294. }, ]
  295. },
  296. // {
  297. // path: '/indexCommons',
  298. // hidden: true,
  299. // component: () => import('@/views/indexcommon/index'),
  300. // redirect: '/indexCommon',
  301. // children: [
  302. // {
  303. // path: '/indexCommon',
  304. // component: () => import('@/views/indexcommon/hhxx'),
  305. // name: 'Dashboard',
  306. // meta: { title: '会话消息', icon: 'dashboard', affix: true },
  307. // },
  308. // {
  309. // path: "/myfile",
  310. // component: () => import("@/views/myfile/MyFile"),
  311. // name: "myfile",
  312. // meta: { title: "我的文件", icon: "myfile" }
  313. // },
  314. // ]
  315. // },
  316. ]
  317. // 动态路由,基于用户权限动态去加载
  318. export const dynamicRoutes = [{
  319. path: '/system/user-auth',
  320. component: Layout,
  321. hidden: true,
  322. permissions: ['system:user:edit'],
  323. children: [{
  324. path: 'role/:userId(\\d+)',
  325. component: () => import('@/views/system/user/authRole'),
  326. name: 'AuthRole',
  327. meta: {
  328. title: '分配角色',
  329. activeMenu: '/system/user'
  330. }
  331. }]
  332. },
  333. {
  334. path: '/system/role-auth',
  335. component: Layout,
  336. hidden: true,
  337. permissions: ['system:role:edit'],
  338. children: [{
  339. path: 'user/:roleId(\\d+)',
  340. component: () => import('@/views/system/role/authUser'),
  341. name: 'AuthUser',
  342. meta: {
  343. title: '分配用户',
  344. activeMenu: '/system/role'
  345. }
  346. }]
  347. },
  348. {
  349. path: '/system/dict-data',
  350. component: Layout,
  351. hidden: true,
  352. permissions: ['system:dict:list'],
  353. children: [{
  354. path: 'index/:dictId(\\d+)',
  355. component: () => import('@/views/system/dict/data'),
  356. name: 'Data',
  357. meta: {
  358. title: '字典数据',
  359. activeMenu: '/system/dict'
  360. }
  361. }]
  362. },
  363. {
  364. path: '/monitor/job-log',
  365. component: Layout,
  366. hidden: true,
  367. permissions: ['monitor:job:list'],
  368. children: [{
  369. path: 'index/:jobId(\\d+)',
  370. component: () => import('@/views/monitor/job/log'),
  371. name: 'JobLog',
  372. meta: {
  373. title: '调度日志',
  374. activeMenu: '/monitor/job'
  375. }
  376. }]
  377. },
  378. {
  379. path: '/tool/gen-edit',
  380. component: Layout,
  381. hidden: true,
  382. permissions: ['tool:gen:edit'],
  383. children: [{
  384. path: 'index/:tableId(\\d+)',
  385. component: () => import('@/views/tool/gen/editTable'),
  386. name: 'GenEdit',
  387. meta: {
  388. title: '修改生成配置',
  389. activeMenu: '/tool/gen'
  390. }
  391. }]
  392. }
  393. ]
  394. const router = createRouter({
  395. history: createWebHistory(),
  396. routes: constantRoutes,
  397. scrollBehavior(to, from, savedPosition) {
  398. if (savedPosition) {
  399. return savedPosition
  400. } else {
  401. return {
  402. top: 0
  403. }
  404. }
  405. console.log(savedPosition, 'savedPosition');
  406. },
  407. });
  408. export default router;