Skip to content

Let's use AI to Earn!

feat: 首页UI优化

gaoSir5627fd7a40b1
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
index 37d334b3..9bcfa17a 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
@@ -233,6 +233,7 @@
margin-top: 10px;
li {
display: flex;
+ align-items: center;
justify-content: center;
flex-direction: column;
white-space: nowrap;
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx
new file mode 100644
index 00000000..229718cc
--- /dev/null
+++ b/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx
@@ -0,0 +1,82 @@
+import { ForwardedRef, forwardRef, memo, useState } from "react";
+import styles from "@/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss";
+import { Button, Modal } from "antd";
+import { deleteAccountsApi } from "@/api/account";
+import AvatarPlat from "@/components/AvatarPlat";
+import { SocialAccount } from "@/api/types/account.type";
+
+export interface IDeleteUserConfirmModalRef {}
+
+export interface IDeleteUserConfirmModalProps {
+ open: boolean;
+ onClose: () => void;
+ onDeleteSuccess: () => void;
+ deleteUsers: SocialAccount[];
+}
+
+const DeleteUserConfirmModal = memo(
+ forwardRef(
+ (
+ {
+ open,
+ onClose,
+ deleteUsers,
+ onDeleteSuccess,
+ }: IDeleteUserConfirmModalProps,
+ ref: ForwardedRef<IDeleteUserConfirmModalRef>,
+ ) => {
+ const [deleteLoading, setDeleteLoading] = useState(false);
+
+ return (
+ <Modal
+ open={open}
+ title="删除提示"
+ width={500}
+ zIndex={1002}
+ rootClassName={styles.userManageDeleteHitModal}
+ footer={
+ <>
+ <Button onClick={() => onClose()}>取消</Button>
+ <Button
+ type="primary"
+ loading={deleteLoading}
+ onClick={async () => {
+ setDeleteLoading(true);
+ const res = await deleteAccountsApi(
+ deleteUsers.map((v) => v.id),
+ );
+ setDeleteLoading(false);
+ if (!res) return setDeleteLoading(false);
+ onDeleteSuccess();
+ onClose();
+ }}
+ >
+ 确认
+ </Button>
+ </>
+ }
+ >
+ <p>
+ 是否删除以下
+ <span style={{ color: "var(--errerColor)" }}>
+ {deleteUsers.length}
+ </span>
+ 个账号?
+ </p>
+ <div className={styles["userManageDeleteHitModal-users"]}>
+ {deleteUsers.map((v) => {
+ return (
+ <li key={v.id}>
+ <AvatarPlat account={v} size="large" />
+ <span>{v.nickname}</span>
+ </li>
+ );
+ })}
+ </div>
+ </Modal>
+ );
+ },
+ ),
+);
+
+export default DeleteUserConfirmModal;
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
index 57fc324e..904e9a94 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
@@ -40,6 +40,7 @@ import { deleteAccountsApi, updateAccountApi } from "@/api/account";
import { useTransClient } from "@/app/i18n/client";
import AddAccountModal from "../AddAccountModal";
import { getIpLocation, IpLocationInfo, formatLocationInfo, extractCountry } from "@/utils/ipLocation";
+import DeleteUserConfirmModal from "@/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal";
export interface IUserManageModalRef {
setActiveGroup: (groupId: string) => void;
@@ -79,13 +80,13 @@ const UserGroupSelect = ({
};
// 空间信息展示组件
-const SpaceInfoCard = ({
- activeGroup,
- accountGroupList,
- allUser
-}: {
- activeGroup: string;
- accountGroupList: any[];
+const SpaceInfoCard = ({
+ activeGroup,
+ accountGroupList,
+ allUser
+}: {
+ activeGroup: string;
+ accountGroupList: any[];
allUser: string;
}) => {
const { t } = useTransClient("account");
@@ -120,9 +121,9 @@ const SpaceInfoCard = ({
if (!currentSpace) return null;
return (
- <Card
- size="small"
- style={{
+ <Card
+ size="small"
+ style={{
marginBottom: '16px',
backgroundColor: 'var(--grayColor1)',
border: '1px solid var(--grayColor3)'
@@ -130,8 +131,8 @@ const SpaceInfoCard = ({
>
<Space direction="vertical" size="small" style={{ width: '100%' }}>
{/* <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
- <span style={{
- fontSize: 'var(--fs-xs)',
+ <span style={{
+ fontSize: 'var(--fs-xs)',
color: 'var(--grayColor6)',
backgroundColor: 'var(--grayColor2)',
padding: '2px 8px',
@@ -140,13 +141,13 @@ const SpaceInfoCard = ({
{currentSpace.children?.length || 0} 个账号
</span>
</div> */}
-
+
{/* 根据proxyIp判断显示IP和属地信息 */}
{(!currentSpace.proxyIp || currentSpace.proxyIp === "") ? (
// 本地IP显示
- <div style={{
- display: 'flex',
- alignItems: 'center',
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
gap: '8px',
padding: '8px',
backgroundColor: 'var(--grayColor2)',
@@ -162,7 +163,7 @@ const SpaceInfoCard = ({
</span>
) : ipLocationInfo ? (
<Tooltip title={t("ipInfo.tooltip", { asn: ipLocationInfo.asn, org: ipLocationInfo.org })}>
- <span style={{
+ <span style={{
color: 'var(--grayColor7)',
cursor: 'help',
fontWeight: '500'
@@ -179,9 +180,9 @@ const SpaceInfoCard = ({
) : (
// 数据中的IP显示
currentSpace.ip && currentSpace.location && (
- <div style={{
- display: 'flex',
- alignItems: 'center',
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
gap: '8px',
padding: '8px',
backgroundColor: 'var(--grayColor2)',
@@ -189,7 +190,7 @@ const SpaceInfoCard = ({
}}>
<GlobalOutlined style={{ color: 'var(--colorPrimary5)' }} />
<Tooltip title={`IP: ${currentSpace.ip}\n位置: ${currentSpace.location}`}>
- <span style={{
+ <span style={{
color: 'var(--grayColor7)',
cursor: 'help',
fontWeight: '500'
@@ -200,10 +201,10 @@ const SpaceInfoCard = ({
</div>
)
)}
-
+
{/* 空间创建时间等信息 */}
- <div style={{
- fontSize: 'var(--fs-xs)',
+ <div style={{
+ fontSize: 'var(--fs-xs)',
color: 'var(--grayColor6)',
display: 'flex',
alignItems: 'center',
@@ -212,7 +213,7 @@ const SpaceInfoCard = ({
<EnvironmentOutlined />
<span>空间ID: {currentSpace.id}</span>
{currentSpace.isDefault && (
- <span style={{
+ <span style={{
color: 'var(--colorPrimary5)',
backgroundColor: 'var(--colorPrimary1)',
padding: '1px 6px',
@@ -408,7 +409,7 @@ const UserManageModal = memo(
};
useImperativeHandle(ref, () => imperativeHandle);
- const openAddAccountFlow = async () => {
+ const openAddAccountFlow = async () => {
const currentGroupId = activeGroup;
close();
if (currentGroupId === allUser.current) {
@@ -459,54 +460,16 @@ const UserManageModal = memo(
return (
<>
- <Modal
+ <DeleteUserConfirmModal
+ deleteUsers={selectedRows}
open={deleteHitOpen}
- title="删除提示"
- width={500}
- zIndex={1002}
- rootClassName={styles.userManageDeleteHitModal}
- footer={
- <>
- <Button onClick={() => setDeleteHitOpen(false)}>取消</Button>
- <Button
- type="primary"
- loading={deleteLoading}
- onClick={async () => {
- setDeleteLoading(true);
- const res = await deleteAccountsApi(
- selectedRows.map((v) => v.id),
- );
- if (!res) return setDeleteLoading(false);
- await getAccountList();
- setDeleteHitOpen(false);
- setSelectedRows([]);
- message.success("删除成功");
- setDeleteLoading(false);
- }}
- >
- 确认
- </Button>
- </>
- }
- >
- <p>
- 是否删除以下
- <span style={{ color: "var(--errerColor)" }}>
- {selectedRows.length}
- </span>
- 个账号?
- </p>
- <div className={styles["userManageDeleteHitModal-users"]}>
- {selectedRows.map((v) => {
- return (
- <li key={v.id}>
- <AvatarPlat account={v} size="large" />
- <span>{v.nickname}</span>
- </li>
- );
- })}
- </div>
- </Modal>
+ onClose={() => setDeleteHitOpen(false)}
+ onDeleteSuccess={async () => {
+ await getAccountList();
+ setSelectedRows([]);
+ message.success("删除成功");
+ }}
+ />
<Modal
open={open}
@@ -530,12 +493,12 @@ const UserManageModal = memo(
<div className="userManage-content">
{/* 空间信息卡片 - 显示在右侧上方 */}
- <SpaceInfoCard
+ <SpaceInfoCard
activeGroup={activeGroup}
accountGroupList={accountGroupList}
allUser={allUser.current}
/>
-
+
<div className="userManage-content-head" style={{ marginBottom: "8px", display: "flex", justifyContent: "flex-end" }}>
<Button type="primary" onClick={openAddAccountFlow}>{t("addAccount")}</Button>
</div>
diff --git a/src/app/[lng]/page.tsx b/src/app/[lng]/page.tsx
index 1da61694..fd06bde0 100644
--- a/src/app/[lng]/page.tsx
+++ b/src/app/[lng]/page.tsx
@@ -984,7 +984,7 @@ function UpcomingFeaturesSection() {
</div>
</div>
- <div className={styles.buildRight}>
+ <div className={styles.buildRight} style={{ minHeight: '500px' }}>
<div className={styles.imageCarousel}>
<div className={styles.carouselContainer}>
<div className={`${styles.carouselSlide} ${styles.active}`}>
diff --git a/src/app/[lng]/styles/difyHome.module.scss b/src/app/[lng]/styles/difyHome.module.scss
index 4ebaca06..d2a98ce4 100644
--- a/src/app/[lng]/styles/difyHome.module.scss
+++ b/src/app/[lng]/styles/difyHome.module.scss
@@ -68,6 +68,13 @@
justify-content: space-between;
}
+.headerRight {
+ @media (max-width: 768px) {
+ display: flex;
+ justify-content: right;
+ }
+}
+
.logo {
display: flex;
flex-direction: row;
@@ -503,6 +510,10 @@
opacity: 0.3;
}
}
+
+ @media (max-width: 768px) {
+ padding: 40px 0;
+ }
}
// 脉冲动画
@@ -546,6 +557,21 @@
}
@media (max-width: 768px) {
+ grid-template-columns: 1fr; // 单列上下布局
+ gap: 40px;
+ min-height: auto;
+ }
+}
+
+// 保证左右区块在移动端占满宽度
+@media (max-width: 768px) {
+ .buildLeft,
+ .buildRight {
+ width: 100%;
+ min-height: 400px;
+ img {
+ max-width: 100%;
+ }
}
}
@@ -686,6 +712,10 @@
padding: 120px 0;
overflow: hidden;
position: relative;
+
+ @media (max-width: 768px) {
+ padding: 40px 0;
+ }
}
.downloadContainer {
@@ -724,6 +754,10 @@
display: flex;
gap: 16px;
flex-wrap: wrap;
+
+ @media (max-width: 768px) {
+ justify-content: center;
+ }
}
.downloadBtn {
@@ -1439,6 +1473,10 @@
justify-content: space-between;
align-items: center;
font-size: 15px;
+
+ @media (max-width: 768px) {
+ position: static;
+ }
}
.copyright {
@@ -1509,6 +1547,9 @@
background-clip: text;
-webkit-background-clip: text;
transition: color 0.1s ease;
+ @media (max-width: 748px) {
+ margin-left: 20px !important;
+ }
}
@media (max-width: 1024px) {
@@ -1732,9 +1773,9 @@
}
.carouselSlide {
- //position: absolute;
- //top: 0;
- //right: 0;
+ position: absolute;
+ top: 0;
+ right: 0;
width: 100%;
height: 100%;
opacity: 0;
@@ -1746,6 +1787,17 @@
&.active {
opacity: 1;
}
+
+ @media (max-width: 768px) {
+ display: flex;
+ justify-content: center;
+ img {
+ height: 100%;
+ }
+ video {
+ height: 100%;
+ }
+ }
}
.carouselImage {
@@ -1905,7 +1957,7 @@
}
}
-// 即将上线功能模块样式
+// 即将上线功能��块样式
.comingSoonPlaceholder {
display: flex;
flex-direction: column;