|
@@ -1,23 +1,115 @@
|
|
<template>
|
|
<template>
|
|
<div class="website-layout">
|
|
<div class="website-layout">
|
|
- <index-nav></index-nav>
|
|
|
|
|
|
+ <div class="layout-title">
|
|
|
|
+ <div class="title-box">
|
|
|
|
+ <div class="title-logo" @click="$router.push('/')">
|
|
|
|
+ <img src="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/f9617c7f80da485cb3cc72b6accc62ed"
|
|
|
|
+ alt="logo.png">
|
|
|
|
+ <div class="title-label">
|
|
|
|
+ <div class="title-name">WorkArk</div>
|
|
|
|
+ <div class="title-sub-name">SMART SERVE SYSTEM</div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <ul class="navbar-nav" v-if="$route.path === '/'">
|
|
|
|
+ <li class="nav-link" v-for="(item,index) in navList" :key="index" @click="navClick(item)">
|
|
|
|
+ {{item.name}}
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ <div class="login" v-if="user.userId">
|
|
|
|
+ <div class="login-avatar">
|
|
|
|
+ <avatar :user="user"></avatar>
|
|
|
|
+ </div>
|
|
|
|
+ <span class="login-name">{{user.userName}}</span>
|
|
|
|
+ <span class="color-primary logout" @click="logout">退出</span>
|
|
|
|
+ <span class="admin-system" @click="$router.push('/work')">控制台</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="login" v-else>
|
|
|
|
+ <div class="login-icon">
|
|
|
|
+ <i class="el-icon-s-custom"></i>
|
|
|
|
+ </div>
|
|
|
|
+ <span class="login-name" @click="loginFunc">登录 / 注册</span>
|
|
|
|
+ <span class="admin-system" @click="$router.push('/work')">控制台</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<keep-alive :include="['index']">
|
|
<keep-alive :include="['index']">
|
|
- <router-view />
|
|
|
|
|
|
+ <router-view ref="indexPage" @navFunc="navFunc"></router-view>
|
|
</keep-alive>
|
|
</keep-alive>
|
|
<index-foot></index-foot>
|
|
<index-foot></index-foot>
|
|
|
|
+ <el-dialog custom-class="login-custom" :close-on-click-modal="false" :visible.sync="dialogVisible"
|
|
|
|
+ :append-to-body="true">
|
|
|
|
+ <login v-if="dialogVisible" @callback="callback"></login>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- const indexNav = () => import('./components/indexNav');
|
|
|
|
|
|
+ import {
|
|
|
|
+ removeToken,
|
|
|
|
+ removeComment
|
|
|
|
+ } from '@/uitls/auth';
|
|
|
|
+ import {
|
|
|
|
+ mapGetters
|
|
|
|
+ } from 'vuex';
|
|
|
|
+ const login = () => import('./components/login');
|
|
const indexFoot = () => import('./components/indexFoot');
|
|
const indexFoot = () => import('./components/indexFoot');
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
- return {}
|
|
|
|
|
|
+ return {
|
|
|
|
+ user: {},
|
|
|
|
+ dialogVisible: false,
|
|
|
|
+ navList: []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.init();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ init() {
|
|
|
|
+ this.user = this.$store.getters.user;
|
|
|
|
+ },
|
|
|
|
+ loginFunc() {
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
+ },
|
|
|
|
+ logout() {
|
|
|
|
+ this.$confirm('是否要退出登录?', () => {
|
|
|
|
+ removeToken();
|
|
|
|
+ removeComment();
|
|
|
|
+ if (this.$store.getters.chatToken) this.$chat.disConnect();
|
|
|
|
+ if (this.$store.getters.chatTokens) this.$chats.disConnect();
|
|
|
|
+ this.$store.dispatch('app/resetState');
|
|
|
|
+ this.$message.success('退出成功');
|
|
|
|
+ this.callbackFunc();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ callbackFunc() {
|
|
|
|
+ if (this.$route.path === '/') {
|
|
|
|
+ this.init();
|
|
|
|
+ } else {
|
|
|
|
+ this.$router.go(0);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ callback(type) {
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ if (type == 'init') this.callbackFunc();
|
|
|
|
+ },
|
|
|
|
+ navClick(item) {
|
|
|
|
+ if (this.$refs.indexPage) this.$refs.indexPage.screenTo(item);
|
|
|
|
+ },
|
|
|
|
+ navFunc(list) {
|
|
|
|
+ this.navList = list;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapGetters(['loginVisible'])
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ loginVisible(val) {
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- computed: {},
|
|
|
|
components: {
|
|
components: {
|
|
- indexNav,
|
|
|
|
|
|
+ login,
|
|
indexFoot
|
|
indexFoot
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -31,4 +123,143 @@
|
|
position: relative;
|
|
position: relative;
|
|
padding-top: 60px;
|
|
padding-top: 60px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .login-custom {
|
|
|
|
+ width: 440px !important;
|
|
|
|
+ height: auto !important;
|
|
|
|
+
|
|
|
|
+ .el-dialog__header {
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .layout-title {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 60px;
|
|
|
|
+ z-index: 9;
|
|
|
|
+ background: $--color-white;
|
|
|
|
+ box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.1);
|
|
|
|
+ position: fixed;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+
|
|
|
|
+ .navbar-nav {
|
|
|
|
+ flex: 1;
|
|
|
|
+ width: 0;
|
|
|
|
+ display: flex;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .nav-link {
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ font-size: 15px;
|
|
|
|
+ line-height: 21px;
|
|
|
|
+ text-align: left;
|
|
|
|
+ font-style: normal;
|
|
|
|
+ padding: 0 16px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+
|
|
|
|
+ &:hover {
|
|
|
|
+ color: $--color-primary;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title-box {
|
|
|
|
+ width: 1200px;
|
|
|
|
+ height: 100%;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ padding-right: 20px;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title-logo {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+
|
|
|
|
+ img {
|
|
|
|
+ width: 44px;
|
|
|
|
+ height: 44px;
|
|
|
|
+ margin-right: 10px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title-label {
|
|
|
|
+ width: 150px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title-name {
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ line-height: 22px;
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title-sub-name {
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ transform: scale(.68) translateX(-32px);
|
|
|
|
+ opacity: .75;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .location {
|
|
|
|
+ border: 2px solid #fff;
|
|
|
|
+ border-radius: 26px;
|
|
|
|
+ height: 26px;
|
|
|
|
+ padding: 0 10px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .location-name {
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ margin-left: 3px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .login {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .logout {
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ margin-left: 5px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .login-avatar {
|
|
|
|
+ width: 32px;
|
|
|
|
+ height: 32px;
|
|
|
|
+ border-radius: 32px;
|
|
|
|
+ margin-right: 10px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .login-icon {
|
|
|
|
+ width: 32px;
|
|
|
|
+ height: 32px;
|
|
|
|
+ border: 2px solid #fff;
|
|
|
|
+ border-radius: 32px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ line-height: 32px;
|
|
|
|
+
|
|
|
|
+ .el-icon-s-custom {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .login-name {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .admin-system {
|
|
|
|
+ margin-left: 20px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|