接口调用优化

This commit is contained in:
tianfeng 2025-08-22 11:08:46 +08:00
parent ee79f6d07b
commit 3b9b359012
3 changed files with 17 additions and 12 deletions

View File

@ -175,6 +175,15 @@ export function getAgentMonthLastTarget() {
return get(`/team/bd/agent-count-last`)
}
/**
* 获取团队的成员数量
* @param teamId
* @returns {Promise}
*/
export function getTeamMemberCount(teamId) {
return get(`/team/members/count?id=${teamId}`)
}
/**
* 格式化显示状态
* @param {string} status - 状态值

View File

@ -164,6 +164,7 @@ import { get } from '../utils/http.js'
import {getBankBalance, getTeamEntry} from "@/api/wallet.js";
import {getTeamId, setUserInfo} from "@/utils/userStore.js";
import {showError} from "@/utils/toast.js";
import {getTeamMemberCount} from "@/api/teamBill.js";
const router = useRouter()
@ -243,8 +244,7 @@ const fetchTeamMemberCount = async () => {
// 使teamId使ID
const teamId = getTeamId()
const response = await get(`/team/members/count?id=${teamId}`)
const response = await getTeamMemberCount(teamId)
if (response.status && typeof response.body === 'number') {
teamMemberCount.value = response.body
} else {

View File

@ -81,7 +81,7 @@ 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 {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'
@ -96,7 +96,7 @@ const appConnected = ref(false)
const headerInfo = ref({})
const userProfile = ref(null)
const identityChecked = ref(false)
const teamMemberCount = ref(87) // 87
const teamMemberCount = ref(0)
const loadingMemberCount = ref(false)
// APP
@ -158,6 +158,7 @@ const connectToApp = async () => {
})
console.debug('⏳ Waiting for APP response...')
console.groupEnd()
}
//
@ -181,12 +182,11 @@ const fetchTeamMemberCount = async () => {
const teamId = getTeamId()
if (teamId) {
const response = await get(`/team/members/count?id=${teamId}`)
const response = await getTeamMemberCount(teamId)
if (response.status && typeof response.body === 'number') {
teamMemberCount.value = response.body
} else {
teamMemberCount.value = 87 //
teamMemberCount.value = 0
}
}
} catch (error) {
@ -319,11 +319,7 @@ onMounted(async () => {
// APP
await connectToApp()
await getAgentMonth()
// APP
if (!isInApp()) {
await fetchTeamMemberCount()
}
await fetchTeamMemberCount()
})
</script>