feat: 广告
This commit is contained in:
82
src/components/prejob-popup/index.less
Normal file
82
src/components/prejob-popup/index.less
Normal file
@ -0,0 +1,82 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.prejob-popup {
|
||||
&__content {
|
||||
padding: 40px 32px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 48px;
|
||||
margin-bottom: 31px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__body {
|
||||
}
|
||||
|
||||
&__item {
|
||||
.flex-row();
|
||||
margin-bottom: 40px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.share {
|
||||
background: #feba00;
|
||||
> image {
|
||||
width: 40px;
|
||||
height: 46px;
|
||||
}
|
||||
}
|
||||
&.vip {
|
||||
background: #b094ff;
|
||||
> image {
|
||||
width: 48px;
|
||||
height: 42px;
|
||||
}
|
||||
}
|
||||
&.video {
|
||||
background: #34a853;
|
||||
> image {
|
||||
width: 46px;
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-main {
|
||||
padding: 0 24px;
|
||||
flex: 1;
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.desc {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
color: @blColorG1;
|
||||
}
|
||||
}
|
||||
&-action {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__btn {
|
||||
.button(@width: 136px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 43px, @highlight: 0);
|
||||
background: #f2f2f2;
|
||||
}
|
||||
}
|
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>
|
||||
);
|
||||
}
|
@ -3,6 +3,7 @@ export const PREFIX = 'product-dialog';
|
||||
export enum DialogStatus {
|
||||
// 加载中
|
||||
LOADING = 'loading',
|
||||
PRE_ACTION = 'pre_action',
|
||||
// 直接联系通告主
|
||||
JOB_CONTACT_DIRECT = 'job_contact_direct',
|
||||
// 联系客服去联系通告主 -> 订阅通知
|
||||
@ -13,6 +14,7 @@ export enum DialogStatus {
|
||||
JOB_UNABLE_UNLOCK = 'job_unable_unlock',
|
||||
// 通告解锁次数用完,购买界面
|
||||
JOB_BUY = 'job_buy',
|
||||
PREACTION_JOB_BUY = 'preaction_job_buy',
|
||||
// 加群二维码
|
||||
GROUP_QR_CODE = 'group_qr_code',
|
||||
// 确定加群
|
||||
|
@ -133,6 +133,7 @@
|
||||
&__header {
|
||||
.flex-row();
|
||||
.header-font();
|
||||
font-size: 32px;
|
||||
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
@ -143,7 +144,8 @@
|
||||
&__describe {
|
||||
.flex-row();
|
||||
.describe-font();
|
||||
margin-top: 24px;
|
||||
margin-top: 18px;
|
||||
line-height: 40px;
|
||||
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
@ -158,13 +160,13 @@
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
width: 170px;
|
||||
width: 182px;
|
||||
height: 192px;
|
||||
.flex-column();
|
||||
justify-content: center;
|
||||
border: 2px solid @blHighlightColor;
|
||||
border-radius: 8px;
|
||||
margin-right: 24px;
|
||||
margin-right: 15px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
|
@ -3,20 +3,24 @@ import Taro from '@tarojs/taro';
|
||||
import { Dialog } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { PrejobPopup } from '@/components/prejob-popup';
|
||||
import { DialogStatus, PREFIX } from '@/components/product-dialog/const';
|
||||
import JobBuy from '@/components/product-dialog/steps-ui/job-buy';
|
||||
import ContactCustomerService from '@/components/product-dialog/steps-ui/job-contact-customer';
|
||||
import ContactDirect from '@/components/product-dialog/steps-ui/job-contact-direct';
|
||||
import UnableUnlockContent from '@/components/product-dialog/steps-ui/job-unable';
|
||||
import { EventName } from '@/constants/app';
|
||||
import { GET_CONTACT_TYPE } from '@/constants/job';
|
||||
import { DeclarationType, ProductType } from '@/constants/product';
|
||||
import { JobDetails } from '@/types/job';
|
||||
import { ProductInfo } from '@/types/product';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { getSkipPrejobAction, setSkipPrejobAction } from '@/utils/job';
|
||||
import {
|
||||
requestProductUseRecord,
|
||||
requestProductBalance,
|
||||
requestUseProduct,
|
||||
requestAllBuyProduct,
|
||||
requestProductBalance,
|
||||
requestProductUseRecord,
|
||||
requestUseProduct,
|
||||
} from '@/utils/product';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
@ -33,13 +37,31 @@ const log = logWithPrefix('product-job-dialog');
|
||||
function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
const { data, onClose } = props;
|
||||
const [status, setStatus] = useState<DialogStatus>(DialogStatus.LOADING);
|
||||
const [showContact, setShowContact] = useState(false);
|
||||
const [showPrejob, setShowPrejob] = useState(false);
|
||||
const [publisherAcctNo, setPublisherAcctNo] = useState<string>('');
|
||||
const initRef = useRef(() => {});
|
||||
const initRef = useRef<(skipPreAction?: boolean, skipRecordGet?: boolean) => void | Promise<void>>(() => {});
|
||||
|
||||
const handleCloseDialog = useCallback(() => {
|
||||
setShowContact(false);
|
||||
onClose();
|
||||
}, [onClose]);
|
||||
|
||||
const handleClosePrejob = useCallback(() => {
|
||||
setShowPrejob(false);
|
||||
}, []);
|
||||
|
||||
const handleConfirmPrejob = useCallback(async (type: GET_CONTACT_TYPE) => {
|
||||
if (type === GET_CONTACT_TYPE.VIP) {
|
||||
const allowBuy = await requestAllBuyProduct(PRODUCT_CODE);
|
||||
setShowContact(true);
|
||||
setShowPrejob(false);
|
||||
setStatus(allowBuy ? DialogStatus.PREACTION_JOB_BUY : DialogStatus.JOB_UNABLE_UNLOCK);
|
||||
} else if (type === GET_CONTACT_TYPE.VIDEO) {
|
||||
Taro.eventCenter.trigger(EventName.SHOW_VIDEO_REWARD);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleAfterBuy = useCallback(async () => {
|
||||
const time = await requestProductBalance(PRODUCT_CODE);
|
||||
if (time <= 0) {
|
||||
@ -49,6 +71,8 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
}
|
||||
const productInfo = await requestUseProduct(PRODUCT_CODE, { jobId: data.id });
|
||||
const declarationTypeResult = productInfo.declarationTypeResult;
|
||||
setShowContact(true);
|
||||
setShowPrejob(false);
|
||||
if (declarationTypeResult?.type === DeclarationType.Direct && declarationTypeResult.publisherAcctNo) {
|
||||
setStatus(DialogStatus.JOB_CONTACT_DIRECT);
|
||||
setPublisherAcctNo(declarationTypeResult.publisherAcctNo);
|
||||
@ -62,8 +86,9 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
initRef.current = async () => {
|
||||
initRef.current = async (skipPreAction?: boolean, skipRecordGet?: boolean) => {
|
||||
const handleContact = (declarationTypeResult?: ProductInfo['declarationTypeResult']) => {
|
||||
setShowContact(true);
|
||||
if (declarationTypeResult?.type === DeclarationType.Direct && declarationTypeResult.publisherAcctNo) {
|
||||
setStatus(DialogStatus.JOB_CONTACT_DIRECT);
|
||||
setPublisherAcctNo(declarationTypeResult.publisherAcctNo);
|
||||
@ -77,19 +102,34 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
// setStatus(DialogStatus.JOB_CONTACT_CS);
|
||||
// return;
|
||||
// }
|
||||
const result = await requestProductUseRecord(PRODUCT_CODE, { jobId: data.id });
|
||||
log('requestProductUseRecord result', result);
|
||||
if (result) {
|
||||
handleContact(result.declarationTypeResult);
|
||||
return;
|
||||
if (!skipRecordGet) {
|
||||
const result = await requestProductUseRecord(PRODUCT_CODE, { jobId: data.id });
|
||||
log('requestProductUseRecord result', result);
|
||||
if (result) {
|
||||
handleContact(result.declarationTypeResult);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const time = await requestProductBalance(PRODUCT_CODE);
|
||||
if (time <= 0) {
|
||||
const allowBuy = await requestAllBuyProduct(PRODUCT_CODE);
|
||||
setShowContact(true);
|
||||
setStatus(allowBuy ? DialogStatus.JOB_BUY : DialogStatus.JOB_UNABLE_UNLOCK);
|
||||
} else {
|
||||
}
|
||||
// 创建模卡之后可以直接解锁一次, 分享后解锁一次
|
||||
else if (getSkipPrejobAction() || skipPreAction) {
|
||||
const productInfo = await requestUseProduct(PRODUCT_CODE, { jobId: data.id });
|
||||
setShowPrejob(false);
|
||||
if (!skipPreAction) {
|
||||
setSkipPrejobAction(false);
|
||||
}
|
||||
handleContact(productInfo.declarationTypeResult);
|
||||
} else {
|
||||
setShowPrejob(true);
|
||||
setStatus(DialogStatus.PRE_ACTION);
|
||||
|
||||
// const productInfo = await requestUseProduct(PRODUCT_CODE, { jobId: data.id });
|
||||
// handleContact(productInfo.declarationTypeResult);
|
||||
}
|
||||
} catch (e) {
|
||||
Toast.error('出错了,请重试');
|
||||
@ -104,21 +144,44 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
initRef.current();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
Taro.eventCenter.once(EventName.PRE_ACTION_SHARE_SUCCESS, () => {
|
||||
initRef.current(true, true);
|
||||
});
|
||||
Taro.eventCenter.on(EventName.PRE_ACTION_VIDEO_SUCCESS, () => {
|
||||
initRef.current(true, true);
|
||||
});
|
||||
|
||||
return () => {
|
||||
Taro.eventCenter.off(EventName.PRE_ACTION_SHARE_SUCCESS);
|
||||
Taro.eventCenter.off(EventName.PRE_ACTION_VIDEO_SUCCESS);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (status === DialogStatus.LOADING) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog className={PREFIX} onClose={onClose} open>
|
||||
<Dialog.Content>
|
||||
{status === DialogStatus.JOB_CONTACT_CS && <ContactCustomerService onAfterConfirm={handleCloseDialog} />}
|
||||
{status === DialogStatus.JOB_CONTACT_DIRECT && (
|
||||
<ContactDirect publisherAcctNo={publisherAcctNo} onAfterConfirm={handleCloseDialog} onReport={handleReport} />
|
||||
)}
|
||||
{status === DialogStatus.JOB_BUY && <JobBuy onConfirm={handleAfterBuy} />}
|
||||
{status === DialogStatus.JOB_UNABLE_UNLOCK && <UnableUnlockContent onConfirm={handleCloseDialog} />}
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
<div>
|
||||
<PrejobPopup open={showPrejob} onCancel={handleClosePrejob} onConfirm={handleConfirmPrejob} />
|
||||
<Dialog className={PREFIX} onClose={onClose} open={showContact}>
|
||||
<Dialog.Content>
|
||||
{status === DialogStatus.JOB_CONTACT_CS && <ContactCustomerService onAfterConfirm={handleCloseDialog} />}
|
||||
{status === DialogStatus.JOB_CONTACT_DIRECT && (
|
||||
<ContactDirect
|
||||
publisherAcctNo={publisherAcctNo}
|
||||
onAfterConfirm={handleCloseDialog}
|
||||
onReport={handleReport}
|
||||
/>
|
||||
)}
|
||||
{(status === DialogStatus.JOB_BUY || status === DialogStatus.PREACTION_JOB_BUY) && (
|
||||
<JobBuy onConfirm={handleAfterBuy} justBuy={status === DialogStatus.PREACTION_JOB_BUY} />
|
||||
)}
|
||||
{status === DialogStatus.JOB_UNABLE_UNLOCK && <UnableUnlockContent onConfirm={handleCloseDialog} />}
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import Taro from '@tarojs/taro';
|
||||
|
||||
import { Button } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Fragment, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import Badge from '@/components/badge';
|
||||
import { PREFIX } from '@/components/product-dialog/const';
|
||||
@ -16,6 +16,7 @@ import { postSubscribe, subscribeMessage } from '@/utils/subscribe';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
interface IProps {
|
||||
justBuy?: boolean;
|
||||
onConfirm: () => void;
|
||||
}
|
||||
|
||||
@ -29,22 +30,22 @@ interface Item {
|
||||
}
|
||||
|
||||
const LIST: Item[] = [
|
||||
{ id: ProductSpecId.WeeklyVIP, title: '非会员', content: '每日2次', price: '免费', amt: 0 },
|
||||
{ id: ProductSpecId.WeeklyVIP, title: '日会员', content: '1天内免广告', price: '60播豆', amt: 6, badge: '限时体验' },
|
||||
{
|
||||
id: ProductSpecId.WeeklyVIP,
|
||||
title: '周会员',
|
||||
content: '每日5次',
|
||||
price: '60播豆',
|
||||
amt: 6,
|
||||
badge: '限时体验',
|
||||
content: '7天内免广告',
|
||||
price: '180播豆',
|
||||
amt: 18,
|
||||
badge: '4.2折',
|
||||
},
|
||||
{
|
||||
id: ProductSpecId.NewMonthlyVIP,
|
||||
title: '月会员',
|
||||
content: '每日5次',
|
||||
price: '180播豆',
|
||||
amt: 18,
|
||||
badge: ' 超值',
|
||||
content: '30天内免广告',
|
||||
price: '300播豆',
|
||||
amt: 30,
|
||||
badge: '1.6折',
|
||||
},
|
||||
];
|
||||
|
||||
@ -75,6 +76,7 @@ export default function JobBuy(props: IProps) {
|
||||
type: OrderType.VIP,
|
||||
amt: getOrderPrice(selectItem.amt),
|
||||
productCode: ProductType.VIP,
|
||||
// todo: 日会员的 productSpectId 是什么?
|
||||
productSpecId: selectItem.id,
|
||||
});
|
||||
log('handleBuy payInfo', payOrderNo, createPayInfo);
|
||||
@ -107,14 +109,26 @@ export default function JobBuy(props: IProps) {
|
||||
return (
|
||||
<div className={`${PREFIX}__job-buy`}>
|
||||
<div className={`${PREFIX}__job-buy__header`}>
|
||||
<div>今日通告对接次数</div>
|
||||
<div className="highlight">已用完</div>
|
||||
{props.justBuy ? (
|
||||
<div>开通播络会员即可直接查看联系方式</div>
|
||||
) : (
|
||||
<Fragment>
|
||||
<div>今日通告对接次数</div>
|
||||
<div className="highlight">已用完</div>
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
<div className={`${PREFIX}__job-buy__describe`}>
|
||||
<div>请</div>
|
||||
<div className="highlight">明日</div>
|
||||
<div>再来 或 </div>
|
||||
<div className="highlight">升级会员</div>
|
||||
{props.justBuy ? (
|
||||
<div>每天可查看10个联系方式</div>
|
||||
) : (
|
||||
<Fragment>
|
||||
<div>请</div>
|
||||
<div className="highlight">明日</div>
|
||||
<div>再来 或 </div>
|
||||
<div className="highlight">升级会员</div>
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
<div className={`${PREFIX}__job-buy__container`}>
|
||||
{LIST.map(item => (
|
||||
|
@ -24,6 +24,10 @@ export enum EventName {
|
||||
SELECT_MY_PUBLISH_JOB = 'select_my_publish_job',
|
||||
EXIT_CHAT_PAGE = 'exit_chat_page',
|
||||
VIEW_MATERIAL_SUCCESS = 'view_material_success',
|
||||
PRE_ACTION_SHARE_SUCCESS = 'pre_action_share_success',
|
||||
PRE_ACTION_VIDEO_SUCCESS = 'pre_action_video_success',
|
||||
PRE_ACTION_VIDEO_ERROR = 'pre_action_video_error',
|
||||
SHOW_VIDEO_REWARD = 'show_video_reward',
|
||||
}
|
||||
|
||||
export enum OpenSource {
|
||||
@ -75,6 +79,7 @@ export enum PageUrl {
|
||||
Partner = 'pages/partner/index',
|
||||
WithdrawRecord = 'pages/withdraw-record/index',
|
||||
GroupDelegatePublish = 'pages/group-delegate-publish/index',
|
||||
PartnerShare = 'pages/partner-share/index',
|
||||
}
|
||||
|
||||
export enum PluginUrl {
|
||||
|
@ -13,4 +13,7 @@ export enum CacheKey {
|
||||
AGREEMENT_SIGNED = '__agreement_signed__',
|
||||
CITY_CODES = '__city_codes__',
|
||||
JOIN_GROUP_CARD_CLICKED = '__join_group_card_clicked__',
|
||||
SHARE_TO_GET_JOB_CONTACT = '__share_to_get_job_contract__',
|
||||
SHARE_TO_GET_ANCHOR_CONTACT = '__share_to_get_anchor_contract__',
|
||||
SKIP_PREACTION = '__skip_preaction__',
|
||||
}
|
||||
|
@ -174,3 +174,9 @@ export const FULL_EMPLOY_SALARY_OPTIONS = [
|
||||
export const PART_PRICE_OPTIONS = PART_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);
|
||||
|
||||
export const FULL_PRICE_OPTIONS = FULL_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);
|
||||
|
||||
export enum GET_CONTACT_TYPE {
|
||||
SHARE = 'share',
|
||||
VIP = 'vip',
|
||||
VIDEO = 'video',
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ export enum ProductSpecId {
|
||||
AddGroup2 = 'ADDGROUP_2',
|
||||
AddGroup3 = 'ADDGROUP_3',
|
||||
BossVip = 'BOSSVIP',
|
||||
DaylyVIP = 'VIP_D',
|
||||
WeeklyVIP = 'VIP_W',
|
||||
MonthlyVIP = 'VIP_M', // 30 每天十次
|
||||
NewMonthlyVIP = 'VIP_M_NEW', // 18 每天五次
|
||||
|
@ -44,7 +44,7 @@
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
background: #0000005c;
|
||||
background: #6D3DF5B2;
|
||||
border-radius: 48px;
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ export const APP_CONFIG: AppConfigType = {
|
||||
PageUrl.Partner,
|
||||
PageUrl.WithdrawRecord,
|
||||
PageUrl.GroupDelegatePublish,
|
||||
PageUrl.PartnerShare,
|
||||
// PageUrl.DevDebug,
|
||||
],
|
||||
window: {
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { Map, MapProps, Text, Image, Button } from '@tarojs/components';
|
||||
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { CertificationStatusIcon } from '@/components/certification-status';
|
||||
import CommonDialog from '@/components/common-dialog';
|
||||
import DevDiv from '@/components/dev-div';
|
||||
import JobRecommendList from '@/components/job-recommend-list';
|
||||
import { JoinGroupHint } from '@/components/join-group-hint';
|
||||
import LoginButton from '@/components/login-button';
|
||||
import MaterialGuide from '@/components/material-guide';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
@ -37,7 +38,6 @@ import Toast from '@/utils/toast';
|
||||
import { isNeedCreateMaterial } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
import { JoinGroupHint } from '@/components/join-group-hint';
|
||||
|
||||
const PREFIX = 'job-detail';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
@ -183,6 +183,7 @@ export default function JobDetail() {
|
||||
const roleType = useRoleType();
|
||||
const userInfo = useUserInfo();
|
||||
const [data, setData] = useState<JobDetails | null>(null);
|
||||
const videoRef = useRef<Taro.RewardedVideoAd | null>(null);
|
||||
const isOwner = roleType === RoleType.Company && userInfo.userId === data?.userId;
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
@ -219,6 +220,56 @@ export default function JobDetail() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handleLoad = () => {
|
||||
log('视频奖励加载成功');
|
||||
};
|
||||
const handleError = err => {
|
||||
Taro.eventCenter.trigger(EventName.PRE_ACTION_VIDEO_ERROR);
|
||||
log('视频奖励加载失败', err);
|
||||
};
|
||||
const handleClose = res => {
|
||||
if (res.isEnded) {
|
||||
Taro.eventCenter.trigger(EventName.PRE_ACTION_VIDEO_SUCCESS);
|
||||
} else {
|
||||
Toast.info('请完整观看广告以获得奖励');
|
||||
}
|
||||
};
|
||||
const handleShowVideo = async () => {
|
||||
if (videoRef.current) {
|
||||
try {
|
||||
await videoRef.current.show();
|
||||
} catch (error) {
|
||||
Taro.eventCenter.trigger(EventName.PRE_ACTION_VIDEO_ERROR);
|
||||
Toast.info('广告奖励加载失败,请重试');
|
||||
log('激励视频显示失败');
|
||||
}
|
||||
} else {
|
||||
Taro.eventCenter.trigger(EventName.PRE_ACTION_VIDEO_ERROR);
|
||||
Toast.info('广告奖励加载失败,请重试');
|
||||
log('激励视频加载&显示失败');
|
||||
}
|
||||
};
|
||||
videoRef.current = Taro.createRewardedVideoAd({
|
||||
adUnitId: 'adunit-ca879f574edfeb33',
|
||||
});
|
||||
videoRef.current.onLoad(handleLoad);
|
||||
videoRef.current.onClose(handleClose);
|
||||
videoRef.current.onError(handleError);
|
||||
|
||||
videoRef.current.load();
|
||||
Taro.eventCenter.on(EventName.SHOW_VIDEO_REWARD, handleShowVideo);
|
||||
|
||||
return () => {
|
||||
if (videoRef.current) {
|
||||
videoRef.current.offLoad(handleLoad);
|
||||
videoRef.current.offError(handleError);
|
||||
videoRef.current.offClose(handleClose);
|
||||
}
|
||||
Taro.eventCenter.off(EventName.SHOW_VIDEO_REWARD);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useLoad(async () => {
|
||||
switchRoleType(RoleType.Anchor);
|
||||
|
||||
|
@ -15,7 +15,7 @@ import useLocation from '@/hooks/use-location';
|
||||
import { MaterialProfile } from '@/types/material';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job';
|
||||
import { isFullTimePriceRequired, isPartTimePriceRequired, setSkipPrejobAction } from '@/utils/job';
|
||||
import { updateProfile, subscribeMaterialMessage } from '@/utils/material';
|
||||
import { navigateBack } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
@ -110,6 +110,7 @@ export default function MaterialCreateProfile() {
|
||||
// 发起订阅不能在异步任务中,保证是第一个
|
||||
await Promise.all([subscribeMaterialMessage(), updateProfile(data)]);
|
||||
}
|
||||
setSkipPrejobAction();
|
||||
Taro.eventCenter.trigger(EventName.CREATE_PROFILE);
|
||||
nextType ? setGroupType(nextType) : navigateBack(2);
|
||||
} catch (e) {
|
||||
|
3
src/pages/partner-share/index.config.ts
Normal file
3
src/pages/partner-share/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '分享',
|
||||
});
|
57
src/pages/partner-share/index.less
Normal file
57
src/pages/partner-share/index.less
Normal file
@ -0,0 +1,57 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.partner-share {
|
||||
padding-top: 175px;
|
||||
&__money {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
&__header {
|
||||
.flex-column();
|
||||
justify-content: center;
|
||||
font-weight: 500;
|
||||
font-size: 48px;
|
||||
line-height: 48px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding-top: 86px;
|
||||
.flex-column();
|
||||
}
|
||||
|
||||
&__item {
|
||||
.flex-row();
|
||||
margin-top: 72px;
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 48px;
|
||||
width: 640px;
|
||||
|
||||
color: #000000;
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
font-weight: 400;
|
||||
padding-left: 8px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
&__no {
|
||||
width: 74px;
|
||||
height: 46px;
|
||||
margin-right: 21px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
&__btn {
|
||||
.button(@width: 360px; @height: 72px;);
|
||||
margin-top: 150px;
|
||||
}
|
||||
}
|
61
src/pages/partner-share/index.tsx
Normal file
61
src/pages/partner-share/index.tsx
Normal file
@ -0,0 +1,61 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { EventName } from '@/constants/app';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { hasShareToGetContact, setShareToGetContact } from '@/utils/job';
|
||||
import { navigateBack } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'partner-share';
|
||||
|
||||
export default function Partner() {
|
||||
const inviteCode = useInviteCode();
|
||||
useDidShow(() => {
|
||||
if (!hasShareToGetContact()) {
|
||||
Taro.eventCenter.trigger(EventName.PRE_ACTION_SHARE_SUCCESS);
|
||||
navigateBack(-1);
|
||||
}
|
||||
});
|
||||
useShareAppMessage(() => {
|
||||
setShareToGetContact();
|
||||
console.log('Partner inviteCode', inviteCode);
|
||||
return getCommonShareMessage({ useCapture: false, inviteCode });
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<div className={`${PREFIX}__header`}>
|
||||
<Image
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/money.png"
|
||||
mode="aspectFit"
|
||||
className={`${PREFIX}__money`}
|
||||
/>
|
||||
<div>分享可获3重收益</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className={`${PREFIX}__item`}>
|
||||
<Image src="https://publiccdn.neighbourhood.com.cn/img/01.svg" mode="aspectFit" className={`${PREFIX}__no`} />
|
||||
<div>
|
||||
直接获得被邀请人支付金额<div className="highlight">20%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item`}>
|
||||
<Image src="https://publiccdn.neighbourhood.com.cn/img/02.svg" mode="aspectFit" className={`${PREFIX}__no`} />
|
||||
<div>邀请的主播被企业开聊,即可获得分润</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item`}>
|
||||
<Image src="https://publiccdn.neighbourhood.com.cn/img/03.svg" mode="aspectFit" className={`${PREFIX}__no`} />
|
||||
<div>
|
||||
获得被邀请人再邀请他人收益的<div className="highlight">5%</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button className={`${PREFIX}__btn`} openType="share">
|
||||
立即分享
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -8,20 +8,20 @@ import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { selectLocation } from '@/store/selector';
|
||||
import {
|
||||
JobDetails,
|
||||
CreateJobInfo,
|
||||
GetJobManagesRequest,
|
||||
GetJobManagesResponse,
|
||||
GetJobsDetailsRequest,
|
||||
GetJobsRequest,
|
||||
GetJobsResponse,
|
||||
JobInfo,
|
||||
GetMyRecommendJobRequest,
|
||||
GetUserJobRequest,
|
||||
GetUserJobResponse,
|
||||
MyDeclaredJobInfo,
|
||||
MyBrowsedJobInfo,
|
||||
GetMyRecommendJobRequest,
|
||||
GetJobManagesRequest,
|
||||
GetJobManagesResponse,
|
||||
CreateJobInfo,
|
||||
JobDetails,
|
||||
JobInfo,
|
||||
JobManageInfo,
|
||||
MyBrowsedJobInfo,
|
||||
MyDeclaredJobInfo,
|
||||
} from '@/types/job';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { getCityValues } from '@/utils/location';
|
||||
@ -131,3 +131,19 @@ export function postPublishJob(jobId: string) {
|
||||
export function postCloseJob(jobId: string) {
|
||||
return http.post(API.CLOSE_JOB, { data: { jobId }, contentType: 'application/x-www-form-urlencoded' });
|
||||
}
|
||||
|
||||
export function setSkipPrejobAction(skip = true) {
|
||||
Taro.setStorageSync(CacheKey.SKIP_PREACTION, skip);
|
||||
}
|
||||
|
||||
export function getSkipPrejobAction() {
|
||||
return !!Taro.getStorageSync(CacheKey.SKIP_PREACTION);
|
||||
}
|
||||
|
||||
export function setShareToGetContact(job = true) {
|
||||
Taro.setStorageSync(job ? CacheKey.SHARE_TO_GET_JOB_CONTACT : CacheKey.SHARE_TO_GET_ANCHOR_CONTACT, true);
|
||||
}
|
||||
|
||||
export function hasShareToGetContact(job = true) {
|
||||
return !Taro.getStorageSync(job ? CacheKey.SHARE_TO_GET_JOB_CONTACT : CacheKey.SHARE_TO_GET_ANCHOR_CONTACT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user