hanbaoshan
2020-08-08 98a44e94ecc76abd72b9817648ca4b91469b936a
src/pages/desktop/index/components/Tools.vue
@@ -12,10 +12,11 @@
      </div>
    </div>
    <div class="tools-middle">
      <div v-for="dock in this.$store.state.desktop.minDocks" :key="dock.id" class="dock-item-wrap" :class="{'actived':dock.highlight}">
      <div v-for="dock in $store.state.desktop.minDocks" :key="dock.id" class="dock-item-wrap" :class="{'actived':dock.highlight}">
        <a @click="dockClick(dock)">
          <img class="dock-item" :src="dock.src" :alt="dock.alt" />
          <img class="dock-shot" :src="dock.screenshot" :alt="dock.name" />
          <img class="dock-shot" :src="dock.screenshot" v-if="dock.screenshot"/>
        </a>
      </div>
    </div>
@@ -30,14 +31,25 @@
        <img :src="`${publicPath}images/desktop/header-icon/notice.png`" alt />
      </div>
      <div class="tools-icon">
        <img :src="`${publicPath}images/desktop/header-icon/user.png`" alt />
        <el-dropdown size="small" placement="bottom">
          <span class="el-dropdown-link">
            <img :src="`${publicPath}images/desktop/header-icon/user.png`" alt />
            <!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
          </span>
          <el-dropdown-menu slot="dropdown" style='top: 44px;'>
            <el-dropdown-item @click.native='toLogout'>
              退出登录
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>
<script>
import {logout} from "@/api/login";
export default {
  name: "Tools",
  data() {
@@ -75,6 +87,7 @@
  //     deep: true
  //   }
  // },
  
  methods: {
    notificationCenterClick: function () {
@@ -103,7 +116,8 @@
          id: frame.id,
          src: frame.icon,
          alt: frame.title,
          type: "3"
          type: "3",
          screenshot: ''
        });
      })
    },
@@ -124,6 +138,33 @@
        debugger
        this.$store.commit("desktop/refreshFrame", dock);
      }
    },
    toLogout(){
      this.$confirm("提示:确定退出吗?", {
        center: true,
        cancelButtonClass: "comfirm-class-cancle",
        confirmButtonClass: "comfirm-class-sure"
      }).then(_ => {
        logout().then(res => {
          if (res === "退出成功") {
            sessionStorage.removeItem("userInfo");
            location.assign('/view/index');
            this.$notify({
              title: "提示",
              type: "success",
              message: "退出成功!"
            });
          } else {
            this.$notify({
              title: "提示",
              type: "success",
              message: "退出失败!"
            });
          }
        });
      }).catch(_ => {
        console.log("退出失败");
      });
    }
  }
};
@@ -180,6 +221,7 @@
}
.tools-middle .dock-item-wrap.actived{
  border-color: #40c3ff;
  background-color: #98aabe;
}
.dock-item-wrap a {
  height: 100%;
@@ -221,4 +263,7 @@
  height: 100%;
  margin-right: 14px;
}
.el-dropdown-menu{
  top: 40px !important;
}
</style>