fix: bug修复

This commit is contained in:
landaiqing
2024-07-24 00:59:28 +08:00
parent 8fa1c50fb3
commit 190fda426c
16 changed files with 1512 additions and 1301 deletions

View File

@@ -156,7 +156,10 @@ export const getUserInfoApi = (userId: string): any => {
export const updateUserInfo = (data: any): any => { export const updateUserInfo = (data: any): any => {
return web.request({ return web.request({
url: "/auth/auth/user/update", url: "/auth/auth/user/update",
method: "get", method: "post",
headers: {
"Content-Type": "application/json;charset=UTF-8",
},
data: data, data: data,
}); });
}; };
@@ -195,3 +198,29 @@ export const logout = (userId: any): any => {
}, },
}); });
}; };
/**
* 检查用户名是否已存在
* @param userName
*/
export const checkUserName = (userName: any): any => {
return web.request({
url: "/auth/auth/user/checkUserName",
method: "post",
params: {
userName: userName,
},
});
};
/**
* 获取最近分享
* @param userId
*/
export const getRecentShare = (userId: any): any => {
return web.request({
url: "/share/share/detail/getRecentShare",
method: "get",
params: {
userId: userId,
},
});
};

View File

@@ -29,10 +29,7 @@ const FileUpload = (props: any) => {
const uploadFile = async (options: any) => { const uploadFile = async (options: any) => {
const { onSuccess, onError, file }: { onSuccess: any; onError: any; file: any } = options; const { onSuccess, onError, file }: { onSuccess: any; onError: any; file: any } = options;
if ( if (store.getUploadFileBucket() === null || store.getUploadFileStorage() === null) {
store.getUploadFilePath() === null ||
(store.getUploadFileBucket() === null && store.getUploadFileStorage() === null)
) {
message.open({ message.open({
content: "请选择存储桶和存储路径", content: "请选择存储桶和存储路径",
type: "error", type: "error",

View File

@@ -339,7 +339,7 @@ const MainHome: React.FC = observer(() => {
color: "coral", color: "coral",
fontWeight: "bolder", fontWeight: "bolder",
}}> }}>
{storageCount} {storageCount || 0}
</span> </span>
} }
/ /
@@ -400,7 +400,7 @@ const MainHome: React.FC = observer(() => {
color: "lightblue", color: "lightblue",
fontWeight: "bolder", fontWeight: "bolder",
}}> }}>
{bucketCount} {bucketCount || 0}
</span> </span>
} }
/ /
@@ -467,7 +467,7 @@ const MainHome: React.FC = observer(() => {
color: "orange", color: "orange",
marginLeft: 5, marginLeft: 5,
}}> }}>
{uploadFile} {uploadFile || 0}
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
@@ -483,7 +483,7 @@ const MainHome: React.FC = observer(() => {
color: "green", color: "green",
marginLeft: 5, marginLeft: 5,
}}> }}>
{downloadFile} {downloadFile || 0}
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
@@ -531,7 +531,7 @@ const MainHome: React.FC = observer(() => {
color: "orange", color: "orange",
marginLeft: 5, marginLeft: 5,
}}> }}>
{uploadFlow} {uploadFlow || 0}
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
@@ -547,7 +547,7 @@ const MainHome: React.FC = observer(() => {
color: "green", color: "green",
marginLeft: 5, marginLeft: 5,
}}> }}>
{downloadFlow} {downloadFlow || 0}
</span> </span>
</Flex> </Flex>
</Flex> </Flex>

View File

@@ -31,7 +31,7 @@ import { cyan, generate, green, presetPalettes, red } from "@ant-design/colors";
type Presets = Required<ColorPickerProps>["presets"][number]; type Presets = Required<ColorPickerProps>["presets"][number];
const ShareAdd: React.FunctionComponent = observer(() => { const ShareAdd: React.FunctionComponent = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const divRef = useRef(null); const divRef = useRef(null);
const [form] = Form.useForm(); const [form] = Form.useForm();
@@ -373,5 +373,5 @@ const ShareAdd: React.FunctionComponent = observer(() => {
</div> </div>
</> </>
); );
}); };
export default observer(ShareAdd); export default observer(ShareAdd);

View File

