bd 页面优化

This commit is contained in:
tianfeng 2025-08-22 17:05:51 +08:00
parent 6b0265dc3a
commit 1175f019cb
2 changed files with 15 additions and 103 deletions

View File

@ -55,8 +55,7 @@ export const ROLE_PERMISSIONS = {
PAGES.TRANSFER, // 转账功能
PAGES.EXCHANGE, // 兑换功能
PAGES.MESSAGE, // 消息功能
PAGES.PERSONAL_SALARY, // 个人薪资查看
PAGES.AGENCY_CENTER, // 可以查看代理页面
'/team-member'
],
// Anchor (主播)

View File

@ -83,103 +83,25 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue'
import { getUserIdentity, getTeamEntry } from '../api/wallet.js'
import {getAgentMonthLastTarget, getAgentMonthTarget, getTeamMemberCount} 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'
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
import {isInApp} from "@/utils/appBridge.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(0)
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...')
console.groupEnd()
}
//
const userInfo = reactive({
userNickname: '',
id: '',
userAvatar: '',
})
//
const salaryInfo = reactive({
lastMonth: '',
thisMonth: ''
})
//
const fetchTeamMemberCount = async () => {
try {
@ -320,28 +242,19 @@ const transfer = () => {
router.push('/transfer')
}
//
const handleImageError = (event) => {
// userAvatar
userInfo.userAvatar = ''
}
//
const getAvatarPlaceholder = () => {
if (userInfo.name && userInfo.name.length > 0) {
return userInfo.name.charAt(0).toUpperCase()
const {
appConnected,
userInfo,
salaryInfo,
handleImageError,
getAvatarPlaceholder
} = usePageInitializationWithConfig('BD_CENTER', {
onDataLoaded: () => {
getAgentMonth()
fetchTeamMemberCount()
}
return 'U' // 'U'
}
// APP
onMounted(async () => {
// APP
await connectToApp()
await fetchTeamEntry()
await getAgentMonth()
await fetchTeamMemberCount()
})
</script>
<style scoped>