Browse Source

fix: 用户协议 隐私政策补充

version/2.1.0
WIN-UGQIHHLSKBB\EDY 1 month ago
parent
commit
84f70d3fb9
  1. 2
      src/constants/index.ts
  2. 8
      src/dialog/LoginRegisterModal/index.tsx
  3. 5
      src/dialog/points-recharge/index.tsx
  4. 2
      src/layouts/Layout/Layout.tsx
  5. 33
      src/pages/content/privacy-policy/index.tsx
  6. 33
      src/pages/content/user-terms/index.tsx
  7. 18
      src/router/index.tsx

2
src/constants/index.ts

@ -18,6 +18,8 @@ export const ROUTES = {
LEGAL: "/legal", LEGAL: "/legal",
CONTENT: "/content", CONTENT: "/content",
CONTENT_PAGE: "/content/page", CONTENT_PAGE: "/content/page",
CONTENT_PRIVACY_POLICY: "/content/privacy-policy",
CONTENT_USER_TERMS: "/content/user-terms",
NOT_FOUND: "/404", NOT_FOUND: "/404",
} as const; } as const;

8
src/dialog/LoginRegisterModal/index.tsx

@ -523,11 +523,11 @@ export function LoginRegisterModal({ onClose, onSelect }: LoginRegisterModalProp
<div className="login_register_modal_wechat_agreement"> <div className="login_register_modal_wechat_agreement">
<p className="login_register_modal_wechat_agreement_text"> <p className="login_register_modal_wechat_agreement_text">
{t("auth.agreement_sub1")} {t("auth.agreement_sub1")}
<a href="/content/userTerms" target="_blank" rel="noreferrer"> <a href={ROUTES.CONTENT_USER_TERMS} target="_blank" rel="noreferrer">
{t("app.user_terms")} {t("app.user_terms")}
</a> </a>
{t("auth.agreement_sub2")} {t("auth.agreement_sub2")}
<a href="/content/privacyPolicy" target="_blank" rel="noreferrer"> <a href={ROUTES.CONTENT_PRIVACY_POLICY} target="_blank" rel="noreferrer">
{t("app.privacy_policy")} {t("app.privacy_policy")}
</a> </a>
</p> </p>
@ -571,11 +571,11 @@ export function LoginRegisterModal({ onClose, onSelect }: LoginRegisterModalProp
> >
{t("auth.agreement_sub1")} {t("auth.agreement_sub1")}
</span> </span>
<a href="/content/userTerms" target="_blank" rel="noreferrer"> <a href={ROUTES.CONTENT_USER_TERMS} target="_blank" rel="noreferrer">
{t("app.user_terms")} {t("app.user_terms")}
</a> </a>
{t("auth.agreement_sub2")} {t("auth.agreement_sub2")}
<a href="/content/privacyPolicy" target="_blank" rel="noreferrer"> <a href={ROUTES.CONTENT_PRIVACY_POLICY} target="_blank" rel="noreferrer">
{t("app.privacy_policy")} {t("app.privacy_policy")}
</a> </a>
{t("auth.agreement_sub3")} {t("auth.agreement_sub3")}

5
src/dialog/points-recharge/index.tsx

@ -1,6 +1,7 @@
import { Message } from "@arco-design/web-react"; import { Message } from "@arco-design/web-react";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { ROUTES } from "@/constants";
import { getParamConfig, getPointPackageList } from "@/api/api"; import { getParamConfig, getPointPackageList } from "@/api/api";
import { useUserStore } from "@/store/useUserStore"; import { useUserStore } from "@/store/useUserStore";
import { useCopyText } from "@/hooks/useCopyText"; import { useCopyText } from "@/hooks/useCopyText";
@ -134,7 +135,7 @@ export default function PointsRecharge({ title }: PointsRechargeProps) {
{t("points_recharge.tip_middle")} {t("points_recharge.tip_middle")}
<a <a
className="points_recharge_tip_link" className="points_recharge_tip_link"
href="/content/userTerms" href={ROUTES.CONTENT_USER_TERMS}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
@ -143,7 +144,7 @@ export default function PointsRecharge({ title }: PointsRechargeProps) {
{t("auth.agreement_sub2")} {t("auth.agreement_sub2")}
<a <a
className="points_recharge_tip_link" className="points_recharge_tip_link"
href="/content/privacyPolicy" href={ROUTES.CONTENT_PRIVACY_POLICY}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >

2
src/layouts/Layout/Layout.tsx

@ -231,7 +231,7 @@ export function Layout({ children }: LayoutProps) {
/** 角色创建页:侧栏固定收起且不可展开 */ /** 角色创建页:侧栏固定收起且不可展开 */
const isCharactersCreateRoute = pathname === ROUTES.CHARACTERS_CREATE; const isCharactersCreateRoute = pathname === ROUTES.CHARACTERS_CREATE;
const shouldShowFloatingComposer = pathname !== ROUTES.SUBSCRIBE && pathname !== ROUTES.CHARACTERS_CREATE; const shouldShowFloatingComposer = pathname !== ROUTES.SUBSCRIBE && pathname !== ROUTES.CHARACTERS_CREATE && pathname !== ROUTES.CONTENT_USER_TERMS && pathname !== ROUTES.CONTENT_PRIVACY_POLICY;
const effectiveSidebarCollapsed = isCharactersCreateRoute || sidebarCollapsed; const effectiveSidebarCollapsed = isCharactersCreateRoute || sidebarCollapsed;

33
src/pages/content/privacy-policy/index.tsx

@ -0,0 +1,33 @@
import { getPrivacyPolicy } from "@/api/api";
import { useEffect, useState } from "react";
import "../page/index.scss";
export default function PrivacyPolicy() {
const [html, setHtml] = useState<string | undefined>(undefined);
const [title, setTitle] = useState<string | undefined>(undefined);
useEffect(() => {
setHtml(undefined);
getPrivacyPolicy().then((res) => {
setHtml(res.data?.content);
setTitle(res.data?.title);
});
}, []);
return (
<div className="legal-page">
<section
className="legal-page__section"
id="privacy-policy"
aria-labelledby="legal-doc-title"
>
<h1 className="legal-page__title" id="legal-doc-title">
{title}
</h1>
<div className="legal-page__content">
<div dangerouslySetInnerHTML={{ __html: html ?? "" }} />
</div>
</section>
</div>
);
}

33
src/pages/content/user-terms/index.tsx

@ -0,0 +1,33 @@
import { getUserTerms } from "@/api/api";
import { useEffect, useState } from "react";
import "../page/index.scss";
export default function UserTerms() {
const [html, setHtml] = useState<string | undefined>(undefined);
const [title, setTitle] = useState<string | undefined>(undefined);
useEffect(() => {
setHtml(undefined);
getUserTerms().then((res) => {
setHtml(res.data?.content);
setTitle(res.data?.title);
});
}, []);
return (
<div className="legal-page">
<section
className="legal-page__section"
id="user-terms"
aria-labelledby="legal-doc-title"
>
<h1 className="legal-page__title" id="legal-doc-title">
{title}
</h1>
<div className="legal-page__content">
<div dangerouslySetInnerHTML={{ __html: html ?? "" }} />
</div>
</section>
</div>
);
}

18
src/router/index.tsx

@ -19,6 +19,8 @@ const Subscribe = lazy(() => import("@/pages/subscribe"));
const Profile = lazy(() => import("@/pages/Profile")); const Profile = lazy(() => import("@/pages/Profile"));
const Legal = lazy(() => import("@/pages/legal")); const Legal = lazy(() => import("@/pages/legal"));
const ContentPage = lazy(() => import("@/pages/content/page")); const ContentPage = lazy(() => import("@/pages/content/page"));
const PrivacyPolicy = lazy(() => import("@/pages/content/privacy-policy"));
const UserTerms = lazy(() => import("@/pages/content/user-terms"));
export const router = createBrowserRouter([ export const router = createBrowserRouter([
{ {
@ -75,6 +77,14 @@ export const router = createBrowserRouter([
path: "content/page", path: "content/page",
element: <ContentPage />, element: <ContentPage />,
}, },
{
path: "content/privacy-policy",
element: <PrivacyPolicy />,
},
{
path: "content/user-terms",
element: <UserTerms />,
},
], ],
}, },
{ {
@ -89,6 +99,14 @@ export const router = createBrowserRouter([
path: ROUTES.CONTENT, path: ROUTES.CONTENT,
element: <Navigate to={`${ROUTES.CONTENT_PAGE}/page`} replace />, element: <Navigate to={`${ROUTES.CONTENT_PAGE}/page`} replace />,
}, },
{
path: "/content/privacyPolicy",
element: <Navigate to={ROUTES.CONTENT_PRIVACY_POLICY} replace />,
},
{
path: "/content/userTerms",
element: <Navigate to={ROUTES.CONTENT_USER_TERMS} replace />,
},
{ {
path: "*", path: "*",
element: <Navigate to={ROUTES.NOT_FOUND} replace />, element: <Navigate to={ROUTES.NOT_FOUND} replace />,

Loading…
Cancel
Save