Merge pull request 'anln' (#3) from anln into main

Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/tiefen_space_h5/pulls/3
This commit is contained in:
yezian 2024-09-13 12:56:00 +08:00
commit 07e5ef6eb6
6 changed files with 113 additions and 16 deletions

View File

@ -1,9 +1,9 @@
import { get } from "@/utils/storeInfo"; import { get, clear } from "@/utils/storeInfo";
import requireAPI from "@/utils/requireAPI"; import requireAPI from "@/utils/requireAPI";
import { Toast } from "antd-mobile"; import { Toast } from "antd-mobile";
import { JSEncrypt } from "jsencrypt"; import { JSEncrypt } from "jsencrypt";
import baseRequest from "@/utils/baseRequest"; import baseRequest from "@/utils/baseRequest";
//关注和取关功能 //退出登录
export const handleLogout = async () => { export const handleLogout = async () => {
const account = get("account"); const account = get("account");
try { try {
@ -20,6 +20,7 @@ export const handleLogout = async () => {
}); });
return; return;
} }
clear();
} catch (error) { } catch (error) {
// console.error(error); // console.error(error);
} }

View File

@ -380,7 +380,9 @@ function Login({ handleLogin }) {
<div className="flex justify-end"> <div className="flex justify-end">
<span <span
onClick={() => onClick={() =>
router.push(`/my/setting/editPassword?forgetPassword=true`) router.push(
`/my/setting/editPassword?forgetPassword=true&phone=${loginInfo.mobilePhone}`
)
} }
className="text-[#FF669E] text-xs mt-2 text-right" className="text-[#FF669E] text-xs mt-2 text-right"
> >

View File

@ -3,7 +3,7 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleRight } from "@fortawesome/free-solid-svg-icons"; import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
import { Avatar, Image, Toast } from "antd-mobile"; import { Avatar, Image, Toast, Space } from "antd-mobile";
import { useRouter, useSearchParams } from "next/navigation"; import { useRouter, useSearchParams } from "next/navigation";
import { get } from "@/utils/storeInfo"; import { get } from "@/utils/storeInfo";
import requireAPI from "@/utils/requireAPI"; import requireAPI from "@/utils/requireAPI";
@ -16,6 +16,7 @@ const My = () => {
// setUserInfo(userInfo); // setUserInfo(userInfo);
getData(userInfo); getData(userInfo);
} }
console.log("userInfo", userInfo);
// getData(userInfo); // getData(userInfo);
}, []); }, []);
const getData = async (oldUserInfo) => { const getData = async (oldUserInfo) => {
@ -94,7 +95,27 @@ const My = () => {
style={{ "--size": "76px", "--border-radius": "50%" }} style={{ "--size": "76px", "--border-radius": "50%" }}
/> />
<div> <div>
<p className="text-2xl">{userInfo.name}</p> <Space align="center">
<p
className={`text-2xl`}
style={{
color: userInfo?.is_a_member === 1 ? "#FFADBE" : "white",
}}
>
{userInfo.name}
</p>
{userInfo?.is_a_member === 1 && (
<Image
src={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/icons/vipbig.png"
}
width={32}
height={32}
placeholder=""
/>
)}
</Space>
<div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max"> <div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max">
<Image <Image
src={ src={
@ -131,7 +152,27 @@ const My = () => {
style={{ "--size": "76px", "--border-radius": "50%" }} style={{ "--size": "76px", "--border-radius": "50%" }}
/> />
<div> <div>
<p className="text-2xl">{userInfo.name}</p> <Space align="center">
<p
className={`text-2xl`}
style={{
color: userInfo?.is_a_member === 1 ? "#FFADBE" : "white",
}}
>
{userInfo.name}
</p>
{userInfo?.is_a_member === 1 && (
<Image
src={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/icons/vipbig.png"
}
width={32}
height={32}
placeholder=""
/>
)}
</Space>
<div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max"> <div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max">
<Image <Image
src={ src={

View File

@ -12,15 +12,17 @@ import { cryptoPassword } from "@/utils/crypto";
import requireAPI from "@/utils/requireAPI"; import requireAPI from "@/utils/requireAPI";
import { signOut } from "@/utils/auth"; import { signOut } from "@/utils/auth";
export default function EditPassword() { export default function EditPassword() {
const [regionCode, setRegionCode] = useState("86"); const searchParams = useSearchParams();
const [mobilePhone, setMobilePhone] = useState(""); const [regionCode] = useState("86");
const [mobilePhone, setMobilePhone] = useState(
searchParams.get("phone") || ""
);
const [veriCode, setVeriCode] = useState(""); const [veriCode, setVeriCode] = useState("");
const [newPassword, setNewPassword] = useState(""); const [newPassword, setNewPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState("");
const [isCounting, setIsCounting] = useState(false); const [isCounting, setIsCounting] = useState(false);
const [seconds, setSeconds] = useState(60); const [seconds, setSeconds] = useState(60);
const router = useRouter(); const router = useRouter();
const searchParams = useSearchParams();
// useEffect(() => { // useEffect(() => {
// const mobile_phone = get("mobile_phone"); // const mobile_phone = get("mobile_phone");
// console.log("mobile_phone",mobile_phone) // console.log("mobile_phone",mobile_phone)
@ -212,6 +214,8 @@ export default function EditPassword() {
验证码 验证码
</p> </p>
<Input <Input
autoComplete="off"
onCompositionEnd={() => setVeriCode("")}
placeholder="请输入验证码" placeholder="请输入验证码"
onChange={(value) => setVeriCode(value)} onChange={(value) => setVeriCode(value)}
value={veriCode} value={veriCode}
@ -241,11 +245,12 @@ export default function EditPassword() {
新密码 新密码
</p> </p>
<Input <Input
name="password"
autocomplete="new-password"
placeholder="请输入8-15位新密码" placeholder="请输入8-15位新密码"
onChange={(value) => setNewPassword(value)} onChange={(value) => setNewPassword(value)}
value={newPassword} value={newPassword}
type="password" type="password"
autoComplete="off"
style={{ style={{
"--placeholder-color": "#FFFFFF80", "--placeholder-color": "#FFFFFF80",
"--font-size": "16px", "--font-size": "16px",

View File

@ -10,6 +10,7 @@ import {
Popup, Popup,
Radio, Radio,
Picker, Picker,
Space,
} from "antd-mobile"; } from "antd-mobile";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
@ -368,7 +369,6 @@ export default function Search() {
delete currentFilterValue.comprehensiveUsed; delete currentFilterValue.comprehensiveUsed;
delete currentFilterValue.priceUsed; delete currentFilterValue.priceUsed;
querryParams = currentFilterValue; querryParams = currentFilterValue;
console.log("querryParams", querryParams);
try { try {
const data = await requireAPI("POST", "/api/streamer/filter", { const data = await requireAPI("POST", "/api/streamer/filter", {
body: { ...querryParams }, body: { ...querryParams },
@ -547,7 +547,9 @@ export default function Search() {
}} }}
> >
<Popup <Popup
destroyOnClose={true}
closeOnMaskClick={true} closeOnMaskClick={true}
// stopPropagation={["touchstart"]}
maskStyle={{ backgroundColor: "#0000004d" }} maskStyle={{ backgroundColor: "#0000004d" }}
visible={isFilterVisible.comprehensive} visible={isFilterVisible.comprehensive}
bodyStyle={{ bodyStyle={{
@ -561,9 +563,32 @@ export default function Search() {
}) })
} }
> >
<Space className="p-4" justify="between" align="center" block={true}>
<p className="text-xl font-bold">综合筛选</p>
<div
className="p-2 rounded-xl flex justify-center items-center mr-2 bg-[#ffffff1a]"
style={{
width: 32,
height: 32,
}}
>
<FontAwesomeIcon
icon={faClose}
size="xl"
className="text-whitex"
onClick={() => {
setIsFilterVisible({
zone_admission_price: false,
comprehensive: false,
});
setCurrentFiltersChangeValue(filtersValue);
}}
/>
</div>
</Space>
<div <div
className="overflow-y-auto" className="overflow-y-auto"
style={{ height: "calc(100vh - 110px)" }} style={{ height: "calc(100vh - 170px)" }}
> >
{filters.map((item, index) => ( {filters.map((item, index) => (
<div <div
@ -789,6 +814,7 @@ export default function Search() {
</div> </div>
</Popup> </Popup>
<Popup <Popup
stopPropagation={["touchstart"]}
closeOnMaskClick={true} closeOnMaskClick={true}
maskStyle={{ backgroundColor: "#0000004d" }} maskStyle={{ backgroundColor: "#0000004d" }}
bodyStyle={{ bodyStyle={{
@ -803,9 +829,32 @@ export default function Search() {
} }
visible={isFilterVisible.zone_admission_price} visible={isFilterVisible.zone_admission_price}
> >
<Space className="p-4" justify="between" align="center" block={true}>
<p className="text-xl font-bold">价格筛选</p>
<div
className="p-2 rounded-xl flex justify-center items-center mr-2 bg-[#ffffff1a]"
style={{
width: 32,
height: 32,
}}
>
<FontAwesomeIcon
icon={faClose}
size="xl"
className="text-whitex"
onClick={() => {
setIsFilterVisible({
zone_admission_price: false,
comprehensive: false,
});
setCurrentFiltersChangeValue(filtersValue);
}}
/>
</div>
</Space>
<div <div
className="overflow-y-auto" className="overflow-y-auto"
style={{ height: "calc(100vh - 110px)" }} style={{ height: "calc(100vh - 170px)" }}
> >
{priceFilters.map((item, index) => ( {priceFilters.map((item, index) => (
<div <div

View File

@ -22,9 +22,8 @@ export default function WithAuth(WrappedComponent) {
}, [pathname]); }, [pathname]);
const checkLogin = async () => { const checkLogin = async () => {
const hasToken = await get("token"); const hasToken = await get("token");
// console.log("hasToken", hasToken); if (pathname.includes("wxpay_h5")) {
if(pathname.includes("wxpay_h5")){ return;
return
} }
if (hasToken) { if (hasToken) {
const currentIsLogin = await checkAuth(); const currentIsLogin = await checkAuth();