添加webView跳转

This commit is contained in:
al 2025-01-16 20:24:19 +08:00
parent a98db1bf18
commit cf14a0dc2e
20 changed files with 115 additions and 58 deletions

View File

@ -247,7 +247,9 @@ function Login({ handleLogin }) {
className="text-[#FF669E]"
onClick={() => {
setIframePageUrl(
`/webView/${encodeURIComponent("/doc/useragreement")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/useragreement`
)}`
);
}}
>
@ -258,7 +260,9 @@ function Login({ handleLogin }) {
className="text-[#FF669E]"
onClick={() => {
setIframePageUrl(
`/webView/${encodeURIComponent("/doc/privatypolicy")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/privatypolicy`
)}`
);
}}
>
@ -598,7 +602,9 @@ const LoginBtn = ({
<span
onClick={() => {
setIframePageUrl(
`/webView/${encodeURIComponent("/doc/useragreement")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/useragreement`
)}`
);
}}
className="text-[#FF669E] text-xs"
@ -609,7 +615,9 @@ const LoginBtn = ({
<span
onClick={() => {
setIframePageUrl(
`/webView/${encodeURIComponent("/doc/privatypolicy")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/privatypolicy`
)}`
);
}}
className="text-[#FF669E] text-xs"

View File

@ -235,7 +235,11 @@ const My = () => {
subTitle != "完善资料后解锁" &&
!disable &&
router.push(
toWebView ? `/webView/${encodeURIComponent(url)}` : url
toWebView
? `/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/${url}`
)}`
: url
);
}}
>
@ -422,7 +426,9 @@ const My = () => {
const base = baseRequest();
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
`${
process.env.NEXT_PUBLIC_WEB_URL
}/${`/vip?base=${encodeURIComponent(JSON.stringify(base))}`}`
)}`
);
}}

View File

@ -41,7 +41,9 @@ export default function AboutUs() {
className="flex justify-between items-center p-3"
onClick={() =>
router.push(
`/webView/${encodeURIComponent("/doc/useragreement")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/useragreement`
)}`
)
}
>
@ -64,7 +66,9 @@ export default function AboutUs() {
className="flex justify-between items-center p-3"
onClick={() =>
router.push(
`/webView/${encodeURIComponent("/doc/privatypolicy")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/privatypolicy`
)}`
)
}
>

View File

