HomeView.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div class="container">
  3. <div class="header">
  4. <div class="top">
  5. <div class="left">
  6. <span class="left1">
  7. <img src="../assets/img/nav-index.jpg" alt="" />
  8. </span>
  9. <span class="left2">
  10. <img src="../assets/img/luzhougongan.png" alt="" />
  11. </span>
  12. </div>
  13. <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect"
  14. text-color="#006C9AFF" active-text-color="#51CFFEFF" background-color="transparent" router :stroke-width="15">
  15. <el-menu-item index="/home/page">
  16. <span class="nav1">
  17. <img :src="srcIndex == '0'
  18. ? icoUrl[0]['home1']
  19. : icoUrl[0]['home2']
  20. " />
  21. </span>首页
  22. <!-- <span class="nav1">
  23. <img :src="icoUrl[srcIndex]['home'+srcIndex]" />
  24. </span>首页 -->
  25. </el-menu-item>
  26. <el-menu-item index="/home/retrieval">
  27. <span class="nav1">
  28. <img :src="srcIndex == '1'
  29. ? icoUrl[1]['search1']
  30. : icoUrl[1]['search2']
  31. " /> </span>快速检索
  32. </el-menu-item>
  33. <el-submenu index="2">
  34. <template slot="title">
  35. <span class="nav1">
  36. <img :src="srcIndex == '2' ? icoUrl[2]['doc1'] : icoUrl[2]['doc2']" /> </span>文档管理
  37. </template>
  38. <li v-for="(item, index) in docMenus" :key="index">
  39. <el-menu-item :index="item.path">{{item.meta.title}}</el-menu-item>
  40. </li>
  41. <!-- <li v-for="(item, index) in arr" :key="index"> -->
  42. <!-- <el-menu-item index="/home/file/part">部门文档</el-menu-item>
  43. <el-menu-item index="/home/doc/public">公共文档</el-menu-item>
  44. <el-menu-item index="/home/file/Storage">分组文档</el-menu-item>
  45. <el-menu-item index="/home/file/set">文档设置</el-menu-item>
  46. <el-menu-item index="/home/file/level">文档级别</el-menu-item>
  47. <el-menu-item index="/home/file/demand">扩容申请</el-menu-item> -->
  48. <!-- <el-menu-item index="/home/file/individual">个人文档</el-menu-item> -->
  49. </el-submenu>
  50. <el-submenu index="3">
  51. <template slot="title">
  52. <span class="nav1">
  53. <img :src="srcIndex == '3'
  54. ? icoUrl[3]['person1']
  55. : icoUrl[3]['person2']
  56. " />
  57. <!-- <img src="../assets/img/nav-person1.png"> --> </span>个人设置
  58. </template>
  59. <li v-for="(item, index) in settingMenus" :key="index">
  60. <el-menu-item
  61. :index="item.path">{{item.meta.title}}
  62. </el-menu-item>
  63. </li>
  64. <!-- <el-menu-item index="/home/personal/Partspace">部门存储空间</el-menu-item>
  65. <el-menu-item index="/home/personal/Publispace">公共存储空间</el-menu-item>
  66. <el-menu-item index="/home/personal/Storagespace">分组存储空间</el-menu-item>
  67. <el-menu-item index="/home/personal/space">个人存储空间</el-menu-item>
  68. <el-menu-item index="/home/personal/modify">登录密码修改</el-menu-item>
  69. <el-menu-item index="/home/personal/identificat">文字识别</el-menu-item> -->
  70. </el-submenu>
  71. <!-- <el-submenu index="4">
  72. <template slot="title">
  73. <span class="nav1">
  74. <img :src="srcIndex == '4'
  75. ? icoUrl[4]['search1']
  76. : icoUrl[4]['search2']
  77. " /> </span>系统管理
  78. </template>
  79. <el-menu-item index="/home/system/user">用户管理</el-menu-item>
  80. <el-menu-item index="/home/system/role">角色管理</el-menu-item>
  81. <el-menu-item index="/home/system/menu">菜单管理</el-menu-item>
  82. <el-menu-item index="/home/system/department">部门管理</el-menu-item>
  83. <el-menu-item index="/home/system/post">岗位管理</el-menu-item>
  84. <el-menu-item index="/home/system/dictionary">字典管理</el-menu-item>
  85. <el-menu-item index="/home/system/parameter">参数管理</el-menu-item>
  86. <el-menu-item index="/home/system/notice">通知公告</el-menu-item>
  87. <el-submenu index="2-4">
  88. <template slot="title">日志管理</template>
  89. <el-menu-item index="/home/system/journal/operation">操作日志</el-menu-item>
  90. <el-menu-item index="/home/system/journal/register">登录日志</el-menu-item>
  91. </el-submenu>
  92. </el-submenu> -->
  93. <el-submenu index="5">
  94. <template slot="title">
  95. <span class="nav1">
  96. <img :src="srcIndex == '5' ? icoUrl[5]['group1'] : icoUrl[5]['group2']
  97. " /> </span>分组管理
  98. </template>
  99. <el-menu-item index="/home/group/groups">分组</el-menu-item>
  100. </el-submenu>
  101. </el-menu>
  102. <div class="right">
  103. <!-- <span class="right_1">
  104. <img src="../assets/img/2.jpg" />
  105. </span> -->
  106. <span class="right_2">欢迎您,{{ names }}</span>
  107. <div class="right_3"></div>
  108. <span class="right_4">
  109. <img src="../assets/img/exit.png" @click="exit()" />
  110. </span>
  111. </div>
  112. </div>
  113. <div class="bottom"></div>
  114. </div>
  115. <div class="main">
  116. <router-view></router-view>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import {
  122. constantRoutes
  123. } from "@/router";
  124. export default {
  125. data() {
  126. return {
  127. // activeIndex: '',
  128. srcIndex: "",
  129. // username:this.$store.username,
  130. // 图片数组
  131. icoUrl: [{
  132. home1: require("../assets/img/nav-home1.png"),
  133. home2: require("../assets/img/nav-home.png"),
  134. },
  135. {
  136. search1: require("../assets/img/nav-search1.png"),
  137. search2: require("../assets/img/nav-search.png"),
  138. },
  139. {
  140. doc1: require("../assets/img/nav-doc1.png"),
  141. doc2: require("../assets/img/nav-doc.png"),
  142. },
  143. {
  144. person1: require("../assets/img/nav-person1.png"),
  145. person2: require("../assets/img/nav-person.png"),
  146. },
  147. {
  148. search1: require("../assets/img/nav-setting1.png"),
  149. search2: require("../assets/img/nav-setting.png"),
  150. },
  151. {
  152. group1: require("../assets/img/nav-group1.png"),
  153. group2: require("../assets/img/nav-group.png"),
  154. },
  155. ]
  156. };
  157. },
  158. created() {
  159. },
  160. mounted() {
  161. this.srcIndex = localStorage.getItem('currentSrcIndex')
  162. },
  163. methods: {
  164. handleSelect(key, keyPath) {
  165. // console.log(keyPath);
  166. this.getSrcIndex(keyPath)
  167. //点击之后存到本地存储,便于刷新之后调用
  168. localStorage.setItem('currentSrcIndex', this.srcIndex)
  169. },
  170. getNavTable() {
  171. // getNavTableApi().then
  172. },
  173. getSrcIndex(keyPathArr) {
  174. // 如果是顶级目录,需要手动判断 srcIndex
  175. if (keyPathArr.length == 1) {
  176. if (keyPathArr[0] == '/home/page') {
  177. this.srcIndex = '0'
  178. } else if (keyPathArr[0] == '/home/retrieval') {
  179. this.srcIndex = '1'
  180. }
  181. } else {
  182. const currentSrcIndex = keyPathArr[0]
  183. this.srcIndex = currentSrcIndex
  184. }
  185. },
  186. exit() {
  187. alert("你确定要注销界面吗?");
  188. this.$router.push("/login1");
  189. },
  190. },
  191. computed: {
  192. // 文档菜单
  193. docMenus() {
  194. let docMenus = [];
  195. this.routers.map((menu) => {
  196. if (menu.path === "/home-doc") {
  197. docMenus = menu.children;
  198. }
  199. });
  200. return docMenus;
  201. },
  202. // 设置菜单
  203. settingMenus() {
  204. let settingMenus = [];
  205. this.routers.map((menu) => {
  206. // console.log(menu);
  207. if (menu.path === "/home-setting") {
  208. settingMenus = menu.children;
  209. }
  210. });
  211. return settingMenus;
  212. },
  213. // 所有的路由信息
  214. routers() {
  215. return this.$store.state.permission.topbarRouters;
  216. },
  217. activeIndex() {
  218. const path = this.$route.path;
  219. return path;
  220. },
  221. names() {
  222. const paths = this.$store.state.user.uname;
  223. return paths;
  224. },
  225. }
  226. };
  227. </script>
  228. <style scoped lang="scss">
  229. .container {
  230. background: #0c0827ff;
  231. background-size: 100% 100%;
  232. width: 100%;
  233. height: 100%;
  234. .header {
  235. height: calc(100vh * (70 / 1080));
  236. width: 100%;
  237. padding-top: calc(100vh * (10 / 1080));
  238. // 顶部板块
  239. .top {
  240. height: calc(100vh * (40 / 1080));
  241. width: 100%;
  242. padding-right: calc(100vh * (17 / 1920));
  243. padding-left: calc(100vh * (55 / 1920));
  244. display: flex;
  245. //顶部左边板块
  246. .left {
  247. width: calc(100vw * (369 / 1920));
  248. height: calc(100vh * (40 / 1080));
  249. display: flex;
  250. .left1 {
  251. width: calc(100vw * (28 / 1920));
  252. height: calc(100vh * (30 / 1080));
  253. margin-top: calc(100vh * (8 / 1080));
  254. img {
  255. width: calc(100vw * (28 / 1920));
  256. height: calc(100vh * (30 / 1080));
  257. }
  258. }
  259. .left2 {
  260. width: calc(100vw * (295 / 1920));
  261. height: calc(100vh * (32 / 1080));
  262. margin-left: calc(100vw * (10 / 1920));
  263. margin-top: calc(100vw * (5 / 1080));
  264. img {
  265. width: calc(100vw * (295 / 1920));
  266. height: calc(100vh * (32 / 1080));
  267. }
  268. }
  269. }
  270. // 顶部中间板块
  271. .el-menu-demo {
  272. width: calc(100vw * (1000 / 1920));
  273. margin-left: calc(100vw * (280 / 1920));
  274. padding-bottom: calc(100vh * (8 / 1080));
  275. border: none;
  276. display: flex;
  277. li {
  278. height: calc(100vh * (40 / 1080));
  279. line-height: calc(100vh * (40 / 1080));
  280. margin-right: calc(100vw * (60 / 1920));
  281. :hover {
  282. background: #1e497cff !important;
  283. }
  284. }
  285. .nav1>img {
  286. width: calc(100vw * (24 / 1920));
  287. height: calc(100vh * (24 / 1080));
  288. margin-bottom: calc(100vw * (5 / 1920));
  289. margin-right: calc(100vh * (5 / 1080));
  290. }
  291. }
  292. // 顶部右边板块
  293. .right {
  294. width: calc(100vw * (220 / 1920));
  295. height: calc(100vh * (40 / 1080));
  296. margin-left: calc(100vw * (80 / 1920));
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. // background: salmon;
  301. // .right_1>img {
  302. // width: calc(100vw * (20 / 1920));
  303. // height: calc(100vh * (20 / 1080));
  304. // margin-right: calc(100vw * (5 / 1920));
  305. // }
  306. .right_2 {
  307. font-size: 12px;
  308. color: white;
  309. }
  310. .right_3 {
  311. width: 1px;
  312. height: 13px;
  313. background: #02aac0;
  314. border-radius: 0px 0px 0px 0px;
  315. opacity: 1;
  316. }
  317. .right_4>img {
  318. width: calc(100vw * (26 / 1920));
  319. height: calc(100vh * (26 / 1080));
  320. }
  321. }
  322. }
  323. //顶部下边图片板块
  324. .bottom {
  325. height: calc(100vh * (20 / 1080));
  326. width: 100%;
  327. background: url("../assets/img/nav-decorate.png");
  328. background-size: 100% calc(100vh * (20 / 1080));
  329. }
  330. }
  331. }
  332. ::v-deep .el-menu-item {
  333. padding: 0;
  334. padding-bottom: (100vh * (50 / 1080));
  335. }
  336. ::v-deep .el-submenu__title {
  337. padding: 0;
  338. padding-bottom: (100vh * (50 / 1080));
  339. }
  340. ::v-deep .el-menu--horizontal>.el-submenu .el-submenu__title {
  341. height: calc(100vh * (40 / 1080));
  342. line-height: calc(100vh * (40 / 1080));
  343. }
  344. ::v-deep li:hover {
  345. background: #1e497cff !important;
  346. }
  347. ::v-deep .el-menu--horizontal .el-menu-item:not(.isdisabled):hover {
  348. background: #1e497cff !important;
  349. }
  350. </style>
  351. <style>
  352. /* 下拉框 */
  353. .el-menu--horizontal .el-menu .el-menu-item {
  354. background: #0f1540ff !important;
  355. }
  356. .el-menu--horizontal .el-menu .el-menu-item:hover {
  357. background: #1e497cff !important;
  358. color: #ffffff !important;
  359. }
  360. </style>