('/api/admin/join-group', {
- method: 'PUT',
- body: JSON.stringify({
- flags: cfg.flags,
- copy: cfg.copy,
- }),
- })
- setCfg(data)
- setMsg(`已保存 · ${data.updatedAt || 'OK'}`)
- } catch (e) {
- setErr(e instanceof Error ? e.message : String(e))
- } finally {
- setBusy(false)
- }
- }
-
- if (!cfg && !err) return 加载加群引导…
-
- return (
-
-
-
- {err ?
{err}
: null}
- {msg ?
{msg}
: null}
-
- {cfg ? (
- <>
-
- 渠道开关
-
-
-
-
💬
-
-
- 微信公众号
-
- {cfg.flags.joinGroupWechat ? '开' : '关'}
-
-
- 开 → 加群弹窗引导关注公众号
-
-
-
-
-
-
-
-
🎵
-
-
- 抖音群
-
- {cfg.flags.joinGroupDouyin ? '开' : '关'}
-
-
- 开 → 加群弹窗引导进抖音群
-
-
-
-
-
-
-
-
⏱
-
-
- 自动弹出
-
- {cfg.flags.socialFollowAuto ? '开' : '关'}
-
-
- 门户首页延迟自动弹(默认关)
-
-
-
-
-
-
-
-
-
-
- 保存后真机联网即时生效(无需发版)
-
-
- >
- ) : null}
-
- )
-}
diff --git a/apps/admin/src/pages/PlatformSelect.tsx b/apps/admin/src/pages/PlatformSelect.tsx
index 573b91e..40007e1 100644
--- a/apps/admin/src/pages/PlatformSelect.tsx
+++ b/apps/admin/src/pages/PlatformSelect.tsx
@@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom'
/**
* admin.nomadro.cn 登录后中间页(非 nomadro.cn/admin)。
- * 只两扇门:微信 / 抖音。加群引导在抖音控制台内。
+ * 只两扇门:微信 / 抖音。加群弹窗集成在抖音「首页与入口」。
*/
export default function PlatformSelect() {
const nav = useNavigate()
@@ -52,7 +52,7 @@ export default function PlatformSelect() {
Douyin
抖音小程序
- 入口开关 · 小册 · 加群引导 · 验收
+ 首页入口 · 加群弹窗 · 小册 · 验收
进入抖音控制台 →
diff --git a/apps/admin/src/pages/douyin/DouyinLayout.tsx b/apps/admin/src/pages/douyin/DouyinLayout.tsx
index 60149f5..96dc841 100644
--- a/apps/admin/src/pages/douyin/DouyinLayout.tsx
+++ b/apps/admin/src/pages/douyin/DouyinLayout.tsx
@@ -4,13 +4,12 @@ import './douyin.css'
const NAV = [
{ to: '/douyin', end: true, ico: '◈', label: '总览' },
- { to: '/douyin/modules', end: false, ico: '⏻', label: '入口开关' },
+ { to: '/douyin/modules', end: false, ico: '⏻', label: '首页与入口' },
{ to: '/douyin/book', end: false, ico: '✎', label: '小册 Markdown' },
- { to: '/douyin/join-group', end: false, ico: '👥', label: '加群引导' },
{ to: '/douyin/docs', end: false, ico: '✓', label: '开发与验收' },
] as const
-/** 抖音定制壳 — 加群引导属于本端 */
+/** 抖音定制壳 — 加群弹窗集成在「首页与入口」 */
export default function DouyinLayout() {
const nav = useNavigate()
return (
@@ -41,7 +40,7 @@ export default function DouyinLayout() {
-
只改 platforms.tt:首页 A/B、入口、小册与加群。无道具、无虚拟支付。
+
只改 platforms.tt:首页 A/B、入口、加群弹窗、小册。无道具、无虚拟支付。
diff --git a/apps/admin/src/pages/douyin/DouyinModules.tsx b/apps/admin/src/pages/douyin/DouyinModules.tsx
index 7f1159a..2f087b7 100644
--- a/apps/admin/src/pages/douyin/DouyinModules.tsx
+++ b/apps/admin/src/pages/douyin/DouyinModules.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useState } from 'react'
+import { useCallback, useEffect, useMemo, useState } from 'react'
import { api } from '../../api'
type Mod = { enabled: boolean; title: string; tabLabel?: string; note?: string }
@@ -9,6 +9,22 @@ type TtCfg = {
bookContent: Record
}
+type JoinChannel = 'wechat' | 'douyin'
+type JoinCfg = {
+ ok?: boolean
+ flags: {
+ joinGroupWechat: boolean
+ joinGroupDouyin: boolean
+ socialFollowAuto: boolean
+ }
+ copy: {
+ joinGroupDouyinHint: string
+ joinGroupDouyinQr: string
+ wechatOaName: string
+ }
+ updatedAt?: string
+}
+
const KEYS = [
{ key: 'nav' as const, label: '出海导航', ico: '🧭', desc: '首页导航入口。抖音默认关,需要再开。' },
{ key: 'book' as const, label: '数字游民小册', ico: '📗', desc: '核心内容。默认开;关了首页就看不到小册。' },
@@ -72,23 +88,52 @@ function normalize(cfg: TtCfg): TtCfg {
}
}
+function channelOf(join: JoinCfg): JoinChannel {
+ if (join.flags.joinGroupDouyin && !join.flags.joinGroupWechat) return 'douyin'
+ if (join.flags.joinGroupWechat) return 'wechat'
+ if (join.flags.joinGroupDouyin) return 'douyin'
+ return 'wechat'
+}
+
export default function DouyinModules() {
const [cfg, setCfg] = useState(null)
+ const [join, setJoin] = useState(null)
const [busy, setBusy] = useState(false)
+ const [joinBusy, setJoinBusy] = useState(false)
const [msg, setMsg] = useState('')
const [err, setErr] = useState('')
+ const [joinMsg, setJoinMsg] = useState('')
+ const [joinErr, setJoinErr] = useState('')
- async function load() {
- setErr('')
+ const loadModules = useCallback(async () => {
const data = await api<{ config: TtCfg }>('/api/admin/douyin/config')
setCfg(normalize(data.config))
- }
-
- useEffect(() => {
- load().catch((e) => setErr(e.message || '加载失败'))
}, [])
+ const loadJoin = useCallback(async () => {
+ const data = await api('/api/admin/join-group')
+ setJoin(data)
+ }, [])
+
+ useEffect(() => {
+ Promise.all([loadModules(), loadJoin()])
+ .catch((e) => setErr(e instanceof Error ? e.message : '加载失败'))
+ }, [loadModules, loadJoin])
+
+ useEffect(() => {
+ if (!cfg || !join) return
+ if (typeof window === 'undefined') return
+ if (window.location.hash !== '#join-group') return
+ const el = document.getElementById('join-group')
+ if (!el) return
+ const t = window.setTimeout(() => {
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' })
+ }, 80)
+ return () => window.clearTimeout(t)
+ }, [cfg, join])
+
const variant = cfg?.homeVariant === 'hub' ? 'hub' : 'bmi'
+ const channel = join ? channelOf(join) : 'wechat'
const preview = useMemo(() => {
if (!cfg) return []
@@ -100,7 +145,6 @@ export default function DouyinModules() {
}))
}, [cfg])
- /** 点一下立刻写后端(埋点+ntfy 由 API 触发) */
async function persist(patch: { homeVariant?: HomeVariant; modules?: TtCfg['modules'] }, okHint: string) {
if (!cfg) return
setBusy(true)
@@ -124,7 +168,7 @@ export default function DouyinModules() {
setMsg(okHint)
} catch (e: any) {
setErr(e.message || '保存失败')
- await load().catch(() => undefined)
+ await loadModules().catch(() => undefined)
} finally {
setBusy(false)
}
@@ -154,6 +198,55 @@ export default function DouyinModules() {
)
}
+ async function saveJoin(next: JoinCfg, okHint: string) {
+ setJoinBusy(true)
+ setJoinMsg('')
+ setJoinErr('')
+ setJoin(next)
+ try {
+ const data = await api('/api/admin/join-group', {
+ method: 'PUT',
+ body: JSON.stringify({ flags: next.flags, copy: next.copy }),
+ })
+ setJoin(data)
+ setJoinMsg(okHint)
+ } catch (e: any) {
+ setJoinErr(e.message || '加群配置保存失败')
+ await loadJoin().catch(() => undefined)
+ } finally {
+ setJoinBusy(false)
+ }
+ }
+
+ async function setChannel(next: JoinChannel) {
+ if (!join || joinBusy) return
+ if (channel === next) return
+ await saveJoin(
+ {
+ ...join,
+ flags: {
+ ...join.flags,
+ joinGroupWechat: next === 'wechat',
+ joinGroupDouyin: next === 'douyin',
+ },
+ },
+ next === 'wechat' ? '加群弹窗 → 微信公众号' : '加群弹窗 → 抖音群',
+ )
+ }
+
+ async function toggleAuto(on: boolean) {
+ if (!join || joinBusy) return
+ await saveJoin(
+ { ...join, flags: { ...join.flags, socialFollowAuto: on } },
+ on ? '已开启自动弹出' : '已关闭自动弹出',
+ )
+ }
+
+ async function saveJoinCopy() {
+ if (!join || joinBusy) return
+ await saveJoin(join, '加群文案已保存')
+ }
+
if (!cfg && !err) return 加载入口开关…
if (!cfg) return {err}
@@ -161,10 +254,10 @@ export default function DouyinModules() {
@@ -175,9 +268,6 @@ export default function DouyinModules() {
当前:{variant === 'bmi' ? 'B · BMI 指数(过审)' : 'A · 数字游民门户(正式)'}
{busy ? ' · 同步中…' : ''}
-
- 标题与文案用「BMI 指数」,不要写「健康管理 / 医疗诊断」。
-
{VARIANTS.map((v) => {
const on = variant === v.key
@@ -295,7 +385,7 @@ export default function DouyinModules() {
{msg ? {msg} : null}
{err ? {err} : null}
{!msg && !err ? (
- {busy ? '正在同步后端…' : '切换即生效 · 已与线上同步'}
+ {busy ? '正在同步后端…' : '首页 / 入口 · 切换即生效'}
) : null}
@@ -303,12 +393,188 @@ export default function DouyinModules() {
type="button"
className="dy-btn-ghost"
disabled={busy}
- onClick={() => void load().catch((e) => setErr(e.message || '加载失败'))}
+ onClick={() => void loadModules().catch((e) => setErr(e.message || '加载失败'))}
>
- 刷新
+ 刷新入口
+
+ {/* —— 加群引导(集成,非独立页) —— */}
+
+
+
+
加群弹窗
+
+ 用户点「加群」时弹出。点选渠道即生效,用户端无感知开关。
+
+
+ {join ? (
+
+ {channel === 'douyin' ? '抖音群' : '公众号'}
+
+ ) : null}
+
+
+ {joinErr ? {joinErr}
: null}
+ {joinMsg ? {joinMsg}
: null}
+
+ {!join ? (
+ 加载加群配置…
+ ) : (
+
+
+
+
+
+
+
+
+
+
⏱
+
+
+ 自动弹出
+
+ {join.flags.socialFollowAuto ? '开' : '关'}
+
+
+ 门户首页延迟自动弹(默认关,仅点「加群」才出)
+
+
+
void toggleAuto(v)}
+ />
+
+
+
+
+
+
+
+ )}
+
)
}
diff --git a/apps/admin/src/pages/douyin/DouyinOverview.tsx b/apps/admin/src/pages/douyin/DouyinOverview.tsx
index 0827974..eb94f82 100644
--- a/apps/admin/src/pages/douyin/DouyinOverview.tsx
+++ b/apps/admin/src/pages/douyin/DouyinOverview.tsx
@@ -51,11 +51,11 @@ export default function DouyinOverview() {
Douyin Mini App
抖音小程序控制台
-
只管首页 A/B、入口与小册内容。没有道具、没有虚拟支付——和微信后台完全分开。
+
只管首页 A/B、入口、加群弹窗与小册。没有道具、没有虚拟支付——和微信后台完全分开。
- 调首页 / 入口
+ 调首页 / 入口 / 加群
@@ -120,12 +120,12 @@ export default function DouyinOverview() {
快捷操作
- ⏻ 入口开关
- 导航 / 小册 / 社群 显隐,带手机预览
+ ⏻ 首页 · 入口 · 加群
+ A/B 首页、模块显隐、公众号 / 抖音群弹窗
-
- 👥 加群引导
- 公众号 / 抖音群弹窗开关与文案
+
+ 👥 加群弹窗
+ 一键切换公众号或抖音群(同页锚点)
✎ 小册 Markdown
diff --git a/apps/admin/src/pages/douyin/douyin.css b/apps/admin/src/pages/douyin/douyin.css
index 0461330..ec71096 100644
--- a/apps/admin/src/pages/douyin/douyin.css
+++ b/apps/admin/src/pages/douyin/douyin.css
@@ -517,6 +517,242 @@
}
.dy-phone-tabbar span.on { color: var(--dy-pink); font-weight: 700; }
+/* —— 加群弹窗(集成在入口页) —— */
+.dy-join-panel {
+ margin-top: 22px;
+ scroll-margin-top: 24px;
+}
+.dy-join-layout {
+ display: grid;
+ grid-template-columns: 1fr minmax(220px, 260px);
+ gap: 20px;
+ align-items: start;
+}
+.dy-join-controls {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ min-width: 0;
+}
+.dy-channel-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 12px;
+}
+.dy-channel-card {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 6px;
+ text-align: left;
+ padding: 16px 16px 14px;
+ border-radius: 16px;
+ border: 1px solid var(--dy-line);
+ background: rgba(255, 255, 255, 0.02);
+ color: var(--dy-text);
+ cursor: pointer;
+ font: inherit;
+ min-height: 120px;
+ transition: border-color 0.2s, background 0.2s, transform 0.18s, box-shadow 0.2s;
+}
+.dy-channel-card:hover:not(:disabled) {
+ border-color: var(--dy-line-strong);
+ transform: translateY(-1px);
+}
+.dy-channel-card:disabled {
+ opacity: 0.65;
+ cursor: wait;
+}
+.dy-channel-card.is-on {
+ border-color: rgba(45, 212, 191, 0.45);
+ background: linear-gradient(145deg, rgba(45, 212, 191, 0.12), rgba(254, 44, 85, 0.05));
+ box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.12), 0 10px 28px rgba(0, 0, 0, 0.28);
+}
+.dy-channel-card--dy.is-on {
+ border-color: rgba(254, 44, 85, 0.5);
+ background: linear-gradient(145deg, rgba(254, 44, 85, 0.14), rgba(45, 212, 191, 0.05));
+ box-shadow: 0 0 0 1px rgba(254, 44, 85, 0.15), 0 10px 28px rgba(0, 0, 0, 0.28);
+}
+.dy-channel-ico {
+ width: 40px;
+ height: 40px;
+ border-radius: 12px;
+ display: grid;
+ place-items: center;
+ font-size: 18px;
+ background: rgba(255, 255, 255, 0.06);
+ margin-bottom: 2px;
+}
+.dy-channel-card.is-on .dy-channel-ico {
+ background: rgba(45, 212, 191, 0.16);
+}
+.dy-channel-card--dy.is-on .dy-channel-ico {
+ background: rgba(254, 44, 85, 0.2);
+}
+.dy-channel-card strong {
+ font-family: var(--dy-font);
+ font-size: 15px;
+ font-weight: 700;
+ letter-spacing: -0.02em;
+}
+.dy-channel-card > span:not(.dy-channel-ico):not(.dy-channel-check) {
+ color: var(--dy-muted);
+ font-size: 12px;
+ line-height: 1.4;
+}
+.dy-channel-check {
+ margin-top: auto;
+ padding-top: 8px;
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: 0.04em;
+ color: var(--dy-faint);
+}
+.dy-channel-card.is-on .dy-channel-check {
+ color: var(--dy-cyan);
+}
+.dy-channel-card--dy.is-on .dy-channel-check {
+ color: var(--dy-pink);
+}
+
+.dy-join-fields {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ padding: 14px 16px;
+ border-radius: 14px;
+ border: 1px dashed var(--dy-line);
+ background: rgba(0, 0, 0, 0.18);
+}
+.dy-join-field-actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ margin-top: 4px;
+}
+
+.dy-join-preview {
+ position: sticky;
+ top: 24px;
+}
+.dy-join-preview-label {
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--dy-faint);
+ margin-bottom: 10px;
+}
+.dy-join-sheet {
+ position: relative;
+ border-radius: 20px;
+ border: 1px solid var(--dy-line-strong);
+ background: linear-gradient(160deg, #14161f 0%, #0c0e14 100%);
+ padding: 22px 18px 16px;
+ overflow: hidden;
+ box-shadow: var(--dy-shadow);
+ min-height: 280px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ text-align: center;
+ gap: 8px;
+}
+.dy-join-sheet-glow {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ top: -40px;
+ left: 50%;
+ transform: translateX(-50%);
+ border-radius: 50%;
+ background: radial-gradient(circle, rgba(45, 212, 191, 0.28), transparent 70%);
+ pointer-events: none;
+}
+.dy-join-sheet.is-dy .dy-join-sheet-glow {
+ background: radial-gradient(circle, rgba(254, 44, 85, 0.32), transparent 70%);
+}
+.dy-join-sheet-eye {
+ margin: 0;
+ position: relative;
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--dy-cyan);
+}
+.dy-join-sheet.is-dy .dy-join-sheet-eye {
+ color: var(--dy-pink);
+}
+.dy-join-sheet h3 {
+ margin: 0;
+ position: relative;
+ font-family: var(--dy-font);
+ font-size: 18px;
+ font-weight: 750;
+ letter-spacing: -0.02em;
+}
+.dy-join-sheet h3 em {
+ font-style: normal;
+ color: var(--dy-cyan);
+}
+.dy-join-sheet.is-dy h3 em {
+ color: var(--dy-pink);
+}
+.dy-join-sheet-lead {
+ margin: 0;
+ position: relative;
+ font-size: 12px;
+ line-height: 1.45;
+ color: var(--dy-muted);
+ max-width: 28ch;
+}
+.dy-join-sheet-qr {
+ position: relative;
+ width: 112px;
+ height: 112px;
+ margin: 8px 0;
+ border-radius: 14px;
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px dashed rgba(255, 255, 255, 0.12);
+ display: grid;
+ place-items: center;
+ font-size: 36px;
+ overflow: hidden;
+}
+.dy-join-sheet-qr img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+.dy-join-sheet-cta {
+ position: relative;
+ margin-top: auto;
+ padding: 8px 16px;
+ border-radius: 999px;
+ border: 1px solid var(--dy-line);
+ font-size: 12px;
+ color: var(--dy-muted);
+ font-weight: 600;
+}
+
+@media (max-width: 900px) {
+ .dy-join-layout {
+ grid-template-columns: 1fr;
+ }
+ .dy-join-preview {
+ position: static;
+ max-width: 280px;
+ }
+}
+@media (max-width: 560px) {
+ .dy-channel-grid {
+ grid-template-columns: 1fr;
+ }
+}
+
/* —— 表单 —— */
.dy-label {
display: flex;