This commit is contained in:
@@ -13,7 +13,7 @@ const ServiceDetail = () => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const [searchParams] = useSearchParams();
|
||||
const { user } = useAuth();
|
||||
const { user, showLoginModal } = useAuth();
|
||||
const [service, setService] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
@@ -223,7 +223,7 @@ const ServiceDetail = () => {
|
||||
onClick={() => {
|
||||
if (!user) {
|
||||
message.info('请先登录后再进行咨询');
|
||||
navigate('/login', { state: { from: location.pathname } });
|
||||
showLoginModal();
|
||||
return;
|
||||
}
|
||||
setIsModalOpen(true);
|
||||
|
||||
@@ -21,7 +21,7 @@ const VCCourseDetail = () => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const [searchParams] = useSearchParams();
|
||||
const { user } = useAuth();
|
||||
const { user, showLoginModal } = useAuth();
|
||||
const [course, setCourse] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
@@ -276,7 +276,7 @@ const VCCourseDetail = () => {
|
||||
onClick={() => {
|
||||
if (!user) {
|
||||
message.info('请先登录后再进行报名或购买');
|
||||
navigate('/login', { state: { from: location.pathname } });
|
||||
showLoginModal();
|
||||
return;
|
||||
}
|
||||
setIsModalOpen(true);
|
||||
@@ -445,14 +445,14 @@ const VCCourseDetail = () => {
|
||||
cursor: course.is_purchased ? 'not-allowed' : 'pointer'
|
||||
}}
|
||||
onClick={() => {
|
||||
if (course.is_purchased) return;
|
||||
if (!user) {
|
||||
message.info('请先登录后再进行报名或购买');
|
||||
navigate('/login', { state: { from: location.pathname } });
|
||||
return;
|
||||
}
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
if (course.is_purchased) return;
|
||||
if (!user) {
|
||||
message.info('请先登录后再进行报名或购买');
|
||||
showLoginModal();
|
||||
return;
|
||||
}
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
{course.is_purchased ? '已购买' : (course.is_video_course ? '购买视频课程' : '立即报名 / 咨询')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user