Skip to content

Let's use AI to Earn!

fix(web): Overview This update primarily optimizes homepage loading performance, restructures the navigation, and improves the error handling of the popular content interface (#337)

布莱恩·奥夫托·杰森张3d7c142a2f92
diff --git a/project/web/src/api/monitoring.ts b/project/web/src/api/monitoring.ts
index baa97459..4749ae95 100644
--- a/project/web/src/api/monitoring.ts
+++ b/project/web/src/api/monitoring.ts
@@ -33,6 +33,8 @@ export interface PostDetail {
likeCount: number
forwardCount: number
collectCount: number
+ author?: string
+ avatar?: string
}
// 增量数据
@@ -71,6 +73,7 @@ export interface NoteMonitoringListItem {
createdAt: string
updatedAt: string
error?: string
+ postDetail?: PostDetail
}
// 监控详情(包含完整信息)
@@ -92,7 +95,7 @@ export interface NoteMonitoringListResponse {
}
export interface GetNoteMonitoringListParams {
- platform: string
+ platform?: string
page?: number
pageSize?: number
}
diff --git a/project/web/src/app/[lng]/data-monitoring/[id]/detailPage.module.scss b/project/web/src/app/[lng]/data-monitoring/[id]/detailPage.module.scss
index 963bf01c..e4db50a0 100644
--- a/project/web/src/app/[lng]/data-monitoring/[id]/detailPage.module.scss
+++ b/project/web/src/app/[lng]/data-monitoring/[id]/detailPage.module.scss
@@ -88,18 +88,46 @@
:global(.ant-image) {
display: block;
}
+
+ .mediaContent {
+ width: 500px;
+ // width: 100%;
+ height: auto;
+ min-height: 500px;
+ display: block;
+ }
}
.noteDetails {
flex: 1;
min-width: 0;
+ .authorInfo {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+ padding-bottom: 16px;
+ border-bottom: 1px solid #f0f0f0;
+
+ .authorAvatar {
+ flex-shrink: 0;
+ }
+
+ .authorName {
+ font-size: 16px;
+ font-weight: 500;
+ color: #262626;
+ }
+ }
+
.noteTitle {
font-size: 20px;
font-weight: 600;
color: #1a1a1a;
margin: 0 0 12px 0;
line-height: 1.4;
+ word-break: break-word;
}
.noteTags {
diff --git a/project/web/src/app/[lng]/data-monitoring/[id]/page.tsx b/project/web/src/app/[lng]/data-monitoring/[id]/page.tsx
index aab5d263..305f8457 100644
--- a/project/web/src/app/[lng]/data-monitoring/[id]/page.tsx
+++ b/project/web/src/app/[lng]/data-monitoring/[id]/page.tsx
@@ -6,7 +6,7 @@ import {
StarOutlined,
CommentOutlined,
} from '@ant-design/icons'
-import { Card, Image, message, Spin, Table, Tag } from 'antd'
+import { Avatar, Card, Image, message, Spin, Table, Tag } from 'antd'
import type { ColumnsType } from 'antd/es/table'
import { useParams, useRouter } from 'next/navigation'
import { useEffect, useState } from 'react'
@@ -33,6 +33,7 @@ export default function MonitoringDetailPage() {
const [loading, setLoading] = useState(true)
const [detail, setDetail] = useState<NoteMonitoringItem | null>(null)
+ const [coverError, setCoverError] = useState(false)
// 加载监测详情
const loadDetail = async () => {
@@ -187,20 +188,53 @@ export default function MonitoringDetailPage() {
{/* 笔记信息 */}
<Card className={styles.noteCard}>
<div className={styles.noteContent}>
- {detail.postDetail?.cover && (
+ {(detail.postDetail?.cover || detail.postDetail?.url) && (
<div className={styles.noteImage}>
- <Image
- src={detail.postDetail.cover}
- alt={detail.postDetail.title || t('detail.noteCover')}
- width={500}
- height={500}
- style={{ objectFit: 'cover', borderRadius: '8px' }}
- />
+ {coverError && detail.postDetail?.url ? (
+ detail.postDetail.mediaType === 'video' ? (
+ <video
+ src={detail.postDetail.url}
+ controls
+ className={styles.mediaContent}
+ style={{ borderRadius: '8px' }}
+ >
+ Your browser does not support the video tag.
+ </video>
+ ) : (
+ <img
+ src={detail.postDetail.url}
+ alt={detail.postDetail.title || t('detail.noteCover')}
+ className={styles.mediaContent}
+ style={{ objectFit: 'cover', borderRadius: '8px', width: '100%', height: 'auto' }}
+ />
+ )
+ ) : detail.postDetail?.cover ? (
+ <Image
+ src={detail.postDetail.cover}
+ alt={detail.postDetail.title || t('detail.noteCover')}
+ width={500}
+ height={500}
+ style={{ objectFit: 'cover', borderRadius: '8px' }}
+ onError={() => setCoverError(true)}
+ />
+ ) : null}
</div>
)}
<div className={styles.noteDetails}>
+ {detail.postDetail?.author && (
+ <div className={styles.authorInfo}>
+ <Avatar
+ src={detail.postDetail.avatar}
+ size={40}
+ className={styles.authorAvatar}
+ >
+ {detail.postDetail.author.charAt(0)}
+ </Avatar>
+ <span className={styles.authorName}>{detail.postDetail.author}</span>
+ </div>
+ )}
<h2 className={styles.noteTitle}>
- {detail.postDetail?.title || t('list.untitled')}
+ {detail.postDetail?.title || detail.postDetail?.desc || t('list.untitled')}
</h2>
<div className={styles.noteTags}>
{detail.link && (
diff --git a/project/web/src/app/[lng]/data-monitoring/dataMonitoring.module.scss b/project/web/src/app/[lng]/data-monitoring/dataMonitoring.module.scss
index ce133afc..050b28c1 100644
--- a/project/web/src/app/[lng]/data-monitoring/dataMonitoring.module.scss
+++ b/project/web/src/app/[lng]/data-monitoring/dataMonitoring.module.scss
@@ -1,7 +1,9 @@
.dataMonitoringPage {
padding: 24px;
- background-color: #f5f5f5;
+ width: 100%;
min-height: calc(100vh - 64px);
+ max-width: 1920px;
+ margin: 0 auto;
.pageHeader {
display: flex;
@@ -9,9 +11,9 @@
gap: 16px;
margin-bottom: 24px;
padding: 24px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
border-radius: 12px;
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
+ box-shadow: 0 4px 12px rgba(166, 106, 228, 0.15);
.headerIcon {
font-size: 48px;
@@ -53,14 +55,14 @@
&.ant-tabs-tab-active {
.ant-tabs-tab-btn {
- color: #667eea;
+ color: #a66ae4;
font-weight: 600;
}
}
}
.ant-tabs-ink-bar {
- background: #667eea;
+ background: #a66ae4;
}
}
}
@@ -71,6 +73,117 @@
}
}
+ .filterSection {
+ margin-bottom: 24px;
+ padding: 0 24px;
+
+ .filterCard {
+ border-radius: 12px;
+ box-shadow: 0 2px 8px rgba(166, 106, 228, 0.1);
+ border: 1px solid rgba(166, 106, 228, 0.1);
+ }
+
+ .filterContent {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+
+ .filterLabel {
+ font-size: 14px;
+ font-weight: 500;
+ color: #666;
+ white-space: nowrap;
+ }
+
+ .filterSelect {
+ :global(.ant-select-selector) {
+ border-color: rgba(166, 106, 228, 0.3);
+
+ &:hover {
+ border-color: #a66ae4;
+ }
+ }
+
+ :global(.ant-select-focused .ant-select-selector) {
+ border-color: #a66ae4;
+ box-shadow: 0 0 0 2px rgba(166, 106, 228, 0.1);
+ }
+ }
+ }
+ }
+
+ .addFormSection {
+ margin-bottom: 24px;
+ padding: 0 24px;
+
+ .addFormCard {
+ border-radius: 12px;
+ box-shadow: 0 2px 8px rgba(166, 106, 228, 0.1);
+ border: 1px solid rgba(166, 106, 228, 0.1);
+ }
+
+ .addForm {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+
+ .platformSelect {
+ flex-shrink: 0;
+
+ .platformSelectInput {
+ :global(.ant-select-selector) {
+ border-color: rgba(166, 106, 228, 0.3);
+
+ &:hover {
+ border-color: #a66ae4;
+ }
+ }
+
+ :global(.ant-select-focused .ant-select-selector) {
+ border-color: #a66ae4;
+ box-shadow: 0 0 0 2px rgba(166, 106, 228, 0.1);
+ }
+ }
+
+ .platformOption {
+ display: flex;
+ align-items: center;
+ }
+ }
+
+ .linkInput {
+ flex: 1;
+
+ :global(.ant-input-affix-wrapper) {
+ border-color: rgba(166, 106, 228, 0.3);
+
+ &:hover {
+ border-color: #a66ae4;
+ }
+ }
+
+ :global(.ant-input-affix-wrapper-focused) {
+ border-color: #a66ae4;
+ box-shadow: 0 0 0 2px rgba(166, 106, 228, 0.1);
+ }
+ }
+
+ .addButton {
+ flex-shrink: 0;
+ min-width: 100px;
+ height: 40px;
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
+ border: none;
+ border-radius: 8px;
+ font-weight: 500;
+
+ &:hover {
+ background: linear-gradient(135deg, #9556d3 0%, #7239a8 100%);
+ }
+ }
+ }
+ }
+
.addSection {
display: flex;
justify-content: center;
@@ -89,13 +202,13 @@
transition: all 0.3s ease;
&:hover {
- border-color: #667eea;
- background: #f0f2ff;
+ border-color: #a66ae4;
+ background: #faf0ff;
}
.addIcon {
font-size: 48px;
- color: #667eea;
+ color: #a66ae4;
}
.addTitle {
@@ -109,12 +222,12 @@
min-width: 120px;
height: 40px;
font-size: 16px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
border: none;
border-radius: 8px;
&:hover {
- background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
+ background: linear-gradient(135deg, #9556d3 0%, #7239a8 100%);
}
&:disabled {
@@ -142,10 +255,26 @@
border-radius: 12px;
overflow: hidden;
transition: all 0.3s ease;
+ height: 280px;
+ display: flex;
+ flex-direction: column;
&:hover {
transform: translateY(-4px);
- box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
+ box-shadow: 0 8px 24px rgba(166, 106, 228, 0.15);
+ }
+
+ :global(.ant-card-body) {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ padding: 16px;
+ overflow: hidden;
+ }
+
+ :global(.ant-card-actions) {
+ margin-top: auto;
+ flex-shrink: 0;
}
.coverWrapper {
@@ -164,9 +293,35 @@
display: flex;
justify-content: space-between;
align-items: flex-start;
- margin-bottom: 16px;
+ margin-bottom: 12px;
padding-bottom: 12px;
border-bottom: 1px solid #f0f0f0;
+ flex-shrink: 0;
+
+ .cardHeaderLeft {
+ flex: 1 1 auto;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ min-width: 0;
+
+ .authorInfo {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 4px;
+
+ .authorAvatar {
+ flex-shrink: 0;
+ }
+
+ .authorName {
+ font-size: 14px;
+ font-weight: 500;
+ color: #666;
+ }
+ }
+ }
.noteTitle {
margin: 0;
@@ -177,10 +332,13 @@
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
- -webkit-line-clamp: 2;
+ -webkit-line-clamp: 3;
-webkit-box-orient: vertical;
line-height: 1.5;
- max-height: 3em;
+ word-break: break-word;
+ word-wrap: break-word;
+ overflow-wrap: break-word;
+ min-height: 0;
}
.headerRight {
@@ -194,7 +352,7 @@
.platform {
padding: 4px 12px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
color: #fff;
font-size: 12px;
border-radius: 12px;
@@ -230,13 +388,33 @@
.errorMessage {
margin: 12px 0;
+ padding: 12px 0;
+ word-break: break-word;
+ word-wrap: break-word;
+ overflow-wrap: break-word;
+ max-width: 100%;
+ flex-shrink: 0;
+
+ :global(.ant-tag) {
+ max-width: 100%;
+ white-space: normal;
+ word-break: break-word;
+ word-wrap: break-word;
+ overflow-wrap: break-word;
+ }
}
.cardFooter {
display: flex;
justify-content: space-between;
padding-top: 12px;
- border-top: 1px solid #f0f0f0;
+ margin-top: auto;
+ flex-shrink: 0;
+
+ &.cardFooterNoError {
+ margin-top: auto;
+ padding-top: 12px;
+ }
.createTime,
.updateTime {
@@ -262,29 +440,6 @@
min-height: 400px;
}
- .addModalContent {
- padding: 16px 0;
-
- .modalDesc {
- margin-bottom: 16px;
- font-size: 14px;
- color: #666;
- }
-
- :global {
- .ant-input-affix-wrapper {
- border-radius: 8px;
- padding: 12px 16px;
-
- &:hover,
- &:focus,
- &.ant-input-affix-wrapper-focused {
- border-color: #667eea;
- box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
- }
- }
- }
- }
// 详情弹窗样式
.detailLoading {
@@ -343,17 +498,17 @@
}
}
- .statsSection {
+ .statsSection {
margin-bottom: 24px;
padding: 20px;
- background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
+ background: linear-gradient(135deg, rgba(166, 106, 228, 0.08) 0%, rgba(129, 77, 189, 0.08) 100%);
border-radius: 12px;
h4 {
margin: 0 0 16px;
font-size: 18px;
font-weight: 600;
- color: #667eea;
+ color: #a66ae4;
}
.statsGrid {
@@ -378,7 +533,7 @@
font-size: 24px;
font-weight: 700;
color: #333;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
@@ -418,12 +573,12 @@
}
}
- .historyItem {
+ .historyItem {
padding: 16px;
margin-bottom: 12px;
background: #fafafa;
border-radius: 8px;
- border-left: 3px solid #667eea;
+ border-left: 3px solid #a66ae4;
&:last-child {
margin-bottom: 0;
@@ -431,7 +586,7 @@
.historyTime {
font-size: 13px;
- color: #667eea;
+ color: #a66ae4;
font-weight: 600;
margin-bottom: 8px;
}
@@ -455,7 +610,7 @@
}
}
-// 响应式设计
+// Responsive design
@media (max-width: 768px) {
.dataMonitoringPage {
padding: 16px;
@@ -483,6 +638,30 @@
padding: 16px;
}
+ .addFormSection,
+ .filterSection {
+ padding: 0 16px;
+
+ .addForm {
+ flex-direction: column;
+
+ .platformSelect,
+ .linkInput,
+ .addButton {
+ width: 100%;
+ }
+ }
+
+ .filterContent {
+ flex-direction: column;
+ align-items: flex-start;
+
+ .filterSelect {
+ width: 100%;
+ }
+ }
+ }
+
.addSection {
.addCard {
padding: 32px 48px;
diff --git a/project/web/src/app/[lng]/data-monitoring/page.tsx b/project/web/src/app/[lng]/data-monitoring/page.tsx
index f2bd6fc4..9c6912cd 100644
--- a/project/web/src/app/[lng]/data-monitoring/page.tsx
+++ b/project/web/src/app/[lng]/data-monitoring/page.tsx
@@ -1,7 +1,7 @@
'use client'
import { EyeOutlined, LinkOutlined, UserOutlined } from '@ant-design/icons'
-import { Badge, Button, Card, Empty, Input, message, Modal, Pagination, Spin, Tabs, Tag } from 'antd'
+import { Avatar, Badge, Button, Card, Empty, Input, message, Pagination, Select, Spin, Tabs, Tag } from 'antd'
import { useRouter } from 'next/navigation'
import { useEffect, useState } from 'react'
import { useTransClient } from '@/app/i18n/client'
@@ -10,8 +10,22 @@ import {
apiGetNoteMonitoringList,
type NoteMonitoringListItem,
} from '@/api/monitoring'
+import { AccountPlatInfoMap, PlatType } from '@/app/config/platConfig'
import styles from './dataMonitoring.module.scss'
+// Supported platforms for monitoring
+const SUPPORTED_PLATFORMS = [
+ PlatType.Tiktok,
+ PlatType.BILIBILI,
+ PlatType.Douyin,
+ PlatType.Facebook,
+ PlatType.Instagram,
+ PlatType.Xhs,
+ PlatType.KWAI,
+ PlatType.YouTube,
+ PlatType.Twitter,
+]
+
export default function DataMonitoringPage() {
const { t } = useTransClient('dataMonitoring')
const router = useRouter()
@@ -19,15 +33,20 @@ export default function DataMonitoringPage() {
const [loading, setLoading] = useState(false)
const [monitoringList, setMonitoringList] = useState<NoteMonitoringListItem[]>([])
const [pagination, setPagination] = useState({ page: 1, pageSize: 20, total: 0, totalPages: 0 })
- const [addModalVisible, setAddModalVisible] = useState(false)
+ const [selectedPlatform, setSelectedPlatform] = useState<PlatType>(PlatType.Xhs)
+ const [filterPlatform, setFilterPlatform] = useState<PlatType | 'all'>('all')
const [noteLink, setNoteLink] = useState('')
const [addLoading, setAddLoading] = useState(false)
- // 加载监控列表
- const loadMonitoringList = async (page: number = 1) => {
+ // Load monitoring list
+ const loadMonitoringList = async (page: number = 1, platform?: string) => {
setLoading(true)
try {
- const data = await apiGetNoteMonitoringList({ platform: 'xhs', page, pageSize: 20 })
+ const params: any = { page, pageSize: 20 }
+ if (platform && platform !== 'all') {
+ params.platform = platform
+ }
+ const data = await apiGetNoteMonitoringList(params)
setMonitoringList(data.items)
setPagination({
page: data.page,
@@ -46,16 +65,16 @@ export default function DataMonitoringPage() {
useEffect(() => {
if (activeTab === 'link') {
- loadMonitoringList(1)
+ loadMonitoringList(1, filterPlatform === 'all' ? undefined : filterPlatform)
}
- }, [activeTab])
+ }, [activeTab, filterPlatform])
- // 分页变化
+ // Handle pagination change
const handlePageChange = (page: number) => {
- loadMonitoringList(page)
+ loadMonitoringList(page, filterPlatform === 'all' ? undefined : filterPlatform)
}
- // 添加笔记监控
+ // Add note monitoring
const handleAddNote = async () => {
if (!noteLink.trim()) {
message.warning(t('addModal.linkRequired'))
@@ -64,11 +83,10 @@ export default function DataMonitoringPage() {
setAddLoading(true)
try {
- await apiAddNoteMonitoring({ link: noteLink, platform: 'xhs' })
+ await apiAddNoteMonitoring({ link: noteLink, platform: selectedPlatform })
message.success(t('addModal.addSuccess'))
- setAddModalVisible(false)
setNoteLink('')
- loadMonitoringList(1)
+ loadMonitoringList(1, filterPlatform === 'all' ? undefined : filterPlatform)
}
catch (error: any) {
message.error(error.message || t('error.addFailed'))
@@ -128,24 +146,106 @@ export default function DataMonitoringPage() {
/>
<div className={styles.tabContent}>
- {/* 按笔记链接 */}
+ {/* By note link */}
{activeTab === 'link' && (
<div className={styles.linkMonitoring}>
- <div className={styles.addSection}>
- <div className={styles.addCard}>
- <LinkOutlined className={styles.addIcon} />
- <h3 className={styles.addTitle}>{t('tabs.byLink')}</h3>
- <Button
- type="primary"
- onClick={() => setAddModalVisible(true)}
- className={styles.addButton}
- >
- {t('actions.add')}
- </Button>
- </div>
+ {/* Add note form */}
+ <div className={styles.addFormSection}>
+ <Card className={styles.addFormCard}>
+ <div className={styles.addForm}>
+ <div className={styles.platformSelect}>
+ <Select
+ value={selectedPlatform}
+ onChange={setSelectedPlatform}
+ style={{ width: 180 }}
+ size="large"
+ className={styles.platformSelectInput}
+ >
+ {SUPPORTED_PLATFORMS.map(platform => {
+ const platInfo = AccountPlatInfoMap.get(platform)
+ if (!platInfo) return null
+ const iconSrc = typeof platInfo.icon === 'string'
+ ? platInfo.icon
+ : (platInfo.icon as any)?.src || String(platInfo.icon)
+ return (
+ <Select.Option key={platform} value={platform}>
+ <div className={styles.platformOption}>
+ <img
+ src={iconSrc}
+ alt={platInfo.name}
+ width={20}
+ height={20}
+ style={{ marginRight: 8, objectFit: 'contain' }}
+ />
+ <span>{platInfo.name}</span>
+ </div>
+ </Select.Option>
+ )
+ })}
+ </Select>
+ </div>
+ <Input
+ placeholder={t('addModal.linkPlaceholder')}
+ value={noteLink}
+ onChange={e => setNoteLink(e.target.value)}
+ onPressEnter={handleAddNote}
+ prefix={<LinkOutlined />}
+ size="large"
+ className={styles.linkInput}
+ />
+ <Button
+ type="primary"
+ onClick={handleAddNote}
+ loading={addLoading}
+ size="large"
+ className={styles.addButton}
+ >
+ {t('actions.add')}
+ </Button>
+ </div>
+ </Card>
</div>
- {/* 监控列表 */}
+ {/* Filter section */}
+ <div className={styles.filterSection}>
+ <Card className={styles.filterCard}>
+ <div className={styles.filterContent}>
+ <span className={styles.filterLabel}>{t('list.filterByPlatform' as any)}:</span>
+ <Select
+ value={filterPlatform}
+ onChange={(value) => setFilterPlatform(value)}
+ style={{ width: 200 }}
+ size="large"
+ className={styles.filterSelect}
+ >
+ <Select.Option value="all">{t('list.allPlatforms' as any)}</Select.Option>
+ {SUPPORTED_PLATFORMS.map(platform => {
+ const platInfo = AccountPlatInfoMap.get(platform)
+ if (!platInfo) return null
+ const iconSrc = typeof platInfo.icon === 'string'
+ ? platInfo.icon
+ : (platInfo.icon as any)?.src || String(platInfo.icon)
+ return (
+ <Select.Option key={platform} value={platform}>
+ <div className={styles.platformOption}>
+ <img
+ src={iconSrc}
+ alt={platInfo.name}
+ width={20}
+ height={20}
+ style={{ marginRight: 8, objectFit: 'contain' }}
+ />
+ <span>{platInfo.name}</span>
+ </div>
+ </Select.Option>
+ )
+ })}
+ </Select>
+ </div>
+ </Card>
+ </div>
+
+ {/* Monitoring list */}
{loading ? (
<div className={styles.loading}>
<Spin size="large" />
@@ -170,13 +270,26 @@ export default function DataMonitoringPage() {
]}
>
<div className={styles.cardHeader}>
- <h4 className={styles.noteTitle}>
- {item.link}
- </h4>
+ <div className={styles.cardHeaderLeft}>
+ {item.postDetail?.author && (
+ <div className={styles.authorInfo}>
+ <Avatar
+ src={item.postDetail.avatar}
+ size={32}
+ className={styles.authorAvatar}
+ >
+ {item.postDetail.author.charAt(0)}
+ </Avatar>
+ <span className={styles.authorName}>{item.postDetail.author}</span>
+ </div>
+ )}
+ <h4 className={styles.noteTitle}>
+ {item.postDetail?.title || item.link}
+ </h4>
+ </div>
<div className={styles.headerRight} style={{ marginRight: '0' }}>
{getStatusTag(item.status)}
<Badge
-
status={item.enabled ? 'success' : 'default'}
text={item.enabled ? t('status.enabled') : t('status.disabled')}
/>
@@ -187,7 +300,7 @@ export default function DataMonitoringPage() {
<Tag color="error">{t('list.error')}: {item.error}</Tag>
</div>
)}
- <div className={styles.cardFooter}>
+ <div className={`${styles.cardFooter} ${!item.error ? styles.cardFooterNoError : ''}`}>
<span className={styles.createTime}>
{t('list.createdAt')}: {new Date(item.createdAt).toLocaleString('zh-CN')}
</span>
@@ -219,7 +332,7 @@ export default function DataMonitoringPage() {
</div>
)}
- {/* 按小红书账号 - 暂未开放 */}
+ {/* By account - not yet available */}
{activeTab === 'account' && (
<div className={styles.accountMonitoring}>
<div className={styles.addSection}>
@@ -239,31 +352,6 @@ export default function DataMonitoringPage() {
)}
</div>
</Card>
-
- {/* 添加笔记链接弹窗 */}
- <Modal
- title={t('addModal.title')}
- open={addModalVisible}
- onOk={handleAddNote}
- onCancel={() => {
- setAddModalVisible(false)
- setNoteLink('')
- }}
- confirmLoading={addLoading}
- okText={t('addModal.confirm')}
- cancelText={t('addModal.cancel')}
- >
- <div className={styles.addModalContent}>
- <p className={styles.modalDesc}>{t('addModal.inputPlaceholder')}</p>
- <Input
- placeholder={t('addModal.linkPlaceholder')}
- value={noteLink}
- onChange={e => setNoteLink(e.target.value)}
- prefix={<LinkOutlined />}
- size="large"
- />
- </div>
- </Modal>
</div>
)
}
diff --git a/project/web/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss b/project/web/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss
index c1fe6c0b..8a924f50 100644
--- a/project/web/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss
+++ b/project/web/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss
@@ -71,6 +71,11 @@
width: 110px !important;
height: 75px !important;
}
+
+ .baseInfoCoverPlaceholder {
+ width: 110px !important;
+ height: 75px !important;
+ }
}
}
}
@@ -95,6 +100,32 @@
margin-right: 15px;
}
+ .baseInfoCoverPlaceholder {
+ width: 74px;
+ height: 86px;
+ flex-shrink: 0;
+ border-radius: 4px;
+ margin-right: 15px;
+ background: linear-gradient(135deg, #a66ae4 0%, #814dbd 100%);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: #fff;
+ font-size: 12px;
+ text-align: center;
+ padding: 4px;
+ box-sizing: border-box;
+
+ .placeholderText {
+ word-break: break-word;
+ line-height: 1.2;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ }
+ }
+
:global {
.baseInfo-right {
display: flex;
diff --git a/project/web/src/app/[lng]/hotContent/components/HotContent/hotContentCommonWidget.tsx b/project/web/src/app/[lng]/hotContent/components/HotContent/hotContentCommonWidget.tsx
index f287ff27..d614177c 100644
--- a/project/web/src/app/[lng]/hotContent/components/HotContent/hotContentCommonWidget.tsx
+++ b/project/web/src/app/[lng]/hotContent/components/HotContent/hotContentCommonWidget.tsx
@@ -1,5 +1,6 @@
import Icon from '@ant-design/icons'
import { Avatar, Popover } from 'antd'
+import { useState } from 'react'
import styles from '@/app/[lng]/hotContent/components/HotContent/hotContent.module.scss'
import Uparrow from '@/app/[lng]/hotContent/svgs/uparrow.svg'
import { useTransClient } from '@/app/i18n/client'
@@ -81,10 +82,26 @@ export function HotContentBaseInfo({
onClick?: () => void
}) {
const { t } = useTransClient('hot-content')
+ const [imageError, setImageError] = useState(false)
+ const displayText = title || nickname
+
return (
<div className={styles.baseInfo}>
<Popover placement="right" content={coverPopoverContent}>
- <img className="baseInfo-cover" src={cover} />
+ {imageError ? (
+ <div className={`${styles.baseInfoCoverPlaceholder} baseInfo-cover`}>
+ <span className={styles.placeholderText}>
+ {displayText.length > 10 ? `${displayText.substring(0, 10)}...` : displayText}
+ </span>
+ </div>
+ ) : (
+ <img
+ className="baseInfo-cover"
+ src={cover}
+ onError={() => setImageError(true)}
+ alt={title || nickname}
+ />
+ )}
</Popover>
<div className="baseInfo-right">
{title
diff --git a/project/web/src/app/[lng]/page.tsx b/project/web/src/app/[lng]/page.tsx
index b4272583..b31331aa 100644
--- a/project/web/src/app/[lng]/page.tsx
+++ b/project/web/src/app/[lng]/page.tsx
@@ -15,7 +15,7 @@ import {
} from '@ant-design/icons'
import Image from 'next/image'
import { useParams, useRouter } from 'next/navigation'
-import { useEffect, useRef, useState } from 'react'
+import { useEffect, useRef, useState, type ReactNode } from 'react'
// Mobile app download section
import { QRCode } from 'react-qrcode-logo'
@@ -45,18 +45,18 @@ import styles from './styles/difyHome.module.scss'
// External image URL constants
const IMAGE_URLS = {
- calendar: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/1.%20content%20publish/calendar.jpeg',
- supportChannels: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/1.%20content%20publish/support_channels.jpeg',
- hotspot: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/2.%20content%20hotspot/hotspot.jpg',
- hotspot2: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/2.%20content%20hotspot/hotspot2.jpeg',
- hotspot3: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/2.%20content%20hotspot/hotspot3.jpeg',
- hotspot4: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/2.%20content%20hotspot/hotspot4.jpeg',
- contentSearch: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/3.%20content%20search/contentsearch.gif',
- contentSearch1: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/3.%20content%20search/contentsearch1.jpeg',
- contentSearch2: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/3.%20content%20search/contentsearch2.jpeg',
- contentSearch4: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/3.%20content%20search/contentsearch4.jpeg',
- commentFilter: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/4.%20comments%20search/commentfilter.jpeg',
- commentFilter2: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/common/web/app-screenshot/5.%20content%20engagement/commentfilter2.jpeg',
+ calendar: 'https://assets.aitoearn.ai/common/web/app-screenshot/1.%20content%20publish/calendar.jpeg',
+ supportChannels: 'https://assets.aitoearn.ai/common/web/app-screenshot/1.%20content%20publish/support_channels.jpeg',
+ hotspot: 'https://assets.aitoearn.ai/common/web/app-screenshot/2.%20content%20hotspot/hotspot.jpg',
+ hotspot2: 'https://assets.aitoearn.ai/common/web/app-screenshot/2.%20content%20hotspot/hotspot2.jpeg',
+ hotspot3: 'https://assets.aitoearn.ai/common/web/app-screenshot/2.%20content%20hotspot/hotspot3.jpeg',
+ hotspot4: 'https://assets.aitoearn.ai/common/web/app-screenshot/2.%20content%20hotspot/hotspot4.jpeg',
+ contentSearch: 'https://assets.aitoearn.ai/common/web/app-screenshot/3.%20content%20search/contentsearch.gif',
+ contentSearch1: 'https://assets.aitoearn.ai/common/web/app-screenshot/3.%20content%20search/contentsearch1.jpeg',
+ contentSearch2: 'https://assets.aitoearn.ai/common/web/app-screenshot/3.%20content%20search/contentsearch2.jpeg',
+ contentSearch4: 'https://assets.aitoearn.ai/common/web/app-screenshot/3.%20content%20search/contentsearch4.jpeg',
+ commentFilter: 'https://assets.aitoearn.ai/common/web/app-screenshot/4.%20comments%20search/commentfilter.jpeg',
+ commentFilter2: 'https://assets.aitoearn.ai/common/web/app-screenshot/5.%20content%20engagement/commentfilter2.jpeg',
}
// Release banner
@@ -98,6 +98,43 @@ function LoadingDots() {
)
}
+// 懒加载组件 - 当元素进入视口时才开始加载
+function LazyLoadSection({ children }: { children: ReactNode }) {
+ const [shouldLoad, setShouldLoad] = useState(false)
+ const sectionRef = useRef<HTMLDivElement>(null)
+
+ useEffect(() => {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) {
+ setShouldLoad(true)
+ observer.disconnect()
+ }
+ })
+ },
+ {
+ // 当元素距离视口 200px 时开始加载
+ rootMargin: '200px',
+ },
+ )
+
+ if (sectionRef.current) {
+ observer.observe(sectionRef.current)
+ }
+
+ return () => {
+ observer.disconnect()
+ }
+ }, [])
+
+ return (
+ <div ref={sectionRef}>
+ {shouldLoad ? children : <div style={{ minHeight: '400px' }} />}
+ </div>
+ )
+}
+
// Hero main title section
function Hero() {
const { t } = useTransClient('home')
@@ -1434,7 +1471,7 @@ function UpcomingFeaturesSection() {
<div className={styles.carouselContainer}>
<div className={`${styles.carouselSlide} ${styles.active}`}>
<video
- src="https://aitoearn.s3.ap-southeast-1.amazonaws.com/production/temp/uploads/890044ad-c3a3-4a4c-8981-0eb72abff538.mp4"
+ src="https://assets.aitoearn.ai/production/temp/uploads/890044ad-c3a3-4a4c-8981-0eb72abff538.mp4"
controls
className={styles.desktopCarouselImage}
style={{ borderRadius: '16px', boxShadow: '0 20px 60px rgba(0, 0, 0, 0.2)' }}
@@ -1905,14 +1942,30 @@ export default function Home() {
<div className={styles.difyHome}>
<ReleaseBanner />
<Hero />
- <BrandBar />
- <ContentPublishingSection />
- <ContentHotspotSection />
- <ContentSearchSection />
- <CommentsSearchSection />
- <ContentEngagementSection />
- <UpcomingFeaturesSection />
- <DownloadSection />
+ <LazyLoadSection>
+ <BrandBar />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <ContentPublishingSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <ContentHotspotSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <ContentSearchSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <CommentsSearchSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <ContentEngagementSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <UpcomingFeaturesSection />
+ </LazyLoadSection>
+ <LazyLoadSection>
+ <DownloadSection />
+ </LazyLoadSection>
{/* <EnterpriseSection />
<StatsSection /> */}
{/* <CommunitySection /> */}
diff --git a/project/web/src/app/[lng]/styles/difyHome.module.scss b/project/web/src/app/[lng]/styles/difyHome.module.scss
index ba369854..fc494f64 100644
--- a/project/web/src/app/[lng]/styles/difyHome.module.scss
+++ b/project/web/src/app/[lng]/styles/difyHome.module.scss
@@ -124,6 +124,8 @@
cursor: pointer;
font-family: inherit;
padding: 0;
+ display: inline-flex;
+ align-items: center;
&:hover {
color: #4f46e5;
@@ -145,6 +147,12 @@
border-radius: 1px;
}
}
+
+ &.navLinkWithDropdown {
+ &:hover {
+ color: #4f46e5;
+ }
+ }
}
.getStartedBtn {
@@ -290,6 +298,12 @@
border-left-color: #4f46e5;
font-weight: 600;
}
+
+ &.mobileNavSubLink {
+ padding-left: 40px;
+ font-size: 14px;
+ font-weight: 400;
+ }
}
// 移动端菜单底部
@@ -322,7 +336,10 @@
padding: 80px 0 120px;
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
text-align: center;
- min-height: 600px; // 确保整个hero区域有稳定的最小高度
+ min-height: 100vh; // 占满一屏
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
}
.heroContainer {
diff --git a/project/web/src/app/i18n/locales/en/dataMonitoring.json b/project/web/src/app/i18n/locales/en/dataMonitoring.json
index 6b750142..98c08ab2 100644
--- a/project/web/src/app/i18n/locales/en/dataMonitoring.json
+++ b/project/web/src/app/i18n/locales/en/dataMonitoring.json
@@ -26,7 +26,9 @@
"createdAt": "Created at",
"updatedAt": "Updated at",
"error": "Error",
- "totalRecords": "Total {{count}} records"
+ "totalRecords": "Total {{count}} records",
+ "filterByPlatform": "Filter by Platform",
+ "allPlatforms": "All Platforms"
},
"stats": {
"views": "Views",
diff --git a/project/web/src/app/i18n/locales/en/home.json b/project/web/src/app/i18n/locales/en/home.json
index 32ddf269..0e081e41 100644
--- a/project/web/src/app/i18n/locales/en/home.json
+++ b/project/web/src/app/i18n/locales/en/home.json
@@ -12,7 +12,9 @@
"status": "Status",
"docs": "Docs",
"blog": "Blog",
- "download": "Downloads"
+ "download": "Downloads",
+ "brand": "Brand",
+ "resources": "Resources"
},
"getStarted": "Get Started"
diff --git a/project/web/src/app/i18n/locales/zh-CN/dataMonitoring.json b/project/web/src/app/i18n/locales/zh-CN/dataMonitoring.json
index e6a5148d..fa468484 100644
--- a/project/web/src/app/i18n/locales/zh-CN/dataMonitoring.json
+++ b/project/web/src/app/i18n/locales/zh-CN/dataMonitoring.json
@@ -26,7 +26,9 @@
"createdAt": "创建时间",
"updatedAt": "更新时间",
"error": "错误",
- "totalRecords": "共 {{count}} 条记录"
+ "totalRecords": "共 {{count}} 条记录",
+ "filterByPlatform": "按平台筛选",
+ "allPlatforms": "全部平台"
},
"stats": {
"views": "阅读数",
diff --git a/project/web/src/app/i18n/locales/zh-CN/home.json b/project/web/src/app/i18n/locales/zh-CN/home.json
index a22246bc..ae701358 100644
--- a/project/web/src/app/i18n/locales/zh-CN/home.json
+++ b/project/web/src/app/i18n/locales/zh-CN/home.json
@@ -12,7 +12,9 @@
"status": "状态",
"docs": "文档",
"blog": "博客",
- "download": "下载"
+ "download": "下载",
+ "brand": "品牌",
+ "resources": "资源"
},
"getStarted": "立即开始"
},
diff --git a/project/web/src/app/layout/HomeHeader.tsx b/project/web/src/app/layout/HomeHeader.tsx
index e22d9572..c2974b7c 100644
--- a/project/web/src/app/layout/HomeHeader.tsx
+++ b/project/web/src/app/layout/HomeHeader.tsx
@@ -1,6 +1,7 @@
import type { ForwardedRef } from 'react'
-import { CloseOutlined, MenuOutlined } from '@ant-design/icons'
-import { Button } from 'antd'
+import { CloseOutlined, DownOutlined, MenuOutlined } from '@ant-design/icons'
+import { Button, Dropdown } from 'antd'
+import type { MenuProps } from 'antd'
import Image from 'next/image'
import Link from 'next/link'
import { usePathname, useRouter } from 'next/navigation'
@@ -8,7 +9,7 @@ import { forwardRef, memo, useState } from 'react'
import styles from '@/app/[lng]/styles/difyHome.module.scss'
import { useTransClient } from '@/app/i18n/client'
import { removeLocalePrefix } from '@/app/layout/layout.utils'
-import { homeHeaderRouterData } from '@/app/layout/routerData'
+import { homeHeaderRouterData, type HomeHeaderRouterItem } from '@/app/layout/routerData'
import logo from '@/assets/images/logo.png'
import LanguageSwitcher from '@/components/common/LanguageSwitcher'
import { useUserStore } from '@/store/user'
@@ -44,7 +45,7 @@ const HomeHeader = memo(
* 判断链接是否为当前激活状态
*/
const isActive = (href: string) => {
- if (!href.startsWith('/'))
+ if (!href.startsWith('/') || href === '#')
return false
const normalizedHref = href.replace(/\/+$/, '') || '/'
if (normalizedHref === '/')
@@ -54,6 +55,25 @@ const HomeHeader = memo(
return currentPath.startsWith(`${normalizedHref}/`)
}
+ /**
+ * 生成下拉菜单项
+ */
+ const getDropdownItems = (children: HomeHeaderRouterItem[]): MenuProps['items'] => {
+ return children.map((child) => ({
+ key: child.href,
+ label: (
+ <Link
+ href={child.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={closeMobileMenu}
+ >
+ {child.title}
+ </Link>
+ ),
+ }))
+ }
+
return (
<>
<header className={styles.header}>
@@ -73,6 +93,25 @@ const HomeHeader = memo(
if (v.href === '/') {
return null
}
+ // 如果有子菜单,显示下拉菜单
+ if (v.children && v.children.length > 0) {
+ return (
+ <Dropdown
+ key={v.title}
+ menu={{ items: getDropdownItems(v.children) }}
+ placement="bottomLeft"
+ >
+ <span
+ className={`${styles.navLink} ${styles.navLinkWithDropdown}`}
+ style={{ paddingTop: '3px', cursor: 'pointer' }}
+ >
+ {v.title}
+ <DownOutlined style={{ marginLeft: '4px', fontSize: '10px', marginTop: '4px' }} />
+ </span>
+ </Dropdown>
+ )
+ }
+ // 普通链接
return (
<Link
key={v.title}
@@ -139,6 +178,29 @@ const HomeHeader = memo(
if (v.href === '/') {
return null
}
+ // 如果有子菜单,显示子菜单项
+ if (v.children && v.children.length > 0) {
+ return (
+ <div key={v.title}>
+ <div className={styles.mobileNavLink} style={{ fontWeight: 600, color: '#4f46e5' }}>
+ {v.title}
+ </div>
+ {v.children.map((child) => (
+ <Link
+ key={child.href}
+ className={`${styles.mobileNavLink} ${styles.mobileNavSubLink} ${isActive(child.href) ? styles.active : ''}`}
+ href={child.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={closeMobileMenu}
+ >
+ {child.title}
+ </Link>
+ ))}
+ </div>
+ )
+ }
+ // 普通链接
return (
<Link
key={v.title}
diff --git a/project/web/src/app/layout/routerData.ts b/project/web/src/app/layout/routerData.ts
index aab6b1e1..b6929f87 100644
--- a/project/web/src/app/layout/routerData.ts
+++ b/project/web/src/app/layout/routerData.ts
@@ -56,12 +56,6 @@ export const routerData: IRouterDataItem[] = [
path: '/dataStatistics',
},
- {
- name: '数据监控',
- translationKey: 'dataMonitoring',
- path: '/data-monitoring',
- },
-
{
name: '素材库',
translationKey: 'header.materialLibrary',
@@ -94,8 +88,14 @@ export const peRouterData = recursion(routerData)
* - 英文语言跳转英文下载页:https://docs.aitoearn.ai/en/downloads
* - 中文语言跳转中文下载页:https://docs.aitoearn.ai/zh/downloads
*/
+export interface HomeHeaderRouterItem {
+ href: string
+ title: string
+ children?: HomeHeaderRouterItem[]
+}
+
export const homeHeaderRouterData = {
- get value() {
+ get value(): HomeHeaderRouterItem[] {
const lang = useUserStore.getState().lang
const downloadHref = lang === 'en'
? 'https://docs.aitoearn.ai/en/downloads'
@@ -105,25 +105,32 @@ export const homeHeaderRouterData = {
href: '/',
title: directTrans('home', 'header.nav.home'),
},
+
{
- href: '/pricing',
- title: directTrans('home', 'header.nav.pricing'),
- },
- {
- href: 'https://status.aitoearn.ai/',
- title: directTrans('home', 'header.nav.status'),
+ href: '#',
+ title: directTrans('home', 'header.nav.resources'),
+ children: [
+ {
+ href: 'https://status.aitoearn.ai/',
+ title: directTrans('home', 'header.nav.status'),
+ },
+ {
+ href: 'https://docs.aitoearn.ai/',
+ title: directTrans('home', 'header.nav.docs'),
+ },
+ {
+ href: 'https://blog.aitoearn.ai/',
+ title: directTrans('home', 'header.nav.blog'),
+ },
+ {
+ href: downloadHref,
+ title: directTrans('home', 'header.nav.download'),
+ },
+ ],
},
{
- href: 'https://docs.aitoearn.ai/',
- title: directTrans('home', 'header.nav.docs'),
- },
- {
- href: 'https://blog.aitoearn.ai/',
- title: directTrans('home', 'header.nav.blog'),
- },
- {
- href: downloadHref,
- title: directTrans('home', 'header.nav.download'),
+ href: '/pricing',
+ title: directTrans('home', 'header.nav.pricing'),
},
{
href: '/hotContent',
@@ -133,6 +140,10 @@ export const homeHeaderRouterData = {
href: '/aiRank',
title: directTrans('route', 'aiRank'),
},
+ {
+ href: '/data-monitoring',
+ title: directTrans('route', 'dataMonitoring'),
+ },
]
},
}