map3d.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <div id="app">
  3. <div class="header">
  4. <div class="menuClass" id="menuClass">
  5. <!-- <div
  6. v-for="(item, index) in menu"
  7. :key="index"
  8. :class="activeMenuId == index ? 'activemenu' : 'menu'"
  9. @click="chooseMenu(item, index)"
  10. >
  11. {{ item.title }}
  12. </div> -->
  13. <el-menu
  14. :default-active="activeIndex"
  15. class="el-menu-demo"
  16. mode="horizontal"
  17. @select="handleMenuSelect"
  18. background-color="rgb(4,16,36)"
  19. text-color="white"
  20. active-text-color="white"
  21. >
  22. <template v-for="(item, index) in menu">
  23. <el-menu-item v-if="!item.children" :index="item.path">{{
  24. item.title
  25. }}</el-menu-item>
  26. <el-submenu
  27. :index="index"
  28. v-if="item.children && item.children.length > 0"
  29. >
  30. <template slot="title">{{ item.title }}</template>
  31. <template v-for="(subitem, subindex) in item.children">
  32. <el-menu-item
  33. v-if="!subitem.children"
  34. popper-class="el-menu-item-popper"
  35. :index="subitem.path"
  36. >{{ subitem.title }}</el-menu-item
  37. >
  38. <el-submenu
  39. :index="index + '-' + subindex"
  40. v-if="subitem.children && subitem.children.length > 0"
  41. >
  42. <template slot="title">{{ subitem.title }}</template>
  43. <el-menu-item
  44. :index="submenu.path"
  45. v-for="(submenu, sunindex) in subitem.children"
  46. :key="sunindex"
  47. >{{ submenu.title }}</el-menu-item
  48. >
  49. </el-submenu>
  50. </template>
  51. </el-submenu>
  52. </template>
  53. </el-menu>
  54. </div>
  55. <div class="systemTitle">海南省国土空间智慧治理试点</div>
  56. <tool-bar></tool-bar>
  57. <div class="timeline">
  58. <div class="timeline-item" v-html="formattedText"></div>
  59. <div
  60. class="timeline-item timeline-item-time"
  61. v-html="formattedTime"
  62. ></div>
  63. </div>
  64. <div class="user">
  65. <i
  66. class="exit el-icon-switch-button"
  67. @click="exit"
  68. :title="Resource.exit"
  69. ></i>
  70. </div>
  71. </div>
  72. <div class="routerContainer">
  73. <router-view ref="routeViewRef"></router-view>
  74. </div>
  75. <sm-viewer @viewerChange="viewerChange"> </sm-viewer>
  76. </div>
  77. </template>
  78. <script>
  79. import { getRouters } from "@/api/menu";
  80. export default {
  81. name: "app",
  82. data() {
  83. return {
  84. menu: [],
  85. activeIndex: 0,
  86. formattedText: "",
  87. formattedTime: "",
  88. activeMenuId: 0,
  89. };
  90. },
  91. created() {
  92. this.GetRouters();
  93. },
  94. computed: {},
  95. mounted() {
  96. //动态时间回显
  97. setInterval(() => {
  98. this.updateTime();
  99. }, 1000);
  100. this.updateTime();
  101. },
  102. methods: {
  103. viewerChange(isbig){
  104. this.$refs.routeViewRef[ isbig ? 'switchPack_down':'switchPack_up']()
  105. },
  106. handleMenuSelect(item) {
  107. this.$router.push({ path: item });
  108. },
  109. updateTime() {
  110. let s = new Date().toLocaleString().split(" ");
  111. this.formattedText = s[0];
  112. this.formattedTime = s[1];
  113. },
  114. chooseMenu(item, index) {
  115. if (this.activeMenuId == index) {
  116. return;
  117. }
  118. console.log(item);
  119. this.activeMenuId = index;
  120. this.$router.push({ path: item.path });
  121. },
  122. GetRouters() {
  123. getRouters().then((res) => {
  124. this.menu = res.data[0].children;
  125. // console.log(this.menu);
  126. let curRouter = this.$router.currentRoute.path;
  127. if (curRouter == "/") {
  128. this.activeIndex = this.menu[0].path;
  129. this.$router.push({ path: this.menu[0].path });
  130. } else {
  131. this.activeIndex = curRouter;
  132. this.$router.push({ path: curRouter });
  133. // for (let i = 0; i < this.menu.length; i++) {
  134. // if (this.menu[i].path == curRouter) {
  135. // this.activeMenuId = i;
  136. // this.$router.push({ path: this.menu[i].path });
  137. // break;
  138. // }
  139. // }
  140. }
  141. });
  142. },
  143. getDayOfWeek() {
  144. const days = [
  145. "星期日",
  146. "星期一",
  147. "星期二",
  148. "星期三",
  149. "星期四",
  150. "星期五",
  151. "星期六",
  152. ];
  153. const date = new Date();
  154. return days[date.getDay()];
  155. },
  156. exit() {
  157. this.$alert("确认退出登录吗?", "提示", {
  158. confirmButtonText: "确定",
  159. callback: (action) => {
  160. if (action != "cancel") {
  161. this.$store.dispatch("LogOut").then(() => {
  162. location.href = "/login";
  163. });
  164. }
  165. },
  166. });
  167. },
  168. },
  169. };
  170. </script>
  171. <style scoped>
  172. .exit {
  173. font-size: 30px;
  174. color: cornflowerblue;
  175. cursor: pointer;
  176. }
  177. .user {
  178. width: 40px;
  179. height: 40px;
  180. position: absolute;
  181. right: 10px;
  182. top: 19px;
  183. }
  184. .routerContainer {
  185. position: absolute;
  186. width: 100%;
  187. height: calc(100% - 60px);
  188. top: 60px;
  189. }
  190. .header {
  191. height: 60px;
  192. position: fixed;
  193. top: 0px;
  194. width: 100%;
  195. z-index: 999999;
  196. background: rgb(4, 16, 36);
  197. text-align: center;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. background-image: url("/static/images/overview/title.png");
  202. background-size: 100% 100%;
  203. }
  204. .systemTitle {
  205. height: 100%;
  206. width: 338px;
  207. position: absolute;
  208. top: 0px;
  209. line-height: 60px;
  210. font-size: 25px;
  211. color: white;
  212. }
  213. .menuClass {
  214. position: absolute;
  215. left: 40px;
  216. font-size: 14px;
  217. height: 32px;
  218. top: 20px;
  219. }
  220. .menu {
  221. display: inline-block;
  222. width: 108px;
  223. height: 100%;
  224. line-height: 35px;
  225. margin-left: 9px;
  226. cursor: pointer;
  227. background-image: url("/static/images/overview/menu.png");
  228. background-size: 100% 100%;
  229. }
  230. .activemenu {
  231. display: inline-block;
  232. width: 108px;
  233. height: 100%;
  234. line-height: 35px;
  235. margin-left: 9px;
  236. cursor: pointer;
  237. background-image: url("/static/images/overview/menuactive.png");
  238. background-size: 100% 100%;
  239. }
  240. .menu:hover,
  241. .activemenu:hover {
  242. /* background: blue; */
  243. font-weight: bold;
  244. }
  245. .timeline {
  246. position: absolute;
  247. right: 53px;
  248. top: 17px;
  249. height: 38px;
  250. line-height: 60px;
  251. font-size: 14px;
  252. width: 148px;
  253. color: white;
  254. background-image: url(/static/images/overview/time.png);
  255. background-size: 100% 100%;
  256. }
  257. .timeline-item {
  258. height: 25px;
  259. line-height: 25px;
  260. text-align: center;
  261. width: 100%;
  262. display: inline-block;
  263. font-size: 11px;
  264. position: relative;
  265. top: -21px;
  266. letter-spacing: 1px;
  267. }
  268. .timeline-item-time {
  269. top: -62px;
  270. font-size: 19px;
  271. }
  272. .el-menu-demo {
  273. border: none !important;
  274. height: 100%;
  275. background-color: transparent;
  276. }
  277. .el-menu-item {
  278. background-image: url("/static/images/overview/menu.png");
  279. background-size: 100% 100%;
  280. float: left;
  281. height: 37px;
  282. line-height: 43px !important;
  283. margin: 0;
  284. border: none;
  285. color: white;
  286. width: 120px;
  287. }
  288. .el-menu-item:hover {
  289. font-weight: bold;
  290. color: white !important;
  291. }
  292. .el-submenu,
  293. .is-opend {
  294. background-image: url("/static/images/overview/menu.png");
  295. background-size: 100% 100%;
  296. height: 37px;
  297. line-height: 43px !important;
  298. margin: 0;
  299. border: none;
  300. color: white;
  301. width: 120px;
  302. }
  303. .el-menu--popup .el-submenu {
  304. width: 100% !important;
  305. }
  306. .el-submenu:hover {
  307. font-weight: bold;
  308. color: white !important;
  309. }
  310. .el-menu--horizontal > .el-menu-item.is-active,
  311. .el-menu-item.is-active,
  312. .el-submenu.is-active {
  313. background-image: url("/static/images/overview/menuactive.png");
  314. background-size: 100% 100%;
  315. }
  316. .el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
  317. border: none !important;
  318. color: white !important;
  319. }
  320. .el-submenu__title {
  321. height: 39px !important;
  322. line-height: 43px !important;
  323. border: none !important;
  324. color: white !important;
  325. }
  326. /deep/ .el-menu-item.is-active,
  327. /deep/.el-submenu.is-active,
  328. /deep/ .el-submenu.is-active,
  329. /deep/.el-submenu__title {
  330. border: none;
  331. color: white;
  332. }
  333. /deep/ .el-menu-item,
  334. /deep/ .el-submenu__title,
  335. /deep/ .is-opened {
  336. height: 37px !important;
  337. line-height: 43px !important;
  338. color: white !important;
  339. background-color: transparent !important;
  340. border: none !important;
  341. text-align: center !important;
  342. }
  343. </style>