提交 9259dc60 作者: ZhangLingKun

功能:跳转小程序提示

上级 0a2d74d6
流水线 #7674 已通过 于阶段
in 5 分 9 秒
...@@ -4,6 +4,7 @@ import styled from 'styled-components'; ...@@ -4,6 +4,7 @@ import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import { InterListType } from '@/api/interface'; import { InterListType } from '@/api/interface';
import { ListCompanyInfoByCoopIdType } from '@/api/interface/home'; import { ListCompanyInfoByCoopIdType } from '@/api/interface/home';
import QrcodePopover from '@/components/qrcodePopover';
// 列表类型 // 列表类型
type ListType = InterListType<ListCompanyInfoByCoopIdType>; type ListType = InterListType<ListCompanyInfoByCoopIdType>;
...@@ -34,6 +35,7 @@ const HomeBrandView = () => { ...@@ -34,6 +35,7 @@ const HomeBrandView = () => {
}, []); }, []);
return ( return (
<HomeBrandWrap> <HomeBrandWrap>
<QrcodePopover path={'page-product/product-company/index'}>
<div className="brand-item"> <div className="brand-item">
<div className="item-icon"> <div className="item-icon">
<img <img
...@@ -43,8 +45,14 @@ const HomeBrandView = () => { ...@@ -43,8 +45,14 @@ const HomeBrandView = () => {
/> />
</div> </div>
</div> </div>
</QrcodePopover>
{companyList?.map((i, j) => ( {companyList?.map((i, j) => (
<div key={j} className="brand-item"> <QrcodePopover
key={j}
path={'page-product/product-store/index'}
scene={`id=${Number(i?.backUserAccountId)}`}
>
<div className="brand-item">
<div className="item-logo"> <div className="item-logo">
<img src={i.brandLogo} alt={i.brandName} className="image" /> <img src={i.brandLogo} alt={i.brandName} className="image" />
</div> </div>
...@@ -52,6 +60,7 @@ const HomeBrandView = () => { ...@@ -52,6 +60,7 @@ const HomeBrandView = () => {
{i.brandName || i.companyName} {i.brandName || i.companyName}
</Button> </Button>
</div> </div>
</QrcodePopover>
))} ))}
</HomeBrandWrap> </HomeBrandWrap>
); );
......
...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { RightOutlined } from '@ant-design/icons'; import { RightOutlined } from '@ant-design/icons';
import styled from 'styled-components'; import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import QrcodePopover from '@/components/qrcodePopover';
const HomeNewsView = () => { const HomeNewsView = () => {
// 帖子类型 // 帖子类型
...@@ -114,10 +115,12 @@ const HomeNewsView = () => { ...@@ -114,10 +115,12 @@ const HomeNewsView = () => {
</div> </div>
))} ))}
</div> </div>
<QrcodePopover path={'page-home/news-list/index'}>
<div className="head-more flex-between"> <div className="head-more flex-between">
<div className="more-text">更多</div> <div className="more-text">更多</div>
<RightOutlined style={{ fontSize: 10, color: '#33333380' }} /> <RightOutlined style={{ fontSize: 10, color: '#33333380' }} />
</div> </div>
</QrcodePopover>
<img <img
className="head-bg" className="head-bg"
src="https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/sharefly-web-news.png" src="https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/sharefly-web-news.png"
......
...@@ -37,8 +37,8 @@ const HomeProductView = () => { ...@@ -37,8 +37,8 @@ const HomeProductView = () => {
); );
}; };
// 跳转详情 // 跳转详情
const handleDetail = async (item: ListType[0]['mallGoodsList'][0]) => { const handleDetail = (item: ListType[0]['mallGoodsList'][0]) => {
await router.push(`/mall/product/${item.id}`); router.push(`/mall/product/${item.id}`).then();
}; };
// 组件挂载 // 组件挂载
useEffect(() => { useEffect(() => {
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import styled from 'styled-components'; import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import { InterListType } from '@/api/interface'; import { InterListType } from '@/api/interface';
...@@ -8,6 +9,8 @@ import { IndustryListPagesType } from '@/api/interface/home'; ...@@ -8,6 +9,8 @@ import { IndustryListPagesType } from '@/api/interface/home';
type ListType = InterListType<IndustryListPagesType>; type ListType = InterListType<IndustryListPagesType>;
const HomeServiceView = () => { const HomeServiceView = () => {
// 路由钩子
const router = useRouter();
// 刷新子组件 // 刷新子组件
const [refresh, setRefresh] = useState<boolean>(true); const [refresh, setRefresh] = useState<boolean>(true);
// 服务列表 // 服务列表
...@@ -33,6 +36,10 @@ const HomeServiceView = () => { ...@@ -33,6 +36,10 @@ const HomeServiceView = () => {
setRefresh(true); setRefresh(true);
}, 0); }, 0);
}; };
// 跳转详情
const handleDetail = (item: ListType[0]['inspectionDTOS'][0]) => {
router.push(`/service/${item?.industryTypeId}/${item?.id}`).then();
};
// componentDidMount // componentDidMount
useEffect(() => { useEffect(() => {
getIndustryListPages().then(); getIndustryListPages().then();
...@@ -56,6 +63,7 @@ const HomeServiceView = () => { ...@@ -56,6 +63,7 @@ const HomeServiceView = () => {
<div <div
className="service-item animate__animated animate__fast animate__fadeIn" className="service-item animate__animated animate__fast animate__fadeIn"
key={j} key={j}
onClick={() => handleDetail(i)}
> >
<img <img
className="item-image" className="item-image"
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button } from 'antd'; import { Button } from 'antd';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useDispatch } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import { InterDataType } from '@/api/interface'; import { InterDataType } from '@/api/interface';
import { AppCategoryInfoType } from '@/api/interface/home'; import { AppCategoryInfoType } from '@/api/interface/home';
import { setGlobalData } from '@/store/module/globalData';
// 列表类型 // 列表类型
type ListType = InterDataType<AppCategoryInfoType>; type ListType = InterDataType<AppCategoryInfoType>;
...@@ -12,6 +14,8 @@ type ListType = InterDataType<AppCategoryInfoType>; ...@@ -12,6 +14,8 @@ type ListType = InterDataType<AppCategoryInfoType>;
const TabView01 = () => { const TabView01 = () => {
// 导航钩子 // 导航钩子
const router = useRouter(); const router = useRouter();
// store
const dispatch = useDispatch();
// 列表数据 // 列表数据
const [tabList, setTabList] = useState<ListType>([]); const [tabList, setTabList] = useState<ListType>([]);
// 获取云享商城分类 // 获取云享商城分类
...@@ -26,10 +30,20 @@ const TabView01 = () => { ...@@ -26,10 +30,20 @@ const TabView01 = () => {
}; };
// 跳转一级分类详情 // 跳转一级分类详情
const handleMain = (i: ListType[0]) => { const handleMain = (i: ListType[0]) => {
dispatch(
setGlobalData({
loadingSpinnerVisible: true,
}),
);
router.push(`/mall/${i?.id}`).then(); router.push(`/mall/${i?.id}`).then();
}; };
// 跳转二级分类详情 // 跳转二级分类详情
const handleSecond = (i: ListType[0], n: ListType[0]['subDTOList'][0]) => { const handleSecond = (i: ListType[0], n: ListType[0]['subDTOList'][0]) => {
dispatch(
setGlobalData({
loadingSpinnerVisible: true,
}),
);
router.push(`/mall/${i?.id}/${n?.id}`).then(); router.push(`/mall/${i?.id}/${n?.id}`).then();
}; };
// 组件挂载 // 组件挂载
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button } from 'antd'; import { Button } from 'antd';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useDispatch } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import { InterListType } from '@/api/interface'; import { InterListType } from '@/api/interface';
import { IndustryListPagesType } from '@/api/interface/home'; import { IndustryListPagesType } from '@/api/interface/home';
import { setGlobalData } from '@/store/module/globalData';
// 列表类型 // 列表类型
type ListType = InterListType<IndustryListPagesType>; type ListType = InterListType<IndustryListPagesType>;
...@@ -12,6 +14,8 @@ type ListType = InterListType<IndustryListPagesType>; ...@@ -12,6 +14,8 @@ type ListType = InterListType<IndustryListPagesType>;
const TabView02 = () => { const TabView02 = () => {
// 导航钩子 // 导航钩子
const router = useRouter(); const router = useRouter();
// store
const dispatch = useDispatch();
// 列表数据 // 列表数据
const [tabList, setTabList] = useState<ListType>([]); const [tabList, setTabList] = useState<ListType>([]);
// 获取分类列表 // 获取分类列表
...@@ -27,6 +31,11 @@ const TabView02 = () => { ...@@ -27,6 +31,11 @@ const TabView02 = () => {
}; };
// 跳转一级分类详情 // 跳转一级分类详情
const handleMain = (i: ListType[0]) => { const handleMain = (i: ListType[0]) => {
dispatch(
setGlobalData({
loadingSpinnerVisible: true,
}),
);
router.push(`/service/${i?.id}`).then(); router.push(`/service/${i?.id}`).then();
}; };
// 跳转二级分类详情 // 跳转二级分类详情
...@@ -34,6 +43,11 @@ const TabView02 = () => { ...@@ -34,6 +43,11 @@ const TabView02 = () => {
i: ListType[0], i: ListType[0],
n: ListType[0]['inspectionDTOS'][0], n: ListType[0]['inspectionDTOS'][0],
) => { ) => {
dispatch(
setGlobalData({
loadingSpinnerVisible: true,
}),
);
router.push(`/service/${i?.id}/${n?.id}`).then(); router.push(`/service/${i?.id}/${n?.id}`).then();
}; };
// 组件挂载 // 组件挂载
......
...@@ -23,7 +23,7 @@ const HomeTabView = () => { ...@@ -23,7 +23,7 @@ const HomeTabView = () => {
moduleCode: 'HOME_MENU_NEW', moduleCode: 'HOME_MENU_NEW',
}); });
if (res && res.code === '200') { if (res && res.code === '200') {
setCategoryList(res.result || []); setCategoryList(res.result.slice(0, 2) || []);
} }
}; };
// 选择分类 // 选择分类
......
...@@ -5,10 +5,14 @@ import { ...@@ -5,10 +5,14 @@ import {
VerticalAlignTopOutlined, VerticalAlignTopOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { HomeAPI } from '@/api'; import { HomeAPI } from '@/api';
import { InterDataType } from '@/api/interface'; import { InterDataType } from '@/api/interface';
import { AppPublishListType } from '@/api/interface/home'; import { AppPublishListType } from '@/api/interface/home';
import QrcodePopover from '@/components/qrcodePopover';
import { setGlobalData } from '@/store/module/globalData';
import { UserInfoState } from '@/store/module/userInfo';
import { formatLocationStr } from '@/utils/formatLocation'; import { formatLocationStr } from '@/utils/formatLocation';
import { bigNumberTransform } from '@/utils/money'; import { bigNumberTransform } from '@/utils/money';
...@@ -16,6 +20,10 @@ import { bigNumberTransform } from '@/utils/money'; ...@@ -16,6 +20,10 @@ import { bigNumberTransform } from '@/utils/money';
type ListType = InterDataType<AppPublishListType>; type ListType = InterDataType<AppPublishListType>;
const HomeTaskView = () => { const HomeTaskView = () => {
// store
const dispatch = useDispatch();
// userInfo
const userInfo = useSelector((state: any) => state.userInfo) as UserInfoState;
// 服务标签类型 // 服务标签类型
const serviceTagList = [ const serviceTagList = [
{ {
...@@ -108,6 +116,25 @@ const HomeTaskView = () => { ...@@ -108,6 +116,25 @@ const HomeTaskView = () => {
// formatMoney(props.detail?.orderAmount) // formatMoney(props.detail?.orderAmount)
return i?.orderAmount > 1 ? money : i?.orderAmount; return i?.orderAmount > 1 ? money : i?.orderAmount;
}; };
// 跳转详情
const handleDetail = (item: ListType[0]) => {
// 判断是否登录
if (!userInfo?.id) {
dispatch(
setGlobalData({
loginModalVisible: true,
}),
);
return;
}
dispatch(
setGlobalData({
qrcodeModalVisible: true,
qrcodeModalPath: 'page-order/order-flyer/index',
qrcodeModalScene: `id=${Number(item?.id)}`,
}),
);
};
// 组件挂载 // 组件挂载
useEffect(() => { useEffect(() => {
getRequirementsListType().then(); getRequirementsListType().then();
...@@ -117,16 +144,18 @@ const HomeTaskView = () => { ...@@ -117,16 +144,18 @@ const HomeTaskView = () => {
<HomeTaskWrap> <HomeTaskWrap>
<div className="task-title"> <div className="task-title">
<div className="title-label">抢单大厅</div> <div className="title-label">抢单大厅</div>
<QrcodePopover path={'page-service/service-task/index'}>
<div className="title-more"> <div className="title-more">
<div className="more-label">更多</div> <div className="more-label">更多</div>
<div className="more-icon"> <div className="more-icon">
<RightOutlined style={{ color: '#998e8b', fontSize: 13 }} /> <RightOutlined style={{ color: '#998e8b', fontSize: 13 }} />
</div> </div>
</div> </div>
</QrcodePopover>
</div> </div>
<div className="task-list"> <div className="task-list">
{requireList?.map((i, j) => ( {requireList?.map((i, j) => (
<div className="list-item" key={j}> <div className="list-item" key={j} onClick={() => handleDetail(i)}>
<div className="item-title"> <div className="item-title">
{i?.orderLevelEnum !== 'REGULAR_ORDER' && ( {i?.orderLevelEnum !== 'REGULAR_ORDER' && (
<div <div
......
import React from 'react'; import React, { useEffect } from 'react';
import { Spin } from 'antd';
import { useDispatch, useSelector } from 'react-redux';
import { ContentWrap } from '@/components/layout/content/styled'; import { ContentWrap } from '@/components/layout/content/styled';
import { GlobalDataState, setGlobalData } from '@/store/module/globalData';
const ContentView = ({ children }: { children?: React.ReactNode }) => { const ContentView = ({ children }: { children?: React.ReactNode }) => {
// store
const dispatch = useDispatch();
// globalData
const globalData = useSelector(
(state: any) => state.globalData,
) as GlobalDataState;
// 页面挂载时自动将加载中移除
useEffect(() => {
dispatch(
setGlobalData({
loadingSpinnerVisible: false,
}),
);
}, []);
return ( return (
<div className={'animate__animated animate__faster animate__fadeIn'}> <div className={'animate__animated animate__faster animate__fadeIn'}>
<Spin spinning={globalData?.loadingSpinnerVisible} fullscreen />
<ContentWrap>{!!children && children}</ContentWrap> <ContentWrap>{!!children && children}</ContentWrap>
</div> </div>
); );
......
...@@ -57,7 +57,7 @@ const QrcodePopover: React.FC<{ ...@@ -57,7 +57,7 @@ const QrcodePopover: React.FC<{
return ( return (
<Popover <Popover
content={content} content={content}
trigger="focus" trigger={'click'}
placement="bottomRight" placement="bottomRight"
onOpenChange={handleOpenChange} onOpenChange={handleOpenChange}
> >
......
...@@ -6,6 +6,7 @@ import { ListInspectionPriceUnit } from '@/api/interface/service'; ...@@ -6,6 +6,7 @@ import { ListInspectionPriceUnit } from '@/api/interface/service';
import { UserAddressSelectList } from '@/api/interface/user'; import { UserAddressSelectList } from '@/api/interface/user';
export type GlobalDataState = { export type GlobalDataState = {
loadingSpinnerVisible: boolean;
loginModalVisible: boolean; loginModalVisible: boolean;
qrcodeModalVisible: boolean; qrcodeModalVisible: boolean;
qrcodeModalPath?: string; qrcodeModalPath?: string;
...@@ -17,6 +18,7 @@ export type GlobalDataState = { ...@@ -17,6 +18,7 @@ export type GlobalDataState = {
}; };
const initialState: GlobalDataState = { const initialState: GlobalDataState = {
loadingSpinnerVisible: false,
loginModalVisible: false, loginModalVisible: false,
qrcodeModalVisible: false, qrcodeModalVisible: false,
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论