123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- <template>
- <header>
- <div id="header">
- <!-- 主页路由菜单 开始 -->
- <div class="router-index" v-if="!home">
- <!-- <router-link
- class="router-left"
- :class="title == route.meta.title ? 'router_left2' : 'router_left1'"
- v-for="route in router.slice(1, 2)"
- :key="route"
- :to="route.path"
- v-show="route.meta.type === 'index'"
- >
- <span>{{ route.meta.title }}</span>
- </router-link>
- <a
- :href="'https://wx.ewoogi.com/manage/#/'"
- class="router-left router_left1"
- >后台管理</a
- > -->
- <!-- <a
- :href="'http://localhost:9999/#/login?userName=admin'"
- target="_blank"
- class="router-left router_left1"
- >后台管理</a
- > -->
- </div>
- <!-- 主页路由菜单 结束 -->
- <!-- 站点路由菜单 开始 -->
- <div class="router-menu" v-if="home">
- <div class="select">
- <span>当前站点:</span>
- <el-select
- v-model="value"
- @change="el_select"
- placeholder="请选择"
- popper-class="menu_select"
- filterable
- >
- <el-option
- v-for="(item, index) in options"
- :key="index"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- <div class="site_one" style="display: flex">
- <router-link
- class="router-left"
- :class="title == route.meta.title ? 'router_left2' : 'router_left1'"
- v-for="route in router.slice(2, 4)"
- :key="route"
- :to="route.path"
- v-show="route.meta.type === 'menu'"
- >
- <span>{{ route.meta.title }}</span>
- </router-link>
- </div>
- <div class="site_two" style="display: flex">
- <router-link
- class="router-rigth"
- :class="
- title == route.meta.title ? 'router_rigth2' : 'router_rigth1'
- "
- v-for="route in router.slice(4, 6)"
- :key="route"
- :to="route.path"
- v-show="route.meta.type === 'menu'"
- >
- <span>{{ route.meta.title }}</span>
- </router-link>
- </div>
- </div>
- <!-- 站点路由菜单 结束 -->
- <div class="title">{{ name }}</div>
- <div class="rigth">
- <div class="showTime">{{ time }}</div>
- <router-link class="home" to="/home" v-if="home"></router-link>
- <div class="news">
- <div></div>
- <!-- <span><a>9</a></span> -->
- </div>
- <div class="admin"></div>
- </div>
- </div>
- </header>
- </template>
- <script>
- import api from "@/api/index";
- import { getToken } from "@/utils/auth";
- export default {
- name: "App",
- data() {
- return {
- title: "",
- name: "",
- router: [],
- home: false,
- options: [],
- value: 1,
- time: null,
- assToken: "",
- username: "",
- password: "",
- };
- },
- components: {},
- mounted() {
- this.assToken = getToken();
- setInterval(() => {
- this.$store.commit("getTimeAll");
- var time = this.$store.state.Time_All;
- this.time =
- time[0] +
- "-" +
- (time[1] < 9 ? "0" + (time[1] + 1) : time[1] + 1) +
- "-" +
- (time[2] < 10 ? "0" + time[2] : time[2]) +
- " " +
- (time[3] < 10 ? "0" + time[3] : time[3]) +
- ":" +
- (time[4] < 10 ? "0" + time[4] : time[4]) +
- ":" +
- (time[5] < 10 ? "0" + time[5] : time[5]);
- }, 0);
- this.router = this.$router.options.routes;
- // console.log(this.router);
- },
- methods: {
- el_select(val) {
- // console.log(val);
- for (let i in this.options) {
- if (this.options[i].value == val) {
- this.name = this.options[i].label;
- }
- }
- // localStorage.clear();
- localStorage.removeItem("Overview")
- localStorage.setItem("Overview", [val, this.name]);
- },
- //下拉列表api请求
- options_api() {
- api.options_api().then((requset) => {
- this.options=[]
- // console.log(requset)
- var list = requset.data;
- for (let i in list) {
- this.options.push({ label: list[i].siteName, value: list[i].id });
- }
- });
- },
- },
- watch: {
- value(val) {
- this.$store.commit("increment", val);
- },
- $route: function () {
- var type = this.$route.meta.type;
- var title = this.$route.meta.title;
- var name = this.$route.meta.name;
- this.title = title;
- this.name = name;
- type === "menu"
- ? setTimeout(() => {
- this.options_api();
- }, 100)
- : "";
- var getlocal = localStorage.getItem("Overview");
- if (
- getlocal != undefined &&
- getlocal != null &&
- getlocal != "" &&
- type !== "index"
- ) {
- this.value = parseInt(getlocal.split(",")[0]);
- this.name = getlocal.split(",")[1];
- }
- type === "menu" ? (this.home = true) : (this.home = false);
- },
- },
- };
- </script>
- <style scoped lang="less">
- #header {
- -moz-user-select: none; //设置文本不可选中
- -webkit-user-select: none; //设置文本不可选中
- user-select: none; //设置文本不可选中
- .router-index {
- position: absolute;
- display: flex;
- height: 100%;
- line-height: 1rem;
- // margin-left: 1rem;
- .router-left {
- width: 1.525rem;
- height: 0.5rem;
- display: block;
- text-align: center;
- line-height: 0.5rem;
- margin: 0.125rem;
- font-size: 0.225rem;
- }
- .router-left:hover {
- background: url(./../assets/images/router_left2.png) no-repeat;
- background-size: cover;
- color: #fac112;
- }
- .router_left1 {
- background: url(./../assets/images/router_left1.png) no-repeat;
- color: #fff;
- background-size: cover;
- }
- .router_left2 {
- background: url(./../assets/images/router_left2.png) no-repeat;
- color: #fac112;
- background-size: cover;
- }
- }
- .router-menu {
- position: absolute;
- display: flex;
- height: 100%;
- line-height: 1rem;
- margin-left: 0.5rem;
- .select {
- display: flex;
- span {
- // position: absolute;
- font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;
- color: #fff;
- font-weight: 400;
- font-size: 0.225rem;
- height: 100%;
- line-height: 0.75rem;
- }
- }
- .router-left {
- width: 1.525rem;
- height: 0.5rem;
- display: block;
- text-align: center;
- line-height: 0.5rem;
- margin: 0.125rem;
- font-size: 0.225rem;
- }
- .router-left:hover {
- background: url(./../assets/images/router_left2.png) no-repeat;
- background-size: cover;
- color: #fac112;
- }
- .router_left1 {
- background: url(./../assets/images/router_left1.png) no-repeat;
- color: #fff;
- background-size: cover;
- }
- .router_left2 {
- background: url(./../assets/images/router_left2.png) no-repeat;
- color: #fac112;
- background-size: cover;
- }
- .site_one {
- margin-left: 1.5rem;
- }
- .site_two {
- position: absolute;
- margin-left: 14.9rem;
- }
- .router-rigth {
- width: 1.525rem;
- height: 0.5rem;
- display: block;
- text-align: center;
- line-height: 0.5rem;
- margin: 0.125rem;
- font-size: 0.225rem;
- }
- .router-rigth:hover {
- background: url(./../assets/images/router_right2.png) no-repeat;
- background-size: cover;
- color: #fac112;
- }
- .router_rigth1 {
- background: url(./../assets/images/router_right1.png) no-repeat;
- color: #fff;
- background-size: cover;
- }
- .router_rigth2 {
- background: url(./../assets/images/router_right2.png) no-repeat;
- color: #fac112;
- background-size: cover;
- }
- }
- .title {
- font-size: 0.5rem;
- color: #fff;
- font-family: PangMenZhengDao Regular, PangMenZhengDao Regular-Regular;
- font-weight: 600;
- letter-spacing: 3px;
- text-align: center;
- line-height: 1rem;
- margin: 0 auto;
- width: 6rem;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .rigth {
- position: absolute;
- top: 0;
- right: 0;
- display: flex;
- div {
- margin-right: 0.17rem;
- }
- .home {
- width: 0.3125rem;
- height: 0.25rem;
- margin-top: 0.25rem;
- background: url(./../assets/images/home.png) no-repeat;
- background-size: cover;
- margin-right: 0.3rem;
- }
- .showTime {
- font-size: 0.25rem;
- font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;
- font-weight: 400;
- color: #fff;
- line-height: 0.75rem;
- margin-right: 0.25rem;
- }
- .news {
- font-size: 0.25rem;
- color: #fff;
- line-height: 0.35rem;
- cursor: pointer;
- div {
- width: 0.3rem;
- height: 0.2375rem;
- margin-top: 0.25rem;
- background: url(./../assets/images/news.png) no-repeat;
- background-size: cover;
- }
- span {
- position: absolute;
- text-align: center;
- width: 0.2rem;
- height: 0.2rem;
- line-height: 0.2rem;
- background-color: red;
- border-radius: 100%;
- top: 0.12rem;
- right: 0.75rem;
- a {
- display: block;
- width: 0.2rem;
- height: 0.2rem;
- color: #fff;
- transform: scale(0.7, 0.7);
- }
- }
- }
- .admin {
- width: 0.325rem;
- height: 0.325rem;
- margin-top: 0.2rem;
- background: url(./../assets/images/admin.png) no-repeat;
- background-size: cover;
- cursor: pointer;
- }
- }
- }
- </style>
- <style lang="less">
- .menu_select .el-popper__arrow::before {
- border-top-color: transparent !important;
- border-left-color: transparent !important;
- background: rgba(0, 244, 253, 1) !important;
- }
- .el-select__popper {
- background-color: #082333 !important;
- }
- .menu_select {
- border: 1px solid rgba(0, 244, 253, 1) !important;
- > div {
- border: transparent !important;
- }
- }
- .el-select-dropdown__item.selected {
- color: rgba(0, 244, 253, 1) !important;
- }
- .el-select-dropdown__item {
- color: #fff !important;
- padding: 0 20px !important;
- text-align: center !important;
- }
- .el-select-dropdown__item:hover {
- background: rgba(0, 244, 253, 0.2) !important;
- }
- .el-scrollbar__view {
- background: rgba(0, 244, 253, 0) !important;
- }
- .menu_select .el-scrollbar {
- width: 2rem;
- }
- </style>
|