<template>
  <Index
      @updatePwd="updatePwd"
      @logout="logout"
      :langAble="false"
      :styleAble="true"
      center=""
      :username="state.user.name"
  >
  </Index>
</template>

<script lang="ts" setup>
import { reactive, onMounted, ref } from "vue";
import { useStore } from "vuex";
import { Index, Element, Http } from "noob-mengyxu";
const { showMessage } = Element;
import md5 from "js-md5";
import { useI18n } from "vue3-i18n";
const { t } = useI18n();
const { commit, dispatch, state } = useStore();
// const logo = ref("/logo.png");

const updatePwd = (pwd) => {
  if (state.user.password != md5(pwd.old)) {
    showMessage("error", "旧密码不正确");
    return;
  }
  state.user.password = md5(pwd.new);
};

const logout = () => {
  dispatch("logout");
};

onMounted(() => {
  dispatch("getMenus");
  document.title = t("title");
});
</script>

<style lang="scss">

/* Force selection colors to work globally */
*::selection {
  background-color: #3367d1 !important;
  color: #fff !important;
}

*::-moz-selection {
  background-color: #3367d1 !important;
  color: #fff !important;
}

.el-dialog {
  background-color: rgba($color: #e6e8eb, $alpha: 1) !important;
}

.el-select-dropdown {
  background-color: rgba($color: #e6e8eb, $alpha: 1) !important;
}
</style>
