|
|
@@ -3,6 +3,7 @@
|
|
|
<cwg-dropdown ref="dropdownRef" :menu-list="[]">
|
|
|
<view class="pc-header-btn cursor-pointer" :data-tooltip="t('vu.tooltip.t100')">
|
|
|
<cwg-icon name="icon_my" color="#97A1C0" @click="openNotice" />
|
|
|
+ <view>{{ name }}</view>
|
|
|
</view>
|
|
|
<template #btn>
|
|
|
<view class="dropdown-menu dropdown-menu-end w-225px mt-1 show">
|
|
|
@@ -27,20 +28,21 @@
|
|
|
<text v-t="item.name"></text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view>
|
|
|
- <view class="dropdown-divider my-1"></view>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <view class="dropdown-item d-flex align-items-center gap-2 text-danger cursor-pointer"
|
|
|
- @click="handleLogout">
|
|
|
- <cwg-icon name="logout" :size="16" color="#FF401C" />
|
|
|
- <text v-t="'language.i6'"></text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+<!-- <view>-->
|
|
|
+<!-- <view class="dropdown-divider my-1"></view>-->
|
|
|
+<!-- </view>-->
|
|
|
+<!-- <view>-->
|
|
|
+<!-- <view class="dropdown-item d-flex align-items-center gap-2 text-danger cursor-pointer"-->
|
|
|
+<!-- @click="handleLogout">-->
|
|
|
+<!-- <cwg-icon name="logout" :size="16" color="#FF401C" />-->
|
|
|
+<!-- <text v-t="'language.i6'"></text>-->
|
|
|
+<!-- </view>-->
|
|
|
+<!-- </view>-->
|
|
|
</view>
|
|
|
</template>
|
|
|
</cwg-dropdown>
|
|
|
</view>
|
|
|
+ <cwg-global-popup/>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
@@ -52,11 +54,13 @@ import { userApi } from '@/api/user'
|
|
|
import { useI18n } from "vue-i18n"
|
|
|
import useRouter from "@/hooks/useRouter"
|
|
|
import useGlobalStore from '@/stores/use-global-store'
|
|
|
+import { usePopup } from '@/hooks/usePopup'
|
|
|
const globalStore = useGlobalStore()
|
|
|
const isDark = computed(() => globalStore.theme === 'dark')
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
const router = useRouter()
|
|
|
+const { confirm } = usePopup()
|
|
|
const dropdownRef = ref(null)
|
|
|
const userStore = useUserStore()
|
|
|
const route = useRoute()
|
|
|
@@ -67,6 +71,13 @@ const _displayName = ref('--')
|
|
|
const _displayCid = ref('--')
|
|
|
const _activePath = ref('')
|
|
|
const _email = ref('--')
|
|
|
+
|
|
|
+const name = computed(() => {
|
|
|
+ const info = userStore.userInfo?.customInfo || {}
|
|
|
+ const firstName = info.firstName || ''
|
|
|
+ const lastName = info.lastName || ''
|
|
|
+ return (firstName + ' ' + lastName).trim() || info.name
|
|
|
+})
|
|
|
// 复制文本
|
|
|
const copy = (text: string) => {
|
|
|
uni.setClipboardData({
|
|
|
@@ -144,6 +155,13 @@ function handleNavigate(path) {
|
|
|
|
|
|
// 登出
|
|
|
async function handleLogout() {
|
|
|
+ const res = await confirm({
|
|
|
+ title: t('Msg.SystemPrompt'),
|
|
|
+ content: t('mine.p'),
|
|
|
+ showCancel: t('mine.b2'),
|
|
|
+ confirmText: t('mine.b1'),
|
|
|
+ })
|
|
|
+ if (!res) return
|
|
|
try {
|
|
|
await userApi.logout()
|
|
|
} catch (e) { }
|
|
|
@@ -170,7 +188,7 @@ defineExpose({ openNotice, close })
|
|
|
text-overflow: unset !important;
|
|
|
}
|
|
|
:deep(.cwg-dropdown-menu-container) {
|
|
|
- left: px2rpx(-190) !important;
|
|
|
+ left: px2rpx(-150) !important;
|
|
|
right: px2rpx(0) !important;
|
|
|
|
|
|
.menu {
|
|
|
@@ -181,12 +199,14 @@ defineExpose({ openNotice, close })
|
|
|
|
|
|
@media screen and (max-width: 991px) {
|
|
|
:deep(.cwg-dropdown-menu-container) {
|
|
|
- left: px2rpx(-190) !important;
|
|
|
+ left: px2rpx(-150) !important;
|
|
|
max-width: px2rpx(400);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.pc-header-btn {
|
|
|
+ width: auto;
|
|
|
+ padding: 0 px2rpx(5);
|
|
|
position: relative;
|
|
|
}
|
|
|
|