@ -102,7 +102,9 @@ export default function JoinStreamer() {
className="text-base text-center leading-9 text-[#FF669E]"
onClick={() => {
router.push(
`/webView/${encodeURIComponent("/doc/platformguidelines")}`
`/webView/${encodeURIComponent(
`${process.env.NEXT_PUBLIC_WEB_URL}/doc/platformguidelines`
)}`
);
}}
>

View File

@ -100,7 +100,9 @@ export default function Wallet() {
// console.log("base,base", base);
router.push(
`/webView/${encodeURIComponent(
`/pay?base=${encodeURIComponent(JSON.stringify(base))}`
`${
process.env.NEXT_PUBLIC_WEB_URL
}/pay?base=${encodeURIComponent(JSON.stringify(base))}`
)}`
);
}

View File

@ -217,7 +217,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
return (
<div className="flex flex-col flex-1 p-4">
{/* 广告轮播 */}
{!!scollNotice.length && <ScrollNotice content={scollNotice} />}
{!!scollNotice.content && <ScrollNotice data={scollNotice} />}
{/* 官方消息 */}
<div className="flex flex-col rounded-2xl mt-3.5">

View File

@ -4,8 +4,12 @@ import { Toast } from "antd-mobile";
import { useRouter } from "next/navigation";
import OwnImage from "@/components/OwnImage";
import OwnIcon from "@/components/OwnIcon";
import baseRequest from "@/utils/baseRequest";
export default function NoticeItem({ leftIcon, hasLink, data }) {
const router = useRouter();
const base = baseRequest();
return (
<div className="bg-[#FFFFFF1A] rounded-2xl mb-2 py-[24px] px-[18px]">
<div className="flex text-white">
@ -57,8 +61,20 @@ export default function NoticeItem({ leftIcon, hasLink, data }) {
links[1]?.action === "app_router_path";
router.push(links[1]?.params);
} else {
links[0]?.action === "outward";
router.push(links[0]?.params);
if (links[0]?.action === "outward") {
router(links[0]?.params);
} else {
// alert(links[0]?.params);
// alert(encodeURIComponent(links[0]?.params));
router.push(
`/webView/${encodeURIComponent(
links[0]?.params +
`?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)}`
);
}
}
}
}}

View File

@ -3,7 +3,10 @@
import React from "react";
import { NoticeBar } from "antd-mobile";
import OwnIcon from "@/components/OwnIcon";
export default function ScrollNotice({ content }) {
import { useRouter } from "next/navigation";
/************* ✨ Codeium Command ⭐ *************/
export default function ScrollNotice({ data }) {
const router = useRouter();
// const [fadeAnim] = useState(new Animated.Value(300)); // 透明度初始值为0
// let animation = Animated.timing(fadeAnim, {
// toValue: -(length * 60),
@ -45,7 +48,22 @@ export default function ScrollNotice({ content }) {
/>
}
bordered={false}
content={content}
content={
<div
onClick={() => {
const links = data?.hyperlinks;
if (links.length > 1) {
links[1]?.action === "app_router_path";
router.push(links[1]?.url);
} else {
links[0]?.action === "outward";
router.push(links[0]?.url);
}
}}
>
{data.content}
</div>
}
style={{
"--background-color": "transparent",
"--height": "max-content",

View File

@ -41,7 +41,7 @@ export default function Banner() {
(item, index) => (
<Swiper.Item key={item.id}>
<div
className="w-full h-[calc(100vw*3/7)]"
className="w-full h-[calc((100vw-2rem)*3/7)]"
onClick={() => {
const links = item?.hyperlinks;
if (links.length > 1) {

View File

@ -800,7 +800,9 @@ export default function Search() {
if (!isMember) {
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
`${
process.env.NEXT_PUBLIC_WEB_URL
}/vip?base=${encodeURIComponent(JSON.stringify(base))}`
)}`
);
return;
@ -1000,7 +1002,9 @@ export default function Search() {
if (!isMember) {
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
`${
process.env.NEXT_PUBLIC_WEB_URL
}/vip?base=${encodeURIComponent(JSON.stringify(base))}`
)}`
);
return;

View File

@ -294,11 +294,11 @@ export default function PersonSpace() {
: router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
streamerInfo?.id +
"/h5_zone_superfanship/0" +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${process.env.NEXT_PUBLIC_WEB_URL}/zone/pay/${
streamerInfo?.id
}/h5_zone_superfanship/0?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}}
@ -461,11 +461,11 @@ export default function PersonSpace() {
: router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
streamerInfo?.id +
"/h5_zone_superfanship/0" +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${process.env.NEXT_PUBLIC_WEB_URL}/zone/pay/${
streamerInfo?.id
}/h5_zone_superfanship/0?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}}

View File

@ -256,11 +256,11 @@ export default function PersonSpaceIntroduce() {
router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
data?.id +
"/h5_zone_admission/0" +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${process.env.NEXT_PUBLIC_WEB_URL}/zone/pay/${
data?.id
}/h5_zone_admission/0?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}

View File

@ -4,7 +4,7 @@ import React from "react";
import { useRouter, useParams } from "next/navigation";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
export default function PersonSpace() {
export default function WebView() {
const { src } = useParams();
const router = useRouter();
return (
@ -25,7 +25,7 @@ export default function PersonSpace() {
{/* 内容 */}
<div>
<iframe
src={`${process.env.NEXT_PUBLIC_WEB_URL}` + decodeURIComponent(src)}
src={decodeURIComponent(src)}
className="w-full"
style={{ height: "calc(100vh)" }}
/>

View File

@ -54,7 +54,9 @@ export default function CheckVip({ children, isVipToPassFun, router }) {
showMobal.close();
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
`${
process.env.NEXT_PUBLIC_WEB_URL
}/vip?base=${encodeURIComponent(JSON.stringify(base))}`
)}`
);
},

View File

@ -427,12 +427,13 @@ const ImagesMaskContaint = forwardRef(
router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
data?.zid +
"/h5_zone_moment/" +
data?.id +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${
process.env.NEXT_PUBLIC_WEB_URL
}/zone/pay/${data?.zid}/h5_zone_moment/${
data?.id
}?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}}

View File

@ -81,12 +81,11 @@ export default function PaySpacePost({
router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
data?.zid +
"/h5_zone_moment/" +
data?.id +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${process.env.NEXT_PUBLIC_WEB_URL}/zone/pay/${
data?.zid
}/h5_zone_moment/${data?.id}?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}

View File

@ -214,12 +214,11 @@ export default function Photos({
router.push(
"/webView/" +
encodeURIComponent(
"/zone/pay/" +
data?.zid +
"/h5_zone_moment/" +
data?.id +
"?base=" +
encodeURIComponent(JSON.stringify(base))
`${process.env.NEXT_PUBLIC_WEB_URL}/zone/pay/${
data?.zid
}/h5_zone_moment/${data?.id}?base=${encodeURIComponent(
JSON.stringify(base)
)}`
)
);
}}

View File

@ -13,7 +13,6 @@ function StreamerNavigator({ userId, changeInviter }) {
const router = useRouter();
useEffect(() => {
console.log("+++++++", userId);
userId &&
getStreamer(userId)
.then((res) => {

View File

@ -95,7 +95,6 @@ export default function VideoPlayer({ video }) {
videoPlayer.pause();
const currentTimeStr = getCurrentTime(value);
console.log("currentTimeStr-----", currentTimeStr.desc);
// if (!currentTimeStr) return;
Toast.show({
content: currentTimeStr.desc,

View File

@ -248,7 +248,6 @@ export const toggleFullScreen = (videoEleId, controllerId, getState) => {
// IE/Edge
video.msRequestFullscreen();
}
console.log("toggleFullScreen", video);
if (!video || !controller) return;
// video.style.transform =
// "translateX(50vw) translateY(-24.4vh) rotate(90deg) !important";
@ -282,7 +281,6 @@ export const toggleFullScreen = (videoEleId, controllerId, getState) => {
getState((old) => !old);
} else {
console.log("toggleFullScreen", video);
if (!video || !controller) return;
// video.style.transform =
// "translateX(50vw) translateY(-24.4vh) rotate(90deg) !important";