HomeView.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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
  14. :default-active="activeIndex"
  15. class="el-menu-demo"
  16. mode="horizontal"
  17. @select="handleSelect"
  18. text-color="#006C9AFF"
  19. active-text-color="#51CFFEFF"
  20. background-color="transparent"
  21. router
  22. :stroke-width="15"
  23. >
  24. <el-menu-item index="/">
  25. <span class="nav1">
  26. <img
  27. :src="srcIndex == '0' ? icoUrl[0]['home1'] : icoUrl[0]['home2']"
  28. /> </span
  29. >首页
  30. <!-- <span class="nav1">
  31. <img :src="icoUrl[srcIndex]['home'+srcIndex]" />
  32. </span>首页 -->
  33. </el-menu-item>
  34. <el-menu-item index="/home/retrieval">
  35. <span class="nav1">
  36. <img
  37. :src="
  38. srcIndex == '1' ? icoUrl[1]['search1'] : icoUrl[1]['search2']
  39. "
  40. /> </span
  41. >快速检索
  42. </el-menu-item>
  43. <el-submenu index="2">
  44. <template slot="title">
  45. <span class="nav1">
  46. <img
  47. :src="srcIndex == '2' ? icoUrl[2]['doc1'] : icoUrl[2]['doc2']"
  48. /> </span
  49. >文档管理
  50. </template>
  51. <li v-for="(item, index) in docMenus" :key="index">
  52. <el-menu-item :index="item.path">{{
  53. item.meta.title
  54. }}</el-menu-item>
  55. </li>
  56. <!-- <li v-for="(item, index) in arr" :key="index"> -->
  57. <!-- <el-menu-item index="/home/file/part">部门文档</el-menu-item>
  58. <el-menu-item index="/home/doc/public">公共文档</el-menu-item>
  59. <el-menu-item index="/home/file/Storage">分组文档</el-menu-item>
  60. <el-menu-item index="/home/file/set">文档设置</el-menu-item>
  61. <el-menu-item index="/home/file/level">文档级别</el-menu-item>
  62. <el-menu-item index="/home/file/demand">扩容申请</el-menu-item> -->
  63. <!-- <el-menu-item index="/home/file/individual">个人文档</el-menu-item> -->
  64. </el-submenu>
  65. <el-submenu index="3">
  66. <template slot="title">
  67. <span class="nav1">
  68. <img
  69. :src="
  70. srcIndex == '3'
  71. ? icoUrl[3]['person1']
  72. : icoUrl[3]['person2']
  73. "
  74. />
  75. <!-- <img src="../assets/img/nav-person1.png"> --> </span
  76. >个人设置
  77. </template>
  78. <li v-for="(item, index) in settingMenus" :key="index">
  79. <el-menu-item :index="item.path"
  80. >{{ item.meta.title }}
  81. </el-menu-item>
  82. </li>
  83. <!-- <el-menu-item index="/home/file/demand">扩容申请</el-menu-item> -->
  84. <!-- <el-menu-item index="/home/personal/notice">通知管理</el-menu-item>
  85. <el-menu-item index="/home/personal/messages"
  86. >消息管理</el-menu-item
  87. > -->
  88. <!-- <el-menu-item index="/home/personal/Publispace">公共存储空间</el-menu-item>
  89. <el-menu-item index="/home/personal/Storagespace">分组存储空间</el-menu-item>
  90. <el-menu-item index="/home/personal/space">个人存储空间</el-menu-item>
  91. <el-menu-item index="/home/personal/modify">登录密码修改</el-menu-item>
  92. <el-menu-item index="/home/personal/identificat">文字识别</el-menu-item> -->
  93. </el-submenu>
  94. <!-- <el-submenu index="4">
  95. <template slot="title">
  96. <span class="nav1">
  97. <img :src="srcIndex == '4'
  98. ? icoUrl[4]['search1']
  99. : icoUrl[4]['search2']
  100. " /> </span>系统管理
  101. </template>
  102. <el-menu-item index="/home/system/user">用户管理</el-menu-item>
  103. <el-menu-item index="/home/system/role">角色管理</el-menu-item>
  104. <el-menu-item index="/home/system/menu">菜单管理</el-menu-item>
  105. <el-menu-item index="/home/system/department">部门管理</el-menu-item>
  106. <el-menu-item index="/home/system/post">岗位管理</el-menu-item>
  107. <el-menu-item index="/home/system/dictionary">字典管理</el-menu-item>
  108. <el-menu-item index="/home/system/parameter">参数管理</el-menu-item>
  109. <el-menu-item index="/home/system/notice">通知公告</el-menu-item>
  110. <el-submenu index="2-4">
  111. <template slot="title">日志管理</template>
  112. <el-menu-item index="/home/system/journal/operation">操作日志</el-menu-item>
  113. <el-menu-item index="/home/system/journal/register">登录日志</el-menu-item>
  114. </el-submenu>
  115. </el-submenu> -->
  116. <!-- <el-submenu index="5">
  117. <template slot="title">
  118. <span class="nav1">
  119. <img
  120. :src="
  121. srcIndex == '5' ? icoUrl[5]['group1'] : icoUrl[5]['group2']
  122. "
  123. /> </span
  124. >分组管理
  125. </template>
  126. <el-menu-item index="/home/group/groups">分组</el-menu-item>
  127. </el-submenu> -->
  128. </el-menu>
  129. <div class="right">
  130. <!-- <span class="right_1">
  131. <img src="../assets/img/2.jpg" />
  132. </span> -->
  133. <span class="right_2">欢迎您,{{ names }}</span>
  134. <div class="right_3"></div>
  135. <span class="right_4">
  136. <img src="../assets/img/exit.png" @click="exits = true" />
  137. </span>
  138. </div>
  139. </div>
  140. <div class="bottom"></div>
  141. </div>
  142. <div class="main">
  143. <router-view></router-view>
  144. </div>
  145. <!-- 退出登录界面 -->
  146. <div class="exits" v-if="exits">
  147. <el-button
  148. icon="el-icon-close"
  149. circle
  150. class="exits-circle"
  151. size="mini"
  152. @click="exits = false"
  153. ></el-button>
  154. <div class="top">
  155. <p>提示</p>
  156. </div>
  157. <div class="cen">确定注销并退出系统吗?</div>
  158. <div class="bottom">
  159. <div class="bottom-right" @click="exit1">确定</div>
  160. <div class="bottom-left" @click="exits = false">取消</div>
  161. </div>
  162. </div>
  163. </div>
  164. </template>
  165. <script>
  166. import { constantRoutes } from "@/router";
  167. // import { logout } from "@/api/login1";
  168. export default {
  169. data() {
  170. return {
  171. //退出登录界面
  172. exits: false,
  173. // activeIndex: '',
  174. srcIndex: "",
  175. // username:this.$store.username,
  176. // 图片数组
  177. icoUrl: [
  178. {
  179. home1: require("../assets/img/nav-home1.png"),
  180. home2: require("../assets/img/nav-home.png"),
  181. },
  182. {
  183. search1: require("../assets/img/nav-search1.png"),
  184. search2: require("../assets/img/nav-search.png"),
  185. },
  186. {
  187. doc1: require("../assets/img/nav-doc1.png"),
  188. doc2: require("../assets/img/nav-doc.png"),
  189. },
  190. {
  191. person1: require("../assets/img/nav-person1.png"),
  192. person2: require("../assets/img/nav-person.png"),
  193. },
  194. {
  195. search1: require("../assets/img/nav-setting1.png"),
  196. search2: require("../assets/img/nav-setting.png"),
  197. },
  198. {
  199. group1: require("../assets/img/nav-group1.png"),
  200. group2: require("../assets/img/nav-group.png"),
  201. },
  202. ],
  203. };
  204. },
  205. mounted() {
  206. this.srcIndex = localStorage.getItem("currentSrcIndex");
  207. },
  208. methods: {
  209. handleSelect(key, keyPath) {
  210. // console.log(keyPath);
  211. this.getSrcIndex(keyPath);
  212. //点击之后存到本地存储,便于刷新之后调用
  213. localStorage.setItem("currentSrcIndex", this.srcIndex);
  214. },
  215. getNavTable() {
  216. // getNavTableApi().then
  217. },
  218. getSrcIndex(keyPathArr) {
  219. // 如果是顶级目录,需要手动判断 srcIndex
  220. if (keyPathArr.length == 1) {
  221. if (keyPathArr[0] == "/") {
  222. this.srcIndex = "0";
  223. } else if (keyPathArr[0] == "/home/retrieval") {
  224. this.srcIndex = "1";
  225. }
  226. } else {
  227. const currentSrcIndex = keyPathArr[0];
  228. this.srcIndex = currentSrcIndex;
  229. }
  230. },
  231. //退出方法
  232. exit1() {
  233. this.exits = false;
  234. // this.$router.push("/login1");
  235. this.$store.dispatch('LogOut').then(() => {
  236. location.href = '/login';
  237. })
  238. },
  239. },
  240. computed: {
  241. // 文档菜单
  242. docMenus() {
  243. let docMenus = [];
  244. this.routers.map((menu) => {
  245. if (menu.path === "/home-doc") {
  246. docMenus = menu.children;
  247. }
  248. });
  249. return docMenus;
  250. },
  251. // 设置菜单
  252. settingMenus() {
  253. let settingMenus = [];
  254. this.routers.map((menu) => {
  255. // console.log(menu);
  256. if (menu.path === "/home-setting") {
  257. settingMenus = menu.children;
  258. }
  259. });
  260. return settingMenus;
  261. },
  262. // 所有的路由信息
  263. routers() {
  264. return this.$store.state.permission.topbarRouters;
  265. },
  266. activeIndex() {
  267. const path = this.$route.path;
  268. return path;
  269. },
  270. names() {
  271. const paths = this.$store.state.user.uname;
  272. return paths;
  273. },
  274. },
  275. };
  276. </script>
  277. <style scoped lang="scss">
  278. .container {
  279. background: #0c0827ff;
  280. background-size: 100% 100%;
  281. width: 100%;
  282. height: 100%;
  283. .header {
  284. height: calc(100vh * (70 / 1080));
  285. width: 100%;
  286. padding-top: calc(100vh * (10 / 1080));
  287. // 顶部板块
  288. .top {
  289. height: calc(100vh * (40 / 1080));
  290. width: 100%;
  291. padding-right: calc(100vh * (17 / 1920));
  292. padding-left: calc(100vh * (55 / 1920));
  293. display: flex;
  294. //顶部左边板块
  295. .left {
  296. width: calc(100vw * (369 / 1920));
  297. height: calc(100vh * (40 / 1080));
  298. display: flex;
  299. .left1 {
  300. width: calc(100vw * (28 / 1920));
  301. height: calc(100vh * (30 / 1080));
  302. margin-top: calc(100vh * (8 / 1080));
  303. img {
  304. width: calc(100vw * (28 / 1920));
  305. height: calc(100vh * (30 / 1080));
  306. }
  307. }
  308. .left2 {
  309. width: calc(100vw * (295 / 1920));
  310. height: calc(100vh * (32 / 1080));
  311. margin-left: calc(100vw * (10 / 1920));
  312. margin-top: calc(100vw * (5 / 1080));
  313. img {
  314. width: calc(100vw * (295 / 1920));
  315. height: calc(100vh * (32 / 1080));
  316. }
  317. }
  318. }
  319. // 顶部中间板块
  320. .el-menu-demo {
  321. width: calc(100vw * (1000 / 1920));
  322. margin-left: calc(100vw * (280 / 1920));
  323. padding-bottom: calc(100vh * (8 / 1080));
  324. border: none;
  325. display: flex;
  326. li {
  327. height: calc(100vh * (40 / 1080));
  328. line-height: calc(100vh * (40 / 1080));
  329. margin-right: calc(100vw * (60 / 1920));
  330. :hover {
  331. background: #1e497cff !important;
  332. }
  333. }
  334. .nav1 > img {
  335. width: calc(100vw * (24 / 1920));
  336. height: calc(100vh * (24 / 1080));
  337. margin-bottom: calc(100vw * (5 / 1920));
  338. margin-right: calc(100vh * (5 / 1080));
  339. }
  340. }
  341. // 顶部右边板块
  342. .right {
  343. width: calc(100vw * (220 / 1920));
  344. height: calc(100vh * (40 / 1080));
  345. margin-left: calc(100vw * (80 / 1920));
  346. display: flex;
  347. justify-content: space-between;
  348. align-items: center;
  349. // background: salmon;
  350. // .right_1>img {
  351. // width: calc(100vw * (20 / 1920));
  352. // height: calc(100vh * (20 / 1080));
  353. // margin-right: calc(100vw * (5 / 1920));
  354. // }
  355. .right_2 {
  356. font-size: 12px;
  357. color: white;
  358. }
  359. .right_3 {
  360. width: 1px;
  361. height: 13px;
  362. background: #02aac0;
  363. border-radius: 0px 0px 0px 0px;
  364. opacity: 1;
  365. }
  366. .right_4 > img {
  367. width: calc(100vw * (26 / 1920));
  368. height: calc(100vh * (26 / 1080));
  369. &:hover{
  370. cursor: pointer
  371. }
  372. }
  373. }
  374. }
  375. //顶部下边图片板块
  376. .bottom {
  377. height: calc(100vh * (20 / 1080));
  378. width: 100%;
  379. background: url("../assets/img/nav-decorate.png");
  380. background-size: 100% calc(100vh * (20 / 1080));
  381. }
  382. }
  383. .exits {
  384. width: calc(100vw * (600 / 1920));
  385. height: calc(100vh * (300 / 1080));
  386. background: url("../assets/img/Group-564.png");
  387. background-size: calc(100vw * (600 / 1920)) calc(100vh * (300 / 1080));
  388. position: absolute;
  389. top: 25%;
  390. left: 35%;
  391. color: #ffffff;
  392. .exits-circle {
  393. position: absolute;
  394. right: 8%;
  395. top: 18%;
  396. ::v-deep [class^="el-icon-"] {
  397. color: #02C2E3FF;
  398. }
  399. }
  400. .top {
  401. width: calc(100vw * (430 / 1920));
  402. height: calc(100vh * (50 / 1080));
  403. border-bottom: 1px solid #02618DFF;
  404. margin-top: calc(100vh * (30 / 1080));
  405. margin-left: calc(100vw * (50 / 1920));
  406. p {
  407. width: calc(100vw * (80 / 1920));
  408. height: calc(100vh * (50 / 1080));
  409. border-bottom: 3px solid #02C2E3FF;
  410. margin-left: calc(100vw * (30 / 1920));
  411. }
  412. }
  413. .cen {
  414. width: calc(100vw * (430 / 1920));
  415. height: calc(100vh * (70 / 1080));
  416. // background: salmon;
  417. margin-top: calc(100vh * (30 / 1080));
  418. margin-left: calc(100vw * (100 / 1920));
  419. }
  420. .bottom {
  421. width: calc(100vw * (220 / 1920));
  422. height: calc(100vh * (60 / 1080));
  423. margin-left: calc(100vw * (280 / 1920));
  424. margin-top: calc(100vh * (20 / 1080));
  425. display: flex;
  426. justify-content: space-between;
  427. .bottom-left {
  428. width: calc(100vw * (100 / 1920));
  429. height: calc(100vh * (60 / 1080));
  430. background: #02C2E31F ;
  431. border: 1px solid #02C2E3FF;
  432. text-align: center;
  433. line-height: calc(100vh * (60 / 1080));
  434. border-radius: 12%;
  435. }
  436. .bottom-right {
  437. width: calc(100vw * (100 / 1920));
  438. height: calc(100vh * (60 / 1080));
  439. background: #1E5095FF;
  440. border: 1px solid #02C2E3FF;
  441. text-align: center;
  442. line-height: calc(100vh * (60 / 1080));
  443. border-radius: 15%;
  444. }
  445. }
  446. }
  447. }
  448. ::v-deep .el-menu-item {
  449. padding: 0;
  450. padding-bottom: (100vh * (50 / 1080));
  451. }
  452. ::v-deep .el-submenu__title {
  453. padding: 0;
  454. padding-bottom: (100vh * (50 / 1080));
  455. }
  456. ::v-deep .el-menu--horizontal > .el-submenu .el-submenu__title {
  457. height: calc(100vh * (40 / 1080));
  458. line-height: calc(100vh * (40 / 1080));
  459. }
  460. ::v-deep li:hover {
  461. background: #1e497cff !important;
  462. }
  463. ::v-deep .el-menu--horizontal .el-menu-item:not(.isdisabled):hover {
  464. background: #1e497cff !important;
  465. }
  466. //退出登录弹窗里面的按钮
  467. ::v-deep .el-button--mini.is-circle {
  468. background: transparent;
  469. border: 1px solid #02C2E3FF;
  470. }
  471. </style>
  472. <style>
  473. /* 下拉框 */
  474. .el-menu--horizontal .el-menu .el-menu-item {
  475. background: #0f1540ff !important;
  476. }
  477. .el-menu--horizontal .el-menu .el-menu-item:hover {
  478. background: #1e497cff !important;
  479. color: #ffffff !important;
  480. }
  481. </style>