Merge remote-tracking branch 'origin/main' into version_1.1
This commit is contained in:
commit
c4650da62e
|
@ -192,12 +192,6 @@ function Login({ handleLogin }) {
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
// alert("Error: " + error);
|
|
||||||
// Toast.show({
|
|
||||||
// icon: "fail",
|
|
||||||
// content: error,
|
|
||||||
// position: "top",
|
|
||||||
// });
|
|
||||||
// console.error(error);
|
// console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,8 @@ import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { formatDeadline } from "@/utils/tools";
|
import { formatDeadline } from "@/utils/tools";
|
||||||
import requireAPI from "@/utils/requireAPI";
|
import requireAPI from "@/utils/requireAPI";
|
||||||
|
import { handleLogout } from "@/api/public";
|
||||||
|
|
||||||
export default function DeleteAccount() {
|
export default function DeleteAccount() {
|
||||||
const [deadline, setDeadline] = useState();
|
const [deadline, setDeadline] = useState();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -49,6 +51,8 @@ export default function DeleteAccount() {
|
||||||
}
|
}
|
||||||
checkAccountStatus();
|
checkAccountStatus();
|
||||||
showMobal.current?.close();
|
showMobal.current?.close();
|
||||||
|
await handleLogout();
|
||||||
|
router.replace("/login");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.error(error);
|
// console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +77,8 @@ export default function DeleteAccount() {
|
||||||
const handleShowDialog = () => {
|
const handleShowDialog = () => {
|
||||||
showMobal.current = Dialog.show({
|
showMobal.current = Dialog.show({
|
||||||
title: "您确认要注销此账号吗?",
|
title: "您确认要注销此账号吗?",
|
||||||
content: "注销后无法恢复,请仔细阅读《注销必看须知》后确认。",
|
content:
|
||||||
|
"提交注销后,我们将在7个自然日后完全清除您的账号信息,在此期间若您再次登陆则视为放弃注销。请仔细阅读《注销必看须知》后确认。",
|
||||||
bodyStyle: {
|
bodyStyle: {
|
||||||
maxHeight: "none",
|
maxHeight: "none",
|
||||||
width: "80vw",
|
width: "80vw",
|
||||||
|
@ -144,7 +149,7 @@ export default function DeleteAccount() {
|
||||||
</p>
|
</p>
|
||||||
<p className="text-white text-base font-medium mt-2">3、注销时间</p>
|
<p className="text-white text-base font-medium mt-2">3、注销时间</p>
|
||||||
<p className="text-[#FFFFFFB2] text-base">
|
<p className="text-[#FFFFFFB2] text-base">
|
||||||
您发起注销账户申请后,我们将在7个自然日后完全清除您的账号信息,在此期间您可以随时在本页面撤销该申请。
|
您发起注销账户申请后,我们将在7个自然日后完全清除您的账号信息,在此期间若您再次登陆则视为放弃注销。
|
||||||
</p>
|
</p>
|
||||||
<p className="text-white text-base font-medium mt-2">4、其他</p>
|
<p className="text-white text-base font-medium mt-2">4、其他</p>
|
||||||
<p className="text-[#FFFFFFB2] text-base">
|
<p className="text-[#FFFFFFB2] text-base">
|
||||||
|
|
|
@ -2,31 +2,63 @@
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Divider, Toast } from "antd-mobile";
|
import { Divider, Toast } from "antd-mobile";
|
||||||
import { useRouter, useParams, useSearchParams } from "next/navigation";
|
import { useRouter, useParams } from "next/navigation";
|
||||||
import clipboard from "copy-to-clipboard";
|
import clipboard from "copy-to-clipboard";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import {
|
import { faAngleLeft, faAngleRight } from "@fortawesome/free-solid-svg-icons";
|
||||||
faAngleLeft,
|
|
||||||
faAngleRight,
|
|
||||||
faWallet,
|
|
||||||
faPrint,
|
|
||||||
faDollar,
|
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import { getStreamerInfo } from "@/api/space";
|
import { getStreamerInfo } from "@/api/space";
|
||||||
export default function ShareSpace({ data }) {
|
import requireAPI from "@/utils/requireAPI";
|
||||||
|
|
||||||
|
export default function ShareSpace() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { mid } = useParams();
|
const { mid } = useParams();
|
||||||
const searchParams = useSearchParams();
|
|
||||||
const webUrl = process.env.NEXT_PUBLIC_WEB_URL;
|
const webUrl = process.env.NEXT_PUBLIC_WEB_URL;
|
||||||
const [streamerInfo, setStreamerInfo] = useState(null);
|
const [streamerInfo, setStreamerInfo] = useState(null);
|
||||||
|
const [shareWebUrl, setShareWebUrl] = useState("https://tiefen.fun");
|
||||||
|
|
||||||
|
function generateRandomString(length = 10) {
|
||||||
|
const characters =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
let result = "";
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
result += characters.charAt(
|
||||||
|
Math.floor(Math.random() * characters.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getStreamerInfo(Number(mid)).then((res) => {
|
getStreamerInfo(Number(mid)).then((res) => {
|
||||||
setStreamerInfo(res);
|
setStreamerInfo(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getRandomUrl(urls) {
|
||||||
|
return urls[Math.floor(Math.random() * urls.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
const getShareWebUrl = async () => {
|
||||||
|
try {
|
||||||
|
const data = await requireAPI("POST", "/api/config/cold_config", {
|
||||||
|
body: {},
|
||||||
|
});
|
||||||
|
if (data.ret === -1) {
|
||||||
|
Toast.show({
|
||||||
|
content: data.msg,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const randomUrl = getRandomUrl(data.data.share_redirect_urls);
|
||||||
|
setShareWebUrl(randomUrl);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getShareWebUrl();
|
||||||
}, []);
|
}, []);
|
||||||
//保存内容到剪贴板
|
//保存内容到剪贴板
|
||||||
const copy = (_data) => {
|
const copy = (_data) => {
|
||||||
// console.log("_data",_data)
|
|
||||||
clipboard(_data);
|
clipboard(_data);
|
||||||
Toast.show({
|
Toast.show({
|
||||||
icon: "success",
|
icon: "success",
|
||||||
|
@ -44,13 +76,13 @@ export default function ShareSpace({ data }) {
|
||||||
|
|
||||||
//复制邀请链接
|
//复制邀请链接
|
||||||
const copyShareUrl = () => {
|
const copyShareUrl = () => {
|
||||||
const shareCode = `${webUrl}/zone/${streamerInfo?.streamer_ext?.user_id}`;
|
const randomStr = generateRandomString();
|
||||||
// console.log("shareCode", shareCode);
|
const shareCode = `${shareWebUrl}/zone/${streamerInfo?.streamer_ext?.user_id}/${randomStr}`;
|
||||||
copy(shareCode);
|
copy(shareCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<div>
|
||||||
<div className="p-4 fixed top-0 z-10 w-full">
|
<div className="p-4 fixed top-0 z-10 w-full">
|
||||||
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full float-left absolute">
|
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full float-left absolute">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
|
|
|
@ -240,7 +240,7 @@ export default function PersonSpaceIntroduce() {
|
||||||
handler.current = Dialog.confirm({
|
handler.current = Dialog.confirm({
|
||||||
header: "提醒",
|
header: "提醒",
|
||||||
content:
|
content:
|
||||||
"本空间内容为达人创建并维护,属于虚拟服务,不可退款,且空间内存在部分内容需要另外付费,请再次确认是否付费加入",
|
"本空间内容为达人创建并维护,属于虚拟服务,不可退款,请再次确认是否付费加入",
|
||||||
bodyStyle: {
|
bodyStyle: {
|
||||||
maxHeight: "none",
|
maxHeight: "none",
|
||||||
width: "80vw",
|
width: "80vw",
|
||||||
|
|
|
@ -58,7 +58,8 @@ export default function CollaboratorSetting() {
|
||||||
const visitor_role = Number(searchParams.get("visitor_role"));
|
const visitor_role = Number(searchParams.get("visitor_role"));
|
||||||
try {
|
try {
|
||||||
setIsloading(true);
|
setIsloading(true);
|
||||||
setSelfMid(zid);
|
const base = baseRequest();
|
||||||
|
setSelfMid(base.b_mid);
|
||||||
const body = {
|
const body = {
|
||||||
zid,
|
zid,
|
||||||
visitor_role,
|
visitor_role,
|
||||||
|
@ -190,16 +191,17 @@ export default function CollaboratorSetting() {
|
||||||
const selfData = data?.list?.filter(
|
const selfData = data?.list?.filter(
|
||||||
(item) => item.collaborator_mid === selfMid
|
(item) => item.collaborator_mid === selfMid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isloading) {
|
||||||
|
return (
|
||||||
|
<div className="bg-[#00000099] fixed top-0 w-full text-center flex items-center justify-center h-screen">
|
||||||
|
<SpinLoading />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{isloading && (
|
|
||||||
<div
|
|
||||||
className="bg-[#00000099] fixed top-0 w-full text-center flex items-center justify-center h-screen"
|
|
||||||
// style={{ height: scrollHeight - 60 + "px" }}
|
|
||||||
>
|
|
||||||
<SpinLoading />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{/* 头部标题 */}
|
{/* 头部标题 */}
|
||||||
<div className="p-4 fixed top-0 z-10 w-full bg-black">
|
<div className="p-4 fixed top-0 z-10 w-full bg-black">
|
||||||
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full absolute">
|
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full absolute">
|
||||||
|
@ -216,19 +218,21 @@ export default function CollaboratorSetting() {
|
||||||
</div>
|
</div>
|
||||||
{/* 内容 */}
|
{/* 内容 */}
|
||||||
<div className="p-4 pt-20">
|
<div className="p-4 pt-20">
|
||||||
{searchParams.get("visitor_role") === 2 ? (
|
{searchParams.get("visitor_role") == 2 && selfData ? (
|
||||||
<div className="p-4 pt-20">
|
<div className="flex flex-col gap-2 border-2 border-[#2c2b2f] rounded-2xl p-4 w-full mt-6">
|
||||||
<div className="flex flex-col border-2 border-[#2c2b2f] rounded-2xl p-4 w-full mt-6">
|
<p className="text-base font-medium whitespace-nowrap">
|
||||||
<p>合伙人昵称:{selfData[0]?.collaborator_account?.name}</p>
|
合伙人昵称:{selfData[0]?.collaborator_account?.name}
|
||||||
<p>ID:{selfData[0]?.collaborator_account?.user_id}</p>
|
</p>
|
||||||
<p>
|
<p className="text-base font-medium whitespace-nowrap">
|
||||||
分成比例:
|
ID:{selfData[0]?.collaborator_account?.user_id}
|
||||||
{selfData[0]?.sharing_ratio
|
</p>
|
||||||
? (selfData[0]?.sharing_ratio * 100).toFixed()
|
<p className="text-base font-medium whitespace-nowrap">
|
||||||
: 0}
|
分成比例:
|
||||||
%
|
{selfData[0]?.sharing_ratio
|
||||||
</p>
|
? (selfData[0]?.sharing_ratio * 100).toFixed()
|
||||||
</div>
|
: 0}
|
||||||
|
%
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col items-center p-4">
|
<div className="flex flex-col items-center p-4">
|
||||||
|
|
|
@ -10,14 +10,51 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
|
import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { saveDivImage } from "@/utils/tools/handleFuns";
|
import { saveDivImage } from "@/utils/tools/handleFuns";
|
||||||
import clipboard from "copy-to-clipboard";
|
import clipboard from "copy-to-clipboard";
|
||||||
|
|
||||||
export default function Share() {
|
export default function Share() {
|
||||||
//获取页面数据、生成二维码
|
//获取页面数据、生成二维码
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
const [qrcodeUrl, setQrcodeUrl] = useState("");
|
const [qrcodeUrl, setQrcodeUrl] = useState("");
|
||||||
|
const [shareWebUrl, setShareWebUrl] = useState("https://tiefen.fun");
|
||||||
const [isFetching, setIsFetching] = useState(true);
|
const [isFetching, setIsFetching] = useState(true);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { user_id } = useParams();
|
const { user_id } = useParams();
|
||||||
|
|
||||||
|
function generateRandomString(length = 10) {
|
||||||
|
const characters =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
let result = "";
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
result += characters.charAt(
|
||||||
|
Math.floor(Math.random() * characters.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
function getRandomUrl(urls) {
|
||||||
|
return urls[Math.floor(Math.random() * urls.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
const getShareWebUrl = async () => {
|
||||||
|
try {
|
||||||
|
const data = await requireAPI("POST", "/api/config/cold_config", {
|
||||||
|
body: {},
|
||||||
|
});
|
||||||
|
if (data.ret === -1) {
|
||||||
|
Toast.show({
|
||||||
|
content: data.msg,
|
||||||
|
});
|
||||||
|
return "https://tiefen.fun";
|
||||||
|
}
|
||||||
|
const randomUrl = getRandomUrl(data.data.share_redirect_urls);
|
||||||
|
return randomUrl;
|
||||||
|
} catch (error) {
|
||||||
|
return "https://tiefen.fun";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await requireAPI(
|
const data = await requireAPI(
|
||||||
|
@ -34,18 +71,25 @@ export default function Share() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setData(data.data.streamer_ext);
|
setData(data.data.streamer_ext);
|
||||||
|
|
||||||
|
const _shareWebUrl = await getShareWebUrl();
|
||||||
|
setShareWebUrl(_shareWebUrl);
|
||||||
|
const randomStr = generateRandomString();
|
||||||
|
|
||||||
QRCode.toDataURL(
|
QRCode.toDataURL(
|
||||||
`https://tiefen.fun/zone/${user_id}`,
|
`${_shareWebUrl}/zone/${user_id}/${randomStr}`,
|
||||||
function (err, url) {
|
function (err, url) {
|
||||||
setQrcodeUrl(url);
|
setQrcodeUrl(url);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
setIsFetching(false);
|
setIsFetching(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getData();
|
getData();
|
||||||
|
getShareWebUrl();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
//分享海报组件
|
//分享海报组件
|
||||||
|
@ -131,7 +175,8 @@ export default function Share() {
|
||||||
|
|
||||||
//复制链接
|
//复制链接
|
||||||
const copyUrl = () => {
|
const copyUrl = () => {
|
||||||
clipboard(`https://tiefen.fun/zone/${user_id}`);
|
const randomStr = generateRandomString();
|
||||||
|
clipboard(`${shareWebUrl}/zone/${user_id}/${randomStr}`);
|
||||||
Toast.show({
|
Toast.show({
|
||||||
icon: "success",
|
icon: "success",
|
||||||
content: "已复制到剪贴板",
|
content: "已复制到剪贴板",
|
||||||
|
|
|
@ -3,18 +3,16 @@ import { useRouter, usePathname, useSearchParams } from "next/navigation";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { get } from "@/utils/storeInfo";
|
import { get } from "@/utils/storeInfo";
|
||||||
import { Dialog, Toast } from "antd-mobile";
|
import { Dialog, Toast } from "antd-mobile";
|
||||||
import { save } from "@/utils/storeInfo";
|
|
||||||
import { removeUserInfo } from "@/utils/storeInfo";
|
import { removeUserInfo } from "@/utils/storeInfo";
|
||||||
import { openUrlWithBrowser } from "@/utils/tools";
|
import { openUrlWithBrowser } from "@/utils/tools";
|
||||||
export default function WithAuth(WrappedComponent) {
|
export default function WithAuth(WrappedComponent) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
var ua = navigator.userAgent.toLowerCase();
|
const ua = navigator.userAgent.toLowerCase();
|
||||||
if (
|
if (
|
||||||
(ua.indexOf("quark") > -1 || ua.indexOf("mqqbrowser") > -1) &&
|
(ua.indexOf("mqqbrowser") > -1 || ua.indexOf("quark") > -1) &&
|
||||||
ua.indexOf("iphone") > -1
|
ua.indexOf("iphone") > -1
|
||||||
) {
|
) {
|
||||||
// 夸克浏览器
|
// 夸克浏览器
|
||||||
|
|
|
@ -6,16 +6,21 @@ export default function baseRequest() {
|
||||||
const account = accountCookie === undefined ? {} : accountCookie;
|
const account = accountCookie === undefined ? {} : accountCookie;
|
||||||
const mid = getCookie("mid");
|
const mid = getCookie("mid");
|
||||||
const b_ts = new Date().getTime();
|
const b_ts = new Date().getTime();
|
||||||
|
let b_dt = 0;
|
||||||
|
if (/(iPad|iPhone|iPod)/gi.test(navigator.userAgent)) {
|
||||||
|
b_dt = 1;
|
||||||
|
}
|
||||||
const baseRequest = {
|
const baseRequest = {
|
||||||
b_mid: mid ? parseInt(mid, 10) : account?.mid,
|
b_mid: mid ? parseInt(mid, 10) : account?.mid,
|
||||||
b_ch: "h5",
|
b_ch: "h5",
|
||||||
b_ts: b_ts,
|
b_ts: b_ts,
|
||||||
|
b_dt: b_dt,
|
||||||
b_token: token,
|
b_token: token,
|
||||||
b_did:
|
b_did:
|
||||||
typeof window !== "undefined" &&
|
typeof window !== "undefined" &&
|
||||||
typeof window.navigator !== "undefined" &&
|
typeof window.navigator !== "undefined" &&
|
||||||
navigator?.userAgent.slice(0, 32),
|
navigator?.userAgent.slice(0, 32),
|
||||||
};
|
};
|
||||||
// console.log("baseRequest",baseRequest)
|
// console.log("baseRequest", baseRequest);
|
||||||
return baseRequest;
|
return baseRequest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue