diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0469c0..61b0d29 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -148,7 +148,11 @@ importers: packages/utils: {} - projects/translate-h5: {} + projects/translate-h5: + dependencies: + browser-id3-writer: + specifier: ^6.3.1 + version: 6.3.1 packages: @@ -1075,6 +1079,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + browser-id3-writer@6.3.1: + resolution: {integrity: sha512-sRA4Uq9Q3NsmXiVpLvIDxzomtgCdbw6SY85A6fw7dUQGRVoOBg1/buFv6spPhYiSo6FlVtN5OJQTvvhbmfx9rQ==} + browserslist@4.25.4: resolution: {integrity: sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -1635,6 +1642,7 @@ packages: intersection-observer@0.12.2: resolution: {integrity: sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==} + deprecated: The Intersection Observer polyfill is no longer needed and can safely be removed. Intersection Observer has been Baseline since 2019. is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -3532,6 +3540,8 @@ snapshots: dependencies: fill-range: 7.1.1 + browser-id3-writer@6.3.1: {} + browserslist@4.25.4: dependencies: caniuse-lite: 1.0.30001739 diff --git a/projects/translate-h5/package.json b/projects/translate-h5/package.json index 3798f00..ff8fa60 100644 --- a/projects/translate-h5/package.json +++ b/projects/translate-h5/package.json @@ -7,5 +7,8 @@ "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" + }, + "dependencies": { + "browser-id3-writer": "^6.3.1" } } diff --git a/projects/translate-h5/src/api/getDialog.ts b/projects/translate-h5/src/api/getDialog.ts index 4312f32..c6f7016 100644 --- a/projects/translate-h5/src/api/getDialog.ts +++ b/projects/translate-h5/src/api/getDialog.ts @@ -27,8 +27,9 @@ export const useGetDialog = () => { { manual: true } // 手动触发 ); - const getDialog = () => { + const getDialog = (params: { pageNo: number; pageSize: number }) => { return execute({ + params, headers: { "Content-Type": "application/json", }, diff --git a/projects/translate-h5/src/assets/translate/archives-avatar.png b/projects/translate-h5/src/assets/translate/archives-avatar.png deleted file mode 100644 index 8a23e89..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-avatar.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-bottom.png b/projects/translate-h5/src/assets/translate/archives-bottom.png deleted file mode 100644 index b08e53c..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-bottom.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-card.png b/projects/translate-h5/src/assets/translate/archives-card.png deleted file mode 100644 index da1ad52..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-card.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-data.png b/projects/translate-h5/src/assets/translate/archives-data.png deleted file mode 100644 index da1ad52..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-data.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-date.png b/projects/translate-h5/src/assets/translate/archives-date.png deleted file mode 100644 index 033ebcc..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-date.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-equipment.png b/projects/translate-h5/src/assets/translate/archives-equipment.png deleted file mode 100644 index 996ee10..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-equipment.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-function.png b/projects/translate-h5/src/assets/translate/archives-function.png deleted file mode 100644 index 66499fd..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-function.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-picture.png b/projects/translate-h5/src/assets/translate/archives-picture.png deleted file mode 100644 index 19c95f8..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-picture.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-sw.png b/projects/translate-h5/src/assets/translate/archives-sw.png deleted file mode 100644 index 8884006..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-sw.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-variety.png b/projects/translate-h5/src/assets/translate/archives-variety.png deleted file mode 100644 index 667db80..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-variety.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/archives-weight.png b/projects/translate-h5/src/assets/translate/archives-weight.png deleted file mode 100644 index 3b1bb2c..0000000 Binary files a/projects/translate-h5/src/assets/translate/archives-weight.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/cat-dog.png b/projects/translate-h5/src/assets/translate/cat-dog.png deleted file mode 100644 index c61bb19..0000000 Binary files a/projects/translate-h5/src/assets/translate/cat-dog.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/demo.WAV b/projects/translate-h5/src/assets/translate/demo.WAV deleted file mode 100644 index 9f4928e..0000000 Binary files a/projects/translate-h5/src/assets/translate/demo.WAV and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-1.png b/projects/translate-h5/src/assets/translate/emotion/emotion-1.png new file mode 100644 index 0000000..0d9a951 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-1.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-2.png b/projects/translate-h5/src/assets/translate/emotion/emotion-2.png new file mode 100644 index 0000000..5c6d73b Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-2.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-3.png b/projects/translate-h5/src/assets/translate/emotion/emotion-3.png new file mode 100644 index 0000000..718302e Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-3.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-4.png b/projects/translate-h5/src/assets/translate/emotion/emotion-4.png new file mode 100644 index 0000000..b7bca75 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-4.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-5.png b/projects/translate-h5/src/assets/translate/emotion/emotion-5.png new file mode 100644 index 0000000..36731f3 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-5.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-6.png b/projects/translate-h5/src/assets/translate/emotion/emotion-6.png new file mode 100644 index 0000000..56d5a24 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-6.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-7.png b/projects/translate-h5/src/assets/translate/emotion/emotion-7.png new file mode 100644 index 0000000..4c78265 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-7.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-8.png b/projects/translate-h5/src/assets/translate/emotion/emotion-8.png new file mode 100644 index 0000000..e945491 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-8.png differ diff --git a/projects/translate-h5/src/assets/translate/emotion/emotion-9.png b/projects/translate-h5/src/assets/translate/emotion/emotion-9.png new file mode 100644 index 0000000..12f0e42 Binary files /dev/null and b/projects/translate-h5/src/assets/translate/emotion/emotion-9.png differ diff --git a/projects/translate-h5/src/assets/translate/mood-abstract.png b/projects/translate-h5/src/assets/translate/mood-abstract.png deleted file mode 100644 index 496fad7..0000000 Binary files a/projects/translate-h5/src/assets/translate/mood-abstract.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/mood-chart.png b/projects/translate-h5/src/assets/translate/mood-chart.png deleted file mode 100644 index 173f227..0000000 Binary files a/projects/translate-h5/src/assets/translate/mood-chart.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/mood-filter.png b/projects/translate-h5/src/assets/translate/mood-filter.png deleted file mode 100644 index 8f62125..0000000 Binary files a/projects/translate-h5/src/assets/translate/mood-filter.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/translate/mood-popup.png b/projects/translate-h5/src/assets/translate/mood-popup.png deleted file mode 100644 index 3c5190f..0000000 Binary files a/projects/translate-h5/src/assets/translate/mood-popup.png and /dev/null differ diff --git a/projects/translate-h5/src/assets/user/cart.png b/projects/translate-h5/src/assets/user/cart.png new file mode 100644 index 0000000..e25767a Binary files /dev/null and b/projects/translate-h5/src/assets/user/cart.png differ diff --git a/projects/translate-h5/src/assets/user/header.svg b/projects/translate-h5/src/assets/user/header.svg new file mode 100644 index 0000000..445f34d --- /dev/null +++ b/projects/translate-h5/src/assets/user/header.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/projects/translate-h5/src/assets/user/tool.png b/projects/translate-h5/src/assets/user/tool.png new file mode 100644 index 0000000..b84d2c5 Binary files /dev/null and b/projects/translate-h5/src/assets/user/tool.png differ diff --git a/projects/translate-h5/src/http/axios-instance.ts b/projects/translate-h5/src/http/axios-instance.ts index d73789e..7b8a5fc 100644 --- a/projects/translate-h5/src/http/axios-instance.ts +++ b/projects/translate-h5/src/http/axios-instance.ts @@ -51,4 +51,5 @@ console.log(import.meta.env.VITE_BASE_URL, "import.meta.env.VITE_BASE_URL"); //192.168.1.231:48080 // || "http://192.168.1.231:48080" const baseURL = import.meta.env.VITE_BASE_URL || "https://petshy.tashowz.com"; +// const baseURL = import.meta.env.VITE_BASE_URL || "http://192.168.1.231:48080"; export const axiosInstance = new AxiosInstance(baseURL).getInstance(); diff --git a/projects/translate-h5/src/layout/main/index.less b/projects/translate-h5/src/layout/main/index.less deleted file mode 100644 index 941792f..0000000 --- a/projects/translate-h5/src/layout/main/index.less +++ /dev/null @@ -1,23 +0,0 @@ -.main-layout { - height: 100%; - .layout-content { - --bottom: 0; - --bottom: constant(safe-area-inset-bottom); - --bottom: env(safe-area-inset-bottom); - height: 100%; - overflow-y: auto; - // padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/ - // padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/ - padding-bottom: calc(var(--bottom) + 44px); - } - - .layout-tab { - flex: 0 0 auto; - position: fixed; - bottom: 0; - width: 100%; - z-index: 1000; - background-color: #fff; - box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); - } -} diff --git a/projects/translate-h5/src/layout/main/index.module.less b/projects/translate-h5/src/layout/main/index.module.less new file mode 100644 index 0000000..f4a1d21 --- /dev/null +++ b/projects/translate-h5/src/layout/main/index.module.less @@ -0,0 +1,43 @@ +.main-layout { + height: 100%; + display: flex; + flex-direction: column; + .layout-content { + flex: 1; + overflow-y: auto; + overflow-x: hidden; + padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/ + padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/ + } + + .layout-tab { + flex: 0 0 auto; + width: 100%; + z-index: 1000; + background-color: #fff; + :global { + .adm-tab-bar { + // 去除默认阴影 + box-shadow: none; + background-color: #fff; + padding: 8px 16px; + + .adm-tab-bar-item-active { + // 添加选中时的背景圆角 + &:before { + content: ""; + position: absolute; + + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #0000000a; + border-radius: 100px; + z-index: 99; + } + } + } + } + } +} diff --git a/projects/translate-h5/src/layout/main/mainLayout.tsx b/projects/translate-h5/src/layout/main/mainLayout.tsx index 2e4de3f..6959900 100644 --- a/projects/translate-h5/src/layout/main/mainLayout.tsx +++ b/projects/translate-h5/src/layout/main/mainLayout.tsx @@ -1,7 +1,9 @@ import React from "react"; import { NavBar, SafeArea, TabBar } from "antd-mobile"; import { useNavigate } from "react-router-dom"; -import "./index.less"; +// import "./index.less"; +import styles from "./index.module.less"; + import { Translate, Electrocardiogram, GithubOne, Blossom, User } from "@icon-park/react"; interface MainLayoutProps { @@ -29,28 +31,30 @@ const MainLayout: React.FC = ({ icon: , }, { - key: "/translate/archives", + key: "/mood", title: "情绪监控", icon: , }, { - key: "/translate/mood", + key: "/archives", title: "我的宠物", icon: , }, - // { - // key: "/translate/mood", - // title: "宠物服务", - // icon: , - // }, - // { - // key: "/translate/mood", - // title: "个人中心", + { + key: "/service", + title: "宠物服务", + icon: , + }, + { + key: "/user", + title: "个人中心", - // icon: , - // }, + icon: , + }, ]; + const showTabBarRoutes = tabs.map((tab) => tab.key); + const setRouteActive = (value: string) => { console.log(value); @@ -69,24 +73,25 @@ const MainLayout: React.FC = ({ } }; return ( -
+
{isShowNavBar ? ( - + {title} ) : ( "" )} -
{children}
- -
- setRouteActive(value)} safeArea={true}> - {tabs.map((item) => ( - - ))} - -
+
{children}
+ {showTabBarRoutes.includes(location.pathname) && ( +
+ setRouteActive(value)} safeArea={true}> + {tabs.map((item) => ( + + ))} + +
+ )}
); }; diff --git a/projects/translate-h5/src/route/auth.tsx b/projects/translate-h5/src/route/auth.tsx index e555e41..5fa4957 100644 --- a/projects/translate-h5/src/route/auth.tsx +++ b/projects/translate-h5/src/route/auth.tsx @@ -27,6 +27,18 @@ const AuthRoute: React.FC = ({ children, auth, meta }) => { } }, [meta]); useEffect(() => { + // 识别微信浏览器 + const userAgent = navigator.userAgent.toLowerCase(); + console.log(userAgent.includes("micromessenger")); + if (userAgent.includes("micromessenger")) { + navigate("/wxIndex"); + } else { + // 如果是'/wxIndex'跳转到首页 + if (location.pathname === "/wxIndex") { + navigate("/"); + } + } + // 检查角色权限 if (auth && !isAuthenticated) { navigate("/login"); // 如果未认证且路由需要认证,则重定向到登录 diff --git a/projects/translate-h5/src/route/routes.tsx b/projects/translate-h5/src/route/routes.tsx index 1dffadb..816ae0c 100644 --- a/projects/translate-h5/src/route/routes.tsx +++ b/projects/translate-h5/src/route/routes.tsx @@ -13,9 +13,18 @@ export interface AppRoute { const Home = lazy(() => import("@/view/home")); 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/addArchives")); +const TranslateMood = lazy(() => import("@/view/mood")); +const TranslateArchives = lazy(() => import("@/view/archives")); +const TranslateArchivesAdd = lazy(() => import("@/view/addArchives")); +const Service = lazy(() => import("@/view/service")); +const ServiceDetail = lazy(() => import("@/view/serviceDetail")); +const User = lazy(() => import("@/view/user")); +const Order = lazy(() => import("@/view/order")); +const OrderDetail = lazy(() => import("@/view/orderDetail")); +const Payment = lazy(() => import("@/view/payment")); +const Result = lazy(() => import("@/view/result")); +const WXIndex = lazy(() => import("@/view/wxIndex/index")); + export const routes: AppRoute[] = [ { path: "/", @@ -25,6 +34,14 @@ export const routes: AppRoute[] = [ title: "宠物翻译", }, }, + { + path: "/wxIndex", + element: , + auth: false, + meta: { + title: "微信跳转", + }, + }, { path: "/translate", element: , @@ -35,7 +52,7 @@ export const routes: AppRoute[] = [ }, { path: "/translate/detail", element: , auth: false }, { - path: "/translate/mood", + path: "/mood", element: , auth: false, meta: { @@ -43,7 +60,7 @@ export const routes: AppRoute[] = [ }, }, { - path: "/translate/archives", + path: "/archives", element: , auth: false, meta: { @@ -51,12 +68,55 @@ export const routes: AppRoute[] = [ }, }, { - path: "/translate/addArchives", + path: "/addArchives", element: , auth: false, meta: { title: "新建档案", }, }, + { + path: "/service", + element: , + auth: false, + meta: { + title: "宠物服务", + }, + }, + { + path: "/service/detail", + element: , + auth: false, + meta: { + title: "服务详情", + }, + }, + { + path: "/user", + element: , + auth: false, + meta: { + title: "个人中心", + }, + }, + { + path: "/order", + element: , + auth: false, + meta: { + title: "我的订单", + }, + }, + + { path: "/order/detail", element: , auth: false, meta: { title: "订单详情" } }, + { + path: "/payment", + element: , + auth: false, + meta: { + title: "选择服务", + }, + }, + { path: "/result", element: , auth: false, meta: { title: "支付结果" } }, { path: "*", element: , auth: false }, ]; diff --git a/projects/translate-h5/src/view/home/addArchives/index.module.less b/projects/translate-h5/src/view/addArchives/index.module.less similarity index 100% rename from projects/translate-h5/src/view/home/addArchives/index.module.less rename to projects/translate-h5/src/view/addArchives/index.module.less diff --git a/projects/translate-h5/src/view/home/addArchives/index.tsx b/projects/translate-h5/src/view/addArchives/index.tsx similarity index 91% rename from projects/translate-h5/src/view/home/addArchives/index.tsx rename to projects/translate-h5/src/view/addArchives/index.tsx index 2e9db22..6779ac9 100644 --- a/projects/translate-h5/src/view/home/addArchives/index.tsx +++ b/projects/translate-h5/src/view/addArchives/index.tsx @@ -1,10 +1,5 @@ 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"; @@ -67,6 +62,12 @@ function MyPopup(props: DefinedProps) { } function Add() { + const archivesAvatarPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-avatar.png"; + const catDogPng = "http://qiniu.bydj.tashowz.com/assets/translate/cat-dog.png"; + const archivesVarietyPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-variety.png"; + const archivesDatePng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-date.png"; + const archivesWeightPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-weight.png"; + const [visibleVariety, setVisibleVariety] = useState(false); const [visibleWeight, setVisibleWeight] = useState(false); const [visibleDate, setVisibleDate] = useState(false); @@ -74,8 +75,8 @@ function Add() { const flag = searchParams.get("flag"); const right = ( -
- +
+
diff --git a/projects/translate-h5/src/view/app/App.tsx b/projects/translate-h5/src/view/app/App.tsx index bfce1a9..a78fcc6 100644 --- a/projects/translate-h5/src/view/app/App.tsx +++ b/projects/translate-h5/src/view/app/App.tsx @@ -11,6 +11,10 @@ function App() { axios: axiosInstance, }); const i18nStore = useI18nStore(); + // 持久化一个messageList的本地化数据 + console.log("degfmessageList"); + + localStorage.setItem("messageList", JSON.stringify([])); return ( <> diff --git a/projects/translate-h5/src/view/home/archives/index.module.less b/projects/translate-h5/src/view/archives/index.module.less similarity index 58% rename from projects/translate-h5/src/view/home/archives/index.module.less rename to projects/translate-h5/src/view/archives/index.module.less index 673f11e..427683e 100644 --- a/projects/translate-h5/src/view/home/archives/index.module.less +++ b/projects/translate-h5/src/view/archives/index.module.less @@ -12,10 +12,26 @@ } } +.homeHeader { + display: flex; + padding: 12px; + position: sticky; + top: 0px; + background: #f5f5f5; + justify-content: space-between; + align-items: center; + z-index: 99; + h3 { + font-size: 20px; + font-size: 20px; + } +} + .bottom { position: fixed; - bottom: 0; + bottom: 60px; opacity: 0.98; + z-index: 99; } .archivesAvatar { diff --git a/projects/translate-h5/src/view/archives/index.tsx b/projects/translate-h5/src/view/archives/index.tsx new file mode 100644 index 0000000..13dd8f7 --- /dev/null +++ b/projects/translate-h5/src/view/archives/index.tsx @@ -0,0 +1,97 @@ +// 档案 +import MainLayout from "@/layout/main/mainLayout"; +import styles from "./index.module.less"; +// import archivesPicturePng from "@/assets/translate/archives-picture.png"; +// import archivesDataPng from "@/assets/translate/archives-data.png"; +// import archivesEquipmentPng from "@/assets/translate/archives-equipment.png"; +// import archivesSwPng from "@/assets/translate/archives-sw.png"; +// import archivesFunctionPng from "@/assets/translate/archives-function.png"; +// 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"; +function Index() { + const archivesPicturePng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-picture.png"; + const archivesDataPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-data.png"; + const archivesEquipmentPng = + "http://qiniu.bydj.tashowz.com/assets/translate/archives-equipment.png"; + const archivesSwPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-sw.png"; + const archivesFunctionPng = + "http://qiniu.bydj.tashowz.com/assets/translate/archives-function.png"; + const archivesBottomPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-bottom.png"; + const archivesCardPng = "http://qiniu.bydj.tashowz.com/assets/translate/archives-card.png"; + + const [listShow, setListShow] = useState(false); + + const navigate = useNavigate(); + + const onLink = (link: string) => { + navigate(link); + }; + + // const right = ( + //
+ // + // {listShow ? ( + // setListShow(false)} fill="#333" /> + // ) : ( + // setListShow(true)} fill="#333" /> + // )} + + // onLink("/translate/addArchives?flag=add")} fill="#333" /> + // + // + //
+ // ); + + return ( + +
+

我的宠物

+ + {listShow ? ( + setListShow(false)} fill="#333" /> + ) : ( + setListShow(true)} fill="#333" /> + )} + + onLink("/addArchives?flag=add")} fill="#333" /> + + +
+ {listShow ? ( +
+ + + + +
+ ) : ( + <> +
+ +
+
+ + onLink("/addArchives?flag=edit")} + className={styles.img} + src={archivesDataPng} + > + + + +
+
+ + )} + {/* 添加这行 */} +
+ ); +} + +export default Index; diff --git a/projects/translate-h5/src/view/home/archives/index.tsx b/projects/translate-h5/src/view/home/archives/index.tsx deleted file mode 100644 index d971d98..0000000 --- a/projects/translate-h5/src/view/home/archives/index.tsx +++ /dev/null @@ -1,75 +0,0 @@ -// 档案 -import MainLayout from "@/layout/main/mainLayout"; -import styles from "./index.module.less"; -import archivesPicturePng from "@/assets/translate/archives-picture.png"; -import archivesDataPng from "@/assets/translate/archives-data.png"; -import archivesEquipmentPng from "@/assets/translate/archives-equipment.png"; -import archivesSwPng from "@/assets/translate/archives-sw.png"; -import archivesFunctionPng from "@/assets/translate/archives-function.png"; -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"; -function Index() { - const [listShow, setListShow] = useState(false); - - const navigate = useNavigate(); - - const onLink = (link: string) => { - // safeNavigate(link); - navigate(link); - }; - - const right = ( -
- - {listShow ? ( - setListShow(false)} fill="#333" /> - ) : ( - setListShow(true)} fill="#333" /> - )} - - onLink("/translate/addArchives?flag=add")} fill="#333" /> - - -
- ); - - return ( - - {listShow ? ( -
- - - - -
- ) : ( - <> -
- -
-
- - onLink("/translate/addArchives?flag=edit")} - className={styles.img} - src={archivesDataPng} - > - - - -
-
- - )} - {/* 添加这行 */} -
- ); -} - -export default Index; diff --git a/projects/translate-h5/src/view/home/index.tsx b/projects/translate-h5/src/view/home/index.tsx index bb47dc1..88a5e25 100644 --- a/projects/translate-h5/src/view/home/index.tsx +++ b/projects/translate-h5/src/view/home/index.tsx @@ -2,25 +2,21 @@ import MainLayout from "@/layout/main/mainLayout"; import { useState } from "react"; import { Divider, Space } from "antd-mobile"; import Translate from "./translate/index"; -import { Electrocardiogram, Filter, GithubOne, HamburgerButton } from "@icon-park/react"; -import { useNavigate } from "react-router-dom"; +import { Filter, HamburgerButton } from "@icon-park/react"; + // import { useSafeNavigate } from "@workspace/hooks"; import "./index.less"; function Index() { const [visible, setVisible] = useState(false); // const safeNavigate = useSafeNavigate(); - const navigate = useNavigate(); - const onLink = (link: string) => { - // safeNavigate(link); - navigate(link); - }; return (

