feat:
This commit is contained in:
@ -1,14 +1,15 @@
|
|||||||
import { Button, Image } from '@tarojs/components';
|
import { Button, Image } from '@tarojs/components';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
|
||||||
import { Popup, Dialog } from '@taroify/core';
|
import { Dialog, Popup } from '@taroify/core';
|
||||||
import { Fragment, useCallback, useState } from 'react';
|
import { Fragment, useCallback, useState } from 'react';
|
||||||
|
|
||||||
import JobBuy from '@/components/product-dialog/steps-ui/job-buy';
|
import JobBuy from '@/components/product-dialog/steps-ui/job-buy';
|
||||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||||
import { PageUrl } from '@/constants/app';
|
import { PageUrl } from '@/constants/app';
|
||||||
|
import { CacheKey } from '@/constants/cache-key';
|
||||||
import { GET_CONTACT_TYPE } from '@/constants/job';
|
import { GET_CONTACT_TYPE } from '@/constants/job';
|
||||||
import { navigateTo } from '@/utils/route';
|
import { switchTab, navigateTo } from '@/utils/route';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@ -33,11 +34,19 @@ const GET_CONTACT_TYPE_OPTIONS = [
|
|||||||
desc: '开通会员每天免费查看',
|
desc: '开通会员每天免费查看',
|
||||||
btnText: '开通',
|
btnText: '开通',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: GET_CONTACT_TYPE.GROUP,
|
||||||
|
icon: 'https://publiccdn.neighbourhood.com.cn/img/group-avatar.png',
|
||||||
|
title: '进群领会员(免费报单)',
|
||||||
|
desc: '群内定期发放会员,免费报单',
|
||||||
|
btnText: '进群',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function PrejobPopup({ onCancel, onConfirm }: IProps) {
|
export function PrejobPopup({ onCancel, onConfirm }: IProps) {
|
||||||
const [openPopup, setOpenPopup] = useState(true);
|
const [openPopup, setOpenPopup] = useState(true);
|
||||||
const [openDialog, setOpenDialog] = useState(false);
|
const [openDialog, setOpenDialog] = useState(false);
|
||||||
|
const [clicked, setClicked] = useState(!!Taro.getStorageSync(CacheKey.JOIN_GROUP_POPUP_CLICKED));
|
||||||
const handleClick = (type: GET_CONTACT_TYPE) => () => {
|
const handleClick = (type: GET_CONTACT_TYPE) => () => {
|
||||||
if (type === GET_CONTACT_TYPE.MATERIAL) {
|
if (type === GET_CONTACT_TYPE.MATERIAL) {
|
||||||
navigateTo(PageUrl.MaterialUploadVideo);
|
navigateTo(PageUrl.MaterialUploadVideo);
|
||||||
@ -47,6 +56,12 @@ export function PrejobPopup({ onCancel, onConfirm }: IProps) {
|
|||||||
setOpenPopup(false);
|
setOpenPopup(false);
|
||||||
setOpenDialog(true);
|
setOpenDialog(true);
|
||||||
}
|
}
|
||||||
|
if (type === GET_CONTACT_TYPE.GROUP) {
|
||||||
|
Taro.setStorageSync(CacheKey.JOIN_GROUP_POPUP_CLICKED, true);
|
||||||
|
setClicked(true);
|
||||||
|
switchTab(PageUrl.GroupV2);
|
||||||
|
onConfirm(type);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const handleAfterBuy = useCallback(async () => {
|
const handleAfterBuy = useCallback(async () => {
|
||||||
onConfirm(GET_CONTACT_TYPE.VIP);
|
onConfirm(GET_CONTACT_TYPE.VIP);
|
||||||
@ -58,6 +73,9 @@ export function PrejobPopup({ onCancel, onConfirm }: IProps) {
|
|||||||
<div className={`${PREFIX}__title`}>以下方式任选其一均可获取联系方式</div>
|
<div className={`${PREFIX}__title`}>以下方式任选其一均可获取联系方式</div>
|
||||||
<div className={`${PREFIX}__body`}>
|
<div className={`${PREFIX}__body`}>
|
||||||
{GET_CONTACT_TYPE_OPTIONS.map(option => {
|
{GET_CONTACT_TYPE_OPTIONS.map(option => {
|
||||||
|
if (clicked && option.type === GET_CONTACT_TYPE.GROUP) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className={`${PREFIX}__item`} key={option.type}>
|
<div className={`${PREFIX}__item`} key={option.type}>
|
||||||
<div className={`${PREFIX}__item-icon ${option.type}`}>
|
<div className={`${PREFIX}__item-icon ${option.type}`}>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { DeclarationType, ProductType } from '@/constants/product';
|
|||||||
import { JobDetails } from '@/types/job';
|
import { JobDetails } from '@/types/job';
|
||||||
import { GetProductIsUnlockResponse, ProductInfo } from '@/types/product';
|
import { GetProductIsUnlockResponse, ProductInfo } from '@/types/product';
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { requestProductUseRecord, requestUseProduct } from '@/utils/product';
|
import { requestUseProduct } from '@/utils/product';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
|
||||||
import '../index.less';
|
import '../index.less';
|
||||||
@ -67,6 +67,7 @@ function ProductContactDialog(props: Omit<IProps, 'visible'>) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const productInfo = await requestUseProduct(PRODUCT_CODE, { jobId: data.id });
|
const productInfo = await requestUseProduct(PRODUCT_CODE, { jobId: data.id });
|
||||||
|
console.log('开始报单');
|
||||||
Taro.eventCenter.trigger(EventName.READ_CONTACT);
|
Taro.eventCenter.trigger(EventName.READ_CONTACT);
|
||||||
handleContact(productInfo.declarationTypeResult);
|
handleContact(productInfo.declarationTypeResult);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -13,4 +13,5 @@ export enum CacheKey {
|
|||||||
AGREEMENT_SIGNED = '__agreement_signed__',
|
AGREEMENT_SIGNED = '__agreement_signed__',
|
||||||
CITY_CODES = '__city_codes__',
|
CITY_CODES = '__city_codes__',
|
||||||
JOIN_GROUP_CARD_CLICKED = '__join_group_card_clicked__',
|
JOIN_GROUP_CARD_CLICKED = '__join_group_card_clicked__',
|
||||||
|
JOIN_GROUP_POPUP_CLICKED = '__join_group_popup_clicked__',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -213,4 +213,5 @@ export const FULL_PRICE_OPTIONS = FULL_EMPLOY_SALARY_OPTIONS.filter(o => !!o.val
|
|||||||
export enum GET_CONTACT_TYPE {
|
export enum GET_CONTACT_TYPE {
|
||||||
VIP = 'vip',
|
VIP = 'vip',
|
||||||
MATERIAL = 'material',
|
MATERIAL = 'material',
|
||||||
|
GROUP = 'group',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,7 @@ import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
|||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
import { formatDate } from '@/utils/time';
|
import { formatDate } from '@/utils/time';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
import { isNeedPhone } from '@/utils/user';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'job-detail';
|
const PREFIX = 'job-detail';
|
||||||
@ -75,7 +76,8 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
|||||||
const [showBuyDialog, setShowBuyDialog] = useState(false);
|
const [showBuyDialog, setShowBuyDialog] = useState(false);
|
||||||
const [productInfo, setProductInfo] = useState<undefined | ProductInfo>();
|
const [productInfo, setProductInfo] = useState<undefined | ProductInfo>();
|
||||||
const [productRecord, setProductRecord] = useState<undefined | GetProductIsUnlockResponse>();
|
const [productRecord, setProductRecord] = useState<undefined | GetProductIsUnlockResponse>();
|
||||||
|
const userInfo = useUserInfo();
|
||||||
|
const needPhone = isNeedPhone(userInfo);
|
||||||
const getProductRecord = useCallback(async () => {
|
const getProductRecord = useCallback(async () => {
|
||||||
const result = await requestProductUseRecord(ProductType.VIP, { jobId: data.id });
|
const result = await requestProductUseRecord(ProductType.VIP, { jobId: data.id });
|
||||||
setProductRecord(result);
|
setProductRecord(result);
|
||||||
@ -163,8 +165,11 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
|||||||
|
|
||||||
const handleAfterBuy = useCallback(async () => {
|
const handleAfterBuy = useCallback(async () => {
|
||||||
setShowBuyDialog(false);
|
setShowBuyDialog(false);
|
||||||
|
Taro.showLoading({ mask: true, title: '加载中...' });
|
||||||
await getProductBalance();
|
await getProductBalance();
|
||||||
|
console.log('购买后重新获取次数');
|
||||||
setContactDialogVisible(true);
|
setContactDialogVisible(true);
|
||||||
|
Taro.hideLoading();
|
||||||
}, [getProductBalance]);
|
}, [getProductBalance]);
|
||||||
|
|
||||||
const handleCancel = useCallback(() => {
|
const handleCancel = useCallback(() => {
|
||||||
@ -217,6 +222,8 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
|||||||
<div className={`${PREFIX}__contact-publisher-tag`}>
|
<div className={`${PREFIX}__contact-publisher-tag`}>
|
||||||
{data.isAuthed ? '急招岗位可免费查看' : productInfo?.content}
|
{data.isAuthed ? '急招岗位可免费查看' : productInfo?.content}
|
||||||
</div>
|
</div>
|
||||||
|
) : needPhone ? (
|
||||||
|
<div className={`${PREFIX}__contact-publisher-tag`}>登录后可免费报单</div>
|
||||||
) : null}
|
) : null}
|
||||||
</LoginButton>
|
</LoginButton>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user