Files
it-tools-pro/src/pages/Home.page.vue
T

870 lines
27 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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';
import { toolVisible } from '@/tools/license/license';
// 近期新功能亮点(手动维护,新工具上线时加一条)
// ★铁规则:每完成一批新功能/新工具,必须在这里最前面加条目(新→旧),否则首页看不到
const NEW_FEATURES = [
{ path: '/ai-image-lab', icon: '🧬', name: '图片处理历史全覆盖', desc: 'AI生图、AI修图、AI图片实验室、AI海报、AI换脸五个工具的每个处理动作(抠图换底、证件照、超分、画布导出等)全部自动存服务端历史,右侧50×50缩略图即时可见' },
{ path: '/qrcode-generator', icon: '🕘', name: '草稿找回历史版本', desc: '右下角自动保存条新增「找回」按钮,列出该工具近 20 份保存历史(时间精确到秒),点任意一条立即恢复成那一版继续编辑' },
{ path: '/ai-gen', icon: '🗂️', name: '图片历史铁规则', desc: '所有生图功能右侧 50×50 缩略图历史竖排、点击看大图,按登录账号/机器码只看本人的,生成即保存到后台指定目录,全部功能历史最多显示100条' },
{ path: '/face-swap', icon: '🎭', name: 'AI 换脸', desc: '上传源人脸与目标照片,本地 AI 一键换脸(insightface 人脸检测+inswapper),授权功能支持免费试用' },
{ path: '/poster-maker', icon: '🖼️', name: 'AI 海报生成', desc: '42套模板10分类(含校园师生款)、文字图片可旋转、整页自适应不滚动,改文字换图片AI生成配图,一键导出 PNG' },
{ path: '/ai-gen', icon: '🎨', name: 'AI 生图', desc: '10款内置模型一键出图,四组86个现成提示词(通用/自媒体/电商/软件类),中文自动转英文发送' },
{ path: '/mcp-connect', icon: '🔌', name: 'AI 接入 (MCP)', desc: '把本站能力接到任意 AI 客户端,13个工具、卡密令牌管理、调用记录后台可查' },
{ path: '/my-ip', icon: '🌍', name: '本机IP查询', desc: '公网IPv4/IPv6地址与所属地一键查询,自动测9个热门地点延迟,一键测试当前下载上传网速' },
{ path: '/code-reader', icon: '🧩', name: '二维码生成', desc: '识别工具内新能力:自定义颜色、中间插入本地 Logo 图,生成后自动自扫验证' },
{ path: '/base64-image-converter', icon: '🔁', name: 'Base64图片互转', desc: 'Base64转图片与图片转Base64合一页,三格式自动识别,纯浏览器本地不上传' },
{ path: '/image-tools', icon: '🖌️', name: '图片编辑·无痕改字', desc: 'PS式图层画笔选区,OCR点字框自动匹配字号颜色角度无缝改字' },
{ 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);
/** 管理后台关闭显示的条目不出现在首页推荐;/admin 后台功能一律不进「近期新功能」(用户 2026-11-16 要求) */
const visibleNewFeatures = computed(() => newFeatures.value.filter(f => toolVisible(f.path) && f.path !== '/admin'));
// 精选推荐:管理后台配置(/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">{{ visibleNewFeatures.length }}</em></span>
<span class="nf-sub">持续更新中,登录后数据云端同步、授权跟随账号</span>
</div>
<div class="nf-grid">
<RouterLink v-for="f in visibleNewFeatures" :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>