宠物翻译

+ setVisible(!visible)} /> - onLink("/translate/archives")} - /> + /> */} ({}); const [currentPlayingId, setCurrentPlayingId] = useState(); + const emotionList = [ + Emotion1Png, + Emotion4Png, + Emotion7Png, + Emotion2Png, + Emotion5Png, + Emotion8Png, + Emotion3Png, + Emotion6Png, + Emotion9Png, + ]; useEffect(() => { if (isRecording && currentPlayingId) { @@ -25,7 +46,7 @@ function Index(props: DefinedProps) { } }, [isRecording, currentPlayingId]); - const playAudio = (id: number, audioUrl: string) => { + const playAudio = async (id: number, audioUrl: string) => { if (isRecording) { Toast.show("录音中,无法播放音频"); return; @@ -35,7 +56,28 @@ function Index(props: DefinedProps) { audioRefs.current[currentPlayingId].currentTime = 0; } if (currentPlayingId !== id) { + console.log(id); + setCurrentPlayingId(id); + // console.log(audioUrl, "audioUrl"); + + // const response = await fetch(audioUrl); + // console.log("response", response); + + // const arrayBuffer = await response.arrayBuffer(); + // console.log("arrayBuffer", arrayBuffer); + + // // 创建ID3Writer实例并移除ID3标签 + // const writer = new ID3Writer(new Uint8Array(arrayBuffer)); + // writer.removeTag(); // 移除 ID3 标签 + + // writer.addTag(); // 必须调用 addTag 才能生成带标签的音频数据 + // const blob = writer.getBlob(); // 使用 getBlob 获取正确的 Blob 数据 + + // const url = URL.createObjectURL(blob); + + // console.log("url", url); + audioRefs.current[id] = new Audio(audioUrl); audioRefs.current[id].play(); audioRefs.current[id].onended = () => { @@ -49,14 +91,28 @@ function Index(props: DefinedProps) { }; const renderAvatar = (item: Message) => { - return ; + return ( + + ); }; - const refreshMessage = async (messageId: number, e: React.MouseEvent) => { + const refreshMessage = async (item: Message, e: React.MouseEvent) => { e.stopPropagation(); + console.log("item", item); + + if (!item.file || !item.dialogId || !item.contentText) { + Toast.show("文件不存在,无法重新翻译"); + return; + } const formData = new FormData(); - formData.append("msgId", messageId.toString()); - props.onRefresh(formData, messageId); + formData.append("file", item.file); + formData.append("dialogId", String(item.dialogId)); + formData.append("contentDuration", String(item.contentDuration)); + + props.onRefresh(formData, item.id); }; const renderTranslateResult = (item: Message) => { @@ -70,28 +126,36 @@ function Index(props: DefinedProps) { } else { if (item.transStatus === 1) { return item.transResult?.length ? ( - +
{item.transResult} - +
+ {item.emotion !== undefined && + item.emotion > 0 && + item.emotion <= emotionList.length && ( + + )} +
+
) : ( 未知语句 - refreshMessage(item.id, e)} size="12" fill="#333" /> + refreshMessage(item, e)} size="12" fill="#333" /> ); } else { + console.log("item.transResult", item); + return ( - { e.stopPropagation(); }} > - 翻译失败,请重试 - refreshMessage(item.id, e)} size="12" fill="#333" /> - + {item.transResult} + refreshMessage(item, e)} size="12" fill="#333" /> +
); } } @@ -100,33 +164,46 @@ function Index(props: DefinedProps) { return (
{data.map((item, index) => ( -
- {renderAvatar(item)} - -
-
- - {item.isTranslating && !item.isRefresh ? "" : item.petName ?? "未知宠物"} - - - {!(item.isTranslating && !item.isRefresh) && ( - - )} - {item.createTime} + + {!(item.isTranslating && !item.isRefresh) && ( +
+ +
{item.createTime}
+ + +
{item.terminal ?? "来自App"}
+
-
playAudio(item.id, item.contentText)}> - -
{item.contentDuration}''
+ )} + +
+ {renderAvatar(item)} +
+
+ + {item.isTranslating && !item.isRefresh ? "" : item.petName ?? ""} + +
+
playAudio(item.id, item.contentText)}> + +
{item.contentDuration}''
+
+ {renderTranslateResult(item)}
- {renderTranslateResult(item)}
-
+
))} -
+ ....
); } diff --git a/projects/translate-h5/src/view/home/translate/component/voice/index.less b/projects/translate-h5/src/view/home/translate/component/voice/index.less index 36222d3..6d44b58 100644 --- a/projects/translate-h5/src/view/home/translate/component/voice/index.less +++ b/projects/translate-h5/src/view/home/translate/component/voice/index.less @@ -1,6 +1,6 @@ .voice-record { position: fixed; - bottom: 0; + bottom: 60px; width: 100%; background: #fff; display: flex; @@ -8,7 +8,7 @@ justify-content: center; flex-direction: column; padding: 12px 0px; - box-shadow: 1px 2px 4px 3px #eee; + // box-shadow: 1px 2px 4px 3px #eee; // 不被挤压 flex-shrink: 0; min-height: 100px; /* 添加 min-height 防止被压缩 */ diff --git a/projects/translate-h5/src/view/home/translate/index.tsx b/projects/translate-h5/src/view/home/translate/index.tsx index 344fbb5..e369bf2 100644 --- a/projects/translate-h5/src/view/home/translate/index.tsx +++ b/projects/translate-h5/src/view/home/translate/index.tsx @@ -62,18 +62,30 @@ function Index(props: DefinedProps) { // 添加初始化数据的逻辑 const fetchInitialMessages = async () => { try { + const messages = JSON.parse(localStorage.getItem("messageList") ?? "[]"); + console.log("messages", messages); + // 这里替换为实际的API调用 // const response = await fetch('/api/messages'); - const response = await getDialog(); - const initialMessages: Message[] = response.data?.data?.messages || []; + const response = await getDialog({ + pageNo: 1, + pageSize: 99, + }); + const initialMessages: Message[] = response.data?.data?.messages.list || []; setDialogId(response.data?.data?.dialogId); + if (messages.length > 0) { + setMessages(messages); + return; + } setMessages(initialMessages); + localStorage.setItem("messageList", JSON.stringify(initialMessages)); } catch (error) { console.error("获取初始化数据失败:", error); Toast.show("获取消息失败"); // 失败时设置为空数组 setMessages([]); + localStorage.setItem("messageList", JSON.stringify([])); } }; @@ -88,20 +100,26 @@ function Index(props: DefinedProps) { //完成录音 const onRecordingComplete = useCallback( - (audioUrl: string, actualDuration: number, formData: FormData) => { + async (audioUrl: string, actualDuration: number, formData: FormData) => { console.log(audioUrl, "audioUrl"); const newMessage: Message = { id: Date.now(), contentText: audioUrl, contentDuration: actualDuration, isTranslating: true, + terminal: "", + file: formData.get("file") as Blob, }; setMessages((prev) => [...prev, newMessage]); - setTimeout(() => { - onTranslateAudio(formData, newMessage.id); - }, 500); + requestAnimationFrame(() => { + scrollToBottom(); + }); + await onTranslateAudio(formData, newMessage.id); + requestAnimationFrame(() => { + scrollToBottom(); + }); Toast.show("语音已发送"); }, [messages] @@ -115,51 +133,57 @@ function Index(props: DefinedProps) { const translatedData = response.data; if (translatedData.data.transStatus) { - setMessages((prev) => - prev.map((msg) => + setMessages((prev) => { + const newMessages = prev.map((msg) => msg.id === id ? { ...msg, ...translatedData.data, + id: id, isTranslating: false, isRefresh: false, } : msg - ) - ); + ); + localStorage.setItem("messageList", JSON.stringify(newMessages)); + return newMessages; + }); } else { - setMessages((prev) => - prev.map((msg) => + console.log(translatedData); + + setMessages((prev) => { + const newMessages = prev.map((msg) => msg.id === id ? { ...msg, - id: translatedData.data.id, - petName: "未知宠物", - transStatus: translatedData.data.transStatus, - createTime: translatedData.data.createTime, + ...translatedData.data, + id: id, isTranslating: false, isRefresh: false, } : msg - ) - ); + ); + localStorage.setItem("messageList", JSON.stringify(newMessages)); + return newMessages; + }); } } catch (error) { console.error("翻译失败:", error); Toast.show("翻译失败,请重试"); - - setMessages((prev) => - prev.map((msg) => + setMessages((prev) => { + const newMessages = prev.map((msg) => msg.id === id ? { ...msg, + id: id, isTranslating: false, isRefresh: false, - translatedText: "翻译失败,请重试", } : msg - ) - ); + ); + localStorage.setItem("messageList", JSON.stringify(newMessages)); + return newMessages; + }); } }, [messages] @@ -200,34 +224,12 @@ function Index(props: DefinedProps) {
)} - {/*
scrollToBottom()}>111
*/} - - {/*
- -
-
*/} - - {/*
*/} - { + const moodFilterPng = "http://qiniu.bydj.tashowz.com/assets/translate/mood-filter.png"; + const moodChartPng = "http://qiniu.bydj.tashowz.com/assets/translate/mood-chart.png"; + const moodAbstractPng = "http://qiniu.bydj.tashowz.com/assets/translate/mood-abstract.png"; + const moodPopupPng = "http://qiniu.bydj.tashowz.com/assets/translate/mood-popup.png"; + const [visible, setVisible] = useState(false); - const right = ( -
- - - - -
- ); - return ( - + +
+

情绪监控

+ + + + +
+
setVisible(true)} className={styles["mood-mask-1"]}>
diff --git a/projects/translate-h5/src/view/order/index.less b/projects/translate-h5/src/view/order/index.less new file mode 100644 index 0000000..7fc4f2a --- /dev/null +++ b/projects/translate-h5/src/view/order/index.less @@ -0,0 +1,32 @@ +.order { + background-color: #f5f5f5; + padding: 0; + box-sizing: border-box; + min-height: 100%; + .tab-box { + width: 100%; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; + position: sticky; + top: 0; + z-index: 100; + // 隐藏滚动条 + &::-webkit-scrollbar { + display: none; + } + + // 对于 antd-mobile 的 Image 组件包装器 + .adm-image { + display: inline-block; + vertical-align: top; + + // 图片自适应高度 + img { + height: auto; + width: auto; + max-width: none; // 允许图片超过容器宽度 + } + } + } +} diff --git a/projects/translate-h5/src/view/order/index.tsx b/projects/translate-h5/src/view/order/index.tsx new file mode 100644 index 0000000..8a7e040 --- /dev/null +++ b/projects/translate-h5/src/view/order/index.tsx @@ -0,0 +1,25 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; +import { Image } from "antd-mobile"; +// import tabsSvg from "@/assets/order/tabs.svg"; +// import contant from "@/assets/order/contant.svg"; +import { useNavigate } from "react-router-dom"; + +function Order() { + const tabsSvg = "http://qiniu.bydj.tashowz.com/assets/order/tabs.svg"; + const contant = "http://qiniu.bydj.tashowz.com/assets/order/contant.svg"; + + const navigate = useNavigate(); + return ( + +
+
+ tabs +
+ navigate("/order/detail")} src={contant}> +
+
+ ); +} + +export default Order; diff --git a/projects/translate-h5/src/view/orderDetail/index.less b/projects/translate-h5/src/view/orderDetail/index.less new file mode 100644 index 0000000..52bc8b7 --- /dev/null +++ b/projects/translate-h5/src/view/orderDetail/index.less @@ -0,0 +1,14 @@ +.order-detail { + background-color: #f5f5f5; + padding: 0; + box-sizing: border-box; + min-height: 100%; + .order-contant { + padding-bottom: 90px; + } + .order-bottom { + position: absolute; + bottom: 0; + width: 100%; + } +} diff --git a/projects/translate-h5/src/view/orderDetail/index.tsx b/projects/translate-h5/src/view/orderDetail/index.tsx new file mode 100644 index 0000000..3b8044f --- /dev/null +++ b/projects/translate-h5/src/view/orderDetail/index.tsx @@ -0,0 +1,29 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; +import { Image } from "antd-mobile"; +// import gdSvg from "@/assets/order/gd.svg"; +// import gdPng from "@/assets/order/gd.png"; +// import bottomSvg from "@/assets/order/bottom.svg"; + +function OrderDetail() { + const gdSvg = "http://qiniu.bydj.tashowz.com/assets/order/gd.svg"; + const gdPng = "http://qiniu.bydj.tashowz.com/assets/order/gd.png"; + const bottomSvg = "http://qiniu.bydj.tashowz.com/assets/order/bottom.svg"; + + return ( + +
+
+ + +
+ +
+ +
+
+
+ ); +} + +export default OrderDetail; diff --git a/projects/translate-h5/src/view/payment/index.less b/projects/translate-h5/src/view/payment/index.less new file mode 100644 index 0000000..964ff46 --- /dev/null +++ b/projects/translate-h5/src/view/payment/index.less @@ -0,0 +1,64 @@ +.payment { + background-color: #f5f5f5; + padding: 0; + box-sizing: border-box; + min-height: 100%; + .payment-header { + position: sticky; + top: 0; + z-index: 100; + } + .payment-content { + padding: 12px; + padding-bottom: 160px; + .payment-cart { + position: relative; + margin-bottom: 10px; + .mask { + position: absolute; + z-index: 99; + width: 100%; + height: 45.5%; + top: 21%; + } + } + } + .payment-bottom { + position: fixed; + bottom: 0; + } +} + +.popup-content { + max-height: 60vh; + overflow: auto; +} + +.popup-header { + font-size: 16px; + display: flex; + justify-content: space-between; + padding: 12px; +} + +.popup-bottom { + display: flex; + padding: 16px; + // 设置中间间隔 + .popup-button { + flex: 1; + &:last-child { + margin-right: 0; + } + .cancel-button { + --background-color: #fff; + --border-color: #e9e9e9; + --text-color: #000000; + } + .confirm-button { + --background-color: #f5222d; + --border-color: #f5222d; + --text-color: #fff; + } + } +} diff --git a/projects/translate-h5/src/view/payment/index.tsx b/projects/translate-h5/src/view/payment/index.tsx new file mode 100644 index 0000000..0102e6c --- /dev/null +++ b/projects/translate-h5/src/view/payment/index.tsx @@ -0,0 +1,106 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; +import { Button, Image, Popup } from "antd-mobile"; +// import HeaderSvg from "@/assets/payment/header.svg"; +// import Cart1Svg from "@/assets/payment/cart-1.svg"; +// import Cart2Svg from "@/assets/payment/cart-2.svg"; +// import Cart3Png from "@/assets/payment/cart-3.png"; +// import BottomPng from "@/assets/payment/bottom.png"; +// import PopupPng from "@/assets/payment/popup.png"; +import { CloseOutline } from "antd-mobile-icons"; +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; + +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 Payment() { + const HeaderSvg = "http://qiniu.bydj.tashowz.com/assets/payment/header.svg"; + const Cart1Svg = "http://qiniu.bydj.tashowz.com/assets/payment/cart-1.svg"; + const Cart2Svg = "http://qiniu.bydj.tashowz.com/assets/payment/cart-2.svg"; + const Cart3Png = "http://qiniu.bydj.tashowz.com/assets/payment/cart-3.png"; + const BottomPng = "http://qiniu.bydj.tashowz.com/assets/payment/bottom.png"; + const PopupPng = "http://qiniu.bydj.tashowz.com/assets/payment/popup.png"; + + const [visible, setVisible] = useState(false); + + const navigate = useNavigate(); + + const onLink = (link: string) => { + navigate(link); + }; + + return ( + +
+
+ +
+
+
{ + setVisible(true); + }} + className="payment-cart" + > +
+ +
+
+ +
+
+ +
+
+
+ onLink("/result")} src={BottomPng}> +
+ + { + setVisible(false); + }} + showBottom={true} + > +
+ +
+
+
+
+ ); +} + +export default Payment; diff --git a/projects/translate-h5/src/view/result/index.less b/projects/translate-h5/src/view/result/index.less new file mode 100644 index 0000000..ace1fcf --- /dev/null +++ b/projects/translate-h5/src/view/result/index.less @@ -0,0 +1,13 @@ +.result { + min-height: 100%; + padding: 0 24px; + padding-top: 92px; + + .bottom { + position: fixed; + width: 100%; + bottom: 0; + left: 0; + background-color: #fff; + } +} diff --git a/projects/translate-h5/src/view/result/index.tsx b/projects/translate-h5/src/view/result/index.tsx new file mode 100644 index 0000000..78a79bc --- /dev/null +++ b/projects/translate-h5/src/view/result/index.tsx @@ -0,0 +1,34 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; +import { Image } from "antd-mobile"; + +// import TitlePng from "@/assets/result/title.png"; +// import ContentSvg from "@/assets/result/content.svg"; +// import BottomSvg from "@/assets/result/bottom.svg"; +import { useNavigate } from "react-router-dom"; + +function Result() { + const TitlePng = "http://qiniu.bydj.tashowz.com/assets/result/title.png"; + const ContentSvg = "http://qiniu.bydj.tashowz.com/assets/result/content.svg"; + const BottomSvg = "http://qiniu.bydj.tashowz.com/assets/result/bottom.svg"; + + const navigate = useNavigate(); + + const onLink = (link: string) => { + navigate(link); + }; + + return ( + +
+ + +
+ onLink("/service")} src={BottomSvg} /> +
+
+
+ ); +} + +export default Result; diff --git a/projects/translate-h5/src/view/service/index.module.less b/projects/translate-h5/src/view/service/index.module.less new file mode 100644 index 0000000..d9ec3dd --- /dev/null +++ b/projects/translate-h5/src/view/service/index.module.less @@ -0,0 +1,29 @@ +.service { + background-color: #f5f5f5; + padding: 12px 0; + box-sizing: border-box; + min-height: 100%; +} + +.homeHeader { + display: flex; + padding: 12px; + position: sticky; + top: 0px; + background: #f5f5f5; + justify-content: space-between; + align-items: center; + z-index: 99; + h3 { + font-size: 20px; + font-size: 20px; + } + .headerItem { + display: flex; + flex-direction: column; + align-items: center; + p { + font-size: 12px; + } + } +} diff --git a/projects/translate-h5/src/view/service/index.tsx b/projects/translate-h5/src/view/service/index.tsx new file mode 100644 index 0000000..7dc69d5 --- /dev/null +++ b/projects/translate-h5/src/view/service/index.tsx @@ -0,0 +1,44 @@ +import MainLayout from "@/layout/main/mainLayout"; +import styles from "./index.module.less"; +import { Space, Image } from "antd-mobile"; +import { HeadsetOne, TextMessage, TransactionOrder } from "@icon-park/react"; +import { useNavigate } from "react-router-dom"; + +function Service() { + const navigate = useNavigate(); + + const content = "http://qiniu.bydj.tashowz.com/assets/service/content.png"; + + const onLink = (link: string) => { + navigate(link); + }; + + return ( + +
+

宠物服务

+ +
+ +

客服

+
+ +
+ +

消息

+
+ +
onLink("/order")} className={styles.headerItem}> + +

