diff --git a/src/api/index.ts b/src/api/index.ts index 267b142..70fbde0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -52,6 +52,7 @@ export { export { GetInvitationInfo, GenBarCodeOrQrCode, + GetInvitationList, } from './inviteCode/index' /** * 系列列表 diff --git a/src/api/inviteCode/index.ts b/src/api/inviteCode/index.ts index 1c433bc..c123a66 100644 --- a/src/api/inviteCode/index.ts +++ b/src/api/inviteCode/index.ts @@ -8,6 +8,13 @@ export const GetInvitationInfo = () => { method: 'get', }) } +// 获取邀请进度 +export const GetInvitationList = () => { + return useRequest({ + url: '/v2/mp/user/inviterList', + method: 'get', + }) +} // 生成二维码 export const GenBarCodeOrQrCode = () => { return useRequest({ diff --git a/src/pages/inviteCode/index.tsx b/src/pages/inviteCode/index.tsx index d314d98..b7cfdfb 100644 --- a/src/pages/inviteCode/index.tsx +++ b/src/pages/inviteCode/index.tsx @@ -9,7 +9,7 @@ import type { TablePropsType } from '@/components/table' import Table from '@/components/table' import NormalButton from '@/components/normalButton' import { alert } from '@/common/common' -import { GenBarCodeOrQrCode, GetInvitationInfo } from '@/api' +import { GenBarCodeOrQrCode, GetInvitationInfo, GetInvitationList } from '@/api' import { getCDNSource } from '@/common/constant' import Painter from '@/components/painter' @@ -64,7 +64,7 @@ const inviteColumns = [ // 邀请码 const InviteCode = () => { screenK = SystemInfo.screenWidth / 750 - + const { fetchData: getInvitationListAPI } = GetInvitationList() const { fetchData } = GetInvitationInfo() const { fetchData: genCode } = GenBarCodeOrQrCode() const [inviteInfo, setInviteInfo] = useState({}) @@ -73,23 +73,28 @@ const InviteCode = () => { dataSource: { list: [], total: 0 }, }) const [loading, setLoading] = useState(false) - // 获取邀请码 - const getInviteCode = async() => { - const res = await fetchData() + const getInvitationList = async() => { + const res = await getInvitationListAPI() if (res.success) { console.log('getInviteCode', res) setCurrentTable((prev: any) => ({ ...prev, dataSource: { - list: res.data.invitation_record.map((item, index: number) => ({ + list: res.data.list.map((item, index: number) => ({ key: index, index: index + 1, - invitee: item.name || '--', - InviteResults: '已邀请', + invitee: item.invitee_name || '--', + InviteResults: item.schedule, })), - total: res.data.invitation_record.length, + total: res.data.list.length, }, })) + } + } + // 获取邀请码 + const getInviteCode = async() => { + const res = await fetchData() + if (res.success) { setInviteInfo(res.data) } } @@ -293,6 +298,7 @@ const InviteCode = () => { } useReady(() => { getInviteCode() + getInvitationList() setTimeout(() => { initCanvas() }, 200)