| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <template>
- <el-container style="height: 100%">
- <el-header class="header" v-show="flag">
- <div v-if="userinfo.logo">
- <img
- :src="userinfo.logo"
- alt=""
- style="position: absolute; left: 20px; top: 20px; width: 136px"
- />
- </div>
- <!-- 用户 -->
- <div class="userinfo">
- 欢迎您,{{ username }}
- </div>
- <!-- 标题 -->
- <div class="sysName">
- <h2 v-if="userinfo.user_header">{{ userinfo.user_header }}</h2>
- <h2 v-else>苗情监测应用系统</h2>
- <p>Plants Growth Status Monitoring System</p>
- </div>
- <div class="site" v-if="userinfo.site">
- <i class="iconfont icon-jidi"></i>
- <span>{{ userinfo.site }}</span>
- </div>
- <span class="header_btn" @click="hCheckFun">[隐藏]</span>
- </el-header>
- <el-header class="header2" v-show="!flag">
- <h3 v-if="userinfo.user_header">{{ userinfo.user_header }}</h3>
- <h3 v-else>苗情监测应用系统</h3>
- <div class="site" v-if="userinfo.site">
- <i class="iconfont icon-jidi"></i>
- <span>{{ userinfo.site }}</span>
- </div>
- <span class="header_btn" @click="hCheckFun">[展开]</span>
- </el-header>
- <el-container style="overflow: auto">
- <el-aside width="200px">
- <el-menu
- :default-active="$route.path"
- :collapse-transition="false"
- class="el-menu-vertical-demo"
- :router="isRouter"
- active-text-color="rgb(0, 0, 0)"
- >
- <el-menu-item index="/index/monitor">
- <i :class="iconObj[20]"></i>
- <span slot="title">苗情监测应用系统</span>
- </el-menu-item>
- <el-menu-item index="/index/list">
- <i :class="iconObj[22]"></i>
- <span slot="title">设备列表</span>
- </el-menu-item>
- <el-menu-item index="/index/userManger">
- <i :class="iconObj[23]"></i>
- <span slot="title">用户管理</span>
- </el-menu-item>
- </el-menu>
- </el-aside>
- <el-main>
- <router-view></router-view>
- </el-main>
- </el-container>
- </el-container>
- </template>
- <script>
- export default {
- data() {
- return {
- isRouter: true,
- iconObj: {
- 20: "iconfont icon-jiankong",
- 22: "iconfont icon-shebei",
- 23: "iconfont icon-xitong",
- },
- flag: true,
- active: 1,
- userinfo: {},
- username: "",
- userphoto: "",
- };
- },
- created: function () {
- this.getuserinfo();
- },
- methods: {
- hCheckFun() {
- this.flag = !this.flag;
- },
- getuserinfo() {
- this.$axios({
- method: "post",
- url: "userinfo_",
- }).then((res) => {
- this.username = res.data.username;
- this.userphoto = res.data.userphoto;
- localStorage.setItem("username", res.data.username); // 0管理员 1用户
- });
- this.$axios({
- method: "get",
- url: "user_detail",
- }).then((res) => {
- this.userinfo = res.data;
- localStorage.setItem("have_type", this.userinfo.have_type); // 0管理员 1用户
- localStorage.setItem("staff", this.userinfo.staff); // 1是admin
- });
- },
- },
- };
- </script>
- <style scoped lang="less">
- .header {
- position: relative;
- width: 100%;
- height: 177px !important;
- border-bottom: 2px solid #272b3a;
- background: #397b0c no-repeat center / 100% 100%
- url(../assets/images/monitor/h_bg.jpg);
- .userinfo {
- color: #fff;
- position: absolute;
- top: 10px;
- right: 10px;
- .userheadImg {
- width: 35px;
- height: 35px;
- border-radius: 50%;
- vertical-align: middle;
- margin-right: 6px;
- }
- }
- .sysName {
- color: #295206;
- text-align: center;
- h2 {
- color: #295206;
- font-weight: 800;
- text-shadow: #fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0;
- font-size: 26px;
- }
- p {
- color: #295206;
- font-weight: 600;
- text-shadow: #fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0;
- font-size: 14px;
- }
- margin-top: 50px;
- }
- .logInfo {
- color: #fff;
- position: absolute;
- top: 10px;
- left: 20px;
- display: flex;
- flex-direction: row;
- align-items: center;
- img {
- width: auto;
- height: 40px;
- }
- h3 {
- margin: 0;
- margin-left: 20px;
- }
- }
- }
- .header2 {
- border-bottom: 2px solid #397b0c;
- position: relative;
- background-color: #397b0c;
- color: #fff;
- }
- .site {
- position: absolute;
- right: 90px;
- bottom: 10px;
- z-index: 888;
- font-size: 14px;
- color: #ffffff;
- span {
- color: #fff;
- letter-spacing: 1px;
- font-size: 13px;
- }
- }
- .header_btn {
- position: absolute;
- color: #999;
- font-size: 14px;
- right: 20px;
- bottom: 10px;
- cursor: pointer;
- }
- .header_btn:hover {
- color: #fff;
- }
- .el-aside {
- background: #f0f0f0;
- i {
- color: #000;
- }
- .is-active {
- span {
- color: #fff;
- }
- background: #5aae22;
- i {
- color: #fff;
- }
- }
- .el-menu-item:focus,
- .el-menu-item:hover {
- i {
- color: #fff;
- }
- color: #fff;
- background: #5aae22;
- }
- }
- .el-main {
- padding: 0;
- }
- </style>
|