订单

+
+
+
+
+ onLink("/service/detail")} src={content}> +
+
+ ); +} + +export default Service; diff --git a/projects/translate-h5/src/view/serviceDetail/index.less b/projects/translate-h5/src/view/serviceDetail/index.less new file mode 100644 index 0000000..95e5308 --- /dev/null +++ b/projects/translate-h5/src/view/serviceDetail/index.less @@ -0,0 +1,64 @@ +.service-detail { + background-color: #f5f5f5; + padding: 0; + box-sizing: border-box; + min-height: 100%; + .swipers { + padding-top: 20px; + box-sizing: border-box; + .swiper-item { + margin: 0 10px; + } + } + + .content { + padding: 8px; + + padding-bottom: 92px; + .service-item { + background-color: #fff; + border-radius: 16px; + margin-top: 12px; + &:first-child { + padding: 16px; + .tabs { + margin: 12px 0; + width: 100%; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; + // 隐藏滚动条 + &::-webkit-scrollbar { + display: none; + } + + // 对于 antd-mobile 的 Image 组件包装器 + .adm-image { + display: inline-block; + vertical-align: top; + + // 图片自适应高度 + img { + height: auto; + width: auto; + max-width: none; // 允许图片超过容器宽度 + } + } + } + } + } + } + + .bottom { + position: fixed; + bottom: 0; + width: 100%; + background-color: #fff; + display: flex; + justify-content: space-between; + box-sizing: border-box; + padding: 0 16px; + padding-top: 16px; + padding-bottom: 36px; + } +} diff --git a/projects/translate-h5/src/view/serviceDetail/index.tsx b/projects/translate-h5/src/view/serviceDetail/index.tsx new file mode 100644 index 0000000..50d8e5c --- /dev/null +++ b/projects/translate-h5/src/view/serviceDetail/index.tsx @@ -0,0 +1,93 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; +import { Image, Swiper } from "antd-mobile"; +import { useNavigate } from "react-router-dom"; + +function ServiceDetail() { + const Swiper1Png = "http://qiniu.bydj.tashowz.com/assets/service/swiper-1.png"; + const Swiper2Png = "http://qiniu.bydj.tashowz.com/assets/service/swiper-2.png"; + const Swiper3Png = "http://qiniu.bydj.tashowz.com/assets/service/swiper-3.png"; + const DetailPricePng = "http://qiniu.bydj.tashowz.com/assets/service/detail-price.png"; + const DetailTapsSvg = "http://qiniu.bydj.tashowz.com/assets/service/detail-taps.svg"; + const DetailTitlePng = "http://qiniu.bydj.tashowz.com/assets/service/detail-title.png"; + const SzzPng = "http://qiniu.bydj.tashowz.com/assets/service/szz.png"; + const SzSvg = "http://qiniu.bydj.tashowz.com/assets/service/sz.svg"; + const NoBoxSvg = "http://qiniu.bydj.tashowz.com/assets/service/noBox.svg"; + const BottomLSvg = "http://qiniu.bydj.tashowz.com/assets/service/bottom-l.svg"; + const BottomRSvg = "http://qiniu.bydj.tashowz.com/assets/service/bottom-r.svg"; + + // 批量导入 + // const images = import.meta.glob("@/assets/service/detail/*.png", { eager: true, as: "url" }); + + const images = Array.from({ length: 19 }, (_, index) => { + const num = index + 1; + return `http://qiniu.bydj.tashowz.com/assets/service/detail/${num}.png`; + }); + + const navigate = useNavigate(); + + const onLink = (link: string) => { + navigate(link); + }; + + const swipers = [{ src: Swiper1Png }, { src: Swiper2Png }, { src: Swiper3Png }]; + + return ( + +
+
+ + {swipers.map((item, index) => { + return ( + +
+ +
+
+ ); + })} +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ {images.map((src, index) => { + return ; + })} +
+ +
+
+ + onLink("/payment")} src={BottomRSvg}> +
+
+
+ ); +} + +export default ServiceDetail; diff --git a/projects/translate-h5/src/view/user/index.module.less b/projects/translate-h5/src/view/user/index.module.less new file mode 100644 index 0000000..3f67373 --- /dev/null +++ b/projects/translate-h5/src/view/user/index.module.less @@ -0,0 +1,30 @@ +.user { + background-color: #f5f5f5; + padding: 0; + box-sizing: border-box; + min-height: 100%; +} + +.homeHeader { + display: flex; + padding: 12px; + padding-left: 0; + position: sticky; + top: 0px; + background: #f5f5f5; + justify-content: space-between; + align-items: center; + z-index: 99; + h3 { + font-size: 20px; + font-size: 20px; + } + .headerItem { + display: flex; + flex-direction: column; + align-items: center; + p { + font-size: 12px; + } + } +} diff --git a/projects/translate-h5/src/view/user/index.tsx b/projects/translate-h5/src/view/user/index.tsx new file mode 100644 index 0000000..c0ab79b --- /dev/null +++ b/projects/translate-h5/src/view/user/index.tsx @@ -0,0 +1,47 @@ +import MainLayout from "@/layout/main/mainLayout"; +import styles from "./index.module.less"; +import { Space, Image } from "antd-mobile"; +import { HeadsetOne, Config, TextMessage } from "@icon-park/react"; +import { useNavigate } from "react-router-dom"; + +function User() { + const headerSvg = "http://qiniu.bydj.tashowz.com/assets/user/header.svg"; + const cartPng = "http://qiniu.bydj.tashowz.com/assets/user/cart.png"; + const toolPng = "http://qiniu.bydj.tashowz.com/assets/user/tool.png"; + + const navigate = useNavigate(); + const onLink = (link: string) => { + // safeNavigate(link); + navigate(link); + }; + + return ( + +
+
+ + +
+ +

客服

+
+ +
+ +

消息

+
+ +
+ +

设置

+
+
+
+ onLink("/order")} src={cartPng}> + +
+
+ ); +} + +export default User; diff --git a/projects/translate-h5/src/view/wxIndex/index.less b/projects/translate-h5/src/view/wxIndex/index.less new file mode 100644 index 0000000..c08fe0f --- /dev/null +++ b/projects/translate-h5/src/view/wxIndex/index.less @@ -0,0 +1,12 @@ +.wx { + width: 100%; + height: 100%; + background: #00000080; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + color: #ffffffdd; + font-size: 16px; + gap: 10px; +} diff --git a/projects/translate-h5/src/view/wxIndex/index.tsx b/projects/translate-h5/src/view/wxIndex/index.tsx new file mode 100644 index 0000000..a86c4c1 --- /dev/null +++ b/projects/translate-h5/src/view/wxIndex/index.tsx @@ -0,0 +1,15 @@ +import MainLayout from "@/layout/main/mainLayout"; +import "./index.less"; + +function WXIndex() { + return ( + +
+
1.点击右上角
+
2.点击使用浏览器打开
+
+
+ ); +} + +export default WXIndex; diff --git a/projects/translate-h5/vite.config.ts b/projects/translate-h5/vite.config.ts index 913c185..30c4d45 100644 --- a/projects/translate-h5/vite.config.ts +++ b/projects/translate-h5/vite.config.ts @@ -15,6 +15,7 @@ export default defineConfig({ proxy: { "/app-api": { target: "https://petshy.tashowz.com", + // target: "http://192.168.1.231:48080", changeOrigin: true, }, },