Navside.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <div>
  3. <el-row :class="[{'shortnav':isCollapse},{'longNav':!isCollapse}]">
  4. <el-col :span="24">
  5. <el-menu
  6. default-active="2"
  7. class="el-menu-vertical-demo"
  8. @open="handleOpen"
  9. @close="handleClose"
  10. @select="handleSelect"
  11. background-color="#545c64"
  12. text-color="#fff"
  13. active-text-color="#ffd04b"
  14. router
  15. :collapse="isCollapse"
  16. >
  17. <el-submenu :index="nav.clmid" :route="nav.clmurl" v-for="nav in navs">
  18. <template slot="title">
  19. <i :class="nav.icon"></i>
  20. <span>{{nav.clmname}}</span>
  21. </template>
  22. <el-menu-item-group v-for="(child,j) in nav.childs">
  23. <el-menu-item :index="child.clmid" :route="child.clmurl">{{child.clmname}}
  24. </el-menu-item>
  25. </el-menu-item-group>
  26. </el-submenu>
  27. <el-submenu index="99">
  28. <template slot="title">
  29. <i class="icon_logout"></i>
  30. <span>退出登陆</span>
  31. </template>
  32. <el-menu-item-group>
  33. <el-menu-item @click="clickLogout">退出登陆
  34. </el-menu-item>
  35. </el-menu-item-group>
  36. </el-submenu>
  37. </el-menu>
  38. </el-col>
  39. </el-row>
  40. </div>
  41. </template>
  42. <script>
  43. import Navs from '../api/Navs';
  44. import {SignOut} from '../api/getApiRes.js'
  45. let qs = require('qs');
  46. export default {
  47. data() {
  48. return {
  49. wildState: 0,
  50. navs: [],
  51. }
  52. },
  53. props: ['isCollapse'],
  54. mounted() {
  55. this.getTableQuery();
  56. },
  57. methods: {
  58. handleSelect(i, s, t) {
  59. this.$emit('TabsAdd', i);//触发事件
  60. },
  61. getTableQuery() {
  62. // 菜单
  63. this.navs = Navs;
  64. },
  65. handleOpen(key, keyPath) {
  66. // console.log(key, keyPath);
  67. },
  68. handleClose(key, keyPath) {
  69. // console.log(key, keyPath);
  70. },
  71. clickLogout() {
  72. let that = this;
  73. let param = {
  74. token: localStorage.token
  75. };
  76. let postdata = qs.stringify(param);
  77. this.$confirm('此操作将退出当前账号, 是否继续?', '提示', {
  78. confirmButtonText: '确定',
  79. cancelButtonText: '取消',
  80. type: 'warning'
  81. }).then(() => {
  82. SignOut(postdata).then(res => {
  83. that.$message({
  84. showClose: true,
  85. message: '用户已退出!',
  86. type: 'success'
  87. });
  88. localStorage.usercode = '';
  89. localStorage.token = '';
  90. that.$router.push({path: '/login', query: {status: 1}});
  91. })
  92. }).catch(() => {
  93. this.$message({
  94. type: 'info',
  95. message: '已取消用户退出'
  96. });
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped>
  103. .shortnav {
  104. position: absolute;
  105. width: 65px;
  106. top: 54px;
  107. bottom: 0;
  108. overflow: hidden;
  109. display: block;
  110. margin: 0 auto;
  111. height: 100%;
  112. }
  113. .longNav {
  114. position: absolute;
  115. width: 320px;
  116. top: 48px;
  117. bottom: 0;
  118. overflow: hidden;
  119. display: block;
  120. margin: 0 auto;
  121. height: 100%;
  122. }
  123. .el-col, .el-menu {
  124. height: 100%;
  125. border-right: 0;
  126. }
  127. /deep/ .el-menu-item {
  128. background-color: rgba(255, 255, 255, 0) !important;
  129. }
  130. /deep/ .el-menu {
  131. background-color: rgba(255, 255, 255, 0.1) !important;
  132. }
  133. /deep/ .el-submenu__title {
  134. background: rgba(255, 255, 255, 0) !important;
  135. }
  136. .el-menu li:hover {
  137. background: #00599A;
  138. }
  139. /deep/ .el-menu-item:hover {
  140. background: #00599A !important;
  141. }
  142. .logout {
  143. color: #fff;
  144. font-size: 14px;
  145. cursor: pointer;
  146. height: 56px;
  147. /*line-height: 56px;*/
  148. }
  149. .logout:hover {
  150. background: rgb(67, 74, 80);
  151. }
  152. .littleLogo {
  153. float: left;
  154. }
  155. .icon_home {
  156. width: 18px;
  157. height: 18px;
  158. float: left;
  159. margin-top: 20px;
  160. background: url("../assets/img/navside/icon_home.png") top center no-repeat;
  161. background-size: 100%;
  162. }
  163. .icon_region {
  164. width: 18px;
  165. height: 18px;
  166. float: left;
  167. margin-top: 20px;
  168. background: url("../assets/img/navside/icon_region.png") top center no-repeat;
  169. background-size: 100%;
  170. }
  171. .icon_signEquip {
  172. width: 18px;
  173. height: 18px;
  174. float: left;
  175. margin-top: 20px;
  176. background: url("../assets/img/navside/icon_signEquip.png") top center no-repeat;
  177. background-size: 100%;
  178. }
  179. .icon_equip {
  180. width: 18px;
  181. height: 18px;
  182. float: left;
  183. margin-top: 20px;
  184. background: url("../assets/img/navside/icon_equip.png") top center no-repeat;
  185. background-size: 100%;
  186. }
  187. .icon_record {
  188. width: 18px;
  189. height: 18px;
  190. float: left;
  191. margin-top: 20px;
  192. background: url("../assets/img/navside/icon_record.png") top center no-repeat;
  193. background-size: 100%;
  194. }
  195. .icon_tactics {
  196. width: 18px;
  197. height: 18px;
  198. float: left;
  199. margin-top: 20px;
  200. background: url("../assets/img/navside/icon_tactics.png") top center no-repeat;
  201. background-size: 100%;
  202. }
  203. .icon_plan {
  204. width: 18px;
  205. height: 18px;
  206. float: left;
  207. margin-top: 20px;
  208. background: url("../assets/img/navside/icon_plan.png") top center no-repeat;
  209. background-size: 100%;
  210. }
  211. .icon_task {
  212. width: 18px;
  213. height: 18px;
  214. float: left;
  215. margin-top: 20px;
  216. background: url("../assets/img/navside/icon_task.png") top center no-repeat;
  217. background-size: 100%;
  218. }
  219. .icon_statistics {
  220. width: 18px;
  221. height: 18px;
  222. float: left;
  223. margin-top: 20px;
  224. background: url("../assets/img/navside/icon_statistics.png") top center no-repeat;
  225. background-size: 100%;
  226. }
  227. .icon_setting {
  228. width: 18px;
  229. height: 18px;
  230. float: left;
  231. margin-top: 20px;
  232. background: url("../assets/img/navside/icon_setting.png") top center no-repeat;
  233. background-size: 100%;
  234. }
  235. .icon_logout {
  236. width: 18px;
  237. height: 18px;
  238. float: left;
  239. margin-top: 20px;
  240. background: url("../assets/img/navside/icon_logout.png") top center no-repeat;
  241. background-size: 100%;
  242. }
  243. li:hover .icon_home {
  244. width: 18px;
  245. height: 18px;
  246. float: left;
  247. margin-top: 20px;
  248. background: url("../assets/img/navside/icon_home_w.png") top center no-repeat;
  249. background-size: 100%;
  250. }
  251. li:hover .icon_region {
  252. width: 18px;
  253. height: 18px;
  254. float: left;
  255. margin-top: 20px;
  256. background: url("../assets/img/navside/icon_region_w.png") top center no-repeat;
  257. background-size: 100%;
  258. }
  259. li:hover .icon_signEquip {
  260. width: 18px;
  261. height: 18px;
  262. float: left;
  263. margin-top: 20px;
  264. background: url("../assets/img/navside/icon_signEquip_w.png") top center no-repeat;
  265. background-size: 100%;
  266. }
  267. li:hover .icon_equip {
  268. width: 18px;
  269. height: 18px;
  270. float: left;
  271. margin-top: 20px;
  272. background: url("../assets/img/navside/icon_equip_w.png") top center no-repeat;
  273. background-size: 100%;
  274. }
  275. li:hover .icon_record {
  276. width: 18px;
  277. height: 18px;
  278. float: left;
  279. margin-top: 20px;
  280. background: url("../assets/img/navside/icon_record_w.png") top center no-repeat;
  281. background-size: 100%;
  282. }
  283. li:hover .icon_tactics {
  284. width: 18px;
  285. height: 18px;
  286. float: left;
  287. margin-top: 20px;
  288. background: url("../assets/img/navside/icon_tactics_w.png") top center no-repeat;
  289. background-size: 100%;
  290. }
  291. li:hover .icon_plan {
  292. width: 18px;
  293. height: 18px;
  294. float: left;
  295. margin-top: 20px;
  296. background: url("../assets/img/navside/icon_plan_w.png") top center no-repeat;
  297. background-size: 100%;
  298. }
  299. li:hover .icon_task {
  300. width: 18px;
  301. height: 18px;
  302. float: left;
  303. margin-top: 20px;
  304. background: url("../assets/img/navside/icon_task_w.png") top center no-repeat;
  305. background-size: 100%;
  306. }
  307. li:hover .icon_statistics {
  308. width: 18px;
  309. height: 18px;
  310. float: left;
  311. margin-top: 20px;
  312. background: url("../assets/img/navside/icon_statistics_w.png") top center no-repeat;
  313. background-size: 100%;
  314. }
  315. li:hover .icon_setting {
  316. width: 18px;
  317. height: 18px;
  318. float: left;
  319. margin-top: 20px;
  320. background: url("../assets/img/navside/icon_setting_w.png") top center no-repeat;
  321. background-size: 100%;
  322. }
  323. li:hover .icon_logout{
  324. width: 18px;
  325. height: 18px;
  326. float: left;
  327. margin-top: 20px;
  328. background: url("../assets/img/navside/icon_logout_w.png") top center no-repeat;
  329. background-size: 100%;
  330. }
  331. /deep/ .el-menu-item-group .el-menu-item {
  332. height: 25px !important;
  333. line-height: 25px !important;
  334. }
  335. /deep/ .el-menu-item {
  336. height: 30px;
  337. line-height: 20px;
  338. }
  339. </style>