新增bdcenter 页面
This commit is contained in:
parent
a607ec008f
commit
6dd08874a6
@ -161,6 +161,20 @@ export function getApplyRecord(userId, status) {
|
||||
return get(`/team/user/apply/record?teamId=${userId}&status=${status}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* BD团队当月总目标
|
||||
*/
|
||||
export function getAgentMonthTarget() {
|
||||
return get(`/team/bd/agent-count`)
|
||||
}
|
||||
|
||||
/**
|
||||
* BD团队上个月总目标
|
||||
*/
|
||||
export function getAgentMonthLastTarget() {
|
||||
return get(`/team/bd/agent-count-last`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化显示状态
|
||||
* @param {string} status - 状态值
|
||||
|
||||
@ -94,6 +94,16 @@ const router = createRouter({
|
||||
name: 'agency-center',
|
||||
component: () => import('../views/AgencyCenterView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/bd-center',
|
||||
name: 'bd-center',
|
||||
component: () => import('../views/BDCenterView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/bd-setting',
|
||||
name: 'bd-setting',
|
||||
component: () => import('../views/BDSettingView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/not_app',
|
||||
name: 'not-app',
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-buttons">
|
||||
<button class="action-btn exchange-btn" @click="exchangeGoldCoins">
|
||||
Exchange<br>Gold Coins
|
||||
Exchange
|
||||
</button>
|
||||
<button class="action-btn transfer-btn" @click="transfer">
|
||||
Transfer
|
||||
|
||||
578
src/views/BDCenterView.vue
Normal file
578
src/views/BDCenterView.vue
Normal file
@ -0,0 +1,578 @@
|
||||
<template>
|
||||
<div class="bd-center gradient-background-circles">
|
||||
<!-- 顶部导航 -->
|
||||
<MobileHeader title="BD Center" :isHomePage="true" />
|
||||
|
||||
<!-- 主要内容 -->
|
||||
<div class="content">
|
||||
<!-- 用户信息卡片 -->
|
||||
<div class="user-card">
|
||||
<!-- APP连接状态指示 -->
|
||||
<div v-if="isInApp() && !appConnected" class="app-status connecting">
|
||||
<div class="status-indicator"></div>
|
||||
<span>正在连接APP...</span>
|
||||
</div>
|
||||
|
||||
<div class="user-info">
|
||||
<div class="avatar">
|
||||
<span>{{ (userInfo.userNickname || userInfo.name).charAt(0) }}</span>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<h3>{{ userInfo.userNickname || userInfo.name }}</h3>
|
||||
<p>ID: {{ userInfo.account || userInfo.id }}</p>
|
||||
</div>
|
||||
<!-- <button class="notification-btn" @click="goToNotification">-->
|
||||
<!-- <span>✏️</span>-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
|
||||
<!-- 账户状态标签 -->
|
||||
<div class="account-tags">
|
||||
<span class="tag bd-tag">👑 BD</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Total team salary 区域 -->
|
||||
<div class="salary-section">
|
||||
<h3>Total team salary:</h3>
|
||||
|
||||
<div class="salary-content">
|
||||
<div class="salary-item">
|
||||
<p class="salary-label">Last month:</p>
|
||||
<p class="salary-amount">${{ salaryInfo.lastMonth }}</p>
|
||||
</div>
|
||||
<div class="salary-separator"></div>
|
||||
<div class="salary-item">
|
||||
<p class="salary-label">This month:</p>
|
||||
<p class="salary-amount">${{ salaryInfo.thisMonth }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Team Member 卡片 -->
|
||||
<div class="team-member-section">
|
||||
<div class="team-member-card" @click="goToTeamMember">
|
||||
<div class="card-content">
|
||||
<span class="member-title">
|
||||
Team Member
|
||||
<span v-if="loadingMemberCount">(Loading...)</span>
|
||||
<span v-else>({{ teamMemberCount }})</span>
|
||||
</span>
|
||||
<span class="arrow">></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-buttons">
|
||||
<button class="action-btn exchange-btn" @click="exchangeGoldCoins">
|
||||
Exchange
|
||||
</button>
|
||||
<button class="action-btn transfer-btn" @click="transfer">
|
||||
Transfer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { getUserIdentity, getTeamEntry } from '../api/wallet.js'
|
||||
import {getAgentMonthLastTarget, getAgentMonthTarget} from '../api/teamBill.js'
|
||||
import { connectApplication, parseAccessOrigin, parseHeader, setHttpHeaders, isInApp } from '../utils/appBridge.js'
|
||||
import { setUserInfo } from '../utils/userStore.js'
|
||||
import { get } from '../utils/http.js'
|
||||
import { getTeamId } from '@/utils/userStore.js'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 当前身份
|
||||
const currentIdentity = ref('bd')
|
||||
const loading = ref(false)
|
||||
const appConnected = ref(false)
|
||||
const headerInfo = ref({})
|
||||
const userProfile = ref(null)
|
||||
const identityChecked = ref(false)
|
||||
const teamMemberCount = ref(87) // 默认显示87个成员
|
||||
const loadingMemberCount = ref(false)
|
||||
|
||||
// 连接APP并获取认证信息
|
||||
const connectToApp = async () => {
|
||||
console.group('🔗 APP Connection Process')
|
||||
console.debug('🚀 Starting APP connection...')
|
||||
|
||||
if (!isInApp()) {
|
||||
console.warn('⚠️ Not running in APP environment')
|
||||
console.debug('🌐 Browser environment detected')
|
||||
console.debug('📱 APP Bridge objects:')
|
||||
console.debug(' - window.app:', !!window.app)
|
||||
console.debug(' - window.webkit:', !!window.webkit)
|
||||
|
||||
// 非APP环境,直接执行后续逻辑
|
||||
appConnected.value = true
|
||||
console.debug('✅ Skipping APP connection, proceeding with team entry')
|
||||
await fetchTeamEntry()
|
||||
console.groupEnd()
|
||||
return
|
||||
}
|
||||
|
||||
console.debug('📱 APP environment detected')
|
||||
console.debug('🔍 Checking APP bridge availability:')
|
||||
console.debug(' - window.app:', !!window.app)
|
||||
console.debug(' - window.webkit:', !!window.webkit)
|
||||
|
||||
connectApplication(async (access) => {
|
||||
const result = parseAccessOrigin(access)
|
||||
|
||||
if (result.success) {
|
||||
// 解析头部信息
|
||||
headerInfo.value = parseHeader(result.data)
|
||||
|
||||
// 设置HTTP请求头
|
||||
console.debug('🔧 Setting HTTP headers...')
|
||||
await setHttpHeaders(headerInfo.value)
|
||||
|
||||
// 标记连接成功
|
||||
appConnected.value = true
|
||||
|
||||
console.debug('🎉 APP connection established successfully')
|
||||
|
||||
// 连接成功后获取团队信息
|
||||
console.debug('📊 Fetching team entry...')
|
||||
const teamEntryResult = await fetchTeamEntry()
|
||||
console.debug('✅ Team entry fetched')
|
||||
if (teamEntryResult != null) {
|
||||
await fetchTeamMemberCount()
|
||||
console.debug('✅ Team member count fetch initiated')
|
||||
}
|
||||
} else {
|
||||
console.error('❌ Failed to parse access origin:', result.error)
|
||||
console.debug('🔄 Redirecting to error page...')
|
||||
router.push({ path: '/not_app', query: { message: result.error }})
|
||||
}
|
||||
|
||||
console.groupEnd()
|
||||
})
|
||||
|
||||
console.debug('⏳ Waiting for APP response...')
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
const userInfo = reactive({
|
||||
name: 'User1',
|
||||
id: '1234567890',
|
||||
userNickname: 'User1',
|
||||
account: '1234567890'
|
||||
})
|
||||
|
||||
// 薪资信息
|
||||
const salaryInfo = reactive({
|
||||
lastMonth: '12345',
|
||||
thisMonth: '12345'
|
||||
})
|
||||
|
||||
// 获取团队成员数量
|
||||
const fetchTeamMemberCount = async () => {
|
||||
try {
|
||||
loadingMemberCount.value = true
|
||||
const teamId = getTeamId()
|
||||
|
||||
if (teamId) {
|
||||
const response = await get(`/team/members/count?id=${teamId}`)
|
||||
|
||||
if (response.status && typeof response.body === 'number') {
|
||||
teamMemberCount.value = response.body
|
||||
} else {
|
||||
teamMemberCount.value = 87 // 默认值
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch team member count:', error)
|
||||
teamMemberCount.value = 87 // 出错时使用默认值
|
||||
} finally {
|
||||
loadingMemberCount.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getAgentMonth = async () => {
|
||||
const res = await getAgentMonthTarget()
|
||||
if (res.status === true) {
|
||||
salaryInfo.thisMonth = res.body.thisMonthTotalTarget
|
||||
}
|
||||
|
||||
const res2 = await getAgentMonthLastTarget()
|
||||
if (res2.status === true) {
|
||||
salaryInfo.lastMonth = res.body.thisMonthTotalTarget
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const goToNotification = () => {
|
||||
router.push('/bd-setting')
|
||||
}
|
||||
|
||||
// 获取团队入口信息
|
||||
const fetchTeamEntry = async () => {
|
||||
try {
|
||||
const response = await getTeamEntry()
|
||||
|
||||
if (response && response.status && response.body) {
|
||||
userProfile.value = response.body
|
||||
|
||||
// 缓存用户信息
|
||||
if (response.body.memberProfile) {
|
||||
setUserInfo(response.body.memberProfile, response.body.teamProfile)
|
||||
|
||||
// 更新用户信息显示
|
||||
userInfo.userNickname = response.body.memberProfile.userNickname
|
||||
userInfo.account = response.body.memberProfile.account
|
||||
}
|
||||
|
||||
// 获取用户ID后检查身份
|
||||
const userId = response.body.memberProfile?.id
|
||||
if (userId) {
|
||||
await checkUserIdentity(userId)
|
||||
}
|
||||
|
||||
return userId
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取团队信息失败:', error)
|
||||
// HTTP 406错误通常表示NOT_TEAM_MEMBER
|
||||
if (error.message && error.message.includes('406')) {
|
||||
await router.push('/apply')
|
||||
return
|
||||
}
|
||||
if (error.message && error.message.includes('401')) {
|
||||
await router.push({
|
||||
path: '/not_app',
|
||||
query: { message: error.message }
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// 获取用户身份并自动跳转
|
||||
const checkUserIdentity = async (userId) => {
|
||||
if (!userId) {
|
||||
console.error('用户ID不存在')
|
||||
return
|
||||
}
|
||||
|
||||
// 防止重复检查
|
||||
if (identityChecked.value) {
|
||||
console.debug('身份已检查,跳过')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
identityChecked.value = true
|
||||
const response = await getUserIdentity(userId)
|
||||
|
||||
if (response && response.status && response.body) {
|
||||
const { freightAgent, anchor, agent } = response.body
|
||||
|
||||
console.debug('用户身份权限:', { freightAgent, anchor, agent })
|
||||
|
||||
// 根据优先级判断:freightAgent > anchor > agent > bd(默认)
|
||||
if (freightAgent) {
|
||||
console.debug('跳转到 coin-seller')
|
||||
// router.replace('/coin-seller')
|
||||
} else if (agent) {
|
||||
console.debug('跳转到 agency-center')
|
||||
// router.replace('/agency-center')
|
||||
} else if (anchor) {
|
||||
console.debug('跳转到 host-center')
|
||||
// router.replace('/host-center')
|
||||
} else {
|
||||
// 如果没有任何权限,保持在BD页面
|
||||
console.debug('保持在 bd-center')
|
||||
currentIdentity.value = 'bd'
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取用户身份失败:', error)
|
||||
// 出错时保持在BD页面
|
||||
currentIdentity.value = 'bd'
|
||||
}
|
||||
}
|
||||
|
||||
const goToTeamMember = () => {
|
||||
router.push('/team-member')
|
||||
}
|
||||
|
||||
const exchangeGoldCoins = () => {
|
||||
router.push('/exchange-gold-coins')
|
||||
}
|
||||
|
||||
const transfer = () => {
|
||||
router.push('/transfer')
|
||||
}
|
||||
|
||||
// 页面加载时先连接APP,然后获取数据
|
||||
onMounted(async () => {
|
||||
// 先连接APP获取认证信息
|
||||
await connectToApp()
|
||||
await getAgentMonth()
|
||||
|
||||
// 如果不是APP环境,直接获取数据
|
||||
if (!isInApp()) {
|
||||
await fetchTeamMemberCount()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.bd-center {
|
||||
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* 用户信息卡片 */
|
||||
.user-card {
|
||||
background-color: white;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
/* APP连接状态 */
|
||||
.app-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.app-status.connecting {
|
||||
background-color: #fef3c7;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.app-status.connected {
|
||||
background-color: #d1fae5;
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: currentColor;
|
||||
}
|
||||
|
||||
.app-status.connecting .status-indicator {
|
||||
animation: pulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 25px;
|
||||
background-color: #8B5CF6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.user-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-details h3 {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.user-details p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.system-info {
|
||||
font-size: 12px !important;
|
||||
color: #8B5CF6 !important;
|
||||
margin-top: 2px !important;
|
||||
}
|
||||
|
||||
.notification-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.account-tags {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 4px 12px;
|
||||
border-radius: 16px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bd-tag {
|
||||
background-color: #E0E7FF;
|
||||
color: #5B21B6;
|
||||
}
|
||||
|
||||
/* Total team salary 区域 */
|
||||
.salary-section {
|
||||
background-color: white;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.salary-section h3 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.salary-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.salary-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.salary-label {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.salary-amount {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.salary-separator {
|
||||
width: 1px;
|
||||
height: 40px;
|
||||
background-color: #8B5CF6;
|
||||
}
|
||||
|
||||
/* Team Member 独立区域 */
|
||||
.team-member-section {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.team-member-card {
|
||||
background-color: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.team-member-card:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.team-member-card .card-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.member-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1F2937;
|
||||
}
|
||||
|
||||
/* 操作按钮 */
|
||||
.action-buttons {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 14px 12px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
line-height: 1.2;
|
||||
transition: all 0.2s;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.action-btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.exchange-btn {
|
||||
background-color: #FDE68A;
|
||||
color: #D97706;
|
||||
}
|
||||
|
||||
.transfer-btn {
|
||||
background-color: #8B5CF6;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* 通用箭头样式 */
|
||||
.arrow {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #8B5CF6;
|
||||
}
|
||||
</style>
|
||||
213
src/views/BDSettingView.vue
Normal file
213
src/views/BDSettingView.vue
Normal file
@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div class="bd-setting gradient-background-circles">
|
||||
<MobileHeader title="BD Setting" />
|
||||
|
||||
<div class="content">
|
||||
<!-- 设置选项列表 -->
|
||||
<div class="settings-list">
|
||||
<!-- 通知设置 -->
|
||||
<div class="setting-item" @click="goToNotifications">
|
||||
<div class="setting-icon">🔔</div>
|
||||
<div class="setting-content">
|
||||
<h3>Notifications</h3>
|
||||
<p>Manage your notification preferences</p>
|
||||
</div>
|
||||
<div class="setting-arrow">></div>
|
||||
</div>
|
||||
|
||||
<!-- 团队管理 -->
|
||||
<div class="setting-item" @click="goToTeamManagement">
|
||||
<div class="setting-icon">👥</div>
|
||||
<div class="setting-content">
|
||||
<h3>Team Management</h3>
|
||||
<p>Manage your team members and permissions</p>
|
||||
</div>
|
||||
<div class="setting-arrow">></div>
|
||||
</div>
|
||||
|
||||
<!-- 数据统计 -->
|
||||
<div class="setting-item" @click="goToStatistics">
|
||||
<div class="setting-icon">📊</div>
|
||||
<div class="setting-content">
|
||||
<h3>Statistics</h3>
|
||||
<p>View team performance and analytics</p>
|
||||
</div>
|
||||
<div class="setting-arrow">></div>
|
||||
</div>
|
||||
|
||||
<!-- 账户设置 -->
|
||||
<div class="setting-item" @click="goToAccountSettings">
|
||||
<div class="setting-icon">⚙️</div>
|
||||
<div class="setting-content">
|
||||
<h3>Account Settings</h3>
|
||||
<p>Manage your account information</p>
|
||||
</div>
|
||||
<div class="setting-arrow">></div>
|
||||
</div>
|
||||
|
||||
<!-- 帮助与支持 -->
|
||||
<div class="setting-item" @click="goToHelp">
|
||||
<div class="setting-icon">❓</div>
|
||||
<div class="setting-content">
|
||||
<h3>Help & Support</h3>
|
||||
<p>Get help and contact support</p>
|
||||
</div>
|
||||
<div class="setting-arrow">></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 退出登录按钮 -->
|
||||
<div class="logout-section">
|
||||
<button class="logout-btn" @click="logout">
|
||||
<span class="logout-icon">🚪</span>
|
||||
<span>Logout</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const goToNotifications = () => {
|
||||
router.push('/message')
|
||||
}
|
||||
|
||||
const goToTeamManagement = () => {
|
||||
router.push('/team-member')
|
||||
}
|
||||
|
||||
const goToStatistics = () => {
|
||||
router.push('/platform-policy')
|
||||
}
|
||||
|
||||
const goToAccountSettings = () => {
|
||||
router.push('/host-setting')
|
||||
}
|
||||
|
||||
const goToHelp = () => {
|
||||
router.push('/platform-policy')
|
||||
}
|
||||
|
||||
const logout = () => {
|
||||
// 确认退出
|
||||
if (confirm('Are you sure you want to logout?')) {
|
||||
// 清除用户数据
|
||||
localStorage.clear()
|
||||
// 跳转到登录页面或首页
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.bd-setting {
|
||||
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* 设置列表 */
|
||||
.settings-list {
|
||||
background-color: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
overflow: hidden;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.setting-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.setting-item:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.setting-item:active {
|
||||
background-color: #e9ecef;
|
||||
}
|
||||
|
||||
.setting-icon {
|
||||
font-size: 24px;
|
||||
margin-right: 12px;
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.setting-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.setting-content h3 {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.setting-content p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.setting-arrow {
|
||||
font-size: 18px;
|
||||
color: #8B5CF6;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 退出登录区域 */
|
||||
.logout-section {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background-color: #fee2e2;
|
||||
color: #dc2626;
|
||||
border: 1px solid #fecaca;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background-color: #fecaca;
|
||||
border-color: #f87171;
|
||||
}
|
||||
|
||||
.logout-btn:active {
|
||||
background-color: #fca5a5;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.logout-icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
@ -109,7 +109,7 @@
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-buttons">
|
||||
<button class="action-btn exchange-btn" @click="exchangeGoldCoins">
|
||||
Exchange<br>Gold Coins
|
||||
Exchange
|
||||
</button>
|
||||
<button class="action-btn transfer-btn" @click="transfer">
|
||||
Transfer
|
||||
@ -349,17 +349,20 @@ const checkUserIdentity = async (userId) => {
|
||||
const response = await getUserIdentity(userId)
|
||||
|
||||
if (response && response.status && response.body) {
|
||||
const { freightAgent, anchor, agent } = response.body
|
||||
const { freightAgent, anchor, agent, bd } = response.body
|
||||
|
||||
console.debug('用户身份权限:', { freightAgent, anchor, agent })
|
||||
console.debug('用户身份权限:', { freightAgent, anchor, agent, bd })
|
||||
|
||||
// 根据优先级判断:freightAgent > anchor > agent
|
||||
// 根据优先级判断:freightAgent > agent > anchor > bd
|
||||
if (freightAgent) {
|
||||
console.debug('跳转到 coin-seller')
|
||||
router.replace('/coin-seller')
|
||||
} else if (agent) {
|
||||
console.debug('跳转到 agency-center')
|
||||
router.replace('/agency-center')
|
||||
} else if (bd) {
|
||||
console.debug('跳转到 bd-center')
|
||||
router.replace('/bd-center')
|
||||
} else if (anchor) {
|
||||
// 保持在当前Host页面
|
||||
console.debug('保持在 host-center')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user