处理屏幕问题和添加主屏幕提示
This commit is contained in:
parent
577cc7d042
commit
e7886b717a
|
@ -3,18 +3,17 @@
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
body{
|
body{
|
||||||
color:#fff;
|
color:#fff;
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
/* padding-bottom: constant(safe-area-inset-bottom);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom); */
|
||||||
}
|
}
|
||||||
footer{
|
footer{
|
||||||
/* Fallback for non-iOS devices */
|
/* Fallback for non-iOS devices */
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
/* iOS 11.0+ */
|
/* iOS 11.0+ */
|
||||||
bottom: constant(safe-area-inset-bottom);
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
|
|
||||||
/* iOS 11.2+ */
|
/* iOS 11.2+ */
|
||||||
bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
}
|
}
|
||||||
/* :root {
|
/* :root {
|
||||||
--foreground-rgb: 0, 0, 0;
|
--foreground-rgb: 0, 0, 0;
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default function RootLayout({ children }) {
|
||||||
{/* <!-- 在定义了apple-mobile-web-app-capable的前提下,设置状态栏的属性值apple-mobile-web-app-status-bar-style才有效; --> */}
|
{/* <!-- 在定义了apple-mobile-web-app-capable的前提下,设置状态栏的属性值apple-mobile-web-app-status-bar-style才有效; --> */}
|
||||||
<meta
|
<meta
|
||||||
name="apple-mobile-web-app-status-bar-style"
|
name="apple-mobile-web-app-status-bar-style"
|
||||||
content="black-translucent"
|
content="#ffffff"
|
||||||
/>
|
/>
|
||||||
{/* <!-- apple-touch-startup-image用来配置启动动画 --> */}
|
{/* <!-- apple-touch-startup-image用来配置启动动画 --> */}
|
||||||
{/* <!-- 这里要注意,这里图片的尺寸要和设备的静态图片显示尺寸完全对应,差一个像素都会导致启动动画无法显示 --> */}
|
{/* <!-- 这里要注意,这里图片的尺寸要和设备的静态图片显示尺寸完全对应,差一个像素都会导致启动动画无法显示 --> */}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { useRouter } from "next/navigation";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { JSEncrypt } from "jsencrypt";
|
import { JSEncrypt } from "jsencrypt";
|
||||||
import { handleLogin } from "@/store/actions";
|
import { handleLogin } from "@/store/actions";
|
||||||
import { saveUserInfo, get } from "@/utils/storeInfo";
|
import { saveUserInfo, get, save } from "@/utils/storeInfo";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { cryptoPassword } from "@/utils/crypto";
|
import { cryptoPassword } from "@/utils/crypto";
|
||||||
import requireAPI from "@/utils/requireAPI";
|
import requireAPI from "@/utils/requireAPI";
|
||||||
|
@ -169,7 +169,11 @@ function Login({ handleLogin }) {
|
||||||
saveUserInfo(data, mobilePhone, regionCode);
|
saveUserInfo(data, mobilePhone, regionCode);
|
||||||
signIn(data);
|
signIn(data);
|
||||||
handleLogin({ isSignin: true, userToken: data.data.token });
|
handleLogin({ isSignin: true, userToken: data.data.token });
|
||||||
|
if(get("firstLogin")==null){
|
||||||
|
save("firstLogin",1)
|
||||||
|
}else{
|
||||||
|
save("firstLogin",0)
|
||||||
|
}
|
||||||
router.push(
|
router.push(
|
||||||
!data?.data?.is_enabled && type != "password"
|
!data?.data?.is_enabled && type != "password"
|
||||||
? "/my/setting/editPassword?is_enabled=" + data?.data?.is_enabled
|
? "/my/setting/editPassword?is_enabled=" + data?.data?.is_enabled
|
||||||
|
|
|
@ -34,7 +34,7 @@ const My = () => {
|
||||||
setUserInfo({ ...oldUserInfo, ...data.data,...account.data.account });
|
setUserInfo({ ...oldUserInfo, ...data.data,...account.data.account });
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className={`h-screen p-4 pb-20 bg-no-repeat bg-contain bg-top`}
|
<div className={`p-4 pb-20 bg-no-repeat bg-contain bg-top`}
|
||||||
style={{backgroundImage:`url(${process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/images/profilebackground.png"})`}}
|
style={{backgroundImage:`url(${process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/images/profilebackground.png"})`}}
|
||||||
>
|
>
|
||||||
<div className="flex justify-end items-center z-10 w-full mb-4">
|
<div className="flex justify-end items-center z-10 w-full mb-4">
|
||||||
|
|
42
app/page.js
42
app/page.js
|
@ -18,8 +18,8 @@ import Link from "next/link";
|
||||||
import requireAPI from "@/utils/requireAPI";
|
import requireAPI from "@/utils/requireAPI";
|
||||||
import Empty from "@/components/Empty";
|
import Empty from "@/components/Empty";
|
||||||
import { get } from "@/utils/storeInfo";
|
import { get } from "@/utils/storeInfo";
|
||||||
import { useSearchParams } from "next/navigation";
|
|
||||||
import StreamerNavigator from "@/components/StreamerNavigator";
|
import StreamerNavigator from "@/components/StreamerNavigator";
|
||||||
|
import AddToHome from "@/components/AddToHome";
|
||||||
const variables = {
|
const variables = {
|
||||||
"@active-line-color": "#f00", // 将主题色改为红色
|
"@active-line-color": "#f00", // 将主题色改为红色
|
||||||
};
|
};
|
||||||
|
@ -28,22 +28,15 @@ const tabItems = [
|
||||||
{ key: "follow", title: "关注" },
|
{ key: "follow", title: "关注" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// const scrollHeight = 700;
|
|
||||||
// const scrollHeight = window.innerHeight-126
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const recommPostRef = useRef();
|
const recommPostRef = useRef();
|
||||||
const followPostRef = useRef();
|
const followPostRef = useRef();
|
||||||
const searchParams = useSearchParams();
|
|
||||||
const swiperRef = useRef(null);
|
const swiperRef = useRef(null);
|
||||||
const [activeIndex, setActiveIndex] = useState(0);
|
const [activeIndex, setActiveIndex] = useState(0);
|
||||||
|
|
||||||
|
|
||||||
const [scrollHeight, setScrollHeight] = useState(0);
|
const [scrollHeight, setScrollHeight] = useState(0);
|
||||||
// 获取屏幕高度
|
|
||||||
// const scrollHeight = 600;
|
|
||||||
useEffect(() => {
|
|
||||||
setScrollHeight(window.innerHeight);
|
|
||||||
// getData(0)
|
|
||||||
}, []);
|
|
||||||
const childrenFunc = () => {
|
const childrenFunc = () => {
|
||||||
if (!activeIndex) {
|
if (!activeIndex) {
|
||||||
recommPostRef.current?.doRefresh();
|
recommPostRef.current?.doRefresh();
|
||||||
|
@ -52,10 +45,7 @@ export default function Home() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<div>
|
||||||
className="overflow-x-hidden"
|
|
||||||
style={{ maxHeight: `${scrollHeight}px` }}
|
|
||||||
>
|
|
||||||
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
|
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
|
||||||
<Tabs
|
<Tabs
|
||||||
activeKey={tabItems[activeIndex].key}
|
activeKey={tabItems[activeIndex].key}
|
||||||
|
@ -114,6 +104,7 @@ export default function Home() {
|
||||||
<FontAwesomeIcon icon={faRefresh} size="xl" />
|
<FontAwesomeIcon icon={faRefresh} size="xl" />
|
||||||
</div>
|
</div>
|
||||||
<StreamerNavigator userId={Number(get("inviter"))} />
|
<StreamerNavigator userId={Number(get("inviter"))} />
|
||||||
|
<AddToHome/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -186,8 +177,8 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
))}
|
))}
|
||||||
{commenPostList?.length == 0 && !loading && (
|
{commenPostList?.length == 0 && !loading && (
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col items-center justify-center`}
|
className={`flex flex-col items-center justify-center h-screen`}
|
||||||
style={{ height: `${scrollHeight}px` }}
|
// style={{ height: `${scrollHeight}px` }}
|
||||||
>
|
>
|
||||||
<Empty type="nodata" />
|
<Empty type="nodata" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -208,8 +199,8 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
const [ids, setIds] = useState([]);
|
const [ids, setIds] = useState([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getFollowIds().then((res) => {
|
getFollowIds().then((res) => {
|
||||||
setIds(res)
|
setIds(res);
|
||||||
getFollowPostList(res,0)
|
getFollowPostList(res, 0);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
|
@ -227,10 +218,10 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
// });
|
// });
|
||||||
// throw new Error("刷新失败");
|
// throw new Error("刷新失败");
|
||||||
// getRecommPostList(1);
|
// getRecommPostList(1);
|
||||||
await getFollowPostList(ids,0);
|
await getFollowPostList(ids, 0);
|
||||||
}
|
}
|
||||||
async function loadMore() {
|
async function loadMore() {
|
||||||
await getFollowPostList(ids,offset);
|
await getFollowPostList(ids, offset);
|
||||||
// const newList = [...followPostList, ...list];
|
// const newList = [...followPostList, ...list];
|
||||||
// setFollowPostList(newList);
|
// setFollowPostList(newList);
|
||||||
}
|
}
|
||||||
|
@ -247,8 +238,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
const getFollowPostList = async (data,offset) => {
|
const getFollowPostList = async (data, offset) => {
|
||||||
|
|
||||||
if (data.data.list.length > 0) {
|
if (data.data.list.length > 0) {
|
||||||
//查关注主播展示资料
|
//查关注主播展示资料
|
||||||
const followsResponse = await requireAPI(
|
const followsResponse = await requireAPI(
|
||||||
|
@ -264,7 +254,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// debugger;
|
// debugger;
|
||||||
console.log("offset",followsResponse.data.offset)
|
console.log("offset", followsResponse.data.offset);
|
||||||
setOffset(followsResponse.data.offset);
|
setOffset(followsResponse.data.offset);
|
||||||
setHasMore(followsResponse.data.more);
|
setHasMore(followsResponse.data.more);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
@ -275,7 +265,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
position: "top",
|
position: "top",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setFollowPostList(old=>[...old,...followsResponse.data.list]);
|
setFollowPostList((old) => [...old, ...followsResponse.data.list]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
@ -302,8 +292,8 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
))}
|
))}
|
||||||
{!followPostList?.length && (
|
{!followPostList?.length && (
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col items-center justify-center`}
|
className={`flex flex-col items-center justify-center h-screen`}
|
||||||
style={{ height: `${scrollHeight - 98}px` }}
|
// style={{ height: `${scrollHeight - 98}px` }}
|
||||||
>
|
>
|
||||||
<Empty type="nodata" />
|
<Empty type="nodata" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -130,8 +130,8 @@ export default function Space() {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="h-screen overflow-x-hidden"
|
className=""
|
||||||
// style={{ maxHeight: `${scrollHeight}px` }}
|
|
||||||
>
|
>
|
||||||
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
|
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
|
||||||
<Tabs
|
<Tabs
|
||||||
|
@ -228,8 +228,8 @@ export default function Space() {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col items-center justify-center`}
|
className={`flex flex-col items-center justify-center h-screen`}
|
||||||
style={{ height: `${scrollHeight}px` }}
|
// style={{ height: `${scrollHeight}px` }}
|
||||||
>
|
>
|
||||||
<Empty type="nospace" />
|
<Empty type="nospace" />
|
||||||
<div className="flex flex-col mt-6">
|
<div className="flex flex-col mt-6">
|
||||||
|
@ -251,8 +251,8 @@ export default function Space() {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className="w-full text-center flex items-center justify-center"
|
className="w-full text-center flex items-center justify-center h-screen"
|
||||||
style={{ height: scrollHeight - 60 + "px" }}
|
// style={{ height: scrollHeight - 60 + "px" }}
|
||||||
>
|
>
|
||||||
<SpinLoading />
|
<SpinLoading />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React,{useState,useEffect} from "react";
|
||||||
|
import { Image ,Toast} from "antd-mobile";
|
||||||
|
import { get,save } from "@/utils/storeInfo";
|
||||||
|
export default function AddToHome() {
|
||||||
|
const [firstLogin, setFirstLogin] = useState("0");
|
||||||
|
useEffect(() => {
|
||||||
|
if(!(("standalone" in window.navigator) && window.navigator.standalone)
|
||||||
|
){
|
||||||
|
setFirstLogin(get("firstLogin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
return (
|
||||||
|
firstLogin=="1"?<div
|
||||||
|
className="fixed top-0 z-[999] flex flex-col justify-end items-center h-screen w-screen bg-[#262626b0]"
|
||||||
|
onClick={() => {save("firstLogin", 0);setFirstLogin("0")}}
|
||||||
|
>
|
||||||
|
<div className="font-bold text-xl mb-2 flex items-center">
|
||||||
|
点击
|
||||||
|
<Image
|
||||||
|
fit="cover"
|
||||||
|
// src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/nodata.png"}
|
||||||
|
src={"/icons/ios_share.png"}
|
||||||
|
placeholder=""
|
||||||
|
width={32}
|
||||||
|
height={32}
|
||||||
|
/>
|
||||||
|
添加到主屏幕
|
||||||
|
</div>
|
||||||
|
<Image
|
||||||
|
fit="cover"
|
||||||
|
// src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/nodata.png"}
|
||||||
|
src={"/images/addToHome.png"}
|
||||||
|
placeholder=""
|
||||||
|
width={54}
|
||||||
|
height={54}
|
||||||
|
/>
|
||||||
|
</div>:null
|
||||||
|
);
|
||||||
|
}
|
|
@ -101,7 +101,7 @@ export default function Photos({
|
||||||
title: "",
|
title: "",
|
||||||
content: (
|
content: (
|
||||||
<div className="h-screen flex justify-center items-center">
|
<div className="h-screen flex justify-center items-center">
|
||||||
<div className="flex flex-col gap-2 -mt-12">
|
<div className="flex flex-col gap-2 -mt-24">
|
||||||
<div className="flex w-full justify-end">
|
<div className="flex w-full justify-end">
|
||||||
<div
|
<div
|
||||||
className="flex w-12 h-12 justify-center items-center bg-[#33333348] rounded-full"
|
className="flex w-12 h-12 justify-center items-center bg-[#33333348] rounded-full"
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -24,7 +24,7 @@ export default function customFetch(method, url, options = {}, needMid) {
|
||||||
newBody.mid = mid;
|
newBody.mid = mid;
|
||||||
}
|
}
|
||||||
const body = JSON.stringify({ ...base, ...newBody });
|
const body = JSON.stringify({ ...base, ...newBody });
|
||||||
console.log("newBody", body,url);
|
// console.log("newBody", body,url);
|
||||||
|
|
||||||
// 合并选项
|
// 合并选项
|
||||||
const mergedOptions = { ...defaultOptions, body };
|
const mergedOptions = { ...defaultOptions, body };
|
||||||
|
|
Loading…
Reference in New Issue