ux: 首页今日推荐可点进详情;搜索页热门词;趋势页去假数据/始终进站内详情(阅读量统计生效);资讯详情去大emoji头图/加人话解读卡/分享按钮修复
This commit is contained in:
@@ -221,6 +221,8 @@ function goFirstUnlit() {
|
|||||||
function resumeRead() {
|
function resumeRead() {
|
||||||
if (lastRead.value?.id) {
|
if (lastRead.value?.id) {
|
||||||
uni.navigateTo({ url: `/pages/detail/detail?id=${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}` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,6 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<scroll-view scroll-y class="content">
|
<scroll-view scroll-y class="content">
|
||||||
<!-- 资讯头图 -->
|
|
||||||
<view class="news-hero" :style="{background: heroBg}">
|
|
||||||
<text class="hero-emoji">{{ heroEmoji }}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 分类标签 -->
|
<!-- 分类标签 -->
|
||||||
<view class="category-tag">
|
<view class="category-tag">
|
||||||
<text class="tag-text">{{ categoryLabel }}</text>
|
<text class="tag-text">{{ categoryLabel }}</text>
|
||||||
@@ -50,6 +45,14 @@
|
|||||||
<text class="summary-text">{{ news.summary }}</text>
|
<text class="summary-text">{{ news.summary }}</text>
|
||||||
</view>
|
</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">
|
<view class="news-body" v-if="newsBody">
|
||||||
<rich-text :nodes="newsBody"></rich-text>
|
<rich-text :nodes="newsBody"></rich-text>
|
||||||
@@ -176,10 +179,19 @@ function onFavorite() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onShare() {
|
function onShare() {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.showModal({
|
||||||
|
title: '分享给朋友',
|
||||||
|
content: '点击右上角「···」→ 转发给朋友或分享到朋友圈',
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
uni.setClipboardData({
|
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' })
|
success: () => uni.showToast({ title: '链接已复制', icon: 'none' })
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
function openSource() {
|
function openSource() {
|
||||||
|
|||||||
@@ -31,11 +31,13 @@
|
|||||||
<text class="loading-text">搜索中...</text>
|
<text class="loading-text">搜索中...</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 空搜索提示 -->
|
<!-- 未搜索:热门词快捷入口 -->
|
||||||
<view class="empty-state" v-else-if="!hasSearched">
|
<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-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>
|
</view>
|
||||||
|
|
||||||
<!-- 无结果提示 -->
|
<!-- 无结果提示 -->
|
||||||
@@ -92,6 +94,11 @@ import { knowledgeApi } from '@/utils/api'
|
|||||||
import { DIMENSIONS } from '@/utils/dimensions'
|
import { DIMENSIONS } from '@/utils/dimensions'
|
||||||
|
|
||||||
const searchText = ref('')
|
const searchText = ref('')
|
||||||
|
const HOT_WORDS = ['大模型', 'Transformer', 'DeepSeek', '提示词', 'AI绘画', '智能体', 'RAG', '具身智能']
|
||||||
|
function quickSearch(w) {
|
||||||
|
searchText.value = w
|
||||||
|
doSearch()
|
||||||
|
}
|
||||||
const results = ref([])
|
const results = ref([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const hasSearched = ref(false)
|
const hasSearched = ref(false)
|
||||||
@@ -395,4 +402,20 @@ onShareAppMessage(() => ({
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
.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>
|
||||||
@@ -121,8 +121,7 @@ async function fetchTrends() {
|
|||||||
items.value = data.list || data.items || []
|
items.value = data.list || data.items || []
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取趋势失败:', err)
|
console.error('获取趋势失败:', err)
|
||||||
// 降级:本地示例
|
uni.showToast({ title: '加载失败,下拉重试', icon: 'none' })
|
||||||
items.value = getSampleData()
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@@ -159,57 +158,11 @@ function formatDate(dateStr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function goDetail(item) {
|
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.setStorageSync('__news_item__', JSON.stringify(item))
|
||||||
uni.navigateTo({ url: '/pages/news/news' })
|
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
|
// #ifdef MP-WEIXIN
|
||||||
onShareAppMessage(() => {
|
onShareAppMessage(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user