123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <div class="layout">
- <div class="menu-wrapper">
- <left-menu :isCollapse='isFold'
- @changeMenu="changeMenu"
- @changeIsBack="changeIsBack"></left-menu>
- </div>
- <div class="content">
- <header :style="menuIndex==0?'justify-content: space-between;':''">
- <div class="back-icon"
- v-if="isback"
- @click="goBack"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/back.png"
- alt=""></div>
- <div class="left"
- v-if="menuIndex==0">
- <div class="address">{{userInfo.store_name}}</div>
- </div>
- <div class="right">
- <div class="news"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/news.png"></div>
- <div class="head-img"><img :src="userInfo.avatar_url"></div>
- <el-dropdown trigger="click"
- placement="top"
- @command="loginOut">
- <span class="el-dropdown-link">
- <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/logOut.png"
- alt="">
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item>退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </header>
- <div class="main-wrapper">
- <router-view></router-view>
- </div>
- </div>
- </div>
- </template>
- <script type="text/javascript">
- import leftMenu from './leftMenu'
- import api from '@/server/home'
- export default {
- data () {
- return {
- isFold: false, //导航菜单面板是否折叠
- userId: 0,
- menuIndex: 0,
- isback: false,
- userInfo: {
- name: '333'
- }
- }
- },
- created () {
- this.getUserInfo()
- },
- components: {
- leftMenu,
- },
- methods: {
- getUserInfo () {
- let that = this
- api.getUserInfo().then(res => {
- if (res.code == 200) {
- this.userInfo = res.data
- }
- })
- },
- loginOut () {
- localStorage.removeItem('token');
- location.reload();
- },
- changeMenu (index) {
- this.menuIndex = index
- },
- changeIsBack (isback) {
- this.isback = isback
- },
- goBack () {
- this.$router.back()
- }
- },
- computed: {
- routerItems () {
- let resultArr = [];
- let routeNow = this.$route;
- let RootName = routeNow.matched[0].name; //当前路由的根路由name
- resultArr.push({
- name: RootName,
- path: ''
- })
- if (routeNow.matched[0].path !== '' && RootName !== routeNow.name) {
- if (RootName !== routeNow.name) {
- resultArr.push({
- name: routeNow.matched[1].name,
- path: routeNow.matched[1].path
- })
- }
- }
- return resultArr;
- }
- },
- }
- </script>
- <style lang="less" scoped>
- @import url(../../../style/root.less);
- .layout {
- height: 100vh;
- display: flex;
- }
- .menu-wrapper {
- height: 100%;
- text-align: center;
- overflow: auto;
- background-color: #fa7d22;
- .el-menu {
- background-color: #fa7d22;
- .el-menu-item {
- color: #eee;
- }
- }
- }
- .content {
- background-color: #fff;
- flex: 1;
- overflow: hidden;
- header {
- line-height: 50px;
- font-size: 16px;
- color: #409eff;
- padding: 0 28px 0 13px;
- border-bottom: 1px solid #e5e5e5;
- height: 60px;
- display: flex;
- align-items: center;
- justify-content: right;
- position: relative;
- .back-icon {
- position: absolute;
- left: 19px;
- img {
- width: 16px;
- }
- }
- .left {
- font-size: 14px;
- font-family: SourceHanSansCN-Regular, SourceHanSansCN;
- font-weight: 400;
- color: #333333;
- line-height: 21px;
- }
- .right {
- float: right;
- display: flex;
- align-items: center;
- .news {
- width: 24px;
- height: 24px;
- img {
- width: 100%;
- display: block;
- }
- }
- .head-img {
- margin-left: 19px;
- width: 28px;
- height: 28px;
- border-radius: 50%;
- img {
- width: 100%;
- display: block;
- }
- }
- .el-dropdown-link {
- img {
- width: 28px;
- height: 28px;
- display: block;
- }
- }
- }
- }
- .main-wrapper {
- height: calc(100% - 51px);
- width: 100%;
- overflow: auto;
- padding: 20px;
- background-color: #f7f8fa;
- }
- }
- </style>
|