pageMenu.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <div class="pageMenu" v-bind:class="{ widthFold: menuFold }">
  3. <div class="panel">
  4. <div class="icon" v-show="!menuFold" @click="menuFoldHandle()">
  5. <b></b>
  6. </div>
  7. <div class="iconFold" v-show="menuFold" @click="menuFoldHandle(1)">
  8. <b></b>
  9. </div>
  10. <ul class="menuFold" v-show="menuFold">
  11. <li
  12. @click="menuFoldHandle(1)"
  13. v-bind:class="{ isOpened: opened === 'mainPage' }"
  14. >
  15. <b class="my-icon-home is"></b>
  16. </li>
  17. <li
  18. @click="menuFoldHandle(1)"
  19. v-bind:class="{ isOpened: opened === 'modelLibrary' }"
  20. >
  21. <b class="my-icon-menuA"></b>
  22. </li>
  23. <li
  24. @click="menuFoldHandle(1)"
  25. v-bind:class="{ isOpened: opened === 'algorithmsLibrary' }"
  26. >
  27. <b class="my-icon-menuB"></b>
  28. </li>
  29. <li
  30. @click="menuFoldHandle(1)"
  31. v-bind:class="{ isOpened: opened === 'sceneLibrary' }"
  32. >
  33. <b class="my-icon-menuC"></b>
  34. </li>
  35. <li
  36. @click="menuFoldHandle(1)"
  37. v-bind:class="{ isOpened: opened === 'workManagement' }"
  38. >
  39. <b class="my-icon-menuD"></b>
  40. </li>
  41. <!-- <li
  42. @click="menuFoldHandle(1)"
  43. v-bind:class="{ isOpened: opened === 'systemManagement' }"
  44. >
  45. <b class="my-icon-menuE"></b>
  46. </li>
  47. <li
  48. @click="menuFoldHandle(1)"
  49. v-bind:class="{ isOpened: opened === 'systemManagement' }"
  50. >
  51. <b class="my-icon-menuF"></b>
  52. </li> -->
  53. </ul>
  54. <div class="menuList" v-show="!menuFold">
  55. <el-menu
  56. ref="menu"
  57. :default-active="activeMenu"
  58. class="el-menu-vertical-demo"
  59. background-color="#3397FF"
  60. :unique-opened="true"
  61. :router="true"
  62. @select="menuSel"
  63. >
  64. <!-- active-text-color="#ffffff" -->
  65. <el-menu-item :index="menus[0]" class="indexMenu">
  66. <i class="my-icon-home"></i>
  67. <span>首页</span>
  68. </el-menu-item>
  69. <el-submenu :index="menus[1]">
  70. <template slot="title">
  71. <i class="my-icon-menuA"></i>
  72. <span>模型库</span>
  73. </template>
  74. <el-menu-item index="sensorModel"
  75. >传感器模型</el-menu-item
  76. >
  77. <el-menu-item index="vehicleModel"
  78. >车辆模型</el-menu-item
  79. >
  80. <el-menu-item index="vehicleConfigurationList"
  81. >车辆配置</el-menu-item
  82. >
  83. </el-submenu>
  84. <el-submenu :index="menus[2]">
  85. <template slot="title">
  86. <i class="my-icon-menuB"></i>
  87. <span>算法库</span>
  88. </template>
  89. <el-menu-item index="algorithmsLibraryList"
  90. >算法库列表</el-menu-item
  91. >
  92. <el-menu-item index="algorithmsPlatformList"
  93. >算法平台</el-menu-item
  94. >
  95. </el-submenu>
  96. <el-submenu :index="menus[3]">
  97. <template slot="title">
  98. <i class="my-icon-menuC"></i>
  99. <span>场景库</span>
  100. </template>
  101. <el-menu-item index="naturalDrivingScenarioList"
  102. >自然驾驶场景</el-menu-item
  103. >
  104. <el-menu-item
  105. index="standardRegulationSimulationScenarioList"
  106. >标准法规仿真场景</el-menu-item
  107. >
  108. <el-menu-item
  109. index="trafficAccidentSimulationScenarioList"
  110. >交通事故仿真场景</el-menu-item
  111. >
  112. <el-menu-item index="scenarioTestPackageManagementList"
  113. >场景测试包管理</el-menu-item
  114. >
  115. <el-menu-item index="gradingRulesList"
  116. >评分规则</el-menu-item
  117. >
  118. </el-submenu>
  119. <el-submenu :index="menus[4]">
  120. <template slot="title">
  121. <i class="my-icon-menuD"></i>
  122. <span>工作管理</span>
  123. </template>
  124. <el-menu-item index="manualRunProjectList"
  125. >手动运行项目</el-menu-item
  126. >
  127. </el-submenu>
  128. <!-- <el-submenu index="systemManagement">
  129. <template slot="title">
  130. <i class="my-icon-menuF"></i>
  131. <span>系统管理</span>
  132. </template>
  133. <el-menu-item index="accountManagement"
  134. >账户管理</el-menu-item
  135. >
  136. <el-menu-item index="parameterManagement"
  137. >参数管理</el-menu-item
  138. >
  139. </el-submenu> -->
  140. </el-menu>
  141. </div>
  142. </div>
  143. <!-- <div class="fold" v-show="menuFold">
  144. <img :src="imgSrc" width="100%" height="100%" />
  145. </div>
  146. <div class="unfold" v-show="!menuFold">
  147. <img :src="imgSrc" width="100%" height="100%" />
  148. </div> -->
  149. </div>
  150. </template>
  151. <script>
  152. export default {
  153. name: "pageMenu",
  154. data() {
  155. return {
  156. menuFold: false, // menu是否折叠
  157. opened: false,
  158. imgSrc: require("@/assets/common/image/photoF.png"),
  159. menus: [
  160. "mainPage",
  161. "modelLibrary",
  162. "algorithmsLibrary",
  163. "sceneLibrary",
  164. "workManagement",
  165. ],
  166. activeMenu: "mainPage", // 当前menu
  167. };
  168. },
  169. methods: {
  170. menuFoldHandle(val) {
  171. if (val) {
  172. this.menuFold = false;
  173. } else {
  174. this.menuFold = true;
  175. }
  176. this.$emit("menuFold", this.menuFold);
  177. },
  178. menuSel(index, indexPath) {
  179. // console.log(index, indexPath);
  180. this.opened = indexPath[0];
  181. // console.log(this.activeMenu);
  182. // 如果是首页 手动关闭其他菜单
  183. if (index === this.menus[0]) {
  184. this.menus.forEach((i) => {
  185. this.$refs.menu.close(i);
  186. });
  187. }
  188. },
  189. },
  190. created() {
  191. // localStorage.setItem(
  192. // "Authorization",
  193. // "Bearer 9882c634-9af6-4647-89dc-8ad53c04a56b"
  194. // );
  195. let { code, ticket } = this.$route.query;
  196. if (code && ticket) {
  197. this.$axios({
  198. method: "post",
  199. url: this.$api.common.single,
  200. data: { code, ticket },
  201. }).then((res) => {
  202. if (res.code == 200 && !!res.info.access_token) {
  203. localStorage.setItem(
  204. "Authorization",
  205. "Bearer " + res.info.access_token
  206. );
  207. } else {
  208. alert(res);
  209. }
  210. });
  211. }
  212. },
  213. mounted() {
  214. // console.log(this.$route);
  215. let menuKind = this.$route.meta.menuKind;
  216. if (menuKind && menuKind !== "mainPage") {
  217. this.$refs.menu.open(menuKind);
  218. }
  219. },
  220. };
  221. </script>
  222. <style scoped lang="less">
  223. .pageMenu {
  224. position: absolute;
  225. top: 0;
  226. left: 0;
  227. right: 0;
  228. bottom: 0;
  229. z-index: 6;
  230. width: 150px;
  231. height: 100%;
  232. [class^="my-icon-"] {
  233. vertical-align: middle;
  234. text-align: center;
  235. font-size: 18px;
  236. background-size: contain;
  237. }
  238. }
  239. .widthFold {
  240. width: 60px;
  241. }
  242. .panel {
  243. position: absolute;
  244. left: 0;
  245. top: 0;
  246. bottom: 0;
  247. z-index: 9;
  248. width: 100%;
  249. height: 100%;
  250. background: @themeColor;
  251. }
  252. .icon,
  253. .iconFold {
  254. display: flex;
  255. align-items: center;
  256. justify-content: center;
  257. height: 61px;
  258. border-bottom: 1px solid #ffffff;
  259. cursor: pointer;
  260. b {
  261. display: block;
  262. }
  263. }
  264. .iconFold {
  265. width: 60px;
  266. b {
  267. width: 28px;
  268. height: 38px;
  269. background: url("../../assets/common/image/menu/iconFold.png") center
  270. no-repeat;
  271. background-size: contain;
  272. }
  273. }
  274. .icon {
  275. width: 150px;
  276. b {
  277. width: 98px;
  278. height: 27px;
  279. background: url("../../assets/common/image/menu/icon.png") center
  280. no-repeat;
  281. background-size: contain;
  282. }
  283. }
  284. .el-submenu [class^="my-icon-"],
  285. .el-menu-item [class^="my-icon-"] {
  286. width: 24px;
  287. height: 18px;
  288. margin-right: 5px;
  289. }
  290. .indexMenu {
  291. padding-left: 15px !important;
  292. padding-right: 10px !important;
  293. span {
  294. color: #ffffff !important;
  295. }
  296. }
  297. .my-icon-home {
  298. background: url("../../assets/common/image/menu/home.png") center no-repeat;
  299. }
  300. .my-icon-menuA {
  301. background: url("../../assets/common/image/menu/menuA.png") center no-repeat;
  302. }
  303. .my-icon-menuB {
  304. background: url("../../assets/common/image/menu/menuB.png") center no-repeat;
  305. }
  306. .my-icon-menuC {
  307. background: url("../../assets/common/image/menu/menuC.png") center no-repeat;
  308. }
  309. .my-icon-menuD {
  310. background: url("../../assets/common/image/menu/menuD.png") center no-repeat;
  311. }
  312. .my-icon-menuE {
  313. background: url("../../assets/common/image/menu/menuE.png") center no-repeat;
  314. }
  315. .my-icon-menuF {
  316. background: url("../../assets/common/image/menu/menuF.png") center no-repeat;
  317. }
  318. .menuFold {
  319. li {
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. height: 40px;
  324. margin-top: 20px;
  325. cursor: pointer;
  326. b {
  327. display: block;
  328. width: 20px;
  329. height: 20px;
  330. }
  331. }
  332. .isOpened {
  333. background-color: #2979cc;
  334. }
  335. }
  336. .el-menu {
  337. // background: @themeColor;
  338. border-right-color: @themeColor;
  339. /deep/ .el-submenu__title,
  340. .el-menu-item {
  341. color: #d7e7fe;
  342. &.is-active {
  343. color: #ffffff;
  344. font-weight: bold;
  345. }
  346. }
  347. /deep/ .el-submenu__title {
  348. padding-left: 15px !important;
  349. padding-right: 10px;
  350. span {
  351. color: #ffffff;
  352. }
  353. }
  354. /deep/ .el-submenu__icon-arrow {
  355. right: 10px;
  356. }
  357. /deep/ .el-submenu__title i,
  358. /deep/ .el-menu-item i {
  359. color: #ffffff;
  360. }
  361. /deep/ .el-submenu .el-menu-item {
  362. min-width: auto;
  363. width: 100%;
  364. padding: 0;
  365. padding-left: 30px !important;
  366. }
  367. }
  368. .el-submenu.is-active {
  369. /deep/ .el-submenu__title {
  370. background-color: #2979cc !important;
  371. }
  372. }
  373. .el-submenu.is-active.is-opened {
  374. /deep/ .el-submenu__title {
  375. background-color: @themeColor !important;
  376. }
  377. }
  378. .el-submenu.is-opened {
  379. .el-menu,
  380. .el-menu-item {
  381. background-color: #2979cc !important;
  382. }
  383. }
  384. .hasList {
  385. // /deep/ .el-submenu__title
  386. /deep/ .el-menu-item {
  387. color: #d7e7fe;
  388. }
  389. /deep/ .is-active {
  390. background-color: #3982eb !important;
  391. color: #ffffff;
  392. }
  393. }
  394. .userIcon {
  395. > div {
  396. position: fixed;
  397. bottom: 30px;
  398. }
  399. }
  400. .fold,
  401. .unfold {
  402. position: fixed;
  403. bottom: 30px;
  404. z-index: 12;
  405. border-radius: 50%;
  406. cursor: pointer;
  407. overflow: hidden;
  408. }
  409. .fold {
  410. width: 36px;
  411. height: 36px;
  412. left: 12px;
  413. }
  414. .unfold {
  415. width: 60px;
  416. height: 60px;
  417. left: 35px;
  418. }
  419. </style>