index.vue 1.7 KB

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