| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <div id="app">
- <el-container>
- <el-header>
- <div class="flex flex-auto flex-center">
- <div class="logo mr12">
- <img src="./assets/img/common-logo.png" alt />
- </div>
- <el-menu :default-active="defaultActive"
- class="el-menu-demo"
- mode="horizontal"
- menu-trigger="hover"
- @select="handleSelect"
- :router="router">
- <el-menu-item index="/">首页</el-menu-item>
- <el-menu-item index="/introduce">中心介绍</el-menu-item>
- <el-menu-item index="/news">新闻动态</el-menu-item>
- <el-submenu index="/appointment" popper-class="custom-submenu">
- <template slot="title">
- 预约管理
- </template>
- <el-menu-item index="/appointment/equipment">
- 仪器设备
- </el-menu-item>
- <el-menu-item index="/appointment/equipment-details" v-if="false">
- 仪器设备详情
- </el-menu-item>
- <el-menu-item index="2-2">中心平台</el-menu-item>
- <el-menu-item index="2-3">技术服务</el-menu-item>
- </el-submenu>
- <el-menu-item index="/product">教育培训</el-menu-item>
- <el-menu-item index="/case">资料下载</el-menu-item>
- <el-menu-item index="/contact-us">联系我们</el-menu-item>
- </el-menu>
- </div>
- <div class="user" v-if="$route.path != '/login'">
- <template v-if="!userInfo.id">
- <el-button type="text" @click="toLogin">登录</el-button>
- <el-button type="text" @click="onRegister">注册</el-button>
- </template>
- <template v-else>
- <el-button
- type="primary"
- size="mini"
- color="#386AFE"
- @click="toCenter"
- >
- 个人中心
- </el-button>
- <el-dropdown class="ml12" size="medium" @command="handleCommand">
- <span class="flex flex-center">
- <img v-if="userInfo.avatar" :src="userInfo.avatar" />
- <img v-else src="./assets/img/default-avatar.png">
- <i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="logOut">注销</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </div>
- </el-header>
- <el-main>
- <router-view />
- </el-main>
- <div class="footer">
- 版权所有©遵义医科大学附属医院 贵ICP备17033796号-1
- </div>
- </el-container>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- computed: {
- ...mapGetters(["userInfo"]),
- },
- watch: {
- $route(val) {
- this.defaultActive = val.path;
- },
- },
- data() {
- return {
- router: true,
- defaultActive: "/",
- isShow: false,
- };
- },
- methods: {
- handleSelect(key) {
- this.isShow = this.defaultActive != key;
- window.console.log(this.isShow);
- },
- onRegister() {
- this.$router.push("/register");
- },
- toLogin() {
- this.$router.push("/login");
- },
- toCenter() {
- this.$router.push("/personal-center");
- },
- handleCommand(command) {
- if (command == "logOut") {
- this.$confirm("确定注销吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$store.dispatch('logOut').then(() => this.$router.push('/'))
- })
- }
- }
- },
- };
- </script>
- <style lang="scss">
- * {
- padding: 0;
- margin: 0;
- }
- html,
- body {
- height: 100%;
- }
- #app {
- font-family: "Avenir", Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- color: #2c3e50;
- }
- .el-header {
- display: flex;
- justify-content: space-between;
- align-content: center;
- align-items: center;
- width: 100%;
- margin: 0 auto;
- height: 84px !important;
- .el-menu,
- .el-submenu,
- .el-submenu__title,
- .el-menu-item {
- height: 40px !important;
- line-height: 40px !important;
- }
- .el-menu.el-menu--horizontal,
- .el-menu-demo .el-menu-item,
- .el-submenu .el-submenu__title {
- border-bottom: none;
- font-weight: 400;
- font-size: 16px;
- color: #323232;
- padding: 0;
- margin: 0 20px;
- }
- .el-menu.el-menu--horizontal,
- .el-submenu .el-submenu__title {
- font-weight: 400;
- font-size: 16px;
- color: #323232 !important;
- }
- .logo {
- width: 280px;
- padding: 10px;
- img {
- width: 100%;
- line-height: 60px;
- }
- }
- .user {
- display: flex;
- align-items: center;
- img {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- }
- }
- }
- .el-main {
- padding: 0 !important;
- }
- .footer {
- width: 100%;
- height: 32px;
- overflow: hidden;
- background-color: #386afe;
- font-weight: 400;
- font-size: 18px;
- color: #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|