- 选项卡「最热」→「AI最热」,列标题「当天最热股票」→「AI最热股票」 - 数据源:全市场涨幅榜 → 聚合 12 个 AI 概念板块(人工智能/AI芯片/算力概念/AI应用/AI智能体/多模态AI/AIGC/CPO/智谱AI/AI语料/国产芯片/存储芯片)约 580 只成分股去重 - 排序改为按成交额降序取前 10(涨幅榜被小盘股占据,成交额榜才是资金关注的主线龙头),行内显示「现价 · 成交额」 - 交易时段 60s 自动刷新,标题行保留 交易中/休市 徽章;自选股选项卡不变 - About.vue 功能说明同步更新
855 lines
24 KiB
Vue
855 lines
24 KiB
Vue
<script setup lang="ts">
|
||
import { IconDragDrop, IconHeart } from '@tabler/icons-vue';
|
||
import { useHead } from '@vueuse/head';
|
||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||
import Draggable from 'vuedraggable';
|
||
import ColoredCard from '../components/ColoredCard.vue';
|
||
import ToolCard from '../components/ToolCard.vue';
|
||
import { useToolStore } from '@/tools/tools.store';
|
||
import { useRecentTools } from '@/composable/recent-tools';
|
||
|
||
// 近期新功能亮点(手动维护,新工具上线时加一条)
|
||
const NEW_FEATURES = [
|
||
{ path: '/seal-maker', icon: '🔴', name: '印章生成器', desc: '圆形公章一键生成,盖章到图片/PDF,支持骑缝章' },
|
||
{ path: '/signature-pad', icon: '✍️', name: '手写签名', desc: '真实笔触模拟,透明 PNG,签合同一步到位' },
|
||
{ path: '/text-to-image', icon: '🖼️', name: '文字生成图片', desc: '多行文字排版出图,字体颜色可调,2x/3x 高清' },
|
||
{ path: '/zh-convert', icon: '🈶', name: '简繁体转换', desc: 'OpenCC 词典,词组级准确互转(台湾/香港标准)' },
|
||
{ path: '/pinyin-converter', icon: '🀄', name: '汉字转拼音', desc: '多音字智能转换,全读音标注,三种声调风格' },
|
||
{ path: '/video-tools', icon: '🎥', name: '视频工具箱', desc: '13 个 ffmpeg 工具:转码/压缩/水印/去水印/GIF' },
|
||
{ path: '/audio-tools', icon: '🎙️', name: '音频工具', desc: '文字转音频、语音识别、声音克隆(部署中)' },
|
||
{ path: '/user-center', icon: '👤', name: '用户中心', desc: '收藏/记录云端同步,换电脑登录即恢复,授权跟随账号' },
|
||
{ path: '/ai-image-lab', icon: '🪄', name: 'AI 图片实验室', desc: '智能抠图去背景、AI 无损放大变清晰、一键证件照' },
|
||
{ path: '/ai-chat', icon: '🤖', name: 'AI 客服', desc: '本站功能问答:工具在哪、怎么用、选哪个,支持多轮对话' },
|
||
{ path: '/copywriting', icon: '✍️', name: '文案工具箱', desc: '一键改写、降 AIGC 率、爆款标题、小红书/朋友圈文案' },
|
||
];
|
||
import { config } from '@/config';
|
||
|
||
const toolStore = useToolStore();
|
||
const { recentTools } = useRecentTools();
|
||
|
||
// 近期新功能:静态清单(新开发功能上线时手动加一条)
|
||
const newFeatures = ref<any[]>(NEW_FEATURES);
|
||
|
||
// 精选推荐:管理后台配置(/relay/reco),独立区块置顶显示;为空则隐藏该区块
|
||
const recoList = ref<any[]>([]);
|
||
onMounted(async () => {
|
||
try {
|
||
const res = await fetch('/relay/reco');
|
||
const j = await res.json();
|
||
if (j.code === 200 && Array.isArray(j.data)) {
|
||
recoList.value = j.data.filter((x: any) => x.path && x.name && x.enabled !== false);
|
||
}
|
||
}
|
||
catch { /* 无推荐则隐藏 */ }
|
||
});
|
||
|
||
// 每日 5 列资讯:GITHUB/国际新闻/AI资讯/IT最新技术/AI最热股票
|
||
// 前 4 列 relay 每天 08:00 抓取;「AI最热股票」交易时段 60s 高频刷新
|
||
const newsCols = ref<any[]>([]);
|
||
const newsDate = ref('');
|
||
const newsMarket = ref<'open' | 'closed' | ''>('');
|
||
async function loadNews() {
|
||
try {
|
||
const res = await fetch('/relay/news');
|
||
const j = await res.json();
|
||
if (j.code === 200 && j.data && Array.isArray(j.data.columns)) {
|
||
newsCols.value = j.data.columns;
|
||
newsDate.value = j.data.date || '';
|
||
newsMarket.value = j.data.market === 'open' ? 'open' : (j.data.market === 'closed' ? 'closed' : '');
|
||
}
|
||
}
|
||
catch { /* 无资讯则隐藏 */ }
|
||
}
|
||
let newsTimer: ReturnType<typeof setInterval> | undefined;
|
||
onMounted(() => {
|
||
loadNews();
|
||
// 页面可见时每 60s 拉一次,拿到刷新后的股票列(非交易时段 relay 不重抓,开销可忽略)
|
||
newsTimer = setInterval(() => {
|
||
if (document.visibilityState !== 'visible') return;
|
||
loadNews();
|
||
if (stockTab.value === 'mine') loadMyQuotes();
|
||
}, 60000);
|
||
});
|
||
onUnmounted(() => {
|
||
if (newsTimer) clearInterval(newsTimer);
|
||
});
|
||
|
||
// ===== 股票列选项卡:AI最热 / 自选(自选实时行情,登录后随云同步)=====
|
||
const MY_STOCKS_KEY = 'it-tools-my-stocks';
|
||
const stockTab = ref<'hot' | 'mine'>('hot');
|
||
const stockInput = ref('');
|
||
const stockErr = ref('');
|
||
const myQuotes = ref<any[]>([]);
|
||
// 注意:ref(函数) 不会执行函数(那是 computed 的语义),必须显式调用取初值
|
||
function loadMyStocksList(): string[] {
|
||
try {
|
||
const a = JSON.parse(localStorage.getItem(MY_STOCKS_KEY) || '[]');
|
||
return Array.isArray(a) ? a : [];
|
||
}
|
||
catch { return []; }
|
||
}
|
||
const myStocks = ref<string[]>(loadMyStocksList());
|
||
|
||
// 云同步回写检测用:记住最后一次本地写入,避免自己的写入触发刷新
|
||
let lastSavedStocks = localStorage.getItem(MY_STOCKS_KEY) || '';
|
||
|
||
function saveMyStocks() {
|
||
const s = JSON.stringify(myStocks.value);
|
||
localStorage.setItem(MY_STOCKS_KEY, s);
|
||
lastSavedStocks = s;
|
||
loadMyQuotes();
|
||
}
|
||
|
||
async function loadMyQuotes() {
|
||
if (!myStocks.value.length) {
|
||
myQuotes.value = [];
|
||
return;
|
||
}
|
||
try {
|
||
const res = await fetch('/relay/stock/quotes?codes=' + myStocks.value.join(','));
|
||
const j = await res.json();
|
||
if (j.code === 200 && Array.isArray(j.data?.items)) myQuotes.value = j.data.items;
|
||
}
|
||
catch { /* 网络失败保留上次行情 */ }
|
||
}
|
||
|
||
function addMyStock() {
|
||
const code = stockInput.value.trim();
|
||
if (!/^\d{6}$/.test(code)) {
|
||
stockErr.value = '请输入 6 位股票代码';
|
||
return;
|
||
}
|
||
if (myStocks.value.includes(code)) {
|
||
stockErr.value = '该股票已在自选中';
|
||
return;
|
||
}
|
||
myStocks.value = [...myStocks.value, code];
|
||
stockInput.value = '';
|
||
stockErr.value = '';
|
||
saveMyStocks();
|
||
}
|
||
|
||
function removeMyStock(code: string) {
|
||
myStocks.value = myStocks.value.filter(c => c !== code);
|
||
saveMyStocks();
|
||
}
|
||
|
||
function switchStockTab(t: 'hot' | 'mine') {
|
||
stockTab.value = t;
|
||
if (t === 'mine') loadMyQuotes();
|
||
}
|
||
|
||
// 按自选顺序渲染;行情没返回的代码给占位(仍可删除)
|
||
const myList = computed(() => myStocks.value.map((code) => {
|
||
const q = myQuotes.value.find(x => x.code === code);
|
||
return q || {
|
||
code,
|
||
name: code,
|
||
title: `${code} 暂无数据`,
|
||
desc: '',
|
||
pct: 0,
|
||
url: `https://quote.eastmoney.com/${code}.html`,
|
||
};
|
||
}));
|
||
|
||
// 云同步回写检测(3s):登录或另一台设备的自选股同步到本机后,界面自动刷新
|
||
const stocksSyncTimer = setInterval(() => {
|
||
const remote = localStorage.getItem(MY_STOCKS_KEY) || '';
|
||
if (remote && remote !== lastSavedStocks) {
|
||
myStocks.value = loadMyStocksList();
|
||
lastSavedStocks = remote;
|
||
loadMyQuotes();
|
||
}
|
||
}, 3000);
|
||
onUnmounted(() => clearInterval(stocksSyncTimer));
|
||
|
||
// map recent paths to tool objects (newest first, cap 8)
|
||
const recentToolList = computed(() => {
|
||
const byPath = new Map(toolStore.tools.map(t => [t.path, t]));
|
||
const out: any[] = [];
|
||
for (const r of recentTools.value) {
|
||
const tool = byPath.get(r.path);
|
||
if (tool && !out.includes(tool)) {
|
||
out.push(tool);
|
||
}
|
||
if (out.length >= 8) {
|
||
break;
|
||
}
|
||
}
|
||
return out;
|
||
});
|
||
|
||
useHead({ title: 'IT-TOOLS-PRO - Handy online tools for developers' });
|
||
const { t } = useI18n();
|
||
|
||
const favoriteTools = computed(() => toolStore.favoriteTools);
|
||
|
||
// 全部工具默认折叠,点击标题展开,右侧显示数量
|
||
const showAllTools = ref(false);
|
||
|
||
// Update favorite tools order when drag is finished
|
||
function onUpdateFavoriteTools() {
|
||
toolStore.updateFavoriteTools(favoriteTools.value); // Update the store with the new order
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="pt-50px">
|
||
<!-- 每日 5 列资讯 -->
|
||
<div v-if="newsCols.length" class="news-block">
|
||
<div class="nf-head">
|
||
<span class="nf-title">📰 每日资讯</span>
|
||
<span class="nf-sub">每天 08:00 自动更新{{ newsDate ? ' · ' + newsDate : '' }}</span>
|
||
</div>
|
||
<div class="news-grid">
|
||
<div v-for="col in newsCols" :key="col.key" class="news-col">
|
||
<div class="news-col-head">
|
||
<span class="news-col-icon">{{ col.icon }}</span>
|
||
<span class="news-col-title">{{ col.title }}</span>
|
||
<span
|
||
v-if="col.key === 'stock' && newsMarket"
|
||
class="market-badge"
|
||
:class="newsMarket"
|
||
>{{ newsMarket === 'open' ? '交易中' : '休市' }}</span>
|
||
</div>
|
||
<div v-if="col.key === 'stock'" class="stock-tabs">
|
||
<button class="stock-tab" :class="{ on: stockTab === 'hot' }" @click="switchStockTab('hot')">AI最热</button>
|
||
<button class="stock-tab" :class="{ on: stockTab === 'mine' }" @click="switchStockTab('mine')">自选<template v-if="myStocks.length">·{{ myStocks.length }}</template></button>
|
||
</div>
|
||
<div class="news-list">
|
||
<!-- 自选面板 -->
|
||
<template v-if="col.key === 'stock' && stockTab === 'mine'">
|
||
<div class="mystock-add">
|
||
<input v-model="stockInput" class="mystock-input" placeholder="6位代码 600519" maxlength="6" @keydown.enter.prevent="addMyStock">
|
||
<button class="mystock-btn" @click="addMyStock">添加</button>
|
||
</div>
|
||
<div v-if="stockErr" class="mystock-err">{{ stockErr }}</div>
|
||
<div v-if="!myStocks.length" class="news-empty">输入 6 位代码添加自选股</div>
|
||
<div v-for="q in myList" :key="q.code" class="mystock-item">
|
||
<a class="mystock-main" :href="q.url" target="_blank" rel="noopener noreferrer">
|
||
<span class="news-title" :class="q.pct > 0 ? 'up' : (q.pct < 0 ? 'down' : '')">{{ q.title }}</span>
|
||
<span v-if="q.desc" class="news-desc">{{ q.desc }}</span>
|
||
</a>
|
||
<button class="mystock-x" title="移出自选" @click="removeMyStock(q.code)">✕</button>
|
||
</div>
|
||
</template>
|
||
<!-- AI 最热(默认):AI 概念板块成分股按成交额排序 -->
|
||
<template v-else>
|
||
<a
|
||
v-for="(it, i) in col.items"
|
||
:key="i"
|
||
class="news-item"
|
||
:href="it.url"
|
||
target="_blank"
|
||
rel="noopener noreferrer"
|
||
>
|
||
<span class="news-title">{{ it.title }}</span>
|
||
<span v-if="it.desc" class="news-desc">{{ it.desc }}</span>
|
||
<span class="news-time">{{ it.time }}</span>
|
||
</a>
|
||
<div v-if="!col.items.length" class="news-empty">暂无内容</div>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 精选推荐(管理后台配置,置顶独立列表) -->
|
||
<div v-if="recoList.length" class="nf-block reco-block">
|
||
<div class="nf-head">
|
||
<span class="nf-title">⭐ 精选推荐 <em class="nf-count">{{ recoList.length }}</em></span>
|
||
<span class="nf-sub">为您精选的实用工具,管理员持续更新</span>
|
||
</div>
|
||
<div class="nf-grid">
|
||
<RouterLink v-for="f in recoList" :key="f.path" :to="f.path" class="nf-card reco-card">
|
||
<span class="nf-icon">{{ f.icon }}</span>
|
||
<span class="nf-body">
|
||
<span class="nf-name">{{ f.name }} <em class="reco-badge">荐</em></span>
|
||
<span class="nf-desc">{{ f.desc }}</span>
|
||
</span>
|
||
</RouterLink>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 近期新功能 -->
|
||
<div class="nf-block">
|
||
<div class="nf-head">
|
||
<span class="nf-title">🆕 近期新功能 <em class="nf-count">{{ newFeatures.length }}</em></span>
|
||
<span class="nf-sub">持续更新中,登录后数据云端同步、授权跟随账号</span>
|
||
</div>
|
||
<div class="nf-grid">
|
||
<RouterLink v-for="f in newFeatures" :key="f.path" :to="f.path" class="nf-card">
|
||
<span class="nf-icon">{{ f.icon }}</span>
|
||
<span class="nf-body">
|
||
<span class="nf-name">{{ f.name }} <em class="nf-badge">新</em></span>
|
||
<span class="nf-desc">{{ f.desc }}</span>
|
||
</span>
|
||
</RouterLink>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="grid-wrapper">
|
||
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||
<ColoredCard v-if="config.showBanner" :title="$t('home.follow.title')" :icon="IconHeart">
|
||
{{ $t('home.follow.p1') }}
|
||
<a
|
||
href="https://github.com/CorentinTh/it-tools"
|
||
rel="noopener"
|
||
target="_blank"
|
||
:aria-label="$t('home.follow.githubRepository')"
|
||
>GitHub</a>
|
||
{{ $t('home.follow.p2') }}
|
||
<a
|
||
href="https://x.com/ittoolsdottech"
|
||
rel="noopener"
|
||
target="_blank"
|
||
:aria-label="$t('home.follow.twitterXAccount')"
|
||
>X</a>.
|
||
{{ $t('home.follow.thankYou') }}
|
||
<n-icon :component="IconHeart" />
|
||
</ColoredCard>
|
||
</div>
|
||
|
||
<div v-if="recentToolList.length > 0">
|
||
<h3 class="mb-5px mt-25px text-neutral-400 font-500 grp-h3">
|
||
<span>🕘 {{ $t('home.categories.recentTools') }}</span>
|
||
<span class="grp-count">{{ recentToolList.length }}</span>
|
||
</h3>
|
||
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||
<ToolCard v-for="tool in recentToolList" :key="tool.name" :tool="tool" />
|
||
</div>
|
||
</div>
|
||
|
||
<transition name="height">
|
||
<div v-if="toolStore.favoriteTools.length > 0">
|
||
<h3 class="mb-5px mt-25px text-neutral-400 font-500 grp-h3">
|
||
<span>
|
||
{{ $t('home.categories.favoriteTools') }}
|
||
<c-tooltip :tooltip="$t('home.categories.favoritesDndToolTip')">
|
||
<n-icon :component="IconDragDrop" size="18" />
|
||
</c-tooltip>
|
||
</span>
|
||
<span class="grp-count">{{ favoriteTools.length }}</span>
|
||
</h3>
|
||
<Draggable
|
||
:list="favoriteTools"
|
||
class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4"
|
||
ghost-class="ghost-favorites-draggable"
|
||
item-key="name"
|
||
@end="onUpdateFavoriteTools"
|
||
>
|
||
<template #item="{ element: tool }">
|
||
<ToolCard :tool="tool" />
|
||
</template>
|
||
</Draggable>
|
||
</div>
|
||
</transition>
|
||
|
||
<div v-if="toolStore.newTools.length > 0">
|
||
<h3 class="mb-5px mt-25px text-neutral-400 font-500 grp-h3">
|
||
<span>{{ t('home.categories.newestTools') }}</span>
|
||
<span class="grp-count">{{ toolStore.newTools.length }}</span>
|
||
</h3>
|
||
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||
<ToolCard v-for="tool in toolStore.newTools" :key="tool.name" :tool="tool" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="all-tools">
|
||
<div class="all-tools-head" role="button" :aria-expanded="showAllTools" @click="showAllTools = !showAllTools">
|
||
<span class="all-tools-l">
|
||
<span class="all-tools-arrow" :class="{ open: showAllTools }">▶</span>
|
||
{{ $t('home.categories.allTools') }}
|
||
</span>
|
||
<span class="all-tools-count">{{ toolStore.tools.length }}</span>
|
||
</div>
|
||
<transition name="height">
|
||
<div v-if="showAllTools" class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||
<ToolCard v-for="tool in toolStore.tools" :key="tool.name" :tool="tool" />
|
||
</div>
|
||
</transition>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped lang="less">
|
||
// 首页各组数量徽章:紧跟组名显示(统一绿色圆角)
|
||
.nf-count,
|
||
.grp-count {
|
||
display: inline-block;
|
||
min-width: 22px;
|
||
padding: 0 7px;
|
||
border-radius: 999px;
|
||
background: rgba(24, 160, 88, 0.15);
|
||
color: #18a058;
|
||
font-size: 12px;
|
||
font-weight: 700;
|
||
text-align: center;
|
||
flex-shrink: 0;
|
||
line-height: 1.7;
|
||
font-style: normal;
|
||
margin-left: 5px;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
// h3 组标题:标签 + 数量 紧邻
|
||
.grp-h3 {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
|
||
> span:first-child {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
}
|
||
|
||
// 全部工具:默认折叠,标题左侧箭头 + 右侧数量徽章
|
||
.all-tools {
|
||
margin-top: 25px;
|
||
|
||
.all-tools-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
cursor: pointer;
|
||
user-select: none;
|
||
padding: 7px 8px;
|
||
border-radius: 9px;
|
||
margin-bottom: 5px;
|
||
transition: background 0.15s;
|
||
|
||
&:hover {
|
||
background: rgba(128, 128, 128, 0.07);
|
||
}
|
||
|
||
.all-tools-l {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 7px;
|
||
font-size: 15px;
|
||
font-weight: 500;
|
||
color: rgba(0, 0, 0, 0.55);
|
||
}
|
||
|
||
.all-tools-arrow {
|
||
font-size: 11px;
|
||
opacity: 0.6;
|
||
transition: transform 0.18s;
|
||
|
||
&.open {
|
||
transform: rotate(90deg);
|
||
}
|
||
}
|
||
|
||
.all-tools-count {
|
||
min-width: 30px;
|
||
padding: 2px 10px;
|
||
border-radius: 999px;
|
||
background: rgba(24, 160, 88, 0.15);
|
||
color: #18a058;
|
||
font-size: 13px;
|
||
font-weight: 700;
|
||
text-align: center;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 精选推荐区块:琥珀色调,与绿色「近期新功能」视觉区分(提高优先级覆盖 .nf-card)
|
||
.nf-block.reco-block {
|
||
.nf-title {
|
||
color: #f0a020;
|
||
}
|
||
|
||
.nf-card.reco-card {
|
||
border-color: rgba(240, 160, 32, 0.4);
|
||
background: linear-gradient(120deg, rgba(240, 160, 32, 0.07), rgba(240, 160, 32, 0.02));
|
||
|
||
&:hover {
|
||
border-color: rgba(240, 160, 32, 0.7);
|
||
}
|
||
}
|
||
}
|
||
|
||
.nf-block {
|
||
margin-bottom: 20px;
|
||
|
||
.nf-head {
|
||
display: flex;
|
||
align-items: baseline;
|
||
gap: 10px;
|
||
margin-bottom: 10px;
|
||
|
||
.nf-title {
|
||
font-size: 17px;
|
||
font-weight: 800;
|
||
}
|
||
|
||
.nf-sub {
|
||
font-size: 12px;
|
||
opacity: 0.5;
|
||
}
|
||
}
|
||
|
||
.nf-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
||
gap: 10px;
|
||
}
|
||
|
||
.nf-card {
|
||
display: flex;
|
||
gap: 10px;
|
||
align-items: flex-start;
|
||
border: 1px solid rgba(24, 160, 88, 0.3);
|
||
background: linear-gradient(120deg, rgba(24, 160, 88, 0.05), rgba(24, 160, 88, 0.015));
|
||
border-radius: 10px;
|
||
padding: 10px 12px;
|
||
text-decoration: none;
|
||
color: inherit;
|
||
transition: border-color 0.15s, transform 0.1s;
|
||
|
||
&:hover {
|
||
border-color: #18a058;
|
||
transform: translateY(-1px);
|
||
}
|
||
|
||
.nf-icon {
|
||
font-size: 20px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.nf-body {
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
|
||
.nf-name {
|
||
font-size: 13.5px;
|
||
font-weight: 700;
|
||
|
||
.nf-badge {
|
||
font-style: normal;
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
background: #18a058;
|
||
border-radius: 4px;
|
||
padding: 0 5px;
|
||
margin-left: 4px;
|
||
vertical-align: 1px;
|
||
}
|
||
|
||
.reco-badge {
|
||
font-style: normal;
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
background: #f0a020;
|
||
border-radius: 4px;
|
||
padding: 0 5px;
|
||
margin-left: 4px;
|
||
vertical-align: 1px;
|
||
}
|
||
}
|
||
|
||
.nf-desc {
|
||
font-size: 11.5px;
|
||
opacity: 0.6;
|
||
line-height: 1.55;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// 每日 5 列资讯
|
||
.news-block {
|
||
margin-bottom: 20px;
|
||
|
||
.news-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(5, 1fr);
|
||
gap: 10px;
|
||
|
||
@media (max-width: 1280px) {
|
||
grid-template-columns: repeat(3, 1fr);
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
grid-template-columns: repeat(2, 1fr);
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
}
|
||
|
||
.news-col {
|
||
border: 1px solid rgba(24, 160, 88, 0.25);
|
||
background: rgba(24, 160, 88, 0.04);
|
||
border-radius: 10px;
|
||
padding: 8px 10px 6px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.news-col-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
padding-bottom: 6px;
|
||
margin-bottom: 4px;
|
||
border-bottom: 1px solid rgba(24, 160, 88, 0.18);
|
||
|
||
.news-col-icon {
|
||
font-size: 15px;
|
||
}
|
||
|
||
.news-col-title {
|
||
font-size: 13px;
|
||
font-weight: 800;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
}
|
||
|
||
.news-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
// 固定显示 5 条的高度(含简介约 66px/条),超出在框内滚动
|
||
height: 330px;
|
||
overflow-y: auto;
|
||
overscroll-behavior: contain;
|
||
scrollbar-width: thin;
|
||
|
||
&::-webkit-scrollbar {
|
||
width: 6px;
|
||
}
|
||
|
||
&::-webkit-scrollbar-thumb {
|
||
background: rgba(24, 160, 88, 0.35);
|
||
border-radius: 3px;
|
||
}
|
||
}
|
||
|
||
.news-item {
|
||
display: block;
|
||
padding: 5px 2px;
|
||
border-radius: 6px;
|
||
text-decoration: none;
|
||
color: inherit;
|
||
transition: background 0.15s;
|
||
|
||
&:hover {
|
||
background: rgba(24, 160, 88, 0.1);
|
||
|
||
.news-title {
|
||
color: #18a058;
|
||
}
|
||
}
|
||
|
||
.news-title {
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 2;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
font-size: 12px;
|
||
line-height: 1.45;
|
||
color: rgba(0, 0, 0, 0.85);
|
||
word-break: break-word;
|
||
}
|
||
|
||
.news-desc {
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 2;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
font-size: 11px;
|
||
line-height: 1.45;
|
||
color: rgba(0, 0, 0, 0.45);
|
||
margin-top: 2px;
|
||
word-break: break-word;
|
||
}
|
||
|
||
.news-time {
|
||
display: block;
|
||
font-size: 10.5px;
|
||
opacity: 0.5;
|
||
margin-top: 2px;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
}
|
||
|
||
.news-empty {
|
||
font-size: 11.5px;
|
||
opacity: 0.45;
|
||
padding: 8px 2px;
|
||
}
|
||
|
||
// 开盘状态徽章(交易中 / 休市)
|
||
.market-badge {
|
||
margin-left: auto;
|
||
font-size: 10.5px;
|
||
font-weight: 700;
|
||
padding: 1px 7px;
|
||
border-radius: 999px;
|
||
line-height: 1.6;
|
||
flex-shrink: 0;
|
||
|
||
&.open {
|
||
color: #d03050;
|
||
background: rgba(208, 48, 80, 0.12);
|
||
}
|
||
&.closed {
|
||
color: rgba(0, 0, 0, 0.45);
|
||
background: rgba(0, 0, 0, 0.06);
|
||
}
|
||
}
|
||
|
||
// 股票列:最热 / 自选 选项卡
|
||
.stock-tabs {
|
||
display: flex;
|
||
gap: 6px;
|
||
padding: 6px 10px 0;
|
||
}
|
||
.stock-tab {
|
||
flex: 1;
|
||
font-size: 11.5px;
|
||
padding: 3px 0;
|
||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||
border-radius: 999px;
|
||
background: #fff;
|
||
color: rgba(0, 0, 0, 0.55);
|
||
cursor: pointer;
|
||
transition: all 0.15s;
|
||
|
||
&.on {
|
||
background: rgba(24, 160, 88, 0.12);
|
||
border-color: rgba(24, 160, 88, 0.45);
|
||
color: #18a058;
|
||
font-weight: 700;
|
||
}
|
||
}
|
||
|
||
// 自选面板
|
||
.mystock-add {
|
||
display: flex;
|
||
gap: 6px;
|
||
padding: 2px 0 6px;
|
||
}
|
||
.mystock-input {
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: 11.5px;
|
||
padding: 4px 7px;
|
||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||
border-radius: 6px;
|
||
outline: none;
|
||
|
||
&:focus {
|
||
border-color: #18a058;
|
||
}
|
||
}
|
||
.mystock-btn {
|
||
font-size: 11.5px;
|
||
padding: 4px 9px;
|
||
border: none;
|
||
border-radius: 6px;
|
||
background: #18a058;
|
||
color: #fff;
|
||
cursor: pointer;
|
||
|
||
&:hover {
|
||
opacity: 0.88;
|
||
}
|
||
}
|
||
.mystock-err {
|
||
font-size: 11px;
|
||
color: #d03050;
|
||
padding-bottom: 4px;
|
||
}
|
||
.mystock-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
padding: 7px 8px;
|
||
border-radius: 8px;
|
||
|
||
&:hover {
|
||
background: rgba(0, 0, 0, 0.035);
|
||
}
|
||
.mystock-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
text-decoration: none;
|
||
color: inherit;
|
||
}
|
||
.news-title {
|
||
&.up {
|
||
color: #d03050; // A股红涨
|
||
}
|
||
&.down {
|
||
color: #18a058; // 绿跌
|
||
}
|
||
}
|
||
.mystock-x {
|
||
flex-shrink: 0;
|
||
width: 18px;
|
||
height: 18px;
|
||
border: none;
|
||
border-radius: 50%;
|
||
background: transparent;
|
||
color: rgba(0, 0, 0, 0.3);
|
||
font-size: 11px;
|
||
line-height: 1;
|
||
cursor: pointer;
|
||
|
||
&:hover {
|
||
background: rgba(208, 48, 80, 0.12);
|
||
color: #d03050;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.height-enter-active,
|
||
.height-leave-active {
|
||
transition: all 0.5s ease-in-out;
|
||
overflow: hidden;
|
||
max-height: 500px;
|
||
}
|
||
|
||
.height-enter-from,
|
||
.height-leave-to {
|
||
max-height: 42px;
|
||
overflow: hidden;
|
||
opacity: 0;
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.ghost-favorites-draggable {
|
||
opacity: 0.4;
|
||
background-color: #ccc;
|
||
border: 2px dashed #666;
|
||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||
transform: scale(1.1);
|
||
animation: ghost-favorites-draggable-animation 0.2s ease-out;
|
||
}
|
||
|
||
@keyframes ghost-favorites-draggable-animation {
|
||
0% {
|
||
opacity: 0;
|
||
transform: scale(0.9);
|
||
}
|
||
100% {
|
||
opacity: 0.4;
|
||
transform: scale(1.0);
|
||
}
|
||
}
|
||
</style>
|