-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_frontend.js
More file actions
52 lines (47 loc) · 2.26 KB
/
Copy pathtest_frontend.js
File metadata and controls
52 lines (47 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 模拟API返回的数据
const trend = {
id: 5103,
keyword: "王安宇王玉雯我们三个人很暧昧",
sources: "https://s.weibo.com/weibo?q=%E7%8E%8B%E5%AE%89%E5%AE%87%E7%8E%8B%E7%8E%89%E9%9B%AF%E6%88%91%E4%BB%AC%E4%B8%89%E4%B8%AA%E4%BA%BA%E5%BE%88%E6%9A%A7%E6%98%A7",
source_url: "https://s.weibo.com/weibo?q=%E7%8E%8B%E5%AE%89%E5%AE%87%E7%8E%8B%E7%8E%89%E9%9B%AF%E6%88%91%E4%BB%AC%E4%B8%89%E4%B8%AA%E4%BA%BA%E5%BE%88%E6%9A%A7%E6%98%A7",
heat_current: 69681,
heat_1h_increase: 0,
platforms: "微博",
ai_level: "小瓜",
ai_category: "其他",
ai_risk_level: "低",
ai_recommend_account_type: "垂直领域账号",
ai_suggestion: "可做",
ai_confidence: 0.75
};
// 确定标签样式
let levelClass = 'tag-small';
if (trend.ai_level === '超级大瓜') levelClass = 'tag-super-hot';
else if (trend.ai_level === '大瓜') levelClass = 'tag-hot';
else if (trend.ai_level === '中瓜') levelClass = 'tag-medium';
let riskClass = 'tag-risk-low';
if (trend.ai_risk_level === '中') riskClass = 'tag-risk-medium';
else if (trend.ai_risk_level === '高') riskClass = 'tag-risk-high';
else if (trend.ai_risk_level === '禁做') riskClass = 'tag-risk-forbidden';
// 渲染卡片
const cardHTML = `
<div class="flex items-start justify-between mb-3">
<h3 class="font-jetbrains font-bold text-xl">${trend.keyword}</h3>
<span class="tag ${levelClass}">${trend.ai_level}</span>
</div>
<div class="text-text-secondary mb-3">
<p>来源:${trend.platforms || '未知'}</p>
<p>热度:${trend.heat_current || 0} / 涨幅:+${trend.heat_1h_increase || 0}</p>
</div>
<div class="flex flex-wrap gap-2">
<span class="tag ${riskClass}">风险:${trend.ai_risk_level}</span>
<span class="tag border-gray-300 text-gray-600">${trend.ai_category}</span>
<span class="tag border-gray-300 text-gray-600">${trend.ai_recommend_account_type}</span>
${trend.source_url ? `<a href="${trend.source_url}" target="_blank" class="tag border-accent-color text-accent-color hover:bg-accent-color hover:text-white">查看</a>` : ''}
</div>
`;
console.log('渲染的卡片HTML:');
console.log(cardHTML);
// 检查source_url是否存在
console.log('\nsource_url字段是否存在:', trend.source_url ? '是' : '否');
console.log('source_url值:', trend.source_url);