index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!-- @format -->
  2. <script setup lang="ts">
  3. import { useUserStore } from '@/stores/modules/user'
  4. import { useCommonStore } from '@/stores/modules/common'
  5. const commonStore = useCommonStore()
  6. const userStore = useUserStore()
  7. const { isLogin } = storeToRefs(userStore)
  8. const { noticeRemind } = storeToRefs(commonStore)
  9. const hoverStatus = ref<any>()
  10. const { openLoginModal } = useLoginModal()
  11. commonStore.getNoticeRemind()
  12. // const { locale, setLocale } = useI18nLocale()
  13. // function handleClick({ key }: any) {
  14. // setLocale(key)
  15. // }
  16. async function clickLogin() {
  17. try {
  18. const { status } = await openLoginModal()
  19. if (status)
  20. location.reload()
  21. }
  22. catch (error) {
  23. console.log(error)
  24. }
  25. }
  26. async function onSelected(command: string | number | object) {
  27. if (command === 'signOut') {
  28. // 退出登录
  29. try {
  30. userStore.logout()
  31. }
  32. catch (error) {
  33. console.log(error, 'error')
  34. }
  35. }
  36. }
  37. </script>
  38. <template>
  39. <div>
  40. <div v-if="!isLogin">
  41. <el-button
  42. class="b-solid b-1px b-#AB7045 custom-btn-login !text-#AB7045 !w-100px !h-34px !text-16px !b-rd-150px"
  43. @mouseover="hoverStatus = '!fill-#fff'" @mouseleave="hoverStatus = '!fill-#CC9879'" @click="clickLogin"
  44. >
  45. <template #icon>
  46. <svgo-user :class="hoverStatus" class="w-24px h-24px" :filled="true" />
  47. </template> Log In
  48. </el-button>
  49. </div>
  50. </div>
  51. </template>
  52. <style lang="less">
  53. .custom-btn-login {
  54. .el-icon{
  55. font-size: 24px;
  56. }
  57. }
  58. .custom-dropdown {
  59. &.el-dropdown__popper{
  60. border-radius: 10px;
  61. .el-scrollbar{
  62. .el-dropdown__list{
  63. width: 415px;
  64. padding: 30px!important;
  65. }
  66. .el-dropdown-menu {
  67. .el-dropdown-menu__item{
  68. padding-bottom: 20px;
  69. padding-left: 0 !important;
  70. padding-right: 0 !important;
  71. padding-top: 0 !important;
  72. &:last-child{
  73. padding-bottom: 0;
  74. }
  75. }}
  76. }}
  77. }
  78. </style>