From e8cf28b6e99e6117601a0f358f5685778b684a20 Mon Sep 17 00:00:00 2001 From: chashaobao Date: Mon, 7 Jul 2025 01:15:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/prejob-popup/index.less | 82 ++++++++++++++ src/components/prejob-popup/index.tsx | 86 ++++++++++++++ src/components/product-dialog/const.ts | 2 + src/components/product-dialog/index.less | 10 +- src/components/product-dialog/job/index.tsx | 105 ++++++++++++++---- .../product-dialog/steps-ui/job-buy.tsx | 46 +++++--- src/constants/app.ts | 5 + src/constants/cache-key.ts | 3 + src/constants/job.ts | 6 + src/constants/product.ts | 1 + src/fragments/profile/view/index.less | 2 +- src/hooks/use-config.tsx | 1 + src/pages/job-detail/index.tsx | 55 ++++++++- src/pages/material-create-profile/index.tsx | 3 +- src/pages/partner-share/index.config.ts | 3 + src/pages/partner-share/index.less | 57 ++++++++++ src/pages/partner-share/index.tsx | 61 ++++++++++ src/utils/job.ts | 32 ++++-- 18 files changed, 507 insertions(+), 53 deletions(-) create mode 100644 src/components/prejob-popup/index.less create mode 100644 src/components/prejob-popup/index.tsx create mode 100644 src/pages/partner-share/index.config.ts create mode 100644 src/pages/partner-share/index.less create mode 100644 src/pages/partner-share/index.tsx diff --git a/src/components/prejob-popup/index.less b/src/components/prejob-popup/index.less new file mode 100644 index 0000000..c450739 --- /dev/null +++ b/src/components/prejob-popup/index.less @@ -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; + } +} diff --git a/src/components/prejob-popup/index.tsx b/src/components/prejob-popup/index.tsx new file mode 100644 index 0000000..d0c34e4 --- /dev/null +++ b/src/components/prejob-popup/index.tsx @@ -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 ( + +
+
以下方式任选其一均可获取联系方式
+
+ {GET_CONTACT_TYPE_OPTIONS.map(option => { + // 该方式只能用一次, 以后不再出现在选项中 + if (option.type === GET_CONTACT_TYPE.SHARE && !hasShareToGetContact()) { + return null; + } + + return ( +
+
+ +
+
+
{option.title}
+
{option.desc}
+
+
+ +
+
+ ); + })} +
+
+ +
+ ); +} diff --git a/src/components/product-dialog/const.ts b/src/components/product-dialog/const.ts index 701c722..96b5857 100644 --- a/src/components/product-dialog/const.ts +++ b/src/components/product-dialog/const.ts @@ -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', // 确定加群 diff --git a/src/components/product-dialog/index.less b/src/components/product-dialog/index.less index ea6f8a9..7ea6aa8 100644 --- a/src/components/product-dialog/index.less +++ b/src/components/product-dialog/index.less @@ -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; @@ -660,4 +662,4 @@ } } -} \ No newline at end of file +} diff --git a/src/components/product-dialog/job/index.tsx b/src/components/product-dialog/job/index.tsx index 52455d3..83ef7c2 100644 --- a/src/components/product-dialog/job/index.tsx +++ b/src/components/product-dialog/job/index.tsx @@ -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) { const { data, onClose } = props; const [status, setStatus] = useState(DialogStatus.LOADING); + const [showContact, setShowContact] = useState(false); + const [showPrejob, setShowPrejob] = useState(false); const [publisherAcctNo, setPublisherAcctNo] = useState(''); - const initRef = useRef(() => {}); + const initRef = useRef<(skipPreAction?: boolean, skipRecordGet?: boolean) => void | Promise>(() => {}); 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) { } 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) { }, [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) { // 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) { 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 ( - - - {status === DialogStatus.JOB_CONTACT_CS && } - {status === DialogStatus.JOB_CONTACT_DIRECT && ( - - )} - {status === DialogStatus.JOB_BUY && } - {status === DialogStatus.JOB_UNABLE_UNLOCK && } - - +
+ + + + {status === DialogStatus.JOB_CONTACT_CS && } + {status === DialogStatus.JOB_CONTACT_DIRECT && ( + + )} + {(status === DialogStatus.JOB_BUY || status === DialogStatus.PREACTION_JOB_BUY) && ( + + )} + {status === DialogStatus.JOB_UNABLE_UNLOCK && } + + +
); } diff --git a/src/components/product-dialog/steps-ui/job-buy.tsx b/src/components/product-dialog/steps-ui/job-buy.tsx index fb4e154..2056a6f 100644 --- a/src/components/product-dialog/steps-ui/job-buy.tsx +++ b/src/components/product-dialog/steps-ui/job-buy.tsx @@ -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 (
-
今日通告对接次数
-
已用完
+ {props.justBuy ? ( +
开通播络会员即可直接查看联系方式
+ ) : ( + +
今日通告对接次数
+
已用完
+
+ )}
-
-
明日
-
再来 或
-
升级会员
+ {props.justBuy ? ( +
每天可查看10个联系方式
+ ) : ( + +
+
明日
+
再来 或
+
升级会员
+
+ )}
{LIST.map(item => ( diff --git a/src/constants/app.ts b/src/constants/app.ts index d35b869..aa68073 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -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 { diff --git a/src/constants/cache-key.ts b/src/constants/cache-key.ts index f45331f..ed7eb19 100644 --- a/src/constants/cache-key.ts +++ b/src/constants/cache-key.ts @@ -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__', } diff --git a/src/constants/job.ts b/src/constants/job.ts index 2f702fe..5cf8e0f 100644 --- a/src/constants/job.ts +++ b/src/constants/job.ts @@ -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', +} diff --git a/src/constants/product.ts b/src/constants/product.ts index b699334..daadbc9 100644 --- a/src/constants/product.ts +++ b/src/constants/product.ts @@ -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 每天五次 diff --git a/src/fragments/profile/view/index.less b/src/fragments/profile/view/index.less index 80b024f..fc27b5f 100644 --- a/src/fragments/profile/view/index.less +++ b/src/fragments/profile/view/index.less @@ -44,7 +44,7 @@ font-size: 28px; font-weight: 400; color: #ffffff; - background: #0000005c; + background: #6D3DF5B2; border-radius: 48px; } diff --git a/src/hooks/use-config.tsx b/src/hooks/use-config.tsx index 4c3e409..dacf608 100644 --- a/src/hooks/use-config.tsx +++ b/src/hooks/use-config.tsx @@ -98,6 +98,7 @@ export const APP_CONFIG: AppConfigType = { PageUrl.Partner, PageUrl.WithdrawRecord, PageUrl.GroupDelegatePublish, + PageUrl.PartnerShare, // PageUrl.DevDebug, ], window: { diff --git a/src/pages/job-detail/index.tsx b/src/pages/job-detail/index.tsx index 738548d..ab60e0c 100644 --- a/src/pages/job-detail/index.tsx +++ b/src/pages/job-detail/index.tsx @@ -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(null); + const videoRef = useRef(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); diff --git a/src/pages/material-create-profile/index.tsx b/src/pages/material-create-profile/index.tsx index 57bbce3..5b67cfe 100644 --- a/src/pages/material-create-profile/index.tsx +++ b/src/pages/material-create-profile/index.tsx @@ -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) { diff --git a/src/pages/partner-share/index.config.ts b/src/pages/partner-share/index.config.ts new file mode 100644 index 0000000..8f9ba0f --- /dev/null +++ b/src/pages/partner-share/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '分享', +}); diff --git a/src/pages/partner-share/index.less b/src/pages/partner-share/index.less new file mode 100644 index 0000000..45001e3 --- /dev/null +++ b/src/pages/partner-share/index.less @@ -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; + } +} diff --git a/src/pages/partner-share/index.tsx b/src/pages/partner-share/index.tsx new file mode 100644 index 0000000..aa03488 --- /dev/null +++ b/src/pages/partner-share/index.tsx @@ -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 ( +
+
+ +
分享可获3重收益
+
+
+
+ +
+ 直接获得被邀请人支付金额
20%
+
+
+
+ +
邀请的主播被企业开聊,即可获得分润
+
+
+ +
+ 获得被邀请人再邀请他人收益的
5%
+
+
+ +
+
+ ); +} diff --git a/src/utils/job.ts b/src/utils/job.ts index c167a95..9e5b812 100644 --- a/src/utils/job.ts +++ b/src/utils/job.ts @@ -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); +}