revert ad

This commit is contained in:
chashaobao
2025-07-27 15:59:28 +08:00
parent 1ddc8b46c9
commit 0cd1a46762
16 changed files with 59 additions and 345 deletions

View File

@ -170,7 +170,6 @@ export default function AnchorPage() {
const query = getPageQuery();
getInviteCodeFromQueryAndUpdate(query);
console.log('哈哈哈 useLoad');
try {
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });

View File

@ -1,7 +1,7 @@
import { Map, MapProps, Text, Image, Button } from '@tarojs/components';
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { CertificationStatusIcon } from '@/components/certification-status';
import CommonDialog from '@/components/common-dialog';
@ -183,7 +183,6 @@ 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();
@ -220,56 +219,6 @@ 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 () => {
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string; share: string }>();

View File

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '分享',
});

View File

@ -1,57 +0,0 @@
@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;
}
}

View File

@ -1,61 +0,0 @@
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>
);
}