123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <!-- @format -->
- <script setup lang="ts">
- import { useUserStore } from '@/stores/modules/user'
- import { useCommonStore } from '@/stores/modules/common'
- const commonStore = useCommonStore()
- const userStore = useUserStore()
- const { isLogin } = storeToRefs(userStore)
- const { noticeRemind } = storeToRefs(commonStore)
- const hoverStatus = ref<any>()
- const { openLoginModal } = useLoginModal()
- commonStore.getNoticeRemind()
- // const { locale, setLocale } = useI18nLocale()
- // function handleClick({ key }: any) {
- // setLocale(key)
- // }
- async function clickLogin() {
- try {
- const { status } = await openLoginModal()
- if (status)
- location.reload()
- }
- catch (error) {
- console.log(error)
- }
- }
- async function onSelected(command: string | number | object) {
- if (command === 'signOut') {
- // 退出登录
- try {
- userStore.logout()
- }
- catch (error) {
- console.log(error, 'error')
- }
- }
- }
- </script>
- <template>
- <div>
- <div v-if="!isLogin">
- <el-button
- class="b-solid b-1px b-#AB7045 custom-btn-login !text-#AB7045 !w-100px !h-34px !text-16px !b-rd-150px"
- @mouseover="hoverStatus = '!fill-#fff'" @mouseleave="hoverStatus = '!fill-#CC9879'" @click="clickLogin"
- >
- <template #icon>
- <svgo-user :class="hoverStatus" class="w-24px h-24px" :filled="true" />
- </template> Log In
- </el-button>
- </div>
- <div v-else>
- <el-dropdown :hide-on-click="false" placement="bottom-end" popper-class="custom-dropdown" @command="onSelected">
- <template #default>
- <svgo-user class="!w-30px !h-30px !fill-#5B463E" :filled="true" />
- </template>
- <template #dropdown>
- <div class="flex items-center ">
- <svgo-user-avatar class="!w-20px !h-20px" />
- <span class="text-20px fw-500 text-#333 ml-20px">
- {{ userStore.userInfo.firstName }}
- {{ userStore.userInfo.lastName }}
- </span>
- </div>
- <div class="text-16px text-#999 mt-10px">
- {{ userStore.userInfo.email }}
- </div>
- <!-- <div class="w-full bg-#D8D8D8 h-1px my-20px" />
- <div class="text-16px text-#333">
- Unlock <span class="text-#AB7045">$ 8000</span> Buy Now Pay Later Limit (60 day terms)
- </div> -->
- <div class="w-full bg-#D8D8D8 h-1px my-20px" />
- <el-dropdown-menu>
- <el-dropdown-item command="dashboard">
- <NuxtLink to="/account/panel" class="flex items-center text-16px">
- <svgo-dashboard class="!w-22px !h-22px mr-16px" /> Dashboard
- </NuxtLink>
- </el-dropdown-item>
- <el-dropdown-item command="message">
- <NuxtLink to="/account/rfqs" class="flex items-center text-16px">
- <svgo-rfqs class="!w-20px !h-20px mr-18px" />
- RFQS
- </NuxtLink>
- </el-dropdown-item>
- <el-dropdown-item command="favorites">
- <NuxtLink to="/account/favourites?tab=products" class="flex items-center text-16px">
- <svgo-favorite class="!w-22px !h-22px mr-16px" />
- Favourites
- </NuxtLink>
- </el-dropdown-item>
- <el-dropdown-item command="orders">
- <NuxtLink to="/account/orders?tab=submitted" class="flex items-center text-16px">
- <svgo-order class="!w-22px !h-22px mr-16px" />
- Orders
- </NuxtLink>
- </el-dropdown-item>
- <!-- <el-dropdown-item command="message">
- <NuxtLink to="/account/messages" class="flex items-center text-16px">
- <svgo-message class="!w-22px !h-22px mr-16px" />
- Messages
- </NuxtLink>
- </el-dropdown-item> -->
- <el-dropdown-item command="message">
- <NuxtLink to="/account/notice" class="flex items-center text-16px pos-relative">
- <svgo-notice class="!w-22px !h-22px mr-16px" />
- <div v-if="noticeRemind" class="pos-absolute top-0 left-20px bg-primary w-5px h-5px b-rd-50%" />
- Notice
- </NuxtLink>
- </el-dropdown-item>
- <el-dropdown-item command="setting">
- <NuxtLink to="/account/settings?tab=profile" class="flex items-center text-16px">
- <svgo-setting class="!w-22px !h-22px mr-16px" />
- Settings
- </NuxtLink>
- </el-dropdown-item>
- <div class="w-full bg-#D8D8D8 h-1px mb-20px" />
- <el-dropdown-item command="signOut">
- <div class=" flex items-center text-16px">
- <svgo-logout class="!w-22px !h-22px mr-16px" />
- Sign out
- </div>
- </el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- </div>
- </div>
- </template>
- <style lang="less">
- .custom-btn-login {
- .el-icon{
- font-size: 24px;
- }
- }
- .custom-dropdown {
- &.el-dropdown__popper{
- border-radius: 10px;
- .el-scrollbar{
- .el-dropdown__list{
- width: 415px;
- padding: 30px!important;
- }
- .el-dropdown-menu {
- .el-dropdown-menu__item{
- padding-bottom: 20px;
- padding-left: 0 !important;
- padding-right: 0 !important;
- padding-top: 0 !important;
- &:last-child{
- padding-bottom: 0;
- }
- }}
- }}
- }
- </style>
|