ux: 首页今日推荐可点进详情;搜索页热门词;趋势页去假数据/始终进站内详情(阅读量统计生效);资讯详情去大emoji头图/加人话解读卡/分享按钮修复

This commit is contained in:
Hermes Agent
2026-09-19 20:31:58 +08:00
parent 7849bd067e
commit feac6371ea
4 changed files with 49 additions and 59 deletions
+2
View File
@@ -221,6 +221,8 @@ function goFirstUnlit() {
function resumeRead() {
if (lastRead.value?.id) {
uni.navigateTo({ url: `/pages/detail/detail?id=${lastRead.value.id}` })
} else if (todayKnowledge.value?.id || todayKnowledge.value?._id) {
uni.navigateTo({ url: `/pages/detail/detail?id=${todayKnowledge.value.id || todayKnowledge.value._id}` })
}
}
+18 -6
View File
@@ -11,11 +11,6 @@
</view>
<scroll-view scroll-y class="content">
<!-- 资讯头图 -->
<view class="news-hero" :style="{background: heroBg}">
<text class="hero-emoji">{{ heroEmoji }}</text>
</view>
<!-- 分类标签 -->
<view class="category-tag">
<text class="tag-text">{{ categoryLabel }}</text>
@@ -50,6 +45,14 @@
<text class="summary-text">{{ news.summary }}</text>
</view>
<!-- 人话解读 -->
<view class="summary-card plain" v-if="news.plainExplain">
<text class="summary-label">💡 一句话说清</text>
<text class="summary-text">{{ news.plainExplain }}</text>
<text class="summary-label" style="margin-top: 12px" v-if="news.takeAway">🎯 对你意味着</text>
<text class="summary-text" v-if="news.takeAway">{{ news.takeAway }}</text>
</view>
<!-- 正文 -->
<view class="news-body" v-if="newsBody">
<rich-text :nodes="newsBody"></rich-text>
@@ -176,10 +179,19 @@ function onFavorite() {
}
function onShare() {
// #ifdef MP-WEIXIN
uni.showModal({
title: '分享给朋友',
content: '点击右上角「···」→ 转发给朋友或分享到朋友圈',
showCancel: false,
})
// #endif
// #ifdef H5
uni.setClipboardData({
data: news.value.link || `https://ai-dimension.yuzhiran.com.cn/news/${news.value._id || ''}`,
data: news.value.sourceUrl || `https://wdkj.yuzhiran.com.cn/trends/${news.value._id || ''}`,
success: () => uni.showToast({ title: '链接已复制', icon: 'none' })
})
// #endif
}
function openSource() {
+26 -3
View File
@@ -31,11 +31,13 @@
<text class="loading-text">搜索中...</text>
</view>
<!-- 空搜索提示 -->
<!-- 未搜索:热门词快捷入口 -->
<view class="empty-state" v-else-if="!hasSearched">
<text class="empty-icon">没有找到相关知识</text>
<text class="empty-icon">🔍</text>
<text class="empty-text">输入关键词搜索 AI 知识</text>
<text class="empty-hint">支持按标题、摘要、标签搜索</text>
<view class="hot-words">
<text v-for="w in HOT_WORDS" :key="w" class="hot-word" @click="quickSearch(w)">{{ w }}</text>
</view>
</view>
<!-- 无结果提示 -->
@@ -92,6 +94,11 @@ import { knowledgeApi } from '@/utils/api'
import { DIMENSIONS } from '@/utils/dimensions'
const searchText = ref('')
const HOT_WORDS = ['大模型', 'Transformer', 'DeepSeek', '提示词', 'AI绘画', '智能体', 'RAG', '具身智能']
function quickSearch(w) {
searchText.value = w
doSearch()
}
const results = ref([])
const loading = ref(false)
const hasSearched = ref(false)
@@ -395,4 +402,20 @@ onShareAppMessage(() => ({
font-size: 11px;
color: var(--text-secondary);
}
.hot-words {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: center;
margin-top: 16px;
padding: 0 20px;
}
.hot-word {
padding: 6px 16px;
border-radius: 999px;
background: var(--glass-bg, #f3f4fa);
color: var(--text-secondary, #4a4f63);
font-size: 13px;
}
</style>
+2 -49
View File
@@ -121,8 +121,7 @@ async function fetchTrends() {
items.value = data.list || data.items || []
} catch (err) {
console.error('获取趋势失败:', err)
// 降级:本地示例
items.value = getSampleData()
uni.showToast({ title: '加载失败,下拉重试', icon: 'none' })
} finally {
loading.value = false
}
@@ -159,57 +158,11 @@ function formatDate(dateStr) {
}
function goDetail(item) {
// 如果有原文链接,跳转外部
if (item.link) {
// 微信小程序不支持直接打开外部链接,复制链接提示
uni.setClipboardData({
data: item.link,
success: () => {
uni.showModal({
title: '打开链接',
content: '链接已复制,请在浏览器中打开',
showCancel: false
})
}
})
return
}
// 始终进入站内详情页(人话解读/阅读量统计/收藏/分享);原文链接在详情页内提供
uni.setStorageSync('__news_item__', JSON.stringify(item))
uni.navigateTo({ url: '/pages/news/news' })
}
function getSampleData() {
return [
{
title: 'DeepSeek 发布 R1 推理模型',
summary: 'DeepSeek R1 在多项基准测试中超越 GPT-4o,引发全球关注',
source: '量子位',
newsDate: new Date(Date.now() - 2 * 3600000).toISOString(),
category: 'product',
hot: true,
hotCount: 2000,
viewCount: 15000
},
{
title: 'Google Gemini 1.5 Pro 发布',
summary: '支持 200 万 token 上下文窗口,多模态能力大幅提升',
source: '机器之心',
newsDate: new Date(Date.now() - 6 * 3600000).toISOString(),
category: 'product',
viewCount: 8000
},
{
title: 'Transformer 论文作者新方向',
summary: '从注意力机制到状态空间模型,作者分享最新研究进展',
source: 'PaperWeekly',
newsDate: new Date(Date.now() - 12 * 3600000).toISOString(),
category: 'paper',
picked: true,
viewCount: 5000
}
]
}
// 微信小程序分享
// #ifdef MP-WEIXIN
onShareAppMessage(() => {