123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- <template>
- <div id="app">
- <div class="header">
- <div class="menuClass" id="menuClass">
- <!-- <div
- v-for="(item, index) in menu"
- :key="index"
- :class="activeMenuId == index ? 'activemenu' : 'menu'"
- @click="chooseMenu(item, index)"
- >
- {{ item.title }}
- </div> -->
- <el-menu
- :default-active="activeIndex"
- class="el-menu-demo"
- mode="horizontal"
- @select="handleMenuSelect"
- background-color="rgb(4,16,36)"
- text-color="white"
- active-text-color="white"
- >
- <template v-for="(item, index) in menu">
- <el-menu-item v-if="!item.children" :index="item.path">{{
- item.title
- }}</el-menu-item>
- <el-submenu
- :index="index"
- v-if="item.children && item.children.length > 0"
- >
- <template slot="title">{{ item.title }}</template>
- <template v-for="(subitem, subindex) in item.children">
- <el-menu-item
- v-if="!subitem.children"
- popper-class="el-menu-item-popper"
- :index="subitem.path"
- >{{ subitem.title }}</el-menu-item
- >
- <el-submenu
- :index="index + '-' + subindex"
- v-if="subitem.children && subitem.children.length > 0"
- >
- <template slot="title">{{ subitem.title }}</template>
- <el-menu-item
- :index="submenu.path"
- v-for="(submenu, sunindex) in subitem.children"
- :key="sunindex"
- >{{ submenu.title }}</el-menu-item
- >
- </el-submenu>
- </template>
- </el-submenu>
- </template>
- </el-menu>
- </div>
- <div class="systemTitle">海南省国土空间智慧治理试点</div>
- <tool-bar></tool-bar>
- <div class="timeline">
- <div class="timeline-item" v-html="formattedText"></div>
- <div
- class="timeline-item timeline-item-time"
- v-html="formattedTime"
- ></div>
- </div>
- <div class="user">
- <i
- class="exit el-icon-switch-button"
- @click="exit"
- :title="Resource.exit"
- ></i>
- </div>
- </div>
- <div class="routerContainer">
- <router-view ref="routeViewRef"></router-view>
- </div>
- <sm-viewer @viewerChange="viewerChange"> </sm-viewer>
- </div>
- </template>
- <script>
- import { getRouters } from "@/api/menu";
- export default {
- name: "app",
- data() {
- return {
- menu: [],
- activeIndex: 0,
- formattedText: "",
- formattedTime: "",
- activeMenuId: 0,
- };
- },
- created() {
- this.GetRouters();
- },
- computed: {},
- mounted() {
- //动态时间回显
- setInterval(() => {
- this.updateTime();
- }, 1000);
- this.updateTime();
- },
- methods: {
- viewerChange(isbig){
- this.$refs.routeViewRef[ isbig ? 'switchPack_down':'switchPack_up']()
- },
- handleMenuSelect(item) {
- this.$router.push({ path: item });
- },
- updateTime() {
- let s = new Date().toLocaleString().split(" ");
- this.formattedText = s[0];
- this.formattedTime = s[1];
- },
- chooseMenu(item, index) {
- if (this.activeMenuId == index) {
- return;
- }
- console.log(item);
- this.activeMenuId = index;
- this.$router.push({ path: item.path });
- },
- GetRouters() {
- getRouters().then((res) => {
- this.menu = res.data[0].children;
- // console.log(this.menu);
- let curRouter = this.$router.currentRoute.path;
- if (curRouter == "/") {
- this.activeIndex = this.menu[0].path;
- this.$router.push({ path: this.menu[0].path });
- } else {
- this.activeIndex = curRouter;
- this.$router.push({ path: curRouter });
- // for (let i = 0; i < this.menu.length; i++) {
- // if (this.menu[i].path == curRouter) {
- // this.activeMenuId = i;
- // this.$router.push({ path: this.menu[i].path });
- // break;
- // }
- // }
- }
- });
- },
- getDayOfWeek() {
- const days = [
- "星期日",
- "星期一",
- "星期二",
- "星期三",
- "星期四",
- "星期五",
- "星期六",
- ];
- const date = new Date();
- return days[date.getDay()];
- },
- exit() {
- this.$alert("确认退出登录吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action != "cancel") {
- this.$store.dispatch("LogOut").then(() => {
- location.href = "/login";
- });
- }
- },
- });
- },
- },
- };
- </script>
- <style scoped>
- .exit {
- font-size: 30px;
- color: cornflowerblue;
- cursor: pointer;
- }
- .user {
- width: 40px;
- height: 40px;
- position: absolute;
- right: 10px;
- top: 19px;
- }
- .routerContainer {
- position: absolute;
- width: 100%;
- height: calc(100% - 60px);
- top: 60px;
- }
- .header {
- height: 60px;
- position: fixed;
- top: 0px;
- width: 100%;
- z-index: 999999;
- background: rgb(4, 16, 36);
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- background-image: url("/static/images/overview/title.png");
- background-size: 100% 100%;
- }
- .systemTitle {
- height: 100%;
- width: 338px;
- position: absolute;
- top: 0px;
- line-height: 60px;
- font-size: 25px;
- color: white;
- }
- .menuClass {
- position: absolute;
- left: 40px;
- font-size: 14px;
- height: 32px;
- top: 20px;
- }
- .menu {
- display: inline-block;
- width: 108px;
- height: 100%;
- line-height: 35px;
- margin-left: 9px;
- cursor: pointer;
- background-image: url("/static/images/overview/menu.png");
- background-size: 100% 100%;
- }
- .activemenu {
- display: inline-block;
- width: 108px;
- height: 100%;
- line-height: 35px;
- margin-left: 9px;
- cursor: pointer;
- background-image: url("/static/images/overview/menuactive.png");
- background-size: 100% 100%;
- }
- .menu:hover,
- .activemenu:hover {
- /* background: blue; */
- font-weight: bold;
- }
- .timeline {
- position: absolute;
- right: 53px;
- top: 17px;
- height: 38px;
- line-height: 60px;
- font-size: 14px;
- width: 148px;
- color: white;
- background-image: url(/static/images/overview/time.png);
- background-size: 100% 100%;
- }
- .timeline-item {
- height: 25px;
- line-height: 25px;
- text-align: center;
- width: 100%;
- display: inline-block;
- font-size: 11px;
- position: relative;
- top: -21px;
- letter-spacing: 1px;
- }
- .timeline-item-time {
- top: -62px;
- font-size: 19px;
- }
- .el-menu-demo {
- border: none !important;
- height: 100%;
- background-color: transparent;
- }
- .el-menu-item {
- background-image: url("/static/images/overview/menu.png");
- background-size: 100% 100%;
- float: left;
- height: 37px;
- line-height: 43px !important;
- margin: 0;
- border: none;
- color: white;
- width: 120px;
- }
- .el-menu-item:hover {
- font-weight: bold;
- color: white !important;
- }
- .el-submenu,
- .is-opend {
- background-image: url("/static/images/overview/menu.png");
- background-size: 100% 100%;
- height: 37px;
- line-height: 43px !important;
- margin: 0;
- border: none;
- color: white;
- width: 120px;
- }
- .el-menu--popup .el-submenu {
- width: 100% !important;
- }
- .el-submenu:hover {
- font-weight: bold;
- color: white !important;
- }
- .el-menu--horizontal > .el-menu-item.is-active,
- .el-menu-item.is-active,
- .el-submenu.is-active {
- background-image: url("/static/images/overview/menuactive.png");
- background-size: 100% 100%;
- }
- .el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
- border: none !important;
- color: white !important;
- }
- .el-submenu__title {
- height: 39px !important;
- line-height: 43px !important;
- border: none !important;
- color: white !important;
- }
- /deep/ .el-menu-item.is-active,
- /deep/.el-submenu.is-active,
- /deep/ .el-submenu.is-active,
- /deep/.el-submenu__title {
- border: none;
- color: white;
- }
- /deep/ .el-menu-item,
- /deep/ .el-submenu__title,
- /deep/ .is-opened {
- height: 37px !important;
- line-height: 43px !important;
- color: white !important;
- background-color: transparent !important;
- border: none !important;
- text-align: center !important;
- }
- </style>
|