diff --git a/src/api/share/index.ts b/src/api/share/index.ts index eb982ee..45a0e35 100644 --- a/src/api/share/index.ts +++ b/src/api/share/index.ts @@ -73,6 +73,19 @@ export const listComment = (detailId: any) => { }, }); }; +/** + * 分享圈详情热门评论列表 + * @param detailId + */ +export const listCommentHot = (detailId: any) => { + return web.request({ + url: `/share/share/comment/reply/listcommenthot`, + method: "get", + params: { + detailId: detailId, + }, + }); +}; /** * 分享圈详情回复列表 * @param commentId @@ -115,9 +128,22 @@ export const addReply = (data: any) => { export const returnAllCommentAndReplyCount = (detailId: any) => { return web.request({ url: `/share/share/comment/reply/returncount`, - method: "post", + method: "get", params: { detailId: detailId, }, }); }; +/** + * 获取我的分享圈列表 + * @param userId + */ +export const getMyShareList = (userId: any) => { + return web.request({ + url: `/share/share/detail/mydetail`, + method: "get", + params: { + userId: userId, + }, + }); +}; diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 01e2d04..f538213 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -8,7 +8,7 @@ import web from "@/utils/axios/web.ts"; */ export const oauthLogin = (type: string) => { return web.request({ - url: "/auth/auth/oauth/render/" + type, + url: "/auth/oauth/render/" + type, method: "get", }); }; diff --git a/src/components/Main/File/components/FileUpload.tsx b/src/components/Main/File/components/FileUpload.tsx index 3f20c18..599477d 100644 --- a/src/components/Main/File/components/FileUpload.tsx +++ b/src/components/Main/File/components/FileUpload.tsx @@ -1,17 +1,16 @@ /** @format */ -import React, { useEffect, useState } from "react"; -import { Avatar, Card, Flex, Input, message, Progress, Select, Upload } from "antd"; +import { useState } from "react"; +import { Avatar, Card, Flex, Input, message, Select, Upload } from "antd"; import { CloudUploadOutlined } from "@ant-design/icons"; import { ProCard } from "@ant-design/pro-components"; import StorageIcon from "@/constant/stroage-icon.ts"; import { getStorageBuckets, uploadFiles } from "@/api/oss"; import useStore from "@/utils/store/useStore.tsx"; -import axios from "axios"; const { Dragger } = Upload; -const FileUpload: React.FC = (props: any) => { +const FileUpload = (props: any) => { const [buckets, setBuckets] = useState([]); const store = useStore("file"); const [defaultFileList, setDefaultFileList] = useState([]); @@ -22,12 +21,12 @@ const FileUpload: React.FC = (props: any) => { } }); } - const handleOnChange = ({ fileList }) => { + const handleOnChange = ({ fileList }: { fileList: any }) => { setDefaultFileList(fileList); }; - const uploadFile = async (options) => { - const { onSuccess, onError, file, onProgress } = options; + const uploadFile = async (options: any) => { + const { onSuccess, onError, file }: { onSuccess: any; onError: any; file: any } = options; if ( store.getUploadFilePath() === null || (store.getUploadFileBucket() === null && store.getUploadFileStorage() === null) diff --git a/src/components/Main/File/index.tsx b/src/components/Main/File/index.tsx index c07dbb0..f2e48d0 100644 --- a/src/components/Main/File/index.tsx +++ b/src/components/Main/File/index.tsx @@ -64,7 +64,7 @@ const File: FunctionComponent = () => { const [loadingFile, setLoadingFile] = useState(true); const [open, setOpen] = useState(false); const [openRename, setOpenRename] = useState(false); - const [userStorage, setUserStorage] = useState([]); + const [userStorage, setUserStorage] = useState([] as any); const [buckets, setBuckets] = useState([]); const [newFileName, setNewFileName] = useState(null); const [disable, setDisable] = useState(true); diff --git a/src/components/Main/Settings/components/AliSettings.tsx b/src/components/Main/Settings/components/AliSettings.tsx index 8a43fa5..b7ab961 100644 --- a/src/components/Main/Settings/components/AliSettings.tsx +++ b/src/components/Main/Settings/components/AliSettings.tsx @@ -32,7 +32,7 @@ const AliSettings: React.FC = () => { const [openModal, setOpenModal] = useState(false); const [configs, setConfigs] = useState([]); const [loading, setLoading] = useState(true); - const [configDetail, setConfigDetail] = useState({}); + const [configDetail, setConfigDetail] = useState({} as any); const columns: ProColumns[] = [ { dataIndex: "index", diff --git a/src/components/Main/Settings/components/MinioSettings.tsx b/src/components/Main/Settings/components/MinioSettings.tsx index 13e9b1a..cfb331d 100644 --- a/src/components/Main/Settings/components/MinioSettings.tsx +++ b/src/components/Main/Settings/components/MinioSettings.tsx @@ -32,7 +32,7 @@ const MinioSettings: React.FC = () => { const [configs, setConfigs] = useState([]); const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(true); - const [configDetail, setConfigDetail] = useState({}); + const [configDetail, setConfigDetail] = useState({} as any); const columns: ProColumns[] = [ { dataIndex: "index", diff --git a/src/components/Main/Settings/components/QiniuSettings.tsx b/src/components/Main/Settings/components/QiniuSettings.tsx index 68ba251..2567b44 100644 --- a/src/components/Main/Settings/components/QiniuSettings.tsx +++ b/src/components/Main/Settings/components/QiniuSettings.tsx @@ -32,7 +32,7 @@ const QiniuSettings: React.FC = () => { const [config, setConfig] = useState([]); const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(true); - const [configDetail, setConfigDetail] = useState({}); + const [configDetail, setConfigDetail] = useState({} as any); const columns: ProColumns[] = [ { dataIndex: "index", diff --git a/src/components/Main/Settings/components/TencentSettings.tsx b/src/components/Main/Settings/components/TencentSettings.tsx index 2d9f118..6172d88 100644 --- a/src/components/Main/Settings/components/TencentSettings.tsx +++ b/src/components/Main/Settings/components/TencentSettings.tsx @@ -34,7 +34,7 @@ const TencentSettings: React.FC = () => { const [configs, setConfigs] = useState([]); const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(true); - const [configDetail, setConfigDetail] = useState({}); + const [configDetail, setConfigDetail] = useState({} as any); const columns: ProColumns[] = [ { dataIndex: "index", diff --git a/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx b/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx index fddd996..4653fdc 100644 --- a/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx +++ b/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx @@ -1,33 +1,41 @@ /** @format */ -import React, { useEffect, useRef } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { AiEditor } from "aieditor"; import "aieditor/dist/style.css"; import { useNavigate } from "react-router-dom"; -import "aieditor/dist/style.css"; import styles from "./index.module.less"; import { ProCard } from "@ant-design/pro-components"; +import type { ColorPickerProps } from "antd"; import { Button, Card, + Col, + ColorPicker, + Divider, Flex, Form, FormListFieldData, FormProps, Input, message, + Row, Select, + theme, } from "antd"; import { CloseOutlined, LeftOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; import selectOptions from "@/components/Main/Settings/settings.ts"; import { addShareDetail } from "@/api/share"; import useStore from "@/utils/store/useStore.tsx"; import { observer } from "mobx-react"; +import { cyan, generate, green, presetPalettes, red } from "@ant-design/colors"; + +type Presets = Required["presets"][number]; const ShareAdd: React.FunctionComponent = () => { const navigate = useNavigate(); const divRef = useRef(null); const [form] = Form.useForm(); - const [isDisabled, setIsDisabled] = React.useState(false); + const [isDisabled, setIsDisabled] = useState(false); const store = useStore("share"); const onFinish: FormProps["onFinish"] = (values) => { @@ -36,6 +44,7 @@ const ShareAdd: React.FunctionComponent = () => { userId: 32, ...values, }; + console.log(formData); addShareDetail(formData).then((res: any) => { if (res && res.success) { message @@ -54,6 +63,46 @@ const ShareAdd: React.FunctionComponent = () => { } }); }; + const genPresets = (presets: any = presetPalettes) => + Object.entries(presets).map(([label, colors]: [label: any, colors: any]) => ({ + label, + colors, + })); + + const HorizontalLayoutDemo = () => { + const { token } = theme.useToken(); + + const presets = genPresets({ + primary: generate(token.colorPrimary), + red, + green, + cyan, + }); + + const customPanelRender: ColorPickerProps["panelRender"] = ( + _, + { components: { Picker, Presets } }, + ) => ( + + + + + + + + + + ); + + return ( + + ); + }; useEffect(() => { if (divRef.current) { const aiEditor = new AiEditor({ @@ -104,7 +153,11 @@ const ShareAdd: React.FunctionComponent = () => {
-
+ @@ -160,7 +213,7 @@ const ShareAdd: React.FunctionComponent = () => { if (!tags) { return Promise.reject(new Error("请至少填写一个标签")); } - if (tags.length > 3) { + if (tags.length >= 4) { setIsDisabled(true); return Promise.reject( new Error("最多只能添加三个标签"), @@ -172,35 +225,49 @@ const ShareAdd: React.FunctionComponent = () => { {(fields: FormListFieldData[], { add, remove }, { errors }) => ( <> {fields.map((field: FormListFieldData, index: number) => ( - -

{"标签" + (index + 1)}

- - } - key={index} - id={"tags"}> + - + required={true} + label={ + <> +

{"标签" + (index + 1)}

+ + } + key={index} + id={"tags"}> + + + + + + + + + {fields.length > 0 ? ( + { + setIsDisabled(false); + remove(field.name); + }} + /> + ) : null} +
- {fields.length > 0 ? ( - { - setIsDisabled(false); - remove(field.name); - }} - /> - ) : null} -
+ ))} +
+ + + + + ( - + header={ + <> +

分享列表

+ + } + renderItem={(item: any) => ( + } + avatar={} title={ - <> - { - navigate("/main/share/detail/1"); - }}> - {item.name.last} - - - IDM - - + + + {item.title} + + {item.tags && + Array.from(item.tags).map( + (tag: any, index: number) => { + return ( + + + {tag.tagName} + + + ); + }, + )} + } description={ <> @@ -86,45 +98,67 @@ export default () => { vertical={false} justify={"space-between"} align={"center"}> - {item.email} + {item.description} - - - landaiqing - - - - 1024 - - - - 1024 - - {" "} - - 1024 - + style={{ width: "300px" }}> + + + + {item.nickname} + + + + + + {item.likesCount} + + + + + + {item.commentCount} + + + + {" "} + + {item.views} + + } /> - {/*
Content
*/}
)} /> - +
diff --git a/src/components/Main/User/UserInfo/index.tsx b/src/components/Main/User/UserInfo/index.tsx index 8d3f7a3..b168a61 100644 --- a/src/components/Main/User/UserInfo/index.tsx +++ b/src/components/Main/User/UserInfo/index.tsx @@ -2,7 +2,6 @@ import { FunctionComponent, useEffect, useState } from "react"; import { Avatar, Card, Empty, Flex, List, Skeleton } from "antd"; import { - AntDesignOutlined, BankOutlined, BulbOutlined, EnvironmentOutlined, @@ -13,12 +12,13 @@ import Meta from "antd/es/card/Meta"; import { Link, useNavigate } from "react-router-dom"; import { getAllStorage } from "@/api/oss"; import StorageIcon from "@/constant/stroage-icon.ts"; +import { getUserInfoApi } from "@/api/user"; const UserInfo: FunctionComponent = () => { const navigate = useNavigate(); const [loading, setLoading] = useState(true); const [userStorage, setUserStorage] = useState([]); - // const [userInfo, setUserInfo] = useState({} as any); + const [userInfo, setUserInfo] = useState({} as any); const data = [ { title: "Ant Design Title 1", @@ -40,14 +40,14 @@ const UserInfo: FunctionComponent = () => { setLoading(false); } } - // const getUserInfo = async () => { - // const res = await getUserInfoApi("9"); - // if (res && res.success && res.data) { - // setUserInfo(res.data); - // } - // }; + const getUserInfo = async () => { + const res = await getUserInfoApi("17"); + if (res && res.success && res.data) { + setUserInfo(res.data); + } + }; useEffect(() => { - // getUserInfo().then(); + getUserInfo().then(); getUserStorage().then(); }, []); return ( @@ -56,18 +56,18 @@ const UserInfo: FunctionComponent = () => {
} + src={userInfo.avatar} /> - 用户名 + {userInfo.nickName}
- 前端架构师 + {userInfo.introduce || "-------"}
- 成都 + {userInfo.location || "-------"}
- 成都市上城 + {userInfo.company || "-------"}
diff --git a/src/components/Main/User/UserSetting/index.tsx b/src/components/Main/User/UserSetting/index.tsx index 77bca98..60ca179 100644 --- a/src/components/Main/User/UserSetting/index.tsx +++ b/src/components/Main/User/UserSetting/index.tsx @@ -1,12 +1,9 @@ /** @format */ import { FunctionComponent, useEffect, useState } from "react"; import { ProCard, ProForm, ProFormCascader } from "@ant-design/pro-components"; -import { AntDesignOutlined } from "@ant-design/icons"; import { Avatar, Button, - Descriptions, - DescriptionsProps, Flex, Form, FormProps, @@ -14,42 +11,26 @@ import { Select, Skeleton, Space, - Tabs, + Tabs, Tag } from "antd"; import styles from "./index.module.less"; import TextArea from "antd/es/input/TextArea"; import { city } from "@/constant/five-level-address.ts"; +import { getUserInfoApi } from "@/api/user"; const UserSetting: FunctionComponent = () => { const [disable, setDisable] = useState(true); const [loading, setLoading] = useState(true); - const items: DescriptionsProps["items"] = [ - { - key: "1", - label: "用户名", - children: "Zhou Maomao", - }, - { - key: "2", - label: "账号ID", - children: "1810000000", - }, - { - key: "3", - label: "注册时间", - children: "Hangzhou, Zhejiang", - }, - { - key: "4", - label: "邮箱", - children: "landaiqing@126.com", - }, - { - key: "5", - label: "手机号", - children: "13333333333333", - }, - ]; + const [userInfo, setUserInfo] = useState({} as any); + async function getUserInfo() { + getUserInfoApi("17").then((res: any) => { + console.log(res); + if (res && res.success && res.data) { + setUserInfo(res.data); + setLoading(false); + } + }); + } type FieldType = { email?: string; nickname?: string; @@ -66,7 +47,9 @@ const UserSetting: FunctionComponent = () => { const onFinishFailed: FormProps["onFinishFailed"] = (errorInfo) => { console.log("Failed:", errorInfo); }; - + useEffect(() => { + getUserInfo().then(); + }, []); const prefixSelector = ( + + 登录密码: + + + + - 安全手机:1333333333333333 + + 安全手机: + + + + + - 安全邮箱:landaiqing@126.com + + 安全邮箱: + + + + + @@ -233,14 +228,41 @@ const UserSetting: FunctionComponent = () => {
} + src={userInfo.avatar} /> - + + + + 用户名: + {userInfo.userName} + + + 账号ID: + {userInfo.id} + + + + + 邮 箱: + {userInfo.email || "---------"} + + + 手机号: + {userInfo.phone || "---------"} + + + + + 注册时间: + {userInfo.createdTime} + + + 状 态: + {userInfo.status===0 ? 正常:禁用} + + +