BottomMenus.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <div id="bottomMenus">
  3. <!-- 底部菜单动态SVG底座 -->
  4. <BottomMenuSvg
  5. id="svgBox"
  6. @changeShowBottomMenusStatus="changeShowBottomMenusStatus()"
  7. />
  8. <!-- 申请任务弹窗 -->
  9. <CreateTaskForm
  10. @changeShowBottomMenusStatus="changeShowBottomMenusStatus"
  11. />
  12. <!-- 我的任务弹窗 -->
  13. <MyMission @changeShowBottomMenusStatus="changeShowBottomMenusStatus" />
  14. <!-- 同屏对比弹窗 -->
  15. <SameScreenComparison
  16. @changeShowBottomMenusStatus="changeShowBottomMenusStatus"
  17. />
  18. <!-- 上传数据弹窗 -->
  19. <UploadingData @changeShowBottomMenusStatus="changeShowBottomMenusStatus" />
  20. <!-- 自定义模型 -->
  21. <CustomModelDialog />
  22. <!-- 底部菜单主体 -->
  23. <div
  24. id="menusBox"
  25. :style="{
  26. width: showBottomMenusStatus ? '981px' : '0px',
  27. height: showBottomMenusStatus ? '200px' : '0px',
  28. border: showBottomMenusStatus ? '1px solid #00aaff' : 'none',
  29. }"
  30. >
  31. <!-- 模块遍历渲染也是menus对象的第一层数组 -->
  32. <div
  33. class="bottomMenus_box"
  34. v-for="(item, index) in menus"
  35. :key="index"
  36. :style="{ width: item.width ? item.width : 'auto' }"
  37. >
  38. <!-- 模块标题 -->
  39. <div class="bottomMenus_box_title">{{ item.title }}</div>
  40. <!-- 模块下的菜单主体 -->
  41. <div class="bottomMenus_box_main">
  42. <!-- 遍历渲染每个模块下的子菜单,也是menus数组中subMenu数组 -->
  43. <div
  44. class="colBtuMenu"
  45. @click="
  46. changeBottomMenu(item.index, subItem.index, subItem.clickEmit)
  47. "
  48. v-for="(subItem, subIndex) in item.subMenu"
  49. :key="subIndex"
  50. >
  51. <!-- 选中状态的背景高亮(舍弃) -->
  52. <div
  53. :class="
  54. ifMenuIndex(item.index, subItem.index) ? 'colBtuMenuShadow' : ''
  55. "
  56. ></div>
  57. <!-- 子菜单图标的选择性渲染 -->
  58. <el-image
  59. class="BtuMenu_hover"
  60. :src="returnBgImage(subItem.bgImage + '-a')"
  61. ></el-image>
  62. <el-image
  63. class="BtuMenu"
  64. :src="returnBgImage(subItem.bgImage)"
  65. ></el-image>
  66. <!-- 子菜单标题 -->
  67. <div class="BtuMenu_title">
  68. {{ subItem.title }}
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. <script>
  77. /**
  78. * 底部菜单组件
  79. * @author: LiuMengxiang
  80. * @Date: 2022年11月14-18日
  81. */
  82. import BottomMenuSvg from "./BottomMenuSvg.vue";
  83. import CreateTaskForm from "./BottomForm/CreateTaskForm.vue";
  84. import MyMission from "./BottomForm/MyMission.vue";
  85. import SameScreenComparison from "./BottomForm/SameScreenComparison.vue";
  86. import UploadingData from "./BottomForm/UploadingData.vue";
  87. import CustomModelDialog from "./BottomForm/CustomModelDialog.vue";
  88. export default {
  89. name: "BottomMenus",
  90. components: {
  91. BottomMenuSvg,
  92. CreateTaskForm,
  93. MyMission,
  94. SameScreenComparison,
  95. UploadingData,
  96. CustomModelDialog,
  97. },
  98. data() {
  99. return {
  100. // 弹窗打开状态
  101. dialogVisibleStatus: false,
  102. // 菜单主体显示状态(默认false)
  103. showBottomMenusStatus: false,
  104. // 底部菜单对象
  105. menus: [
  106. {
  107. index: 0,
  108. width: "164px",
  109. title: "任务申请",
  110. subMenu: [
  111. { index: 0, title: "申请任务", bgImage: "sqrw", clickEmit: "sqrw" },
  112. { index: 1, title: "我的任务", bgImage: "wdrw", clickEmit: "wdrw" },
  113. ],
  114. },
  115. {
  116. index: 1,
  117. width: "509px",
  118. title: "疑点分析",
  119. subMenu: [
  120. {
  121. index: 0,
  122. title: "疑点审计",
  123. bgImage: "ydsj",
  124. clickEmit: "caseAuditEvent",
  125. },
  126. {
  127. index: 1,
  128. title: "标记疑点",
  129. bgImage: "bjyd",
  130. clickEmit: "labelCaseEvent",
  131. },
  132. { index: 2, title: "同屏对比", bgImage: "tpdb", clickEmit: "tpdb" },
  133. {
  134. index: 3,
  135. title: "卷帘对比",
  136. bgImage: "jldb",
  137. clickEmit: "JLControl",
  138. },
  139. { index: 4, title: "上传数据", bgImage: "scsj", clickEmit: "scsj" },
  140. {
  141. index: 5,
  142. title: "自定义模型",
  143. bgImage: "zdymx",
  144. clickEmit: "customModelEvent",
  145. },
  146. ],
  147. },
  148. {
  149. index: 2,
  150. width: "94px",
  151. title: "疑点报告",
  152. subMenu: [{ index: 0, title: "报告输出", bgImage: "bgsc" }],
  153. },
  154. {
  155. index: 3,
  156. width: "94px",
  157. title: "现场勘查",
  158. subMenu: [{ index: 0, title: "发到手机", bgImage: "fdsj" }],
  159. },
  160. ],
  161. };
  162. },
  163. mounted() {},
  164. destroy() {},
  165. props: [],
  166. methods: {
  167. // 根据菜单父级index和子菜单index,判断全局变量已选中底部菜单的index对比,返回状态。
  168. ifMenuIndex(index, subIndex) {
  169. // return (
  170. // this.$store.state.bottomMenuIndexs.index == index &&
  171. // this.$store.state.bottomMenuIndexs.subIndex == subIndex
  172. // );
  173. if (index == 1) {
  174. if (subIndex == 0 || subIndex == 1) {
  175. return (
  176. this.$store.state.bottomMenuIndexs.index == index &&
  177. this.$store.state.bottomMenuIndexs.subIndex == subIndex
  178. );
  179. }
  180. // this.$store.state.bottomMenuIndexs.index = 1
  181. }
  182. },
  183. // 根据菜单父级index和子菜单index,更新全局变量。
  184. changeBottomMenu(index, subIndex, clickEvent) {
  185. // 该逻辑可能会舍弃
  186. this.$store.commit("changeBottomMenu", {
  187. index: index,
  188. subIndex: subIndex,
  189. });
  190. if (clickEvent) {
  191. // 调用全局事件总线中的指定事件
  192. this.$bus.$emit(clickEvent);
  193. }
  194. },
  195. // 根据菜单参数bgImage,菜单父级index和子菜单index,判断全局变量已选中底部菜单的index对比,返回不同状态下的icon图标地址。
  196. returnBgImage(bgImage, index, subIndex) {
  197. if (
  198. this.$store.state.bottomMenuIndexs.index == index &&
  199. this.$store.state.bottomMenuIndexs.subIndex == subIndex
  200. ) {
  201. return "/static/images/bottomMenuIcon/" + bgImage + "-a.png";
  202. } else {
  203. return "/static/images/bottomMenuIcon/" + bgImage + ".png";
  204. }
  205. },
  206. // 当用户点击svg底座时,切换底部菜单显示隐藏状态。(较难理解部分,如有疑问,请联系LiuMengxiang)
  207. changeShowBottomMenusStatus(state) {
  208. // 如果接收对象不为空
  209. if (state != undefined) {
  210. // 切换底部菜单显示隐藏状态
  211. this.showBottomMenusStatus = state;
  212. // 并切换弹窗显示隐藏状态
  213. this.dialogVisibleStatus = !state;
  214. } else if (!this.showBottomMenusStatus && this.dialogVisibleStatus) {
  215. // 如果底部菜单为隐藏状态且弹窗为显示状态,则为弹窗关闭询问。
  216. this.$bus.$emit("handleClose");
  217. } else {
  218. // 否则直接切换底部菜单显示隐藏状态
  219. this.showBottomMenusStatus = !this.showBottomMenusStatus;
  220. }
  221. },
  222. },
  223. watch: {},
  224. };
  225. </script>
  226. <style lang="less" scoped>
  227. @borderColor: #00aaff;
  228. @topTitleMinLeft: transparent;
  229. // 底部菜单
  230. #bottomMenus {
  231. position: absolute;
  232. bottom: 20px;
  233. display: flex;
  234. flex-direction: column-reverse;
  235. align-content: center;
  236. align-items: center;
  237. width: 100%;
  238. height: 100%;
  239. -moz-user-select: none;
  240. -webkit-user-select: none;
  241. -ms-user-select: none;
  242. -khtml-user-select: none;
  243. user-select: none;
  244. overflow: hidden;
  245. // svgBox
  246. #svgBox {
  247. width: 220px;
  248. height: 70px;
  249. overflow: hidden;
  250. z-index: 2;
  251. }
  252. }
  253. // menusBox
  254. #menusBox {
  255. background-color: rgba(0, 47, 86, 0.6);
  256. z-index: 1;
  257. border: 1px solid #00aaff;
  258. position: absolute;
  259. bottom: 60px;
  260. display: flex;
  261. flex-wrap: nowrap;
  262. align-content: center;
  263. justify-content: space-evenly;
  264. align-items: center;
  265. transition: width 0.2s, height 0.5s;
  266. &::before {
  267. content: "";
  268. position: absolute;
  269. bottom: -30px;
  270. width: 100%;
  271. height: 30px;
  272. background-image: linear-gradient(to top, #00aaff, #00aaff32);
  273. clip-path: polygon(0 0, 100% 0, 50% 100%, 0 0);
  274. }
  275. }
  276. .bottomMenus {
  277. &_box {
  278. overflow: hidden;
  279. height: 155px;
  280. position: relative;
  281. background: linear-gradient(to left, #00aaff, #00aaff) left top no-repeat,
  282. linear-gradient(to bottom, #00aaff, #00aaff) left top no-repeat,
  283. linear-gradient(to left, #00aaff, #00aaff) right top no-repeat,
  284. linear-gradient(to bottom, #00aaff, #00aaff) right top no-repeat,
  285. linear-gradient(to left, #00aaff, #00aaff) left bottom no-repeat,
  286. linear-gradient(to bottom, #00aaff, #00aaff) left bottom no-repeat,
  287. linear-gradient(to left, #00aaff, #00aaff) right bottom no-repeat,
  288. linear-gradient(to left, #00aaff, #00aaff) right bottom no-repeat;
  289. background-size: 3px 21px, 21px 3px, 3px 21px, 21px 3px;
  290. display: flex;
  291. flex-wrap: nowrap;
  292. align-content: center;
  293. justify-content: space-evenly;
  294. align-items: center;
  295. flex-direction: column;
  296. &::before {
  297. content: "";
  298. position: absolute;
  299. width: 100%;
  300. height: 100%;
  301. background-color: rgba(0, 54, 179, 0.3);
  302. z-index: 9999;
  303. }
  304. &_title {
  305. width: 100%;
  306. height: 40px;
  307. display: flex;
  308. justify-content: center;
  309. align-items: center;
  310. background-image: linear-gradient(
  311. to left,
  312. @topTitleMinLeft,
  313. @borderColor,
  314. @topTitleMinLeft
  315. );
  316. font-size: 16px;
  317. font-family: pingfangSC;
  318. font-weight: 300;
  319. color: #ffffff;
  320. line-height: 60px;
  321. z-index: 99999;
  322. }
  323. &_main {
  324. width: 100%;
  325. display: flex;
  326. flex-wrap: nowrap;
  327. align-content: center;
  328. justify-content: space-evenly;
  329. align-items: center;
  330. .colBtuMenu {
  331. display: flex;
  332. flex-wrap: nowrap;
  333. align-content: center;
  334. flex-direction: column;
  335. justify-content: space-evenly;
  336. align-items: center;
  337. position: relative;
  338. cursor: pointer;
  339. z-index: 99999;
  340. &:hover {
  341. &::before {
  342. content: "";
  343. position: absolute;
  344. width: 110%;
  345. height: 110%;
  346. border-radius: 10px;
  347. z-index: 999;
  348. box-shadow: 0px 0px 5px 1px #00f5ff;
  349. }
  350. .BtuMenu {
  351. display: none;
  352. }
  353. .BtuMenu_hover {
  354. display: block;
  355. }
  356. .BtuMenu_title {
  357. color: #00f5ff;
  358. }
  359. }
  360. .colBtuMenuShadow {
  361. content: "";
  362. position: absolute;
  363. width: 110%;
  364. height: 110%;
  365. border-radius: 10px;
  366. z-index: 999;
  367. box-shadow: 0px 0px 5px 3px #00f5ff;
  368. }
  369. .BtuMenu,
  370. .BtuMenu_hover {
  371. width: 50px;
  372. height: 50px;
  373. background-repeat: no-repeat;
  374. background-size: 100% 100%;
  375. }
  376. .BtuMenu {
  377. display: block;
  378. }
  379. .BtuMenu_hover {
  380. display: none;
  381. }
  382. & > .BtuMenu_title {
  383. font-size: 14px;
  384. font-family: pingfangSC;
  385. font-weight: bold;
  386. color: #ffffff;
  387. line-height: 22px;
  388. }
  389. }
  390. }
  391. }
  392. }
  393. </style>