🎈 perf(邀请码): 完善邀请码列表对接

This commit is contained in:
xuan 2022-12-10 17:09:25 +08:00
parent e38b6da438
commit fbe6e9b449
3 changed files with 23 additions and 9 deletions

View File

@ -52,6 +52,7 @@ export {
export { export {
GetInvitationInfo, GetInvitationInfo,
GenBarCodeOrQrCode, GenBarCodeOrQrCode,
GetInvitationList,
} from './inviteCode/index' } from './inviteCode/index'
/** /**
* *

View File

@ -8,6 +8,13 @@ export const GetInvitationInfo = () => {
method: 'get', method: 'get',
}) })
} }
// 获取邀请进度
export const GetInvitationList = () => {
return useRequest({
url: '/v2/mp/user/inviterList',
method: 'get',
})
}
// 生成二维码 // 生成二维码
export const GenBarCodeOrQrCode = () => { export const GenBarCodeOrQrCode = () => {
return useRequest({ return useRequest({

View File

@ -9,7 +9,7 @@ import type { TablePropsType } from '@/components/table'
import Table from '@/components/table' import Table from '@/components/table'
import NormalButton from '@/components/normalButton' import NormalButton from '@/components/normalButton'
import { alert } from '@/common/common' import { alert } from '@/common/common'
import { GenBarCodeOrQrCode, GetInvitationInfo } from '@/api' import { GenBarCodeOrQrCode, GetInvitationInfo, GetInvitationList } from '@/api'
import { getCDNSource } from '@/common/constant' import { getCDNSource } from '@/common/constant'
import Painter from '@/components/painter' import Painter from '@/components/painter'
@ -64,7 +64,7 @@ const inviteColumns = [
// 邀请码 // 邀请码
const InviteCode = () => { const InviteCode = () => {
screenK = SystemInfo.screenWidth / 750 screenK = SystemInfo.screenWidth / 750
const { fetchData: getInvitationListAPI } = GetInvitationList()
const { fetchData } = GetInvitationInfo() const { fetchData } = GetInvitationInfo()
const { fetchData: genCode } = GenBarCodeOrQrCode() const { fetchData: genCode } = GenBarCodeOrQrCode()
const [inviteInfo, setInviteInfo] = useState<any>({}) const [inviteInfo, setInviteInfo] = useState<any>({})
@ -73,23 +73,28 @@ const InviteCode = () => {
dataSource: { list: [], total: 0 }, dataSource: { list: [], total: 0 },
}) })
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
// 获取邀请码 const getInvitationList = async() => {
const getInviteCode = async() => { const res = await getInvitationListAPI()
const res = await fetchData()
if (res.success) { if (res.success) {
console.log('getInviteCode', res) console.log('getInviteCode', res)
setCurrentTable((prev: any) => ({ setCurrentTable((prev: any) => ({
...prev, ...prev,
dataSource: { dataSource: {
list: res.data.invitation_record.map((item, index: number) => ({ list: res.data.list.map((item, index: number) => ({
key: index, key: index,
index: index + 1, index: index + 1,
invitee: item.name || '--', invitee: item.invitee_name || '--',
InviteResults: '已邀请', 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) setInviteInfo(res.data)
} }
} }
@ -293,6 +298,7 @@ const InviteCode = () => {
} }
useReady(() => { useReady(() => {
getInviteCode() getInviteCode()
getInvitationList()
setTimeout(() => { setTimeout(() => {
initCanvas() initCanvas()
}, 200) }, 200)