diff --git a/projects/translate-h5/src/assets/translate/archives-date.png b/projects/translate-h5/src/assets/translate/archives-date.png new file mode 100644 index 0000000..9bb44bf Binary files /dev/null and b/projects/translate-h5/src/assets/translate/archives-date.png differ diff --git a/projects/translate-h5/src/assets/translate/archives-variety.png b/projects/translate-h5/src/assets/translate/archives-variety.png new file mode 100644 index 0000000..3c5ad36 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/archives-variety.png differ diff --git a/projects/translate-h5/src/assets/translate/archives-weight.png b/projects/translate-h5/src/assets/translate/archives-weight.png new file mode 100644 index 0000000..eea8aa7 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/archives-weight.png differ diff --git a/projects/translate-h5/src/assets/translate/cat-dog.png b/projects/translate-h5/src/assets/translate/cat-dog.png new file mode 100644 index 0000000..a1cc329 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/cat-dog.png differ diff --git a/projects/translate-h5/src/route/routes.tsx b/projects/translate-h5/src/route/routes.tsx index 467cb90..ab81ae9 100644 --- a/projects/translate-h5/src/route/routes.tsx +++ b/projects/translate-h5/src/route/routes.tsx @@ -16,7 +16,7 @@ const Page404 = lazy(() => import("@/view/error/page404")); const TranslateDetail = lazy(() => import("@/view/home/detail")); const TranslateMood = lazy(() => import("@/view/home/mood")); const TranslateArchives = lazy(() => import("@/view/home/archives")); -const TranslateArchivesAdd = lazy(() => import("@/view/home/archives/add")); +const TranslateArchivesAdd = lazy(() => import("@/view/home/addArchives")); export const routes: AppRoute[] = [ { path: "/", @@ -52,7 +52,7 @@ export const routes: AppRoute[] = [ }, }, { - path: "/translate/archives/add", + path: "/translate/addArchives", element: , auth: false, meta: { diff --git a/projects/translate-h5/src/view/home/addArchives/index.module.less b/projects/translate-h5/src/view/home/addArchives/index.module.less new file mode 100644 index 0000000..1fb1743 --- /dev/null +++ b/projects/translate-h5/src/view/home/addArchives/index.module.less @@ -0,0 +1,94 @@ +.archives { + background-color: #f5f5f5; + padding: 12px; + box-sizing: border-box; + min-height: 100%; + + .archivesInfo { + border-radius: 16px; + // 超出隐藏 + overflow: hidden; + background-color: #fff; + .archivesFrom { + padding: 16px; + padding-top: 0; + .archivesFromItem { + height: 56px; + line-height: 56px; + font-size: 14px; + display: flex; + justify-content: space-between; + border-bottom: 0.5px solid #f5f5f5; + + .archivesFromInput { + display: flex; + align-items: center; + color: #9c9c9c; + .archivesTag { + height: 24px; + line-height: 24px; + font-size: 12px; + border-radius: 12px; + padding: 0 10px; + background-color: #f5f5f5; + color: #1f1f1f; + margin-left: 8px; + &.active { + background-color: #000; + color: #fff; + } + } + &.editInput { + color: #000; + } + } + + .saveButton { + --background-color: #000; + --border-color: #000; + --text-color: #fff; + height: 40px; + margin-top: 16px; + } + } + } + } +} + +.archivesAvatar { + width: 100%; + height: 128px; + display: flex; + align-items: center; + justify-content: center; +} + +.popupHeader { + font-size: 16px; + display: flex; + justify-content: space-between; + padding: 12px; +} + +.popupBottom { + display: flex; + padding: 16px; + // 设置中间间隔 + .popupButton { + flex: 1; + margin-right: 22px; + &:last-child { + margin-right: 0; + } + .cancelButton { + --background-color: #fff; + --border-color: #e9e9e9; + --text-color: #000000; + } + .confirmButton { + --background-color: #1c1c1c; + --border-color: #1c1c1c; + --text-color: #fff; + } + } +} diff --git a/projects/translate-h5/src/view/home/addArchives/index.tsx b/projects/translate-h5/src/view/home/addArchives/index.tsx new file mode 100644 index 0000000..b49a07b --- /dev/null +++ b/projects/translate-h5/src/view/home/addArchives/index.tsx @@ -0,0 +1,188 @@ +import MainLayout from "@/layout/main/mainLayout"; +import styles from "./index.module.less"; +import archivesAvatarPng from "@/assets/translate/archives-avatar.png"; +import catDogPng from "@/assets/translate/cat-dog.png"; +import archivesVarietyPng from "@/assets/translate/archives-variety.png"; +import archivesWeightPng from "@/assets/translate/archives-weight.png"; +import archivesDatePng from "@/assets/translate/archives-date.png"; +import { useState } from "react"; +import { Image, Button, Popup, Space } from "antd-mobile"; +import { CloseOutline } from "antd-mobile-icons"; +import { useSearchParams } from "react-router-dom"; +import { Delete } from "@icon-park/react"; + +interface DefinedProps { + visible: boolean; + title: string; + children: React.ReactNode; + showBottom?: boolean; + onClose: () => void; +} + +function MyPopup(props: DefinedProps) { + const { visible, title, children, onClose, showBottom = false } = props; + return ( + +
+

{title}

+ + + +
+
{children}
+ + {showBottom && ( +
+
+ +
+
+ +
+
+ )} +
+ ); +} + +function Add() { + const [visibleVariety, setVisibleVariety] = useState(false); + const [visibleWeight, setVisibleWeight] = useState(false); + const [visibleDate, setVisibleDate] = useState(false); + const [searchParams] = useSearchParams(); + const flag = searchParams.get("flag"); + + const right = ( +
+ + + +
+ ); + + return ( + +
+
+ +
+
+ {flag === "add" && } + +
+
+
昵称*
+
+ {flag === "add" ? "请输入昵称" : "钱多多"} +
+
+
setVisibleVariety(true)} className={styles.archivesFromItem}> +
品种*
+
+ {flag === "add" ? "请选择" : "布偶猫"} + {">"} +
+
+
setVisibleWeight(true)} className={styles.archivesFromItem}> +
体重*
+
+ {flag === "add" ? "请选择" : "45kg"} + {">"} +
+
+
+
性别*
+
+
未知
+
弟弟
+
+ 妹妹 +
+
+
+
setVisibleDate(true)} className={styles.archivesFromItem}> +
出生日期*
+
+ {flag === "add" ? "请选择" : "2018-12-01"} + {">"} +
+
+
+
绝育情况*
+
+
未知
+
已绝育
+
+ 未绝育 +
+
+
+
+ +
+
+
+
+ + { + setVisibleVariety(false); + }} + > + + + + { + setVisibleWeight(false); + }} + showBottom={true} + > + + + { + setVisibleDate(false); + }} + showBottom={true} + > + + +
+ ); +} + +export default Add; diff --git a/projects/translate-h5/src/view/home/archives/add.tsx b/projects/translate-h5/src/view/home/archives/add.tsx deleted file mode 100644 index 813388e..0000000 --- a/projects/translate-h5/src/view/home/archives/add.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import MainLayout from "@/layout/main/mainLayout"; -import styles from "./index.module.less"; -import archivesAvatarPng from "@/assets/translate/archives-avatar.png"; -import archivesAddPng from "@/assets/translate/archives-add.png"; -import archivesEditPng from "@/assets/translate/archives-edit.png"; -import { useState } from "react"; -import { Image } from "antd-mobile"; - -function Add() { - const [flag, setFlag] = useState<"add" | "edit">("add"); - return ( - -
-
- -
- {flag === "add" ? : } -
-
- ); -} - -export default Add; diff --git a/projects/translate-h5/src/view/home/archives/index.tsx b/projects/translate-h5/src/view/home/archives/index.tsx index 7d33acf..d971d98 100644 --- a/projects/translate-h5/src/view/home/archives/index.tsx +++ b/projects/translate-h5/src/view/home/archives/index.tsx @@ -10,6 +10,7 @@ import archivesBottomPng from "@/assets/translate/archives-bottom.png"; import archivesCardPng from "@/assets/translate/archives-card.png"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; +import { Outlet } from "react-router-dom"; // 添加这行 import { Image, Space } from "antd-mobile"; import { ListView, More, AddOne, AlignHorizontalCenterTwo } from "@icon-park/react"; @@ -24,7 +25,7 @@ function Index() { }; const right = ( -
+
{listShow ? ( setListShow(false)} fill="#333" /> @@ -32,7 +33,7 @@ function Index() { setListShow(true)} fill="#333" /> )} - onLink("/translate/archives/add")} fill="#333" /> + onLink("/translate/addArchives?flag=add")} fill="#333" />
@@ -54,7 +55,11 @@ function Index() {
- + onLink("/translate/addArchives?flag=edit")} + className={styles.img} + src={archivesDataPng} + > @@ -62,6 +67,7 @@ function Index() {
)} + {/* 添加这行 */} ); } diff --git a/projects/translate-h5/src/view/home/index.tsx b/projects/translate-h5/src/view/home/index.tsx index 2bccfb3..0017c4f 100644 --- a/projects/translate-h5/src/view/home/index.tsx +++ b/projects/translate-h5/src/view/home/index.tsx @@ -11,13 +11,6 @@ function Index() { const [visible, setVisible] = useState(false); const safeNavigate = useSafeNavigate(); const navigate = useNavigate(); - useEffect(() => { - if (window.history) { - // // 往历史记录里面添加一条新的当前页面的url - // // 给 popstate 绑定一个方法监听页面返回 - window.addEventListener("popstate", () => onLink(""), false); //false阻止默认事件 - } - }, []); const onLink = (link: string) => { // safeNavigate(link); diff --git a/projects/translate-h5/src/view/home/mood/index.tsx b/projects/translate-h5/src/view/home/mood/index.tsx index ac9631a..f51aadb 100644 --- a/projects/translate-h5/src/view/home/mood/index.tsx +++ b/projects/translate-h5/src/view/home/mood/index.tsx @@ -13,7 +13,7 @@ const Moods = () => { const [visible, setVisible] = useState(false); const right = ( -
+