version_1.1 (#22)
Co-authored-by: al <al@cdhncy.com> Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/tiefen_space_h5/pulls/22
This commit is contained in:
parent
62d8d23bf5
commit
a8017d9159
|
@ -9,6 +9,8 @@ import { get } from "@/utils/storeInfo";
|
|||
import requireAPI from "@/utils/requireAPI";
|
||||
import OwnIcon from "@/components/OwnIcon";
|
||||
import OwnImage from "@/components/OwnImage";
|
||||
import { getVipPrice } from "@/utils/auth";
|
||||
import baseRequest from "@/utils/baseRequest";
|
||||
const My = () => {
|
||||
const [userInfo, setUserInfo] = useState({});
|
||||
const router = useRouter();
|
||||
|
@ -76,6 +78,7 @@ const My = () => {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const vipPrice = await getVipPrice();
|
||||
const isInJoinProgress =
|
||||
(statuses.data.basic_status === 0 ||
|
||||
statuses.data.basic_status === 1 ||
|
||||
|
@ -208,7 +211,12 @@ const My = () => {
|
|||
// }
|
||||
return currentOld;
|
||||
});
|
||||
setUserInfo({ ...data.data, ...account.data.account, ...streamer.data });
|
||||
setUserInfo({
|
||||
...data.data,
|
||||
...account.data.account,
|
||||
...streamer.data,
|
||||
vipPrice,
|
||||
});
|
||||
};
|
||||
const ItemEle = ({
|
||||
url,
|
||||
|
@ -406,7 +414,44 @@ const My = () => {
|
|||
<p className="text-[#ffffff88]">钻石</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{/*会员功能*/}
|
||||
<div
|
||||
// activeOpacity={1}
|
||||
onClick={() => {
|
||||
const base = baseRequest();
|
||||
router.push(
|
||||
`/webView/${encodeURIComponent(
|
||||
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
|
||||
)}`
|
||||
);
|
||||
}}
|
||||
className="flex flex-col p-2.5 rounded-2xl mt-3.5 bg-[#301024] mb-4"
|
||||
>
|
||||
<div className="flex flex-row justify-between items-center">
|
||||
<div className="flex flex-col">
|
||||
<div className="flex gap-1 items-center mb-1">
|
||||
<OwnIcon src="/icons/vipbig.png" className="w-[32px] h-[32px]" />
|
||||
<span className="text-base text-[#FF669E] font-medium">
|
||||
{userInfo?.is_a_member !== 1
|
||||
? "开通会员保存图片"
|
||||
: "尊贵的永久会员"}
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-sm text-[#FFFFFF40] font-medium">
|
||||
{userInfo?.is_a_member !== 1
|
||||
? "限时优惠活动"
|
||||
: "已解锁全部会员权益"}
|
||||
</span>
|
||||
</div>
|
||||
{userInfo?.is_a_member !== 1 && (
|
||||
<div className="flex justify-center items-center h-9 bg-[#FF669E] rounded-full px-4">
|
||||
<span className="text-white text-sm font-medium">
|
||||
¥{userInfo.vipPrice}/永久
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* 主播用户 */}
|
||||
{!!streamerNavigates.length && (
|
||||
<div className="rounded-xl p-2 border-2 border-[#2c2b2f] mb-4">
|
||||
|
|
|
@ -23,7 +23,7 @@ export default function Reviewed({ currentIndex }) {
|
|||
const account = get("account");
|
||||
try {
|
||||
const body = {
|
||||
b_mid: account.mid,
|
||||
b_mid: account?.mid,
|
||||
audit_type: 1,
|
||||
offset: offset,
|
||||
limit: 10,
|
||||
|
|
|
@ -28,8 +28,12 @@ export default function AboutUs() {
|
|||
<p className="text-base text-center leading-9">关于我们</p>
|
||||
</div>
|
||||
{/* 内容 */}
|
||||
<div className="pt-16 p-4 flex flex-col justify-center items-center">
|
||||
<OwnIcon className="my-16" width="46%" src="/images/logo.png" />
|
||||
<div className="w-full pt-16 p-4 flex flex-col justify-center items-center">
|
||||
<OwnIcon
|
||||
outClassName="w-1/2"
|
||||
className="my-16 w-1/2"
|
||||
src="/images/logo.png"
|
||||
/>
|
||||
|
||||
<div className="rounded-xl p-2 border-2 border-[#2c2b2f] w-full">
|
||||
<ul>
|
||||
|
|
|
@ -11,7 +11,8 @@ import { multiUploadImage } from "@/utils/upload";
|
|||
import requireAPI from "@/utils/requireAPI";
|
||||
export default function Feedback() {
|
||||
const [value, setValue] = useState();
|
||||
const [assets, setAssets] = useState([]);
|
||||
const [imgAssets, setImgAssets] = useState([]);
|
||||
const [videoAssets, setVideoAssets] = useState([]);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const router = useRouter();
|
||||
//提交反馈
|
||||
|
@ -24,13 +25,26 @@ export default function Feedback() {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (imgAssets.length + videoAssets.length > 9) {
|
||||
Toast.show({
|
||||
icon: "fail",
|
||||
content: "最多上传9个图片或视频",
|
||||
position: "top",
|
||||
});
|
||||
return;
|
||||
}
|
||||
//提交数据
|
||||
setIsSubmitting(true);
|
||||
// const media = await multiUpload(assets);
|
||||
const media = await multiUploadImage(assets, 1);
|
||||
const { image_ids } = await multiUploadImage(imgAssets, 1);
|
||||
const { video_ids } = await multiUploadImage(videoAssets, 2);
|
||||
|
||||
const media = { image_ids, video_ids };
|
||||
|
||||
// console.log("media",media)
|
||||
const account = await get("account");
|
||||
debugger;
|
||||
|
||||
try {
|
||||
const data = await requireAPI(
|
||||
"POST",
|
||||
|
@ -93,9 +107,24 @@ export default function Feedback() {
|
|||
style={{ "--placeholder-color": "#FFFFFF80", "--font-size": "16px" }}
|
||||
/>
|
||||
<p className="text-base font-medium text-white mt-4 mb-1">
|
||||
截图(最多9张)
|
||||
截图或录屏(最多9张)
|
||||
</p>
|
||||
<UploadImgs assets={assets} getImgs={setAssets} />
|
||||
<div className="mb-4">
|
||||
<p className="my-2">图片</p>
|
||||
<UploadImgs
|
||||
accept="image/png, image/jpeg, image/jpg"
|
||||
assets={imgAssets}
|
||||
getImgs={setImgAssets}
|
||||
/>
|
||||
</div>
|
||||
<p className="my-2">视频</p>
|
||||
<UploadImgs
|
||||
accept="video/*"
|
||||
type={2}
|
||||
id="uploadVideoBtn3"
|
||||
assets={videoAssets}
|
||||
getImgs={setVideoAssets}
|
||||
/>
|
||||
<div className="mt-16">
|
||||
<Button
|
||||
shape="rounded"
|
||||
|
|
|
@ -53,6 +53,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
|
|||
]);
|
||||
useImperativeHandle(refInstance, () => ({
|
||||
readAllMsg: async (types) => {
|
||||
if (!data.session_id) return;
|
||||
try {
|
||||
const body = {
|
||||
n_types: types,
|
||||
|
@ -68,6 +69,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const _data2 = await requireAPI(
|
||||
"POST",
|
||||
"/api/contact_customer_service/read_all",
|
||||
|
@ -83,6 +85,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
changeNoticeCount(0);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { Tabs, Swiper, Toast } from "antd-mobile";
|
||||
import { Tabs, Swiper, Toast, Dialog } from "antd-mobile";
|
||||
import Link from "next/link";
|
||||
import requireAPI from "@/utils/requireAPI";
|
||||
import MessageList from "./components/MessageList";
|
||||
|
@ -112,8 +112,48 @@ export default function Space() {
|
|||
}
|
||||
}
|
||||
const handleReadAll = () => {
|
||||
if (mesListEl.current) mesListEl.current.readAllMsg([0, 1, 2, 3]);
|
||||
const showMobal = Dialog.show({
|
||||
title: "提示",
|
||||
content: <div className="text-center">是否确认清除所有未读消息?</div>,
|
||||
bodyStyle: {
|
||||
maxHeight: "none",
|
||||
width: "80vw",
|
||||
position: "fixed",
|
||||
top: "200px",
|
||||
left: "10vw",
|
||||
"--text-color": "#fff",
|
||||
color: "#fff",
|
||||
},
|
||||
// cancelText:"确认",
|
||||
// confirmText:"取消",
|
||||
style: {
|
||||
"--text-color": "#fff",
|
||||
},
|
||||
closeOnAction: true,
|
||||
actions: [
|
||||
[
|
||||
{
|
||||
key: "close",
|
||||
text: "取消",
|
||||
bold: true,
|
||||
style: { color: "#ffffff80" },
|
||||
onClick: () => {
|
||||
showMobal?.close();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "submit",
|
||||
text: "确认",
|
||||
style: { color: "#fff" },
|
||||
onClick: () => {
|
||||
if (mesListEl.current) mesListEl.current.readAllMsg([0, 1, 2, 3]);
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
|
||||
|
|
|
@ -59,10 +59,12 @@ export default function PersonSpace() {
|
|||
const photosArr = [
|
||||
...data?.streamer_ext?.cover?.images?.map((item) => ({
|
||||
url: item.urls[0],
|
||||
id: item.id,
|
||||
type: "video",
|
||||
})),
|
||||
...data?.streamer_ext?.album?.images.map((item) => ({
|
||||
url: item.urls[0],
|
||||
id: item.id,
|
||||
type: "img",
|
||||
})),
|
||||
];
|
||||
|
|
|
@ -27,6 +27,7 @@ import { useRouter, useSearchParams } from "next/navigation";
|
|||
import OwnInput from "@/components/OwnInput";
|
||||
import { get } from "@/utils/storeInfo";
|
||||
import OwnIcon from "@/components/OwnIcon";
|
||||
import baseRequest from "@/utils/baseRequest";
|
||||
export default function CollaboratorSetting() {
|
||||
const [data, setData] = useState(null);
|
||||
const [selfMid, setSelfMid] = useState();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"use client";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import { Dialog } from "antd-mobile";
|
||||
import { checkRole } from "@/utils/auth";
|
||||
// import { useRouter } from "next/navigation";
|
||||
import baseRequest from "@/utils/baseRequest";
|
||||
import { save } from "@/utils/storeInfo";
|
||||
|
@ -9,13 +10,8 @@ import { getUserInfo } from "@/api/public";
|
|||
|
||||
export default function CheckVip({ children, isVipToPassFun, router }) {
|
||||
const base = baseRequest();
|
||||
useEffect(() => {}, []);
|
||||
const handleCheck = async () => {
|
||||
//向服务器请求新的账号信息并保存到本地
|
||||
const account = await getUserInfo();
|
||||
save("account", JSON.stringify(account));
|
||||
const isVip = account?.is_a_member;
|
||||
|
||||
const isVip = await checkRole();
|
||||
if (!isVip) {
|
||||
const showMobal = Dialog.show({
|
||||
title: "是否开通会员",
|
||||
|
@ -56,7 +52,6 @@ export default function CheckVip({ children, isVipToPassFun, router }) {
|
|||
style: { color: "#fff" },
|
||||
onClick: () => {
|
||||
showMobal.close();
|
||||
console.log("showMobal", showMobal);
|
||||
router.push(
|
||||
`/webView/${encodeURIComponent(
|
||||
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
|
||||
|
|
|
@ -21,7 +21,7 @@ import OwnImage from "../OwnImage";
|
|||
import { saveImage } from "@/utils/tools/handleFuns";
|
||||
import requireAPI from "@/utils/requireAPI";
|
||||
import CheckVip from "@/components/CheckVip";
|
||||
function ImagesMask({}, ref) {
|
||||
function ImagesMask({ isEditing = false }, ref) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [images, setImages] = useState([]);
|
||||
const [data, setData] = useState(null);
|
||||
|
@ -32,6 +32,7 @@ function ImagesMask({}, ref) {
|
|||
return (
|
||||
<ImagesMaskContaint
|
||||
images={images}
|
||||
isEditing={isEditing}
|
||||
visible={visible}
|
||||
ref={scrollRef}
|
||||
setVisible={setVisible}
|
||||
|
@ -77,6 +78,7 @@ function ImagesMask({}, ref) {
|
|||
const ImagesMaskContaint = forwardRef(
|
||||
(
|
||||
{
|
||||
isEditing,
|
||||
visible,
|
||||
images,
|
||||
setVisible,
|
||||
|
@ -263,27 +265,35 @@ const ImagesMaskContaint = forwardRef(
|
|||
</div>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<CheckVip
|
||||
isVipToPassFun={() => getOriginImg(images[currentIndex]?.id)}
|
||||
router={router}
|
||||
>
|
||||
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] font-medium rounded-full">
|
||||
原图
|
||||
</div>
|
||||
</CheckVip>
|
||||
{!isEditing && (
|
||||
<>
|
||||
<CheckVip
|
||||
isVipToPassFun={() => {
|
||||
getOriginImg(images[currentIndex]?.id);
|
||||
}}
|
||||
router={router}
|
||||
>
|
||||
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] font-medium rounded-full">
|
||||
原图
|
||||
</div>
|
||||
</CheckVip>
|
||||
|
||||
<CheckVip
|
||||
isVipToPassFun={() => saveImage(images[currentIndex]?.url)}
|
||||
router={router}
|
||||
>
|
||||
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] rounded-full">
|
||||
<FontAwesomeIcon
|
||||
icon={faDownload}
|
||||
size="xl"
|
||||
// className="h-[14px]"
|
||||
/>
|
||||
</div>
|
||||
</CheckVip>
|
||||
<CheckVip
|
||||
isVipToPassFun={() =>
|
||||
saveImage(images[currentIndex]?.url)
|
||||
}
|
||||
router={router}
|
||||
>
|
||||
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] rounded-full">
|
||||
<FontAwesomeIcon
|
||||
icon={faDownload}
|
||||
size="xl"
|
||||
// className="h-[14px]"
|
||||
/>
|
||||
</div>
|
||||
</CheckVip>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div
|
||||
onClick={() => {
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function OwnIcon({
|
|||
<div
|
||||
className={`flex flex-col justify-center items-center relative ${outClassName}`}
|
||||
>
|
||||
<div className={`w-12 h-12 ${className} z-[0]`}>
|
||||
<div className={`${className} z-[0]`}>
|
||||
<Image
|
||||
height={height}
|
||||
width={width}
|
||||
|
|
|
@ -322,7 +322,7 @@ export default function UploadImgs({
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
<ImagesMask ref={imagesMaskRef} />
|
||||
<ImagesMask ref={imagesMaskRef} isEditing={true} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { setCookie, deleteCookie, getCookie } from "cookies-next";
|
||||
import requireAPI from "./requireAPI";
|
||||
import { get } from "./storeInfo";
|
||||
import { get, save } from "./storeInfo";
|
||||
export async function checkAuth() {
|
||||
try {
|
||||
const data = await requireAPI("POST", `/api/login/validate`);
|
||||
|
@ -24,9 +24,51 @@ export function signOut() {
|
|||
deleteCookie("mid");
|
||||
}
|
||||
|
||||
export function checkRole() {
|
||||
const account = get("account");
|
||||
const role = account?.role;
|
||||
const isVip = account?.is_a_member;
|
||||
return role !== 0 && isVip === 1;
|
||||
export async function getUserInfo(mid) {
|
||||
if (!mid) return;
|
||||
try {
|
||||
const data = await requireAPI("POST", `/api/account/list_by_mid`, {
|
||||
body: { mid },
|
||||
});
|
||||
if (data.ret === 1) {
|
||||
return data.data.account;
|
||||
}
|
||||
} catch (e) {
|
||||
// console.log(e);
|
||||
}
|
||||
}
|
||||
export async function getVipPrice() {
|
||||
try {
|
||||
const data = await requireAPI(
|
||||
"POST",
|
||||
`/api/vas/get_membership_product_list`
|
||||
);
|
||||
if (data.ret === -1) {
|
||||
Toast.show({
|
||||
icon: "fail",
|
||||
content: data.msg,
|
||||
position: "top",
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
return data.data.product.real_price / 100;
|
||||
}
|
||||
} catch (e) {
|
||||
// console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkRole() {
|
||||
const account = get("account");
|
||||
|
||||
const userInfo = await getUserInfo(account.mid);
|
||||
if (userInfo) {
|
||||
if (userInfo.is_a_member !== account) {
|
||||
save("account", userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
const role = userInfo?.role;
|
||||
const isVip = userInfo?.is_a_member;
|
||||
return role !== 0 || isVip === 1;
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ export const saveImage = async (url) => {
|
|||
.catch((error) => console.log(error));
|
||||
};
|
||||
export const saveFile = async (href) => {
|
||||
const isVip = checkRole();
|
||||
const isVip = await checkRole();
|
||||
if (!isVip) {
|
||||
// setIsVipModalVisible(true);
|
||||
Toast.show({
|
||||
|
|
Loading…
Reference in New Issue