feat: 广告
This commit is contained in:
86
src/components/prejob-popup/index.tsx
Normal file
86
src/components/prejob-popup/index.tsx
Normal file
@ -0,0 +1,86 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
|
||||
import { Popup } from '@taroify/core';
|
||||
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { GET_CONTACT_TYPE } from '@/constants/job';
|
||||
import { hasShareToGetContact } from '@/utils/job';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
onCancel: () => void;
|
||||
onConfirm: (type: GET_CONTACT_TYPE) => void;
|
||||
}
|
||||
|
||||
const PREFIX = 'prejob-popup';
|
||||
|
||||
const GET_CONTACT_TYPE_OPTIONS = [
|
||||
{
|
||||
type: GET_CONTACT_TYPE.SHARE,
|
||||
icon: 'https://publiccdn.neighbourhood.com.cn/img/file.svg',
|
||||
title: '完善资料',
|
||||
desc: '转发给朋友可享推荐奖励',
|
||||
btnText: '分享',
|
||||
},
|
||||
{
|
||||
type: GET_CONTACT_TYPE.VIP,
|
||||
icon: 'https://publiccdn.neighbourhood.com.cn/img/diamond.svg',
|
||||
title: '播络会员',
|
||||
desc: '开通会员每天可查看10个',
|
||||
btnText: '开通',
|
||||
},
|
||||
{
|
||||
type: GET_CONTACT_TYPE.VIDEO,
|
||||
icon: 'https://publiccdn.neighbourhood.com.cn/img/video.svg',
|
||||
title: '观看视频',
|
||||
desc: '观看6-30s广告即可免费查看',
|
||||
btnText: '观看',
|
||||
},
|
||||
];
|
||||
|
||||
export function PrejobPopup({ open, onCancel, onConfirm }: IProps) {
|
||||
const handleClick = (type: GET_CONTACT_TYPE) => () => {
|
||||
if (type === GET_CONTACT_TYPE.SHARE) {
|
||||
navigateTo(PageUrl.PartnerShare);
|
||||
} else {
|
||||
onConfirm(type);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Popup rounded className={PREFIX} placement="bottom" open={open} onClose={onCancel}>
|
||||
<div className={`${PREFIX}__content`}>
|
||||
<div className={`${PREFIX}__title`}>以下方式任选其一均可获取联系方式</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
{GET_CONTACT_TYPE_OPTIONS.map(option => {
|
||||
// 该方式只能用一次, 以后不再出现在选项中
|
||||
if (option.type === GET_CONTACT_TYPE.SHARE && !hasShareToGetContact()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${PREFIX}__item`} key={option.type}>
|
||||
<div className={`${PREFIX}__item-icon ${option.type}`}>
|
||||
<Image mode="aspectFit" src={option.icon} />
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-main`}>
|
||||
<div className="title">{option.title}</div>
|
||||
<div className="desc">{option.desc}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-action`}>
|
||||
<Button className={`${PREFIX}__btn`} onClick={handleClick(option.type)}>
|
||||
{option.btnText}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<SafeBottomPadding />
|
||||
</Popup>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user