Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15d21235cd | ||
|
|
55b1111d96 | ||
|
|
9d75776d52 |
No files matched your search
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
- **站内支付页 `/buy`(本次核心)**:新增独立支付页——自动读取本机机器码,直接列出本项目可购套餐(名称/价格/时长)、支持支付宝 / 微信支付 / QQ 钱包三种方式、优惠码选填;点击「立即支付」拉起收银台(新标签打开,本页留守轮询),**支付成功当场显示卡密**并自动核验授权,13 个高级功能立即解锁,全程无需人工发货、无需跳出本站
|
||||
- **购买入口全部改指 `/buy`**:顶栏浮条「永久解锁 13 个功能」、试用用尽锁定弹窗的「购买授权」、授权应用页的「💳 前往购买卡密」,三处统一跳转站内支付页(原先跳外部 `auth.88531.cn/#/shop`);页面未登录即可访问,支付状态本机留存,刷新/误关后自动恢复轮询
|
||||
- **CardAuth 后端补发卡**:订单支付完成时同步签发一张卡密并写回订单(原先「带机器码下单」只创建授权、不发卡,导致订单查不到卡密、支付结果页无卡可显示);优先取卡池未用卡,卡池不足自动新建,并绑定下单机器码
|
||||
- **页脚开源地址**:全站页脚新增「🐙 开源 gitea.88531.cn」链接,指向本项目 Gitea 仓库(`https://gitea.88531.cn/jinghui/it-tools-pro`,新标签打开、悬停显示完整地址);页脚改为放不下时自动换行,窄屏也不产生横向溢出
|
||||
|
||||
## Version 2026.11.01-it-tools-pro
|
||||
|
||||
|
||||
@@ -32,6 +32,20 @@
|
||||
- **生成记录**:翻译/OCR/修图/转换等 9 个工具自动留痕,数据存本地
|
||||
- **体验优化**:全站中文默认、收藏与最近使用、菜单一键展开/收起、宽屏自适应、品牌页脚等数十项细节
|
||||
|
||||
### 留言反馈(2026.11 新增)
|
||||
|
||||
- **访客提交**:顶栏「留言反馈」按钮打开弹窗 —— 类型(功能建议/意见建议/Bug 反馈/其他)+ 内容(上限 1000 字)+ 联系方式(可选),图形验证码防刷,同一 IP 一小时内限提交 1 次
|
||||
- **管理后台**:`/admin` 切到「留言反馈」标签(`X-Admin-Token` 鉴权,令牌存本地 `it-tools-admin-token`),列出时间/类型/内容/联系方式/真实 IP,支持状态流转(未处理→已处理→已回复)与删除,导航标签带未处理数角标;窄屏下表格容器内横向滚动不撑破页面
|
||||
- **链路**:公开页 → relay `POST /feedback`(验证码校验 + IP 限频)落盘 `data/feedback.json`;管理接口经 nginx `location /admin/` 反代到 `it-tools-relay:8091`。公网入口 https://it.88531.cn/
|
||||
|
||||
### 在线统计与公告推送(2026.11 新增)
|
||||
|
||||
- **右上角常驻**:🔔 公告铃铛(未读红点)+ `v2026.11.12` 版本徽标(源码常量 `SITE_VERSION`,与 Gitea Release tag 同步,发版时更新)
|
||||
- **公告推送**:铃铛下拉面板列出授权系统公告(标题/时间/正文,未读带红条,点击已读、支持全部已读);`is_popup` 类型公告进站即弹一次(每条只弹一次,已读记录存 localStorage `it-tools-ann-read`)
|
||||
- **在线统计**:打开页面即经 relay `POST /relay/hub/report` 向授权系统(auth.88531.cn 项目 6)登记安装并上报版本号(机器码复用 license 的 `getMachineId()`),每 30 分钟心跳一次;公告每 15 分钟拉取一次(`GET /relay/hub/announcements`),授权系统后台据此展示安装数/在线数/趋势
|
||||
- **失败开放**:授权系统不可达时静默降级,不影响站点任何功能
|
||||
- **实现注意**:公告面板与推送弹窗均 `<Teleport to="body">`——实测 top-nav 内 v-if 子树挂载会触发 Vue `insertBefore null` 崩溃;CardAuth 的 heartbeat 会清空 `client_version/device_info`,relay 侧先心跳后 check-update 保证版本号落库
|
||||
|
||||
## 优势
|
||||
|
||||
- **一次激活,全站通用**:输入一次卡密,全部授权功能解锁,无需逐个购买
|
||||
|
||||
Vendored
+2
@@ -92,6 +92,7 @@ declare module '@vue/runtime-core' {
|
||||
Encryption: typeof import('./src/tools/encryption/encryption.vue')['default']
|
||||
EtaCalculator: typeof import('./src/tools/eta-calculator/eta-calculator.vue')['default']
|
||||
FavoriteButton: typeof import('./src/components/FavoriteButton.vue')['default']
|
||||
FeedbackModal: typeof import('./src/components/FeedbackModal.vue')['default']
|
||||
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
|
||||
GenHistory: typeof import('./src/tools/gen-history/GenHistory.vue')['default']
|
||||
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
|
||||
@@ -193,6 +194,7 @@ declare module '@vue/runtime-core' {
|
||||
NRadioButton: typeof import('naive-ui')['NRadioButton']
|
||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSelect: typeof import('naive-ui')['NSelect']
|
||||
NSlider: typeof import('naive-ui')['NSlider']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
|
||||
+15
@@ -17,6 +17,21 @@ server {
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
|
||||
# admin console SPA route (exact match beats the /admin/ API prefix below,
|
||||
# otherwise nginx 301s /admin -> /admin/ and the API proxy swallows the UI)
|
||||
location = /admin {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# admin console API (relay does its own Bearer auth; must beat SPA fallback)
|
||||
location /admin/ {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://it-tools-relay:8091;
|
||||
proxy_connect_timeout 5s;
|
||||
proxy_read_timeout 30s;
|
||||
}
|
||||
|
||||
# license relay (card activation etc; auth gate itself must stay open)
|
||||
location /relay/ {
|
||||
client_max_body_size 2g;
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
|
||||
// 站内留言反馈弹窗(与授权系统无关,任何人可提交)
|
||||
const props = defineProps<{ show: boolean }>();
|
||||
const emit = defineEmits<{ (e: 'update:show', v: boolean): void }>();
|
||||
|
||||
const message = useMessage();
|
||||
|
||||
const TYPES = ['功能建议', '意见反馈'];
|
||||
const typeOptions = TYPES.map(t => ({ label: t, value: t }));
|
||||
|
||||
const type = ref('功能建议');
|
||||
const content = ref('');
|
||||
const contact = ref('');
|
||||
const captchaId = ref('');
|
||||
const captchaImg = ref('');
|
||||
const captchaCode = ref('');
|
||||
const err = ref('');
|
||||
const submitting = ref(false);
|
||||
|
||||
function close() {
|
||||
emit('update:show', false);
|
||||
}
|
||||
|
||||
async function loadCaptcha() {
|
||||
try {
|
||||
const res = await fetch('/relay/feedback/captcha');
|
||||
const b = await res.json();
|
||||
if (b.code === 200) {
|
||||
captchaId.value = b.data.id;
|
||||
captchaImg.value = `data:image/png;base64,${b.data.img}`;
|
||||
err.value = '';
|
||||
}
|
||||
else {
|
||||
captchaImg.value = '';
|
||||
err.value = b.message || '验证码加载失败';
|
||||
}
|
||||
}
|
||||
catch {
|
||||
captchaImg.value = '';
|
||||
err.value = '网络异常,验证码加载失败';
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.show, (v) => {
|
||||
if (v) {
|
||||
err.value = '';
|
||||
captchaCode.value = '';
|
||||
loadCaptcha();
|
||||
}
|
||||
});
|
||||
|
||||
async function submit() {
|
||||
if (submitting.value) {
|
||||
return;
|
||||
}
|
||||
if (!content.value.trim()) {
|
||||
err.value = '请填写留言内容';
|
||||
return;
|
||||
}
|
||||
if (!captchaCode.value.trim()) {
|
||||
err.value = '请输入图形验证码';
|
||||
return;
|
||||
}
|
||||
submitting.value = true;
|
||||
err.value = '';
|
||||
try {
|
||||
const res = await fetch('/relay/feedback', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
type: type.value,
|
||||
content: content.value,
|
||||
contact: contact.value,
|
||||
captcha_id: captchaId.value,
|
||||
captcha_code: captchaCode.value,
|
||||
}),
|
||||
});
|
||||
const b = await res.json().catch(() => ({} as any));
|
||||
if (b.code === 200) {
|
||||
message.success('提交成功,我们会通过你留的联系方式回复');
|
||||
content.value = '';
|
||||
contact.value = '';
|
||||
captchaCode.value = '';
|
||||
close();
|
||||
return;
|
||||
}
|
||||
err.value = b.message || `提交失败(${res.status})`;
|
||||
// 验证码一次性:除了限频(429)以外都换一张,避免用户对着旧码重试
|
||||
if (res.status !== 429) {
|
||||
loadCaptcha();
|
||||
captchaCode.value = '';
|
||||
}
|
||||
}
|
||||
catch {
|
||||
err.value = '网络异常,请稍后重试';
|
||||
}
|
||||
finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-modal
|
||||
:show="show"
|
||||
preset="card"
|
||||
class="fb-modal"
|
||||
title="💬 留言反馈"
|
||||
:style="{ width: 'min(580px, 94vw)' }"
|
||||
:bordered="false"
|
||||
@update:show="(v: boolean) => emit('update:show', v)"
|
||||
>
|
||||
<div class="fb-hint">与授权系统无关,任何人都可以留言;内容我们会在后台查看,留了联系方式会回复你。</div>
|
||||
|
||||
<div class="fb-row">
|
||||
<label class="fb-label">留言类型</label>
|
||||
<n-select v-model:value="type" :options="typeOptions" size="medium" />
|
||||
</div>
|
||||
|
||||
<div class="fb-row">
|
||||
<label class="fb-label">留言内容 <i>*</i></label>
|
||||
<n-input
|
||||
v-model:value="content"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
maxlength="1000"
|
||||
show-count
|
||||
placeholder="请描述你的功能建议或遇到的问题,越具体越好…"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="fb-row">
|
||||
<label class="fb-label">联系方式(可选)</label>
|
||||
<n-input
|
||||
v-model:value="contact"
|
||||
:maxlength="64"
|
||||
placeholder="QQ / 微信 / 邮箱,方便我们回复你"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="fb-row">
|
||||
<label class="fb-label">图形验证码 <i>*</i></label>
|
||||
<div class="fb-captcha-line">
|
||||
<n-input
|
||||
v-model:value="captchaCode"
|
||||
:maxlength="4"
|
||||
placeholder="4 位字符"
|
||||
class="fb-captcha-input"
|
||||
@keyup.enter="submit"
|
||||
/>
|
||||
<img
|
||||
v-if="captchaImg"
|
||||
class="fb-captcha-img"
|
||||
:src="captchaImg"
|
||||
alt="图形验证码"
|
||||
title="点击换一张"
|
||||
@click="loadCaptcha"
|
||||
>
|
||||
<span v-else class="fb-captcha-img fb-captcha-loading" @click="loadCaptcha">加载中…</span>
|
||||
<span class="fb-captcha-refresh" role="button" tabindex="0" @click="loadCaptcha">换一张</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="err" class="fb-err">{{ err }}</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="fb-foot">
|
||||
<span class="fb-limit">同一 IP 一小时内限提交 1 次</span>
|
||||
<span class="fb-foot-btns">
|
||||
<n-button quaternary @click="close">取消</n-button>
|
||||
<n-button type="primary" :loading="submitting" @click="submit">提交留言</n-button>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<!-- n-modal 会 teleport 到 body,故这里用非 scoped 样式(类名统一 fb- 前缀) -->
|
||||
<style lang="less">
|
||||
.fb-modal {
|
||||
.fb-hint {
|
||||
font-size: 14.5px;
|
||||
line-height: 1.6;
|
||||
opacity: 0.75;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.fb-row {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.fb-label {
|
||||
display: block;
|
||||
font-size: 14.5px;
|
||||
margin-bottom: 6px;
|
||||
|
||||
i {
|
||||
color: #e0115f;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.fb-captcha-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.fb-captcha-input {
|
||||
width: 140px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.fb-captcha-img {
|
||||
height: 40px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(128, 128, 128, 0.35);
|
||||
background: rgba(128, 128, 128, 0.12);
|
||||
padding: 0 12px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14.5px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.fb-captcha-refresh {
|
||||
font-size: 14.5px;
|
||||
cursor: pointer;
|
||||
opacity: 0.8;
|
||||
text-decoration: underline;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.fb-err {
|
||||
margin-top: 10px;
|
||||
font-size: 14.5px;
|
||||
color: #d03050;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.fb-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.fb-limit {
|
||||
font-size: 14px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.fb-foot-btns {
|
||||
display: inline-flex;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+429
-1
@@ -16,6 +16,8 @@ import { useToolStore } from '@/tools/tools.store';
|
||||
import { useTracker } from '@/modules/tracker/tracker.services';
|
||||
import CollapsibleToolMenu from '@/components/CollapsibleToolMenu.vue';
|
||||
import UserMenu from '@/components/UserMenu.vue';
|
||||
import FeedbackModal from '@/components/FeedbackModal.vue';
|
||||
import { getMachineId } from '@/tools/license/license';
|
||||
|
||||
const themeVars = useThemeVars();
|
||||
const styleStore = useStyleStore();
|
||||
@@ -31,6 +33,144 @@ if (isLoggedIn.value) {
|
||||
const version = config.app.version;
|
||||
const commitSha = config.app.lastCommitSha.slice(0, 7);
|
||||
|
||||
// ---- 站内留言反馈(右上角入口,弹窗提交,与授权系统无关) ----
|
||||
const showFeedback = ref(false);
|
||||
|
||||
// ---- 授权系统接入(auth.88531.cn 项目 6):在线统计上报 + 公告推送 + 右上角铃铛/版本号 ----
|
||||
const SITE_VERSION = '2026.11.12'; // 当前版本号,与 Gitea Release tag 同步(发版时更新)
|
||||
const annOpen = ref(false);
|
||||
const announcements = ref<Record<string, any>[]>([]);
|
||||
const popupAnn = ref<Record<string, any> | null>(null);
|
||||
const annSeenVersion = ref(0);
|
||||
let annSeen: string[] = [];
|
||||
try {
|
||||
annSeen = JSON.parse(localStorage.getItem('it-tools-ann-read') || '[]');
|
||||
if (!Array.isArray(annSeen)) annSeen = [];
|
||||
}
|
||||
catch {
|
||||
annSeen = [];
|
||||
}
|
||||
const annUnread = computed(() => {
|
||||
annSeenVersion.value; // 依赖已读版本号,标记已读后重算
|
||||
return announcements.value.filter(a => !annSeen.includes(String(a.id))).length;
|
||||
});
|
||||
function annIsUnread(a: Record<string, any>) {
|
||||
annSeenVersion.value;
|
||||
return !annSeen.includes(String(a.id));
|
||||
}
|
||||
function annSaveSeen() {
|
||||
try {
|
||||
localStorage.setItem('it-tools-ann-read', JSON.stringify(annSeen));
|
||||
}
|
||||
catch { /* localStorage 不可用时忽略 */ }
|
||||
annSeenVersion.value++;
|
||||
}
|
||||
function annMarkRead(a: Record<string, any>) {
|
||||
const id = String(a?.id ?? '');
|
||||
if (id && !annSeen.includes(id)) {
|
||||
annSeen.push(id);
|
||||
annSaveSeen();
|
||||
}
|
||||
}
|
||||
function annMarkAll() {
|
||||
const ids = announcements.value.map(a => String(a?.id ?? '')).filter(Boolean);
|
||||
annSeen = [...new Set([...annSeen, ...ids])];
|
||||
annSaveSeen();
|
||||
}
|
||||
function annTime(t?: string) {
|
||||
return t ? String(t).slice(0, 16) : '';
|
||||
}
|
||||
function toggleAnn() {
|
||||
annOpen.value = !annOpen.value;
|
||||
if (annOpen.value) fetchAnnouncements();
|
||||
}
|
||||
async function fetchAnnouncements() {
|
||||
try {
|
||||
const res = await fetch('/relay/hub/announcements?limit=20');
|
||||
if (!res.ok) return;
|
||||
const body = await res.json();
|
||||
if (body?.code !== 200) return;
|
||||
announcements.value = Array.isArray(body.data?.list) ? body.data.list : [];
|
||||
// 公告推送:popup 列表里没看过的条目每次只弹第一条(其余在铃铛面板可读)
|
||||
const pops = (Array.isArray(body.data?.popup) ? body.data.popup : [])
|
||||
.filter((p: any) => p && !annSeen.includes(String(p.id)));
|
||||
if (pops.length && !popupAnn.value)
|
||||
popupAnn.value = pops[0];
|
||||
}
|
||||
catch {
|
||||
// 授权系统不可达时静默降级,不影响站点使用
|
||||
}
|
||||
}
|
||||
function closePopup() {
|
||||
if (popupAnn.value)
|
||||
annMarkRead(popupAnn.value);
|
||||
popupAnn.value = null;
|
||||
}
|
||||
// 在线统计:打开页面即登记安装 + 每 30 分钟心跳,授权系统后台据此统计安装/在线
|
||||
async function reportOnline() {
|
||||
try {
|
||||
await fetch('/relay/hub/report', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
machine_id: getMachineId(),
|
||||
client_version: SITE_VERSION,
|
||||
device_info: `web ${location.host}`,
|
||||
}),
|
||||
});
|
||||
}
|
||||
catch {
|
||||
// 静默降级
|
||||
}
|
||||
}
|
||||
function onAnnDocClick(e: MouseEvent) {
|
||||
const el = e.target as Element | null;
|
||||
// 面板已 Teleport 到 body,不再位于 .ann-wrap 内,需一并放行
|
||||
if (annOpen.value && !el?.closest?.('.ann-wrap, .ann-panel'))
|
||||
annOpen.value = false;
|
||||
}
|
||||
onMounted(() => {
|
||||
reportOnline();
|
||||
fetchAnnouncements();
|
||||
setInterval(reportOnline, 30 * 60 * 1000);
|
||||
setInterval(fetchAnnouncements, 15 * 60 * 1000);
|
||||
document.addEventListener('click', onAnnDocClick);
|
||||
});
|
||||
onUnmounted(() => document.removeEventListener('click', onAnnDocClick));
|
||||
|
||||
// ---- 页脚售后微信:点击复制 ----
|
||||
const WECHAT_ID = 'q3970260761';
|
||||
const wechatCopied = ref(false);
|
||||
async function copyWechat() {
|
||||
let ok = false;
|
||||
try {
|
||||
await navigator.clipboard.writeText(WECHAT_ID);
|
||||
ok = true;
|
||||
}
|
||||
catch {
|
||||
// 剪贴板 API 不可用(非 https / 老浏览器)时退回 execCommand
|
||||
try {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = WECHAT_ID;
|
||||
ta.style.position = 'fixed';
|
||||
ta.style.opacity = '0';
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
ok = document.execCommand('copy');
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
catch {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
wechatCopied.value = true;
|
||||
setTimeout(() => {
|
||||
wechatCopied.value = false;
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
const { tracker } = useTracker();
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -193,6 +333,18 @@ onBeforeUnmount(() => {
|
||||
|
||||
<UserMenu />
|
||||
|
||||
<!-- 全站右上角:留言反馈(与授权系统无关,任何人可提交) -->
|
||||
<c-tooltip position="bottom" :tooltip="'给我们留言:功能建议 / 意见反馈'">
|
||||
<c-button
|
||||
round
|
||||
class="feedback-btn"
|
||||
:bordered="false"
|
||||
@click="showFeedback = true"
|
||||
>
|
||||
✍️ <span class="feedback-btn-text">留言反馈</span>
|
||||
</c-button>
|
||||
</c-tooltip>
|
||||
|
||||
<c-tooltip position="bottom" :tooltip="'查看授权功能与购买'">
|
||||
<RouterLink to="/pricing" class="pricing-link">
|
||||
<c-button
|
||||
@@ -223,6 +375,53 @@ onBeforeUnmount(() => {
|
||||
<template v-else>⚡ <span class="v6-text">IPv6 直连</span></template>
|
||||
</c-button>
|
||||
</c-tooltip>
|
||||
|
||||
<!-- 全站右上角:授权系统公告(铃铛 + 未读红点 + 下拉面板) -->
|
||||
<div class="ann-wrap">
|
||||
<c-tooltip position="bottom" :tooltip="annUnread ? `有 ${annUnread} 条新公告` : '系统公告'">
|
||||
<c-button
|
||||
round
|
||||
class="ann-btn"
|
||||
:bordered="false"
|
||||
aria-label="系统公告"
|
||||
@click.stop="toggleAnn"
|
||||
>
|
||||
🔔
|
||||
<span class="ann-dot" :style="{ display: annUnread ? 'block' : 'none' }"></span>
|
||||
</c-button>
|
||||
</c-tooltip>
|
||||
<!-- 面板 Teleport 到 body:避免 top-nav 内 v-if 子树挂载进 null 容器(实测 insertBefore 崩溃) -->
|
||||
<Teleport to="body">
|
||||
<div v-if="annOpen" class="ann-panel" @click.stop>
|
||||
<div class="ann-panel-head">
|
||||
<span>📢 系统公告</span>
|
||||
<button v-if="announcements.length" class="ann-readall" type="button" @click="annMarkAll">全部已读</button>
|
||||
</div>
|
||||
<div class="ann-panel-body">
|
||||
<div v-if="!announcements.length" class="ann-empty">暂无公告</div>
|
||||
<div
|
||||
v-for="a in announcements"
|
||||
:key="a.id"
|
||||
class="ann-item"
|
||||
:class="{ 'is-unread': annIsUnread(a) }"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click="annMarkRead(a)"
|
||||
@keyup.enter="annMarkRead(a)"
|
||||
>
|
||||
<div class="ann-item-head">
|
||||
<b v-if="a.title">{{ a.title }}</b>
|
||||
<span class="ann-time">{{ annTime(a.created_at) }}</span>
|
||||
</div>
|
||||
<div class="ann-content">{{ a.content }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
|
||||
<!-- 全站右上角:当前版本号(与 Gitea Release tag 同步) -->
|
||||
<span class="ver-badge" :title="`IT-TOOLS-PRO v${SITE_VERSION}`">v{{ SITE_VERSION }}</span>
|
||||
</div>
|
||||
<slot />
|
||||
|
||||
@@ -233,8 +432,43 @@ onBeforeUnmount(() => {
|
||||
<span>
|
||||
<c-link target="_blank" rel="noopener" href="https://nav.88531.cn">🚀 更多应用尽在 nav.88531.cn</c-link>
|
||||
</span>
|
||||
<span class="footer-sep">·</span>
|
||||
<span>
|
||||
<c-link
|
||||
target="_blank" rel="noopener"
|
||||
href="https://gitea.88531.cn/jinghui/it-tools-pro"
|
||||
title="https://gitea.88531.cn/jinghui/it-tools-pro"
|
||||
>🐙 开源 gitea.88531.cn</c-link>
|
||||
</span>
|
||||
<span class="footer-sep">·</span>
|
||||
<span>
|
||||
<span
|
||||
class="footer-wechat"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="点击复制售后微信 q3970260761"
|
||||
@click="copyWechat"
|
||||
@keyup.enter="copyWechat"
|
||||
>💬 售后微信 {{ wechatCopied ? '已复制 ✓' : 'q3970260761' }}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 留言反馈弹窗 -->
|
||||
<FeedbackModal v-model:show="showFeedback" />
|
||||
|
||||
<!-- 授权系统公告推送(popup 类型,每条只弹一次);Teleport 到 body 避免内容区补丁冲突 -->
|
||||
<Teleport to="body">
|
||||
<div v-if="popupAnn" class="ann-popup-mask" @click.self="closePopup">
|
||||
<div class="ann-popup" role="dialog" aria-label="系统公告">
|
||||
<div class="ann-popup-head">📢 系统公告</div>
|
||||
<div v-if="popupAnn.title" class="ann-popup-title">{{ popupAnn.title }}</div>
|
||||
<div class="ann-popup-content">{{ popupAnn.content }}</div>
|
||||
<div v-if="popupAnn.created_at" class="ann-popup-time">{{ annTime(popupAnn.created_at) }}</div>
|
||||
<c-button round class="ann-popup-ok" type="primary" @click="closePopup">我知道了</c-button>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<!-- 右下角回到顶部火箭 -->
|
||||
<button v-show="showTop" class="back-top" title="回到顶部" aria-label="回到顶部" @click="scrollToTop">🚀</button>
|
||||
</template>
|
||||
@@ -305,7 +539,7 @@ onBeforeUnmount(() => {
|
||||
color: #838587;
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
white-space: nowrap; // 强制单行,不折行
|
||||
white-space: normal; // 放得下时保持单行(原 nowrap 的观感),放不下时折行而不是横向溢出
|
||||
user-select: none;
|
||||
|
||||
.footer-sep {
|
||||
@@ -313,6 +547,16 @@ onBeforeUnmount(() => {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
// 售后微信:点击复制(固定底栏下 pointer-events:none,这里单独放行)
|
||||
.footer-wechat {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
|
||||
&:hover {
|
||||
color: #0e9384;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(a) {
|
||||
color: #838587;
|
||||
text-decoration: none;
|
||||
@@ -355,6 +599,183 @@ onBeforeUnmount(() => {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
// 右上角「留言反馈」入口:与顶栏其它文字按钮同规格
|
||||
.feedback-btn {
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
// 右上角:授权系统公告(铃铛 + 未读红点 + 下拉面板)
|
||||
.ann-wrap {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.ann-btn {
|
||||
position: relative;
|
||||
font-size: 13px;
|
||||
padding-left: 8px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.ann-dot {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 6px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #ff4d4f;
|
||||
box-shadow: 0 0 0 2px v-bind('themeVars.bodyColor');
|
||||
}
|
||||
.ann-panel {
|
||||
position: fixed;
|
||||
top: 60px;
|
||||
right: 26px;
|
||||
z-index: 3000;
|
||||
width: 320px;
|
||||
max-width: 84vw;
|
||||
background: v-bind('themeVars.bodyColor');
|
||||
border: 1px solid v-bind('themeVars.textColor3');
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
|
||||
overflow: hidden;
|
||||
text-align: left;
|
||||
}
|
||||
.ann-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
border-bottom: 1px solid v-bind('themeVars.textColor3');
|
||||
}
|
||||
.ann-readall {
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
color: v-bind('themeVars.primaryColor');
|
||||
cursor: pointer;
|
||||
}
|
||||
.ann-panel-body {
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
padding: 6px 0;
|
||||
}
|
||||
.ann-empty {
|
||||
padding: 18px 12px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.ann-item {
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
border-left: 3px solid transparent;
|
||||
|
||||
&:hover {
|
||||
background: rgba(128, 128, 128, 0.12);
|
||||
}
|
||||
&.is-unread {
|
||||
border-left-color: #ff4d4f;
|
||||
}
|
||||
}
|
||||
.ann-item-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
|
||||
b {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.ann-time {
|
||||
flex-shrink: 0;
|
||||
font-size: 11px;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.ann-content {
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
opacity: 0.85;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
// 右上角:当前版本号徽标
|
||||
.ver-badge {
|
||||
flex-shrink: 0;
|
||||
align-self: center;
|
||||
padding: 4px 9px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
cursor: default;
|
||||
background: rgba(128, 128, 128, 0.16);
|
||||
border: 1px solid v-bind('themeVars.textColor3');
|
||||
color: v-bind('themeVars.textColor2');
|
||||
}
|
||||
|
||||
// 授权系统公告推送弹窗(每条只弹一次)
|
||||
.ann-popup-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 6000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.ann-popup {
|
||||
width: 380px;
|
||||
max-width: 92vw;
|
||||
padding: 18px 20px 16px;
|
||||
border-radius: 12px;
|
||||
background: v-bind('themeVars.bodyColor');
|
||||
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
|
||||
text-align: left;
|
||||
}
|
||||
.ann-popup-head {
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.ann-popup-title {
|
||||
margin-bottom: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.ann-popup-content {
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
opacity: 0.9;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
.ann-popup-time {
|
||||
margin-top: 8px;
|
||||
font-size: 11px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.ann-popup-ok {
|
||||
width: 100%;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
// 窄屏顶栏放不下完整文字时收缩为纯图标,并收紧间距,避免溢出右边缘
|
||||
.top-nav {
|
||||
@@ -367,6 +788,13 @@ onBeforeUnmount(() => {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
.feedback-btn {
|
||||
.feedback-btn-text {
|
||||
display: none;
|
||||
}
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.top-nav {
|
||||
|
||||
+157
-2
@@ -19,7 +19,10 @@ const loginPass = ref('');
|
||||
function authHeaders(): Record<string, string> {
|
||||
const h: Record<string, string> = {};
|
||||
if (token.value) {
|
||||
// Bearer = logged-in admin session (channel 2); X-Admin-Token = bootstrap
|
||||
// ADMIN_TOKEN paste flow (channel 1). Send both so either kind works.
|
||||
h['Authorization'] = `Bearer ${token.value}`;
|
||||
h['X-Admin-Token'] = token.value;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
@@ -61,6 +64,7 @@ async function login() {
|
||||
authed.value = true;
|
||||
localStorage.setItem(TOKEN_KEY, token.value);
|
||||
loadOverview();
|
||||
loadFeedback();
|
||||
}
|
||||
}
|
||||
catch (e: any) {
|
||||
@@ -372,6 +376,55 @@ async function saveReco() {
|
||||
}
|
||||
}
|
||||
|
||||
// ============ 留言反馈(网站访客提交,与授权系统无关) ============
|
||||
const feedback = ref<any[]>([]);
|
||||
|
||||
async function loadFeedback() {
|
||||
try {
|
||||
const b = await api('/admin/feedback');
|
||||
feedback.value = b.data ?? [];
|
||||
} catch (e: any) {
|
||||
setMsg(`留言加载失败:${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function fbSetStatus(f: any, status: string) {
|
||||
try {
|
||||
const b = await api('/admin/feedback', { method: 'POST', body: JSON.stringify({ id: f.id, status }) });
|
||||
setMsg(b.code === 200 ? '已更新留言状态' : (b.message || '状态更新失败'));
|
||||
if (b.code === 200) f.status = status;
|
||||
} catch (e: any) {
|
||||
setMsg(`状态更新失败:${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function fbOnStatus(f: any, e: Event) {
|
||||
fbSetStatus(f, (e.target as HTMLSelectElement).value);
|
||||
}
|
||||
|
||||
async function fbDelete(f: any) {
|
||||
if (!window.confirm('确定删除这条留言?删除后无法恢复。')) return;
|
||||
try {
|
||||
const b = await api('/admin/feedback', { method: 'POST', body: JSON.stringify({ id: f.id, action: 'delete' }) });
|
||||
setMsg(b.code === 200 ? '已删除' : (b.message || '删除失败'));
|
||||
if (b.code === 200) feedback.value = feedback.value.filter(x => x.id !== f.id);
|
||||
} catch (e: any) {
|
||||
setMsg(`删除失败:${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function fbTime(ts: any) {
|
||||
try {
|
||||
const d = new Date(Number(ts) * 1000);
|
||||
const p = (n: number) => String(n).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||||
} catch {
|
||||
return String(ts ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
const fbNewCount = computed(() => feedback.value.filter(f => f.status === 'new').length);
|
||||
|
||||
function recoAdd() {
|
||||
reco.value.unshift({ path: '', icon: '🧰', name: '', desc: '', enabled: true });
|
||||
}
|
||||
@@ -389,9 +442,9 @@ function recoMove(i: number, d: -1 | 1) {
|
||||
reco.value.splice(j, 0, it);
|
||||
}
|
||||
|
||||
const tab = ref<'overview' | 'files' | 'usage' | 'storage' | 'reco'>('overview');
|
||||
const tab = ref<'overview' | 'files' | 'usage' | 'storage' | 'reco' | 'feedback'>('overview');
|
||||
|
||||
function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco' | 'feedback') {
|
||||
tab.value = id;
|
||||
if (id === 'overview') {
|
||||
loadOverview();
|
||||
@@ -405,6 +458,9 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
if (id === 'storage') {
|
||||
loadStorage();
|
||||
}
|
||||
if (id === 'feedback') {
|
||||
loadFeedback();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -436,6 +492,10 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
<div class="adm-nav-item" :class="{ active: tab === 'usage' }" @click="switchTab('usage')">📈 使用统计</div>
|
||||
<div class="adm-nav-item" :class="{ active: tab === 'storage' }" @click="switchTab('storage')">💾 存储设置</div>
|
||||
<div class="adm-nav-item" :class="{ active: tab === 'reco' }" @click="switchTab('reco')">🏠 首页推荐</div>
|
||||
<div class="adm-nav-item" :class="{ active: tab === 'feedback' }" @click="switchTab('feedback')">
|
||||
💬 留言反馈
|
||||
<span v-if="fbNewCount > 0" class="adm-badge bad" style="margin-left: 6px">{{ fbNewCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="javascript:;" class="adm-logout" @click="authed = false; localStorage.removeItem(TOKEN_KEY)">退出</a>
|
||||
</div>
|
||||
@@ -642,6 +702,55 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 留言反馈:网站访客提交的留言,按时间倒序 -->
|
||||
<template v-if="tab === 'feedback'">
|
||||
<div class="adm-toolbar">
|
||||
<span class="adm-sub">
|
||||
共 {{ feedback.length }} 条 · 未处理 {{ fbNewCount }} 条(同一 IP 一小时内限提交 1 次 + 图形验证码)
|
||||
</span>
|
||||
<button class="adm-btn adm-btn-sm" @click="loadFeedback">🔄 刷新</button>
|
||||
</div>
|
||||
<div class="adm-fb-scroll">
|
||||
<table class="adm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>时间</th>
|
||||
<th>类型</th>
|
||||
<th>内容</th>
|
||||
<th>联系方式</th>
|
||||
<th>IP</th>
|
||||
<th>状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="f in feedback" :key="f.id">
|
||||
<td class="adm-fb-time">{{ fbTime(f.ts) }}</td>
|
||||
<td>
|
||||
<span class="adm-badge" :class="f.type === '功能建议' ? 'ok' : 'admin'">{{ f.type }}</span>
|
||||
</td>
|
||||
<td class="adm-fb-content">{{ f.content }}</td>
|
||||
<td class="adm-fb-contact">{{ f.contact || '—' }}</td>
|
||||
<td class="adm-fb-ip">{{ f.ip }}</td>
|
||||
<td>
|
||||
<select class="adm-select" :value="f.status" @change="fbOnStatus(f, $event)">
|
||||
<option value="new">未处理</option>
|
||||
<option value="replied">已回复</option>
|
||||
<option value="done">已处理</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="adm-fb-ops">
|
||||
<a href="javascript:;" class="adm-link" @click="fbDelete(f)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!feedback.length">
|
||||
<td colspan="7" class="adm-none">暂无留言,访客提交后会显示在这里</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -751,6 +860,33 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
// ---- 留言反馈列表 ----
|
||||
.adm-fb-time {
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.adm-fb-content {
|
||||
max-width: 460px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.adm-fb-contact,
|
||||
.adm-fb-ip {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.adm-fb-ip {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.adm-fb-ops {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.adm-reco-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -972,6 +1108,25 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
|
||||
}
|
||||
}
|
||||
|
||||
/* 留言反馈表:窄视口容器内横向滚动,表头保持横排不被挤成竖列 */
|
||||
.adm-fb-scroll {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
.adm-table {
|
||||
min-width: 820px;
|
||||
|
||||
th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td {
|
||||
word-break: break-word;
|
||||
max-width: 360px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.adm-badge {
|
||||
font-size: 11px;
|
||||
padding: 1px 8px;
|
||||
|
||||
Reference in new issue
Block a user