提交 6a700ddd 作者: ZhangLingKun

功能:用户协议

上级 6c4a45b6
import React, { useEffect, useState } from 'react';
import { Button, Modal } from 'antd';
import { useRouter } from 'next/router';
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';
import { HomeAPI } from '@/api';
import { InterDataType } from '@/api/interface';
import { ListBannerImgType } from '@/api/interface/home';
import { RootState } from '@/store';
import { GlobalDataState, setGlobalData } from '@/store/module/globalData';
type AgreeType = InterDataType<ListBannerImgType>;
const AgreeModalView: React.FC<{
open: boolean;
}> = ({ open }) => {
// store
const dispatch = useDispatch();
// 路由钩子
const router = useRouter();
// system
const globalData = useSelector(
(state: RootState) => state.globalData,
) as GlobalDataState;
// 协议内容
const [agreementData, setAgreementData] = useState<AgreeType>();
// 关闭弹窗
const handleClose = () => {
dispatch(setGlobalData({ agreeModalVisible: false }));
// 如果需要返回
if (globalData.toastModalBack) router.back();
};
// 获取协议
const getAgreementData = async () => {
const res = await HomeAPI.listBannerImg({
moduleCode: 'SHAREFLY_ABOUT',
});
if (res && res.code === '200') {
setAgreementData(res.result);
}
};
useEffect(() => {
if (!open) return;
getAgreementData().then();
}, [open]);
return (
<Modal
open={open}
title={
globalData?.agreeModalType === 1 ? '云享飞隐私协议' : '云享飞用户协议'
}
onCancel={handleClose}
width={720}
footer={null}
>
<AgreeModalWrap>
<div className={'content'}>
{agreementData?.[globalData?.agreeModalType]?.textContent && (
<div
className="w-full"
dangerouslySetInnerHTML={{
__html:
agreementData?.[globalData?.agreeModalType]?.textContent,
}}
/>
)}
</div>
<Button type="primary" onClick={handleClose}>
同意并继续
</Button>
</AgreeModalWrap>
</Modal>
);
};
export default AgreeModalView;
// 样式
const AgreeModalWrap = styled.div`
position: relative;
width: 100%;
height: 26.8rem;
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: column;
box-sizing: border-box;
.content {
position: relative;
width: 100%;
height: 24.8rem;
margin-bottom: 1rem;
overflow-y: scroll;
box-sizing: border-box;
&::-webkit-scrollbar {
background-color: transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
width: 7px;
height: 7px;
}
&::-webkit-scrollbar-thumb {
background: #d9d9d9;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
}
}
`;
import React from 'react'; import React from 'react';
import { PhoneOutlined, ShopOutlined } from '@ant-design/icons';
import { Button } from 'antd'; import { Button } from 'antd';
import { FooterWrap } from '@/components/layout/footer/styled'; import { FooterWrap } from '@/components/layout/footer/styled';
import QrcodePopover from '@/components/qrcodePopover'; import QrcodePopover from '@/components/qrcodePopover';
...@@ -110,6 +111,7 @@ const FooterView = () => { ...@@ -110,6 +111,7 @@ const FooterView = () => {
</div> </div>
</div> </div>
<div className="footer-end"> <div className="footer-end">
<div className="flex w-full items-center">
<QrcodePopover path={'page-mine/help-center/index'}> <QrcodePopover path={'page-mine/help-center/index'}>
<Button type={'link'} className="end-item"> <Button type={'link'} className="end-item">
常见问题 常见问题
...@@ -125,9 +127,14 @@ const FooterView = () => { ...@@ -125,9 +127,14 @@ const FooterView = () => {
免责声明 免责声明
</Button> </Button>
</QrcodePopover> </QrcodePopover>
</div>
<div className="flex w-full items-center">
<div className="mr-4 text-999">
Copyright © 2021 - 2024 云享飞 版权所有
</div>
<Button <Button
type={'link'} type={'link'}
className="end-item" className="p-0 text-999"
onClick={() => { onClick={() => {
window.location.href = 'https://beian.miit.gov.cn'; window.location.href = 'https://beian.miit.gov.cn';
}} }}
...@@ -135,6 +142,21 @@ const FooterView = () => { ...@@ -135,6 +142,21 @@ const FooterView = () => {
浙ICP备2023014395号 浙ICP备2023014395号
</Button> </Button>
</div> </div>
<div className="absolute right-0 top-4">
<div className="mb-1">
<ShopOutlined className="mr-2 text-999" />
<span className="text-999">
浙江省杭州市富阳区春江街道富春湾大道2723号17幢283号
</span>
</div>
<div>
<PhoneOutlined className="mr-2 -scale-x-100 text-999" />
<span className="text-999">
联系电话:0571-87199598/17706710318
</span>
</div>
</div>
</div>
</div> </div>
</FooterWrap> </FooterWrap>
); );
......
...@@ -7,7 +7,7 @@ export const FooterWrap = styled.div` ...@@ -7,7 +7,7 @@ export const FooterWrap = styled.div`
.footer-wrap { .footer-wrap {
position: relative; position: relative;
max-width: 1190px; max-width: 1190px;
height: 19.13rem; min-height: 19.13rem;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto; margin: 0 auto;
border-radius: 0; border-radius: 0;
...@@ -15,25 +15,27 @@ export const FooterWrap = styled.div` ...@@ -15,25 +15,27 @@ export const FooterWrap = styled.div`
//padding: 0 12rem; //padding: 0 12rem;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-start;
flex-direction: column; flex-direction: column;
} }
&::after { &::after {
position: absolute; position: absolute;
content: ''; content: '';
bottom: 5rem; bottom: 5rem;
left: 12rem; left: calc((100% - 1190px) / 2);
width: calc(100% - 24rem); width: 1190px;
height: 0.02rem; height: 0.02rem;
background: #bfbfbf; background: #bfbfbf;
} }
.footer-end { .footer-end {
position: relative; position: relative;
width: 100%; width: 100%;
height: 5rem; min-height: 5rem;
display: flex; padding: 1rem 0;
align-items: center; box-sizing: border-box;
justify-content: center; //display: flex;
//align-items: center;
//justify-content: center;
.end-item { .end-item {
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
...@@ -64,7 +66,7 @@ export const FooterWrap = styled.div` ...@@ -64,7 +66,7 @@ export const FooterWrap = styled.div`
align-items: flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
box-sizing: border-box; box-sizing: border-box;
padding-top: 2.5rem; padding: 2.5rem 0;
.start-item { .start-item {
position: relative; position: relative;
min-width: 8.6rem; min-width: 8.6rem;
......
import React from 'react'; import React from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import AgreeModalView from '@/components/agreeModal';
import ContentView from '@/components/layout/content'; import ContentView from '@/components/layout/content';
import FooterView from '@/components/layout/footer'; import FooterView from '@/components/layout/footer';
import HeaderView from '@/components/layout/header'; import HeaderView from '@/components/layout/header';
...@@ -60,6 +61,8 @@ const LayoutView: React.FC<{ ...@@ -60,6 +61,8 @@ const LayoutView: React.FC<{
open={globalData?.toastModalVisible} open={globalData?.toastModalVisible}
onCancel={handleModalClose} onCancel={handleModalClose}
/> />
{/* 协议弹窗 */}
<AgreeModalView open={globalData?.agreeModalVisible} />
</LayoutWrap> </LayoutWrap>
); );
}; };
......
...@@ -7,7 +7,7 @@ import { useDispatch, useSelector } from 'react-redux'; ...@@ -7,7 +7,7 @@ import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { CommonAPI } from '@/api'; import { CommonAPI } from '@/api';
import { RootState } from '@/store'; import { RootState } from '@/store';
import { GlobalDataState } from '@/store/module/globalData'; import { GlobalDataState, setGlobalData } from '@/store/module/globalData';
import { setSystem } from '@/store/module/system'; import { setSystem } from '@/store/module/system';
import { setUserInfo } from '@/store/module/userInfo'; import { setUserInfo } from '@/store/module/userInfo';
...@@ -161,6 +161,10 @@ const LoginModalView = ({ ...@@ -161,6 +161,10 @@ const LoginModalView = ({
await router.push('/user/signup'); await router.push('/user/signup');
handleClose(); handleClose();
}; };
// 打开协议弹窗
const handleAgree = (type: number) => {
dispatch(setGlobalData({ agreeModalVisible: true, agreeModalType: type }));
};
// 组件挂载 // 组件挂载
useEffect(() => { useEffect(() => {
if (!open) { if (!open) {
...@@ -249,9 +253,19 @@ const LoginModalView = ({ ...@@ -249,9 +253,19 @@ const LoginModalView = ({
onChange={(e) => setCheckValue(e.target?.checked)} onChange={(e) => setCheckValue(e.target?.checked)}
> >
<span>阅读并接受</span> <span>阅读并接受</span>
<span className="bold cursor-pointer">云享飞用户协议</span> <span
className="bold cursor-pointer"
onClick={() => handleAgree(1)}
>
云享飞用户协议
</span>
<span></span> <span></span>
<span className="bold cursor-pointer">隐私协议</span> <span
className="bold cursor-pointer"
onClick={() => handleAgree(2)}
>
隐私协议
</span>
</Checkbox> </Checkbox>
</div> </div>
<div className="signup"> <div className="signup">
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { CheckCircleFilled } from '@ant-design/icons'; import { CheckCircleFilled } from '@ant-design/icons';
import { Button } from 'antd'; import { Button } from 'antd';
import { useRouter } from 'next/router';
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';
...@@ -13,6 +14,8 @@ import ProductItemView from '@/components/productItem'; ...@@ -13,6 +14,8 @@ import ProductItemView from '@/components/productItem';
type ListType = InterDataType<RecommendGoodsType>; type ListType = InterDataType<RecommendGoodsType>;
const OrderSuccessView = () => { const OrderSuccessView = () => {
// 路由钩子
const router = useRouter();
// 推荐商品列表 // 推荐商品列表
const [recommendGoodsList, setRecommendGoodsList] = useState< const [recommendGoodsList, setRecommendGoodsList] = useState<
ListType[0]['mallGoodsList'] ListType[0]['mallGoodsList']
...@@ -30,6 +33,10 @@ const OrderSuccessView = () => { ...@@ -30,6 +33,10 @@ const OrderSuccessView = () => {
); );
} }
}; };
// 跳转订单详情
const handleDetail = async () => {
await router.push(`/order/product/${router.query?.id}`);
};
// 页面加载 // 页面加载
useEffect(() => { useEffect(() => {
getRecommendGoodsList().then(); getRecommendGoodsList().then();
...@@ -55,7 +62,7 @@ const OrderSuccessView = () => { ...@@ -55,7 +62,7 @@ const OrderSuccessView = () => {
<div className="item-label">实付款:</div> <div className="item-label">实付款:</div>
<div className="item-value price">¥19.9</div> <div className="item-value price">¥19.9</div>
</div> </div>
<Button type="link" className="mb-2 px-0"> <Button type="link" className="mb-2 px-0" onClick={handleDetail}>
查看订单 查看订单
</Button> </Button>
</div> </div>
......
...@@ -18,6 +18,8 @@ export type GlobalDataState = { ...@@ -18,6 +18,8 @@ export type GlobalDataState = {
priceUnitList?: InterDataType<ListInspectionPriceUnit>; priceUnitList?: InterDataType<ListInspectionPriceUnit>;
toastModalVisible: boolean; toastModalVisible: boolean;
toastModalBack: boolean; toastModalBack: boolean;
agreeModalVisible: boolean;
agreeModalType: number;
}; };
const initialState: GlobalDataState = { const initialState: GlobalDataState = {
...@@ -26,6 +28,8 @@ const initialState: GlobalDataState = { ...@@ -26,6 +28,8 @@ const initialState: GlobalDataState = {
qrcodeModalVisible: false, qrcodeModalVisible: false,
toastModalVisible: false, toastModalVisible: false,
toastModalBack: false, toastModalBack: false,
agreeModalVisible: false,
agreeModalType: 1,
}; };
const globalDataSlice = createSlice({ const globalDataSlice = createSlice({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论