@@ -8,6 +8,8 @@ import {
HeartOutlined, HeartOutlined,
InfoCircleOutlined, InfoCircleOutlined,
LeftOutlined, LeftOutlined,
LikeOutlined,
StarOutlined,
TagsOutlined, TagsOutlined,
WarningOutlined, WarningOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
@@ -22,10 +24,10 @@ const { Paragraph } = Typography;
import like from "@/assets/icons/like.svg"; import like from "@/assets/icons/like.svg";
import favorite from "@/assets/icons/favorite.svg"; import favorite from "@/assets/icons/favorite.svg";
import useStore from "@/utils/store/useStore.tsx"; import useStore from "@/utils/store/useStore.tsx";
import { addLikeDetail, getShareDetail } from "@/api/share"; import { addLikeDetail, deletedLikeDetail, getShareDetail } from "@/api/share";
import StorageIcon from "@/constant/stroage-icon.ts"; import StorageIcon from "@/constant/stroage-icon.ts";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { addFavorites } from "@/api/user"; import { addFavorites, deleteFavorites } from "@/api/user";
const ShareDetail: React.FunctionComponent = () => { const ShareDetail: React.FunctionComponent = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const store = useStore("share"); const store = useStore("share");
@@ -44,18 +46,20 @@ const ShareDetail: React.FunctionComponent = () => {
} }
async function addLike() { async function addLike() {
const data: any = { const data: any = {
circleId: store.getCircleId(),
userId: userId, userId: userId,
detailId: params.id, detailId: params.id,
}; };
addLikeDetail(data).then(); addLikeDetail(data).then();
} }
// async function delLike() { async function delLike() {
// const data: any = { const data: any = {
// userId: userId, circleId: store.getCircleId(),
// detailId: params.id, userId: userId,
// }; detailId: params.id,
// deletedLikeDetail(data).then(); };
// } deletedLikeDetail(data).then();
}
async function setFavorites() { async function setFavorites() {
const data: any = { const data: any = {
userId: userId, userId: userId,
@@ -68,6 +72,7 @@ const ShareDetail: React.FunctionComponent = () => {
type: "success", type: "success",
content: "收藏成功", content: "收藏成功",
}); });
getDetail().then();
} else { } else {
message.open({ message.open({
type: "error", type: "error",
@@ -76,6 +81,27 @@ const ShareDetail: React.FunctionComponent = () => {
} }
}); });
} }
async function cancelFavorites() {
const data: any = {
userId: userId,
detailId: params.id,
circleId: store.getCircleId(),
};
deleteFavorites(data).then((res: any) => {
if (res && res.success) {
message.open({
type: "success",
content: "取消成功",
});
getDetail().then();
} else {
message.open({
type: "error",
content: "取消失败",
});
}
});
}
useEffect(() => { useEffect(() => {
getDetail().then(); getDetail().then();
@@ -109,7 +135,7 @@ const ShareDetail: React.FunctionComponent = () => {
color: "gray", color: "gray",
overflow: "hidden", overflow: "hidden",
}}> }}>
{detail.nickname} {detail.nickname || "unknown"}
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
@@ -119,7 +145,7 @@ const ShareDetail: React.FunctionComponent = () => {
fontSize: 12, fontSize: 12,
color: "gray", color: "gray",
}}> }}>
{detail.likesCount} {detail.likesCount || 0}
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
@@ -129,7 +155,7 @@ const ShareDetail: React.FunctionComponent = () => {
fontSize: 12, fontSize: 12,
color: "gray", color: "gray",
}}> }}>
{detail.commentCount} {detail.commentCount || 0}
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
@@ -139,7 +165,7 @@ const ShareDetail: React.FunctionComponent = () => {
fontSize: 12, fontSize: 12,
color: "gray", color: "gray",
}}> }}>
{detail.views} {detail.views || 0}
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
@@ -218,7 +244,7 @@ const ShareDetail: React.FunctionComponent = () => {
color: "#1677FF", color: "#1677FF",
fontSize: 16, fontSize: 16,
}}> }}>
{url.typeName}
</span> </span>
</div> </div>
<ExportOutlined <ExportOutlined
@@ -277,7 +303,7 @@ const ShareDetail: React.FunctionComponent = () => {
Array.from(detail.tags).map((tag: any, index: number) => { Array.from(detail.tags).map((tag: any, index: number) => {
return ( return (
<div key={index}> <div key={index}>
<Tag bordered={false} color={getRandomColor()}> <Tag bordered={false} color={"#" + detail.color}>
{tag.tagName} {tag.tagName}
</Tag> </Tag>
</div> </div>
@@ -290,21 +316,54 @@ const ShareDetail: React.FunctionComponent = () => {
align={"center"} align={"center"}
justify={"center"} justify={"center"}
style={{ height: 50 }}> style={{ height: 50 }}>
<Avatar {detail.isLike === true ? (
className={styles.like_icon} <>
src={like as any} <Tooltip title={"取消点赞"} placement={"bottom"}>
onClick={() => { <Avatar
addLike().then(); className={styles.like_icon}
}} src={like as any}
size={"large"}></Avatar> onClick={() => {
{/*isFavor*/} delLike().then();
<Avatar }}
className={styles.favtorie_icon} size={"large"}></Avatar>
src={favorite as any} </Tooltip>
onClick={() => { </>
setFavorites().then(); ) : (
}} <>
size={"large"}></Avatar> <Tooltip title={"点赞"} placement={"bottom"}>
<LikeOutlined
className={styles.detail_link_btn}
onClick={() => {
addLike().then();
}}></LikeOutlined>
</Tooltip>
</>
)}
{detail.isFavor === true ? (
<>
<Tooltip title={"取消收藏"} placement={"bottom"}>
<Avatar
className={styles.favtorie_icon}
src={favorite as any}
onClick={() => {
cancelFavorites().then();
}}
size={"large"}></Avatar>
</Tooltip>
</>
) : (
<>
<Tooltip title={"收藏"} placement={"bottom"}>
<StarOutlined
onClick={() => {
setFavorites().then();
}}
className={styles.detail_link_btn}
/>
</Tooltip>
</>
)}
</Flex> </Flex>
</ProCard> </ProCard>
</div> </div>

View File

@@ -44,33 +44,38 @@ const Comment = observer((props: any) => {
const userStore = useStore("user"); const userStore = useStore("user");
const userId: any = userStore.getUserId(); const userId: any = userStore.getUserId();
async function listComments() { async function listComments() {
setComment([]);
listComment(params.id, userId).then((res: any) => { listComment(params.id, userId).then((res: any) => {
console.log(res);
if (res && res.success && res.data) { if (res && res.success && res.data) {
setComment([]);
setComment(res.data); setComment(res.data);
setLoading(false); setLoading(false);
} }
}); });
} }
async function addLike(commentId: any) { async function addLike(commentId: any) {
setComment([]);
const data: any = { const data: any = {
detailId: params.id,
userId: userId, userId: userId,
commentId: commentId, commentId: commentId,
}; };
addLikeComment(data).then(); addLikeComment(data).then();
listComments().then();
} }
async function delLike(commentId: any) { async function delLike(commentId: any) {
setComment([]);
const data: any = { const data: any = {
detailId: params.id,
userId: userId, userId: userId,
commentId: commentId, commentId: commentId,
}; };
deletedLikeComment(data).then(); deletedLikeComment(data).then();
listComments().then();
} }
async function getCommentHot() { async function getCommentHot() {
setComment([]);
listCommentHot(params.id, userId).then((res: any) => { listCommentHot(params.id, userId).then((res: any) => {
if (res && res.success && res.data) { if (res && res.success && res.data) {
setComment([]);
setComment(res.data); setComment(res.data);
setLoading(false); setLoading(false);
} }
@@ -85,7 +90,7 @@ const Comment = observer((props: any) => {
} }
async function addComments(data: any) { async function addComments(data: any) {
addComment(data).then((res: any) => { addComment(data).then((res: any) => {
if (res && res.success && res.data) { if (res && res.success) {
message.open({ message.open({
content: "评论成功", content: "评论成功",
type: "success", type: "success",
@@ -108,7 +113,7 @@ const Comment = observer((props: any) => {
} }
async function addReplies(data: any) { async function addReplies(data: any) {
addReply(data).then((res: any) => { addReply(data).then((res: any) => {
if (res && res.success && res.data) { if (res && res.success) {
message.open({ message.open({
content: "回复成功", content: "回复成功",
type: "success", type: "success",
@@ -132,7 +137,7 @@ const Comment = observer((props: any) => {
setIsReplyComment(isReplyComment === index ? null : index); setIsReplyComment(isReplyComment === index ? null : index);
}; };
useEffect(() => { useEffect(() => {
listComments().then(); getCommentHot().then();
getAllCommentAndReply(params.id).then(); getAllCommentAndReply(params.id).then();
}, []); }, []);
return ( return (
@@ -264,99 +269,136 @@ const Comment = observer((props: any) => {
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}
style={{ justify={"space-between"}>
marginTop: 10, <Flex
width: "100%", vertical={false}
}}> align={"center"}
<span
style={{ style={{
fontSize: 13, marginTop: 10,
color: "grey", width: "100%",
}}> }}>
{item.createdTime} <span
</span> style={{
<Flex fontSize: 13,
vertical={false} color: "grey",
align={"center"}> }}>
{item.isLike === false ? ( {item.createdTime}
<LikeOutlined </span>
onClick={() => { <Flex
delLike( vertical={false}
item.id, align={"center"}>
).then(); {item.isLike ===
}} true ? (
className={ <LikeFilled
styles.like_icon onClick={() => {
} delLike(
/> item.id,
) : ( ).then();
<LikeFilled }}
className={ style={{
styles.like_icon color: "red",
} }}
/>
) : (
<LikeOutlined
className={
styles.like_icon
}
onClick={() => {
addLike(
item.id,
).then();
}}
/>
)}
<span
style={{ style={{
color: "red", fontSize: 13,
}} color: "grey",
}}>
{item.likes}
</span>
</Flex>
<Flex
vertical={false}
align={"center"}>
<CommentOutlined
onClick={() => { onClick={() => {
addLike( setReply([]);
item.id, if (item.id) {
).then(); replyComment(
}} item.id,
/> ).then(
)} () => {
<span handleExpandReplyCommentClick(
style={{ index,
fontSize: 13, );
color: "grey", },
}}>
{item.likes}
</span>
</Flex>
<Flex
vertical={false}
align={"center"}>
<CommentOutlined
onClick={() => {
setReply([]);
if (item.id) {
replyComment(
item.id,
).then(() => {
handleExpandReplyCommentClick(
index,
); );
}); }
}}
className={
styles.comment_icon
} }
}} />
className={ <span
styles.comment_icon style={{
} fontSize: 13,
/> color: "grey",
<span }}>
style={{ {item.replyCount}
fontSize: 13, </span>
color: "grey", </Flex>
}}> <Flex
{item.replyCount} vertical={false}
</span> align={"center"}>
<Button
type="text"
size={"small"}
onClick={() => {
handleExpandClick(
index,
);
}}
style={{
fontSize: 13,
color: "grey",
}}>
</Button>
</Flex>
</Flex> </Flex>
<Flex <Flex
vertical={false} vertical={false}
align={"center"}> align={"center"}>
<Button <span
type="text"
size={"small"}
onClick={() => {
handleExpandClick(
index,
);
}}
style={{ style={{
textWrap: "nowrap",
fontSize: 12,
color: "grey",
textAlign: "end",
}}>
{item.location ||
"unknown"}
</span>
<span
style={{
marginLeft: 10,
fontSize: 13, fontSize: 13,
color: "grey", color: "grey",
}}> }}>
{item.browser ||
</Button> "unknown"}
</span>
<span
style={{
marginLeft: 10,
fontSize: 13,
color: "grey",
}}>
{item.browserVersion ||
"unknown"}
</span>
</Flex> </Flex>
</Flex> </Flex>
</ProCard> </ProCard>
@@ -573,62 +615,97 @@ const Comment = observer((props: any) => {
vertical={ vertical={
false false
} }
style={{ align={
marginTop: 10, "center"
width: "100%", }
}}> justify={
<span "space-between"
style={{ }>
fontSize: 13,
color: "grey",
}}>
{
replyItem.createdTime
}
</span>
<Flex <Flex
vertical={ vertical={
false false
} }
align={ style={{
"center" marginTop: 10,
}> width: "100%",
{replyItem.isLike === }}>
false ? (
<LikeOutlined
onClick={() => {
delLike(
replyItem.id,
).then();
}}
className={
styles.like_icon
}
/>
) : (
<LikeFilled
className={
styles.like_icon
}
style={{
color: "red",
}}
onClick={() => {
addLike(
replyItem.id,
).then();
}}
/>
)}
<span <span
style={{ style={{
fontSize: 13, fontSize: 13,
color: "grey", color: "grey",
}}> }}>
{ {
replyItem.likes replyItem.createdTime
} }
</span> </span>
<Flex
vertical={
false
}
align={
"center"
}>
{replyItem.isLike ===
false ? (
<LikeOutlined
onClick={() => {
addLike(
replyItem.id,
).then();
}}
className={
styles.like_icon
}
/>
) : (
<LikeFilled
className={
styles.like_icon
}
style={{
color: "red",
}}
onClick={() => {
delLike(
replyItem.id,
).then();
}}
/>
)}
<span
style={{
fontSize: 13,
color: "grey",
}}>
{
replyItem.likes
}
</span>
</Flex>
<Flex
vertical={
false
}
align={
"center"
}>
<Button
type="text"
size={
"small"
}
onClick={() => {
handleExpandReplyReplyClick(
replyItem.id,
);
}}
style={{
fontSize: 13,
color: "grey",
}}>
</Button>
</Flex>
</Flex> </Flex>
<Flex <Flex
vertical={ vertical={
@@ -637,22 +714,36 @@ const Comment = observer((props: any) => {
align={ align={
"center" "center"
}> }>
<Button <span
type="text"
size={
"small"
}
onClick={() => {
handleExpandReplyReplyClick(
replyItem.id,
);
}}
style={{ style={{
textWrap:
"nowrap",
fontSize: 12,
color: "grey",
textAlign:
"end",
}}>
{replyItem.location ||
"unknown"}
</span>
<span
style={{
marginLeft: 10,
fontSize: 13, fontSize: 13,
color: "grey", color: "grey",
}}> }}>
{replyItem.browser ||
</Button> "unknown"}
</span>
<span
style={{
marginLeft: 10,
fontSize: 13,
color: "grey",
}}>
{replyItem.browserVersion ||
"unknown"}
</span>
</Flex> </Flex>
</Flex> </Flex>
</ProCard> </ProCard>

View File

@@ -21,3 +21,10 @@
width: 50px; width: 50px;
height: auto; height: auto;
} }
.detail_link_btn{
font-size: 30px;
}
.detail_link_btn:hover{
font-size: 35px;
color: red;
}

View File

@@ -1,7 +1,7 @@
/** @format */ /** @format */
import { ProCard } from "@ant-design/pro-components"; import { ProCard } from "@ant-design/pro-components";
import { Avatar, Button, Flex, Input, List, Skeleton, Tag } from "antd"; import { Avatar, Button, Empty, Flex, Input, List, Skeleton, Tag } from "antd";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import styles from "./index.module.less"; import styles from "./index.module.less";
@@ -25,24 +25,7 @@ export default observer(() => {
} }
}); });
} }
// async function cancelFavorites(id: any) {
// const data: any = {
// id: id,
// };
// deleteFavorites(data).then((res: any) => {
// if (res && res.success) {
// message.open({
// type: "success",
// content: "取消成功",
// });
// } else {
// message.open({
// type: "error",
// content: "取消失败",
// });
// }
// });
// }
useEffect(() => { useEffect(() => {
getMyShare().then(); getMyShare().then();
}, []); }, []);
@@ -75,110 +58,128 @@ export default observer(() => {
</div> </div>
</ProCard> </ProCard>
<ProCard bordered={false} boxShadow={false}> <ProCard bordered={false} boxShadow={false}>
<Skeleton loading={loading} active={true} paragraph={{ rows: 14 }}> {data.length === 0 ? (
<List <Empty description={"暂无数据"}></Empty>
dataSource={data} ) : (
header={ <>
<> <Skeleton loading={loading} active={true} paragraph={{ rows: 14 }}>
<h4></h4> <List
</> dataSource={data}
} header={
renderItem={(item: any) => ( <>
<List.Item key={item.id}> <h4></h4>
<List.Item.Meta </>
avatar={<Avatar src={item.icon} />} }
title={ renderItem={(item: any) => (
<Flex vertical={false} align={"center"}> <List.Item key={item.id}>
<Link to={"/main/share/detail/" + item.id}> <List.Item.Meta
{item.title} avatar={<Avatar src={item.icon} />}
</Link> title={
{item.tags && <Flex vertical={false} align={"center"}>
Array.from(item.tags).map( <Link to={"/main/share/detail/" + item.id}>
(tag: any, index: number) => { {item.title}
return ( </Link>
{item.tags &&
Array.from(item.tags).map(
(tag: any, index: number) => {
return (
<Flex
vertical={false}
align={"center"}
key={index}>
<Tag
bordered={false}
color={
"#" + tag.color
}
style={{
marginLeft: 10,
}}>
{tag.tagName}
</Tag>
</Flex>
);
},
)}
</Flex>
}
description={
<>
<Flex
vertical={false}
justify={"space-between"}
align={"center"}>
{item.description}
<Flex
vertical={false}
align={"center"}
justify={"space-between"}
style={{ width: "300px" }}>
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}>
key={index}> <Avatar
<Tag src={item.avatar as any}
bordered={false} size={"small"}
color={"#" + tag.color} />
style={{ marginLeft: 10 }}> <span
{tag.tagName} style={{
</Tag> fontSize: 12,
color: "gray",
overflow: "hidden",
}}>
{item.nickname}
</span>
</Flex> </Flex>
); <Flex
}, vertical={false}
)} align={"center"}>
</Flex> <HeartOutlined />
} <span
description={ style={{
<> fontSize: 12,
<Flex color: "gray",
vertical={false} }}>
justify={"space-between"} {item.likesCount}
align={"center"}> </span>
{item.description} </Flex>
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}>
justify={"space-between"} <CommentOutlined />
style={{ width: "300px" }}> <span
<Flex vertical={false} align={"center"}> style={{
<Avatar fontSize: 12,
src={item.avatar as any} color: "gray",
size={"small"} }}>
/> {item.commentCount}
<span </span>
style={{ </Flex>
fontSize: 12, <Flex
color: "gray", vertical={false}
overflow: "hidden", align={"center"}>
}}> <EyeOutlined
{item.nickname} style={{ color: "gray" }}
</span> />{" "}
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.views}
</span>
</Flex>
</Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> </>
<HeartOutlined /> }
<span />
style={{ </List.Item>
fontSize: 12, )}
color: "gray", />
}}> </Skeleton>
{item.likesCount} </>
</span> )}
</Flex>
<Flex vertical={false} align={"center"}>
<CommentOutlined />
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.commentCount}
</span>
</Flex>
<Flex vertical={false} align={"center"}>
<EyeOutlined
style={{ color: "gray" }}
/>{" "}
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.views}
</span>
</Flex>
</Flex>
</Flex>
</>
}
/>
</List.Item>
)}
/>
</Skeleton>
</ProCard> </ProCard>
</div> </div>
</> </>

View File

@@ -1,7 +1,7 @@
/** @format */ /** @format */
import { ProCard } from "@ant-design/pro-components"; import { ProCard } from "@ant-design/pro-components";
import { Avatar, Button, Flex, Input, List, Skeleton, Tag } from "antd"; import { Avatar, Button, Empty, Flex, Input, List, Skeleton, Tag } from "antd";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import styles from "./index.module.less"; import styles from "./index.module.less";
@@ -58,110 +58,128 @@ export default observer(() => {
</div> </div>
</ProCard> </ProCard>
<ProCard bordered={false} boxShadow={false}> <ProCard bordered={false} boxShadow={false}>
<Skeleton loading={loading} active={true} paragraph={{ rows: 14 }}> {data.length === 0 ? (
<List <Empty description={"暂无数据"}></Empty>
dataSource={data} ) : (
header={ <>
<> <Skeleton loading={loading} active={true} paragraph={{ rows: 14 }}>
<h4></h4> <List
</> dataSource={data}
} header={
renderItem={(item: any) => ( <>
<List.Item key={item.id}> <h4></h4>
<List.Item.Meta </>
avatar={<Avatar src={item.icon} />} }
title={ renderItem={(item: any) => (
<Flex vertical={false} align={"center"}> <List.Item key={item.id}>
<Link to={"/main/share/detail/" + item.id}> <List.Item.Meta
{item.title} avatar={<Avatar src={item.icon} />}
</Link> title={
{item.tags && <Flex vertical={false} align={"center"}>
Array.from(item.tags).map( <Link to={"/main/share/detail/" + item.id}>
(tag: any, index: number) => { {item.title}
return ( </Link>
{item.tags &&
Array.from(item.tags).map(
(tag: any, index: number) => {
return (
<Flex
vertical={false}
align={"center"}
key={index}>
<Tag
bordered={false}
color={
"#" + tag.color
}
style={{
marginLeft: 10,
}}>
{tag.tagName}
</Tag>
</Flex>
);
},
)}
</Flex>
}
description={
<>
<Flex
vertical={false}
justify={"space-between"}
align={"center"}>
{item.description}
<Flex
vertical={false}
align={"center"}
justify={"space-between"}
style={{ width: "300px" }}>
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}>
key={index}> <Avatar
<Tag src={item.avatar as any}
bordered={false} size={"small"}
color={"#" + tag.color} />
style={{ marginLeft: 10 }}> <span
{tag.tagName} style={{
</Tag> fontSize: 12,
color: "gray",
overflow: "hidden",
}}>
{item.nickname}
</span>
</Flex> </Flex>
); <Flex
}, vertical={false}
)} align={"center"}>
</Flex> <HeartOutlined />
} <span
description={ style={{
<> fontSize: 12,
<Flex color: "gray",
vertical={false} }}>
justify={"space-between"} {item.likesCount}
align={"center"}> </span>
{item.description} </Flex>
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}>
justify={"space-between"} <CommentOutlined />
style={{ width: "300px" }}> <span
<Flex vertical={false} align={"center"}> style={{
<Avatar fontSize: 12,
src={item.avatar as any} color: "gray",
size={"small"} }}>
/> {item.commentCount}
<span </span>
style={{ </Flex>
fontSize: 12, <Flex
color: "gray", vertical={false}
overflow: "hidden", align={"center"}>
}}> <EyeOutlined
{item.nickname} style={{ color: "gray" }}
</span> />{" "}
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.views}
</span>
</Flex>
</Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> </>
<HeartOutlined /> }
<span />
style={{ </List.Item>
fontSize: 12, )}
color: "gray", />
}}> </Skeleton>
{item.likesCount} </>
</span> )}
</Flex>
<Flex vertical={false} align={"center"}>
<CommentOutlined />
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.commentCount}
</span>
</Flex>
<Flex vertical={false} align={"center"}>
<EyeOutlined
style={{ color: "gray" }}
/>{" "}
<span
style={{
fontSize: 12,
color: "gray",
}}>
{item.views}
</span>
</Flex>
</Flex>
</Flex>
</>
}
/>
</List.Item>
)}
/>
</Skeleton>
</ProCard> </ProCard>
</div> </div>
</> </>

View File

@@ -1,46 +1,37 @@
/** @format */ /** @format */
import { FunctionComponent, useEffect, useState } from "react"; import { FunctionComponent, useEffect, useState } from "react";
import { Avatar, Card, Empty, Flex, List, Skeleton } from "antd"; import { Avatar, Card, Empty, Flex, List, Skeleton } from "antd";
import { import { BankOutlined, BulbOutlined, EnvironmentOutlined } from "@ant-design/icons";
BankOutlined,
BulbOutlined,
EnvironmentOutlined,
} from "@ant-design/icons";
import styles from "./index.module.less"; import styles from "./index.module.less";
import { ProCard } from "@ant-design/pro-components"; import { ProCard } from "@ant-design/pro-components";
import Meta from "antd/es/card/Meta"; import Meta from "antd/es/card/Meta";
import { Link, useNavigate } from "react-router-dom"; import { Link, useNavigate } from "react-router-dom";
import { getAllStorage } from "@/api/oss"; import { getAllStorage } from "@/api/oss";
import StorageIcon from "@/constant/stroage-icon.ts"; import StorageIcon from "@/constant/stroage-icon.ts";
import { getUserInfoApi } from "@/api/user"; import { getRecentShare, getUserInfoApi } from "@/api/user";
import useStore from "@/utils/store/useStore.tsx"; import useStore from "@/utils/store/useStore.tsx";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
const UserInfo: FunctionComponent = observer(() => { const UserInfo: FunctionComponent = observer(() => {
const navigate = useNavigate(); const navigate = useNavigate();
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [loadingStorage, setLoadingStorage] = useState(true);
const [userStorage, setUserStorage] = useState([]); const [userStorage, setUserStorage] = useState([]);
const [recentShare, setRecentShare] = useState([]);
const [userInfo, setUserInfo] = useState<any>({} as any); const [userInfo, setUserInfo] = useState<any>({} as any);
const store = useStore("user"); const store = useStore("user");
const userId: any = store.getUserId(); const userId: any = store.getUserId();
const data = [
{
title: "Ant Design Title 1",
},
{
title: "Ant Design Title 2",
},
{
title: "Ant Design Title 3",
},
{
title: "Ant Design Title 4",
},
];
async function getUserStorage() { async function getUserStorage() {
const res: any = await getAllStorage(userId); const res: any = await getAllStorage(userId);
if (res && res.success && res.data) { if (res && res.success && res.data) {
setUserStorage(res.data); setUserStorage(res.data);
setLoadingStorage(false);
}
}
async function getUserRecentShare() {
const res: any = await getRecentShare(userId);
if (res && res.success && res.data) {
setRecentShare(res.data);
setLoading(false); setLoading(false);
} }
} }
@@ -53,6 +44,7 @@ const UserInfo: FunctionComponent = observer(() => {
useEffect(() => { useEffect(() => {
getUserInfo().then(); getUserInfo().then();
getUserStorage().then(); getUserStorage().then();
getUserRecentShare().then();
}, []); }, []);
return ( return (
<> <>
@@ -79,81 +71,92 @@ const UserInfo: FunctionComponent = observer(() => {
<div className={styles.user_info_center_content}> <div className={styles.user_info_center_content}>
<ProCard <ProCard
bordered bordered
style={{ maxWidth: "64%" }} style={{ maxWidth: "100%" }}
title="我的存储商" title="我的存储商"
boxShadow boxShadow
extra={<Link to={"/main/setting"}></Link>}> extra={<Link to={"/main/setting"}></Link>}>
<Flex vertical={false} align={"center"} justify={"space-between"} wrap={true}> <Flex vertical={false} align={"center"} justify={"space-between"} wrap={true}>
<Skeleton loading={loading} active> {userStorage && userStorage.length === 0 ? (
{userStorage.map((item: any, index: number) => { <Empty description={"暂无数据"}></Empty>
return ( ) : (
<> <>
<Card <Skeleton loading={loadingStorage} active>
key={index} {userStorage.map((item: any, index: number) => {
onClick={() => { return (
navigate(`/main/setting/${item.ossType}`); <div key={index}>
}} <Card
style={{ width: 350, marginTop: 16, marginLeft: 10 }} onClick={() => {
hoverable={true}> navigate(`/main/setting/${item.ossType}`);
<Meta }}
avatar={<Avatar src={StorageIcon[item.ossType]} />} style={{
title={item.name} width: 350,
description={ marginTop: 16,
<> marginLeft: 10,
<span> {item.configCount}</span> }}
<span style={{ marginLeft: 10 }}> hoverable={true}>
{item.bucketCount} <Meta
</span> avatar={
</> <Avatar
}></Meta> src={StorageIcon[item.ossType]}
</Card> />
</> }
); title={item.name}
})} description={
</Skeleton> <>
<span>
{" "}
{item.configCount}
</span>
<span style={{ marginLeft: 10 }}>
{item.bucketCount}
</span>
</>
}></Meta>
</Card>
</div>
);
})}
</Skeleton>
</>
)}
</Flex> </Flex>
</ProCard> </ProCard>
<ProCard bordered style={{ maxWidth: "34%" }} title="我的存储桶" boxShadow> {/*<ProCard bordered style={{ maxWidth: "34%" }} title="我的存储桶" boxShadow>*/}
<Skeleton loading={loading} active> {/* <Skeleton loading={loading} active>*/}
<Card style={{ width: 300, marginTop: 16 }} hoverable={true}> {/* <Card style={{ width: 300, marginTop: 16 }} hoverable={true}>*/}
<Meta {/* <Meta*/}
avatar={ {/* avatar={*/}
<Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=1" /> {/* <Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=1" />*/}
} {/* }*/}
title="Card title" {/* title="Card title"*/}
description="This is the description" {/* description="This is the description"*/}
/> {/* />*/}
</Card> {/* </Card>*/}
</Skeleton> {/* </Skeleton>*/}
</ProCard> {/*</ProCard>*/}
</div> </div>
<div className={styles.user_info_bottom_content}> <div className={styles.user_info_bottom_content}>
<ProCard <ProCard bordered style={{ maxWidth: "64%" }} title="最近动态" boxShadow>
bordered {recentShare && recentShare.length === 0 ? (
style={{ maxWidth: "64%" }} <Empty description={"暂无数据"}></Empty>
title="最近动态" ) : (
boxShadow <Skeleton loading={loading} active avatar>
extra={<Link to={"#"}></Link>}> <List
<Skeleton loading={loading} active avatar> itemLayout="horizontal"
<List dataSource={recentShare}
itemLayout="horizontal" renderItem={(item: any) => (
dataSource={data} <List.Item>
renderItem={(item, index) => ( <List.Item.Meta
<List.Item> avatar={<Avatar src={userInfo.avatar} />}
<List.Item.Meta title={item.title}
avatar={ description={item.date}
<Avatar />
src={`https://api.dicebear.com/7.x/miniavs/svg?seed=${index}`} </List.Item>
/> )}
} />
title={<a href="https://ant.design">{item.title}</a>} </Skeleton>
description="Ant Design, a design language for background applications, is refined by Ant UED Team" )}
/>
</List.Item>
)}
/>
</Skeleton>
</ProCard> </ProCard>
<ProCard bordered style={{ maxWidth: "34%" }} title="站内通知" boxShadow> <ProCard bordered style={{ maxWidth: "34%" }} title="站内通知" boxShadow>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>

View File

@@ -33,6 +33,7 @@ const UserSetting: FunctionComponent = observer(() => {
const userId: any = store.getUserId(); const userId: any = store.getUserId();
async function getUserInfo() { async function getUserInfo() {
getUserInfoApi(userId).then((res: any) => { getUserInfoApi(userId).then((res: any) => {
console.log(res);
if (res && res.success && res.data) { if (res && res.success && res.data) {
setUserInfo(res.data); setUserInfo(res.data);
setLoading(false); setLoading(false);
@@ -40,8 +41,8 @@ const UserSetting: FunctionComponent = observer(() => {
}); });
} }
type FieldType = { type FieldType = {
nickname?: string; nickName?: string;
location?: string; // location?: string;
introduce?: string; introduce?: string;
gender?: string; gender?: string;
company?: string; company?: string;
@@ -64,7 +65,7 @@ const UserSetting: FunctionComponent = observer(() => {
} }
const onFinish: FormProps<FieldType>["onFinish"] = (values) => { const onFinish: FormProps<FieldType>["onFinish"] = (values) => {
const data: any = { const data: any = {
userId: userId, id: userId,
...values, ...values,
}; };
updateUserInfo(data).then((res: any) => { updateUserInfo(data).then((res: any) => {
@@ -92,24 +93,22 @@ const UserSetting: FunctionComponent = observer(() => {
getUserInfo().then(); getUserInfo().then();
}, []); }, []);
const prefixSelector = ( const prefixSelector = (
<Form.Item name="prefix" noStyle> <Select style={{ width: 90 }}>
<Select style={{ width: 90 }}> <Select.Option value="https://">https://</Select.Option>
<Select.Option value="https://">https://</Select.Option> <Select.Option value="http://">http://</Select.Option>
<Select.Option value="http://">http://</Select.Option> </Select>
</Select>
</Form.Item>
); );
const ProFormText = (props: any) => { // const ProFormText = (props: any) => {
return ( // return (
<ProForm.Item {...props} style={{ height: "10px" }}> // <ProForm.Item {...props} style={{ height: "10px" }}>
<ProFormCascader // <ProFormCascader
request={async () => city} // request={async () => city}
width="md" // width="md"
name="location" // name="location"
disabled={disable}></ProFormCascader> // disabled={disable}></ProFormCascader>
</ProForm.Item> // </ProForm.Item>
); // );
}; // };
useEffect(() => {}, []); useEffect(() => {}, []);
const TabItems = [ const TabItems = [
{ {
@@ -142,7 +141,7 @@ const UserSetting: FunctionComponent = observer(() => {
{/*</Form.Item>*/} {/*</Form.Item>*/}
<Form.Item<FieldType> <Form.Item<FieldType>
label="昵称" label="昵称"
name="nickname" name="nickName"
rules={[ rules={[
{ {
type: "string", type: "string",
@@ -167,12 +166,12 @@ const UserSetting: FunctionComponent = observer(() => {
<Select.Option value="UNKNOWN"></Select.Option> <Select.Option value="UNKNOWN"></Select.Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item<FieldType> {/*<Form.Item<FieldType>*/}
label="地区" {/* label="地区"*/}
name="location" {/* name="location"*/}
rules={[{ required: true, message: "请输入地区!" }]}> {/* rules={[{ required: true, message: "请输入地区!" }]}>*/}
<ProFormText /> {/* <ProFormText />*/}
</Form.Item> {/*</Form.Item>*/}
<Form.Item<FieldType> label="公司" name="company"> <Form.Item<FieldType> label="公司" name="company">
<Input allowClear disabled={disable} /> <Input allowClear disabled={disable} />
</Form.Item> </Form.Item>
@@ -240,7 +239,7 @@ const UserSetting: FunctionComponent = observer(() => {
type="text" type="text"
onClick={async () => { onClick={async () => {
const data: any = { const data: any = {
userId: userId, id: userId,
password: password, password: password,
}; };
await updateUser(data); await updateUser(data);
@@ -264,7 +263,7 @@ const UserSetting: FunctionComponent = observer(() => {
type="text" type="text"
onClick={async () => { onClick={async () => {
const data: any = { const data: any = {
userId: userId, id: userId,
phone: phone, phone: phone,
}; };
await updateUser(data); await updateUser(data);
@@ -288,7 +287,7 @@ const UserSetting: FunctionComponent = observer(() => {
type="text" type="text"
onClick={async () => { onClick={async () => {
const data: any = { const data: any = {
userId: userId, id: userId,
email: email, email: email,
}; };
await updateUser(data); await updateUser(data);
@@ -323,14 +322,14 @@ const UserSetting: FunctionComponent = observer(() => {
<Flex vertical={true} justify={"flex-start"}> <Flex vertical={true} justify={"flex-start"}>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
<span style={{ color: "grey" }}></span> <span style={{ color: "grey" }}></span>
<span style={{ width: 130 }}>{userInfo.userName}</span> <span style={{ width: 200 }}>{userInfo.userName}</span>
</Flex> </Flex>
<Flex <Flex
vertical={false} vertical={false}
align={"center"} align={"center"}
style={{ marginTop: 20 }}> style={{ marginTop: 20 }}>
<span style={{ color: "grey" }}>ID</span> <span style={{ color: "grey" }}>ID</span>
<span style={{ width: 130 }}>{userInfo.id}</span> <span style={{ width: 200 }}>{userInfo.id}</span>
</Flex> </Flex>
</Flex> </Flex>
<Flex vertical={true} style={{ marginLeft: 50 }}> <Flex vertical={true} style={{ marginLeft: 50 }}>

View File

@@ -4,7 +4,7 @@ import Request from "./request";
const web: Request = new Request({ const web: Request = new Request({
baseURL: import.meta.env.VITE_APP_BASE_API, baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 10000, // timeout: 10000,
}); });
export default web; export default web;

View File

@@ -16,6 +16,8 @@ import { logout } from "@/api/user";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import useStore from "@/utils/store/useStore.tsx"; import useStore from "@/utils/store/useStore.tsx";
import { getUserMenuPermission } from "@/api/user"; import { getUserMenuPermission } from "@/api/user";
import { clearStorage, getStorageFromKey, removeStorageFromKey } from "@/utils/localStorage/config.ts";
import localforage from "localforage";
const Layout = () => { const Layout = () => {
const location = useLocation(); const location = useLocation();
@@ -75,7 +77,14 @@ const Layout = () => {
label: "退出登录", label: "退出登录",
onClick: () => { onClick: () => {
logout(store.getUserId()); logout(store.getUserId());
navigate("/login"); clearStorage();
store.setToken("");
store.setUserId("");
store.setAvatar("");
store.setNickName("");
setTimeout(() => {
navigate("/login");
}, 1000);
}, },
}, },
], ],

View File

@@ -115,7 +115,7 @@ export default observer(() => {
async function wechatLogin() { async function wechatLogin() {
createClientId().then((res: any) => { createClientId().then((res: any) => {
generateQRCode(res.data).then((response: any) => { generateQRCode(res.data).then((response: any) => {
if (response.success) { if (res && response.success && res.data) {
setQRCode(response.data.qrCodeUrl); setQRCode(response.data.qrCodeUrl);
setLoading(false); setLoading(false);
timerManager.add(() => { timerManager.add(() => {
@@ -180,8 +180,6 @@ export default observer(() => {
className={styles.mp_code_img} className={styles.mp_code_img}
// src={generateMpRegCodeData.data?.qrCodeUrl} // src={generateMpRegCodeData.data?.qrCodeUrl}
src={QRCode} src={QRCode}
fallback="data:image/png;base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0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="
/> />
</Spin> </Spin>
<Alert <Alert

View File

@@ -120,6 +120,7 @@ export default observer(() => {
store.setAvatar(res.data.user.avatar); store.setAvatar(res.data.user.avatar);
store.setNickName(res.data.user.nickName); store.setNickName(res.data.user.nickName);
setStorage("token", res.data.token, 24 * 60 * 30); setStorage("token", res.data.token, 24 * 60 * 30);
setStorage("userId", res.data.user.id, 24 * 60 * 30);
if (store.getToken() !== null || store.getUserId() !== null) { if (store.getToken() !== null || store.getUserId() !== null) {
setTimeout(() => { setTimeout(() => {
navigate("/main/home"); navigate("/main/home");
@@ -154,6 +155,7 @@ export default observer(() => {
store.setToken(res.data.token); store.setToken(res.data.token);
store.setUserId(res.data.user.id); store.setUserId(res.data.user.id);
setStorage("token", res.data.token, 24 * 60 * 30); setStorage("token", res.data.token, 24 * 60 * 30);
setStorage("userId", res.data.user.id, 24 * 60 * 30);
if (store.getToken() !== null || store.getUserId() !== null) { if (store.getToken() !== null || store.getUserId() !== null) {
setTimeout(() => { setTimeout(() => {
navigate("/main"); navigate("/main");
@@ -217,7 +219,7 @@ export default observer(() => {
async function wechatLogin() { async function wechatLogin() {
createClientId().then((res: any) => { createClientId().then((res: any) => {
generateQRCode(res.data).then((response: any) => { generateQRCode(res.data).then((response: any) => {
if (response.success) { if (res && response.success && res.data) {
setQRCode(response.data.qrCodeUrl); setQRCode(response.data.qrCodeUrl);
setLoading(false); setLoading(false);
timerManager.add(() => { timerManager.add(() => {
@@ -289,7 +291,6 @@ export default observer(() => {
className={styles.mp_code_img} className={styles.mp_code_img}
// src={generateMpRegCodeData.data?.qrCodeUrl} // src={generateMpRegCodeData.data?.qrCodeUrl}
src={QRCode} src={QRCode}
fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAE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IhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="
/> />
</Spin> </Spin>
<Alert <Alert

View File

@@ -125,7 +125,7 @@ export default observer(() => {
async function wechatLogin() { async function wechatLogin() {
createClientId().then((res: any) => { createClientId().then((res: any) => {
generateQRCode(res.data).then((response: any) => { generateQRCode(res.data).then((response: any) => {
if (response.success) { if (res && response.success && res.data) {
setQRCode(response.data.qrCodeUrl); setQRCode(response.data.qrCodeUrl);
setLoading(false); setLoading(false);
timerManager.add(() => { timerManager.add(() => {
@@ -184,7 +184,6 @@ export default observer(() => {
className={styles.mp_code_img} className={styles.mp_code_img}
// src={generateMpRegCodeData.data?.qrCodeUrl} // src={generateMpRegCodeData.data?.qrCodeUrl}
src={QRCode} src={QRCode}
fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEa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