2026-05-13 12:43:01 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="admin-profile">
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<section class="profile-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span class="profile-eyebrow">后台账号</span>
|
|
|
|
|
|
<h1>{{ userInfo?.nickname || '未设置昵称' }}</h1>
|
|
|
|
|
|
<p>{{ userInfo?.account || '当前登录账号' }} · {{ roleLabel }}</p>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</div>
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<span class="profile-chip">{{ isPlatformOverview ? '平台总览' : currentShopName }}</span>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<section class="profile-section">
|
|
|
|
|
|
<div class="profile-section__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>账号与门店</h2>
|
|
|
|
|
|
<p>账号资料、权限范围和门店切换已集中到系统设置。</p>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<button class="profile-link" type="button" @click="router.push({ path: '/admin/settings', query: { section: 'account' } })">
|
|
|
|
|
|
<span class="profile-link__icon">◎</span>
|
|
|
|
|
|
<span class="profile-link__body"><strong>打开当前账号设置</strong><small>查看后台账号、权限范围和可用门店</small></span>
|
|
|
|
|
|
<span class="profile-link__arrow">›</span>
|
|
|
|
|
|
</button>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<section class="profile-section">
|
|
|
|
|
|
<div class="profile-section__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>常用入口</h2>
|
|
|
|
|
|
<p>继续处理日常经营工作。</p>
|
|
|
|
|
|
</div>
|
2026-05-21 18:43:59 +08:00
|
|
|
|
</div>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<div class="profile-actions">
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<a-button type="default" size="large" @click="router.push('/admin/orders')">查看订单</a-button>
|
|
|
|
|
|
<a-button type="default" size="large" @click="router.push('/admin/manage')">进入经营模块</a-button>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-10-25 20:34:15 +08:00
|
|
|
|
<section class="profile-section profile-section--logout">
|
|
|
|
|
|
<div class="profile-section__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>退出登录</h2>
|
|
|
|
|
|
<p>退出后需要重新登录后台。</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<a-button danger size="large" block @click="handleLogout">退出当前账号</a-button>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-10-25 20:34:15 +08:00
|
|
|
|
import { computed, ref } from 'vue'
|
2026-05-13 12:43:01 +08:00
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
|
import { message, Modal } from 'ant-design-vue'
|
2026-10-10 16:08:46 +08:00
|
|
|
|
import { completeAdminLogout } from '@/utils/admin-logout'
|
2026-10-25 20:34:15 +08:00
|
|
|
|
import { runWithGlobalLoading } from '@/utils/action-loading'
|
|
|
|
|
|
import { getAdminCurrentShopName, getAdminRoleLabel, isBootstrapAdminUser, loadCachedAdminUserInfo } from './admin-helpers'
|
2026-05-13 12:43:01 +08:00
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
const userInfo = ref(loadCachedAdminUserInfo())
|
|
|
|
|
|
const roleLabel = computed(() => getAdminRoleLabel(userInfo.value?.type))
|
2026-10-25 20:34:15 +08:00
|
|
|
|
const currentShopName = computed(() => getAdminCurrentShopName(userInfo.value))
|
|
|
|
|
|
const isPlatformOverview = computed(() => isBootstrapAdminUser(userInfo.value))
|
2026-05-13 12:43:01 +08:00
|
|
|
|
|
|
|
|
|
|
const handleLogout = () => {
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '确认退出登录',
|
|
|
|
|
|
content: '退出后需要重新登录后台。',
|
|
|
|
|
|
okText: '确认',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
await runWithGlobalLoading(async () => {
|
2026-10-10 16:08:46 +08:00
|
|
|
|
await completeAdminLogout(router)
|
|
|
|
|
|
message.success('已退出登录')
|
2026-05-13 12:43:01 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-10-25 20:34:15 +08:00
|
|
|
|
.admin-profile { display: grid; gap: 18px; color: var(--admin-mobile-ink); }
|
|
|
|
|
|
.profile-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--admin-mobile-border); }
|
|
|
|
|
|
.profile-eyebrow { color: var(--theme-primary-action); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
|
|
|
|
|
|
.profile-head h1 { margin: 7px 0 4px; font-size: 27px; }
|
|
|
|
|
|
.profile-head p, .profile-section__head p { margin: 0; color: var(--admin-mobile-muted); font-size: 13px; }
|
|
|
|
|
|
.profile-chip { padding: 7px 10px; border-radius: 999px; background: var(--admin-mobile-accent-soft); color: var(--theme-primary-action); font-size: 12px; font-weight: 700; white-space: nowrap; }
|
|
|
|
|
|
.profile-section { padding-top: 16px; border-top: 1px solid var(--admin-mobile-border); }
|
|
|
|
|
|
.profile-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
|
|
|
|
|
.profile-section__head h2 { margin: 0 0 4px; font-size: 15px; }
|
|
|
|
|
|
.profile-link { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--admin-mobile-border); background: transparent; color: inherit; text-align: left; cursor: pointer; }
|
|
|
|
|
|
.profile-link:hover { color: var(--theme-primary-action); }
|
|
|
|
|
|
.profile-link__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px; background: var(--admin-mobile-accent-soft); color: var(--theme-primary-action); font-size: 20px; }
|
|
|
|
|
|
.profile-link__body { display: grid; flex: 1; gap: 3px; min-width: 0; }
|
|
|
|
|
|
.profile-link__body strong { font-size: 14px; }
|
|
|
|
|
|
.profile-link__body small { color: var(--admin-mobile-muted); font-size: 12px; }
|
|
|
|
|
|
.profile-link__arrow { color: var(--admin-mobile-muted); font-size: 24px; line-height: 1; }
|
|
|
|
|
|
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }
|
|
|
|
|
|
.profile-actions .ant-btn { flex: 1 1 180px; }
|
|
|
|
|
|
.profile-section--logout .ant-btn { max-width: 240px; }
|
|
|
|
|
|
@media (max-width: 560px) {
|
|
|
|
|
|
.profile-head { align-items: flex-start; flex-direction: column; }
|
|
|
|
|
|
.profile-section--logout .ant-btn { max-width: none; }
|
2026-05-13 12:43:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|