index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 { openLoginModal } = useLoginModal()
  10. async function clickLogin() {
  11. try {
  12. const { status } = await openLoginModal()
  13. if (status) location.reload()
  14. } catch (error) {
  15. console.log(error)
  16. }
  17. }
  18. // async function onSelected(command: string | number | object) {
  19. // if (command === "signOut") {
  20. // // 退出登录
  21. // try {
  22. // userStore.logout()
  23. // } catch (error) {
  24. // console.log(error, "error")
  25. // }
  26. // }
  27. // }
  28. </script>
  29. <template>
  30. <div>
  31. <div v-if="!isLogin">
  32. <el-button
  33. class="!b-0px !bg-#9B6CFF custom-btn-login !text-#fff !w-100px !h-32px !text-16px !b-rd-410px"
  34. @click="clickLogin"
  35. >
  36. Sign in
  37. </el-button>
  38. </div>
  39. </div>
  40. </template>
  41. <style lang="less">
  42. .custom-btn-login {
  43. .el-icon {
  44. font-size: 24px;
  45. }
  46. }
  47. .custom-dropdown {
  48. &.el-dropdown__popper {
  49. border-radius: 10px;
  50. .el-scrollbar {
  51. .el-dropdown__list {
  52. width: 415px;
  53. padding: 30px !important;
  54. }
  55. .el-dropdown-menu {
  56. .el-dropdown-menu__item {
  57. padding-bottom: 20px;
  58. padding-left: 0 !important;
  59. padding-right: 0 !important;
  60. padding-top: 0 !important;
  61. &:last-child {
  62. padding-bottom: 0;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. </style>