FooterNavigation.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div
  3. class="footer-navigation-container"
  4. v-if="$route.name == 'basePage' || $route.name === null"
  5. >
  6. <div class="btn-box">
  7. <div
  8. class="btn"
  9. v-for="(item, index) in btnList"
  10. :key="item.id"
  11. :style="{
  12. left: item.left,
  13. top: (item.level * 7).toString() + 'px',
  14. backgroundImage: 'url(' + item.icon + ')',
  15. }"
  16. @mouseover="mouseover(item)"
  17. @mouseout="mouseout(item, index)"
  18. @click="click(item, index)"
  19. >
  20. <!-- {{ item.text + item.id }} -->
  21. </div>
  22. </div>
  23. <div class="home-btn-box" @click="toDefaultView"></div>
  24. </div>
  25. </template>
  26. <script>
  27. import { getFooterNavigationList } from "@/API/visual";
  28. import {
  29. flyToPerspective,
  30. setModelShow,
  31. setDataSourceShow,
  32. openLayer,
  33. openDialog,
  34. setUnderPipeline,
  35. setUndergroundMode,
  36. setBuildId,
  37. setBuildInfoByBuildId,
  38. } from "@/utils/mapUtil.js";
  39. export default {
  40. name: "FooterNavigation",
  41. data() {
  42. return {
  43. btnSel: -1,
  44. btnList: [],
  45. btnList1: [
  46. {
  47. id: 1,
  48. icon: "/imgs/footerNavigation/icon_RY_nor@2x.png",
  49. iconNor: "/imgs/footerNavigation/icon_RY_nor@2x.png",
  50. iconSel: "/imgs/footerNavigation/icon_RY_sel@2x.png",
  51. text: "按钮",
  52. script: "alert(111)",
  53. left: "calc(50% - 74px)",
  54. level: 0,
  55. },
  56. ],
  57. btnPositionList: [
  58. {
  59. left: "calc(50% - 74px)",
  60. level: 0,
  61. },
  62. {
  63. left: "calc(50% + 13px)",
  64. level: 0,
  65. },
  66. {
  67. left: "calc(50% - 161px)",
  68. level: 1,
  69. },
  70. {
  71. left: "calc(50% + 100px)",
  72. level: 1,
  73. },
  74. {
  75. left: "calc(50% - 248px)",
  76. level: 2,
  77. },
  78. {
  79. left: "calc(50% + 187px)",
  80. level: 2,
  81. },
  82. {
  83. left: "calc(50% - 335px)",
  84. level: 3,
  85. },
  86. {
  87. left: "calc(50% + 274px)",
  88. level: 3,
  89. },
  90. {
  91. left: "calc(50% - 422px)",
  92. level: 4,
  93. },
  94. {
  95. left: "calc(50% + 361px)",
  96. level: 4,
  97. },
  98. {
  99. left: "calc(50% - 509px)",
  100. level: 5,
  101. },
  102. {
  103. left: "calc(50% + 448px)",
  104. level: 5,
  105. },
  106. ],
  107. };
  108. },
  109. watch: {
  110. $route(to, from) {},
  111. },
  112. mounted() {
  113. if (localStorage.getItem("token") !== null) {
  114. this.getNavigationList();
  115. }
  116. },
  117. methods: {
  118. flyToPerspective,
  119. setModelShow,
  120. setDataSourceShow,
  121. openLayer,
  122. openDialog,
  123. setUnderPipeline,
  124. setUndergroundMode,
  125. setBuildId,
  126. setBuildInfoByBuildId,
  127. initMap() {
  128. this.setBuildId("");
  129. // this.jumpRoute("/basePage", { buildId: "654044537953460225" });
  130. // setTimeout(() => {
  131. // this.setBuildInfoByBuildId("654044537953460225");
  132. // }, 500);
  133. },
  134. jumpRoute(path, param) {
  135. if (!path) return;
  136. let route = { path: path };
  137. if (param) {
  138. // if (path === "/page2" && !!param.path) param.path = decodeURIComponent(param.path);
  139. if (!!param.path) param.path = decodeURIComponent(param.path);
  140. route["query"] = { ...param };
  141. }
  142. this.$router.push(route);
  143. },
  144. async getNavigationList() {
  145. try {
  146. const p = {};
  147. const res = await getFooterNavigationList(p);
  148. // console.log("底部菜单", res.data);
  149. res.data.content.forEach((item, index) => {
  150. const btn = {
  151. id: item.id,
  152. icon: item.iconNorPath,
  153. iconNor: item.iconNorPath,
  154. iconSel: item.iconSelPath,
  155. text: item.name,
  156. script: item.script,
  157. left: this.btnPositionList[index].left,
  158. level: this.btnPositionList[index].level,
  159. };
  160. item.left = this.btnPositionList[index].left;
  161. item.level = this.btnPositionList[index].level;
  162. this.btnList.push(btn);
  163. });
  164. // this.initMap(); //托克托不需要
  165. // console.log(this.btnList, "按钮列表");
  166. } catch (err) {
  167. console.log(err);
  168. }
  169. },
  170. mouseover(item) {
  171. item.icon = item.iconSel;
  172. },
  173. mouseout(item, index) {
  174. if (this.btnSel != index) {
  175. item.icon = item.iconNor;
  176. }
  177. },
  178. click(item, index) {
  179. try {
  180. //this.btnSel = index;
  181. this.btnList.forEach((element, loopIndex) => {
  182. if (this.btnSel === loopIndex) {
  183. element.icon = element.iconSel;
  184. } else {
  185. element.icon = element.iconNor;
  186. }
  187. });
  188. eval(item.script);
  189. } catch (error) {
  190. console.log(error);
  191. }
  192. },
  193. toDefaultView() {
  194. this.$store.dispatch("globalConfig/setMapMode", {
  195. value: "3d",
  196. });
  197. },
  198. openFooterDialog(type) {
  199. if (type) {
  200. switch (type) {
  201. case "fbky":
  202. console.log("防爆扩音");
  203. this.$store.dispatch("globalConfig/setSoundDialog", {
  204. show: true,
  205. dialogMsg: {},
  206. type: "All",
  207. });
  208. break;
  209. case "crkz":
  210. console.log("出入控制");
  211. this.$store.dispatch("globalConfig/setAccessControlDialog", {
  212. show: true,
  213. dialogMsg: {},
  214. type: "All",
  215. });
  216. break;
  217. case "jgyt":
  218. console.log("激光云台");
  219. this.$store.dispatch("globalConfig/setJGYTControlDialog", {
  220. show: true,
  221. dialogMsg: {},
  222. type: "All",
  223. });
  224. break;
  225. case "yyth":
  226. console.log("语音通话");
  227. this.$store.dispatch("globalConfig/setVoiceCallDialog", {
  228. show: true,
  229. dialogMsg: {},
  230. type: "All",
  231. });
  232. break;
  233. default:
  234. break;
  235. }
  236. }
  237. // this.getTestList();
  238. },
  239. },
  240. };
  241. </script>
  242. <style lang="less" scoped>
  243. .footer-navigation-container {
  244. border: 0px solid red;
  245. pointer-events: initial;
  246. position: absolute;
  247. z-index: 1800; // loading层是2000 设置高一些,下拉菜单会盖住loading层
  248. left: 50%;
  249. bottom: 0;
  250. transform: translate(-50%, 0);
  251. width: 1020px /* 1858/192 */;
  252. height: 135px /* 46/192 */;
  253. .btn-box {
  254. .btn {
  255. position: absolute;
  256. background-size: 100% 100%;
  257. background-repeat: no-repeat;
  258. display: inline-block;
  259. border: 0px solid rgb(0, 255, 136);
  260. box-sizing: border-box;
  261. height: 75px;
  262. width: 62px;
  263. cursor: pointer;
  264. }
  265. }
  266. .home-btn-box {
  267. position: absolute;
  268. background-size: 100% 100%;
  269. background-repeat: no-repeat;
  270. // background-image: url("/imgs/footerNavigation/buttn_GKPT.png");
  271. display: inline-block;
  272. border: 0px solid rgb(0, 255, 136);
  273. box-sizing: border-box;
  274. height: 35px;
  275. width: 107px;
  276. left: 456px;
  277. top: 100px;
  278. cursor: pointer;
  279. }
  280. }
  281. </style>