Scrub BMI medical copy and live-refresh Douyin home A/B + portals.
Rename titles to BMI指数, soften audit-sensitive tips, and subscribe remote config so homepage variant and entrance toggles apply within a few seconds. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d7d828ec78
commit
8c5eb388c1
@ -10,7 +10,7 @@ type Meta = {
|
||||
|
||||
const CHECKS = [
|
||||
'开发者工具导入 apps/miniprogram/tt,AppID 正确',
|
||||
'过审:首页为 BMI 健康管理(homeVariant=bmi)',
|
||||
'过审:首页为 BMI 指数(homeVariant=bmi),勿写健康管理/医疗文案',
|
||||
'审核通过后:后台切 hub,门户入口与「入口开关」一致',
|
||||
'小册可连续竖滑;目录跳章后不弹回封面',
|
||||
'用户隐私保护协议已声明「剪切板」(导航复制外链)',
|
||||
|
||||
@ -24,16 +24,16 @@ const VARIANTS: Array<{
|
||||
}> = [
|
||||
{
|
||||
key: 'bmi',
|
||||
label: 'B · BMI 健康管理',
|
||||
label: 'B · BMI 指数',
|
||||
ico: '⚖️',
|
||||
desc: '过审首页:身体质量指数计算、理想体重、本地记录。类目:工具 / 实用工具 / 健康管理。',
|
||||
desc: '过审首页:BMI 指数计算与本机记录。文案避免「健康管理 / 医疗」。',
|
||||
badge: '过审用',
|
||||
},
|
||||
{
|
||||
key: 'hub',
|
||||
label: 'A · 数字游民门户',
|
||||
ico: '🌐',
|
||||
desc: '正式首页:出海导航 / 小册 / 旅居社群入口。审核通过后再切回来。',
|
||||
desc: '正式首页:出海导航 / 小册 / 旅居社群入口。',
|
||||
badge: '正式版',
|
||||
},
|
||||
]
|
||||
@ -164,7 +164,7 @@ export default function DouyinModules() {
|
||||
<div className="dy-eyebrow">Home A / B · Live</div>
|
||||
<h1>首页与入口</h1>
|
||||
<p>
|
||||
切换即写后端并推 ntfy。小程序前台切回 / 重新打开会立刻拉配置生效。
|
||||
切换即写后端并推 ntfy。小程序约 3 秒轮询:首页 A/B 自动跳转,门户入口开关也会实时增减。
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
@ -172,9 +172,12 @@ export default function DouyinModules() {
|
||||
<div className="dy-panel" style={{ marginBottom: 14 }}>
|
||||
<h2>首页变体(实时)</h2>
|
||||
<p className="dy-muted" style={{ marginBottom: 12 }}>
|
||||
当前:{variant === 'bmi' ? 'B · BMI 健康管理(过审)' : 'A · 数字游民门户(正式)'}
|
||||
当前:{variant === 'bmi' ? 'B · BMI 指数(过审)' : 'A · 数字游民门户(正式)'}
|
||||
{busy ? ' · 同步中…' : ''}
|
||||
</p>
|
||||
<p className="dy-muted" style={{ marginBottom: 12 }}>
|
||||
标题与文案用「BMI 指数」,不要写「健康管理 / 医疗诊断」。
|
||||
</p>
|
||||
<div className="dy-mod-list">
|
||||
{VARIANTS.map((v) => {
|
||||
const on = variant === v.key
|
||||
@ -241,7 +244,7 @@ export default function DouyinModules() {
|
||||
<div className="dy-phone-notch" />
|
||||
<div className="dy-phone-screen">
|
||||
<div className="dy-phone-title">
|
||||
{variant === 'bmi' ? 'BMI · 健康管理' : 'Nomadro · 抖音'}
|
||||
{variant === 'bmi' ? 'BMI 指数' : 'Nomadro · 抖音'}
|
||||
</div>
|
||||
{variant === 'bmi' ? (
|
||||
<div className="dy-phone-tiles">
|
||||
@ -251,7 +254,7 @@ export default function DouyinModules() {
|
||||
</div>
|
||||
<div className="dy-phone-tile on">
|
||||
<span>📏</span>
|
||||
<span>理想体重</span>
|
||||
<span>参考体重</span>
|
||||
</div>
|
||||
<div className="dy-phone-tile on">
|
||||
<span>📝</span>
|
||||
|
||||
@ -43,7 +43,7 @@ export default function DouyinOverview() {
|
||||
|
||||
const mods = cfg?.modules || {}
|
||||
const onCount = Object.values(mods).filter((m) => m?.enabled).length
|
||||
const homeVariant = cfg?.homeVariant === 'hub' ? 'hub' : 'bmi'
|
||||
const homeVariant = cfg?.homeVariant === 'bmi' ? 'bmi' : 'hub'
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -70,7 +70,7 @@ export default function DouyinOverview() {
|
||||
<div className="dy-card">
|
||||
<strong>当前首页</strong>
|
||||
<div className="dy-card-val" style={{ fontSize: 15 }}>
|
||||
{homeVariant === 'bmi' ? 'B · BMI' : 'A · 门户'}
|
||||
{homeVariant === 'hub' ? 'A · 门户' : 'B · BMI'}
|
||||
</div>
|
||||
</div>
|
||||
<div className="dy-card">
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
| 产物 | `dist/`(gitignore;本地 `pnpm build` 生成) |
|
||||
| 工程配置 | `project.tt.json`(`miniprogramRoot: ./dist/`) |
|
||||
| TabBar | **无** |
|
||||
| 首页 | **A/B**:默认 `homeVariant=bmi`(BMI 健康管理过审);后台可切 `hub` 正式门户 |
|
||||
| 首页 | **A/B**:默认 `homeVariant=bmi`(BMI 指数工具);后台可切 `hub` 正式门户 |
|
||||
| 支付 | 默认关闭 / 离线免费(无微信虚拟支付) |
|
||||
| 隐私 | `usePrivacyCheck: true`(官方隐私弹窗) |
|
||||
|
||||
@ -62,7 +62,7 @@ pnpm build # 生产构建 + copy-static + validate:size
|
||||
| 运行时 | `FORCE_OFFLINE_BOOK`,不拉线上旧目录 |
|
||||
| 阅读 | **连续竖滑**:首屏渐进挂载章节(避免一次解析 41 章卡死);目录跳章 `ensureMountedThrough`;全书挂完才出「全书读完」 |
|
||||
| 滚动 | 目录跳转只用短回钉;用户滑离即停 `pageScrollTo`;跳章锁定期勿增章(否则会抖回封面) |
|
||||
| 过审 | 默认 BMI 首页(健康管理类目);后台 `homeVariant=hub` 切回门户;门户默认隐藏「出海导航」;小册正文不嵌公众号二维码;加群由 `joinGroupWechat`/`joinGroupDouyin` 开关决定;「稍后再说」仅关闭弹窗 |
|
||||
| 过审 | 默认 BMI 指数首页(勿用「健康管理/医疗」文案);后台 `homeVariant=hub` 切门户;门户默认隐藏「出海导航」;小册正文不嵌公众号二维码;加群由 `joinGroupWechat`/`joinGroupDouyin` 开关决定;「稍后再说」仅关闭弹窗 |
|
||||
|
||||
## 包体积(官方)
|
||||
|
||||
@ -77,7 +77,7 @@ pnpm build # 生产构建 + copy-static + validate:size
|
||||
## 验收
|
||||
|
||||
1. [ ] 导入 `tt/`,AppID 正确;`pnpm build` 后预览 `dist/`
|
||||
2. [ ] **过审默认**:首页为 BMI 健康管理(身高/体重/结果/本地记录);无门户入口
|
||||
2. [ ] **过审默认**:首页为 BMI 指数(身高/体重/结果/本地记录);标题不含「健康管理」
|
||||
3. [ ] 后台将 `homeVariant` 切为 `hub` 后,首页变为门户(导航/小册/社群按开关)
|
||||
4. [ ] 门户:红标 logo;顶栏避开状态栏;导航复制外链正常
|
||||
5. [ ] 小册可连续上下滑;目录跳章后上下滑**不会**弹回封面 / 原地抖
|
||||
|
||||
@ -31,7 +31,7 @@ export default defineAppConfig({
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#0b0f14',
|
||||
navigationBarTitleText: 'BMI健康管理',
|
||||
navigationBarTitleText: 'BMI指数',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0b0f14',
|
||||
},
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
import { useEffect } from 'react'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import { useDidHide, useDidShow, useLaunch } from '@tarojs/taro'
|
||||
import Taro, { useDidHide, useDidShow, useLaunch } from '@tarojs/taro'
|
||||
import { flush, trackAppLaunch } from './utils/track'
|
||||
import {
|
||||
loadRemoteConfig,
|
||||
softRefreshRemoteConfig,
|
||||
startRemoteConfigLiveSync,
|
||||
subscribeRemoteConfig,
|
||||
} from './services/remoteConfig'
|
||||
import {
|
||||
resolveTtHomeVariantFromConfig,
|
||||
type NomadroRemoteConfig,
|
||||
} from './data/remoteConfig.defaults'
|
||||
import { startH5RemLock } from './utils/h5RemLock'
|
||||
import { applyH5Theme, getStoredH5Theme } from './utils/h5Theme'
|
||||
// Taro multi-end: theme.h5.ts -> community.scss; theme.ts -> h5-theme.scss
|
||||
@ -14,6 +19,25 @@ import './styles/theme'
|
||||
import './styles/ebook.scss'
|
||||
import './app.scss'
|
||||
|
||||
/** 后台改 homeVariant 后,若当前停在启动页/门户页则立刻跳转 */
|
||||
function applyHomeVariantRoute(config: NomadroRemoteConfig) {
|
||||
const variant = resolveTtHomeVariantFromConfig(config)
|
||||
try {
|
||||
const pages = Taro.getCurrentPages()
|
||||
const cur = pages[pages.length - 1] as { route?: string } | undefined
|
||||
const route = (cur?.route || '').replace(/^\//, '')
|
||||
const onIndex = route === 'pages/index/index'
|
||||
const onHub = route === 'pages/hub/index'
|
||||
if (variant === 'hub' && onIndex) {
|
||||
void Taro.reLaunch({ url: '/pages/hub/index' })
|
||||
} else if (variant === 'bmi' && onHub) {
|
||||
void Taro.reLaunch({ url: '/pages/index/index' })
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
function App({ children }: PropsWithChildren) {
|
||||
useLaunch(() => {
|
||||
trackAppLaunch()
|
||||
@ -34,12 +58,16 @@ function App({ children }: PropsWithChildren) {
|
||||
useEffect(() => {
|
||||
const stopRem = startH5RemLock()
|
||||
const stopLive = startRemoteConfigLiveSync()
|
||||
const unsub = subscribeRemoteConfig((r) => {
|
||||
applyHomeVariantRoute(r.config)
|
||||
})
|
||||
if (process.env.TARO_ENV === 'h5') {
|
||||
applyH5Theme(getStoredH5Theme())
|
||||
}
|
||||
return () => {
|
||||
stopRem()
|
||||
stopLive()
|
||||
unsub()
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
@ -28,11 +28,11 @@ export type TtBookContent = {
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
/** 抖音首页变体:bmi=过审健康工具;hub=正式数字游民门户 */
|
||||
/** 抖音首页变体:bmi=BMI指数首页;hub=数字游民门户 */
|
||||
export type TtHomeVariant = 'bmi' | 'hub'
|
||||
|
||||
export type TtPlatformConfig = {
|
||||
/** 首页 A/B:默认 bmi 过审;后台可切 hub */
|
||||
/** 首页 A/B:默认 bmi;后台可切 hub */
|
||||
homeVariant: TtHomeVariant
|
||||
modules: {
|
||||
nav: ModuleToggle
|
||||
@ -98,7 +98,7 @@ export const DEFAULT_TT_BOOK_CONTENT: TtBookContent = {
|
||||
}
|
||||
|
||||
export const DEFAULT_TT_PLATFORM: TtPlatformConfig = {
|
||||
/** 过审默认 BMI;审核通过后后台切 hub */
|
||||
/** 默认 BMI 指数首页;后台可切 hub */
|
||||
homeVariant: 'bmi',
|
||||
modules: {
|
||||
nav: {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
/**
|
||||
* 首页 A — 数字游民门户(homeVariant=hub 时启用)
|
||||
* onShow 强制拉配置,切回 BMI 时立刻 reLaunch
|
||||
* 订阅远程配置:入口开关 / 切回 BMI 近实时生效
|
||||
*/
|
||||
import { useEffect, useState } from 'react'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import {
|
||||
getCachedRemoteConfig,
|
||||
loadRemoteConfig,
|
||||
subscribeRemoteConfig,
|
||||
} from '@/services/remoteConfig'
|
||||
import {
|
||||
resolveTtHomeVariantFromConfig,
|
||||
@ -28,7 +29,14 @@ export default function HubPage() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const unsub = subscribeRemoteConfig((r) => {
|
||||
setConfig(r.config)
|
||||
if (resolveTtHomeVariantFromConfig(r.config) === 'bmi') {
|
||||
Taro.reLaunch({ url: '/pages/index/index' })
|
||||
}
|
||||
})
|
||||
void syncVariant(true)
|
||||
return unsub
|
||||
}, [])
|
||||
|
||||
useDidShow(() => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 首页 B — BMI 健康管理(过审默认)
|
||||
* 首页 B — BMI 指数(过审默认)
|
||||
* 干净工具风:原生顶栏、无品牌壳、少卡片。
|
||||
*/
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
@ -29,7 +29,7 @@ const LEVELS: BmiLevel[] = [
|
||||
{
|
||||
key: 'under',
|
||||
label: '偏瘦',
|
||||
tip: '可适当增加优质蛋白与规律力量训练,循序渐进增重。',
|
||||
tip: '指数偏低,可对照下方参考区间。',
|
||||
color: '#38bdf8',
|
||||
min: 0,
|
||||
max: 18.5,
|
||||
@ -37,7 +37,7 @@ const LEVELS: BmiLevel[] = [
|
||||
{
|
||||
key: 'normal',
|
||||
label: '正常',
|
||||
tip: '体重状态良好,保持均衡饮食与每周适度运动即可。',
|
||||
tip: '指数落在常见参考区间内。',
|
||||
color: '#34d399',
|
||||
min: 18.5,
|
||||
max: 24,
|
||||
@ -45,7 +45,7 @@ const LEVELS: BmiLevel[] = [
|
||||
{
|
||||
key: 'over',
|
||||
label: '超重',
|
||||
tip: '建议控制精加工饮食,增加有氧与日常步数。',
|
||||
tip: '指数偏高,可对照下方参考区间。',
|
||||
color: '#fbbf24',
|
||||
min: 24,
|
||||
max: 28,
|
||||
@ -53,7 +53,7 @@ const LEVELS: BmiLevel[] = [
|
||||
{
|
||||
key: 'obese',
|
||||
label: '肥胖',
|
||||
tip: '建议制定可持续减重计划,必要时咨询专业医生。',
|
||||
tip: '指数较高,可对照下方参考区间。',
|
||||
color: '#f87171',
|
||||
min: 28,
|
||||
max: 99,
|
||||
@ -248,8 +248,8 @@ export default function BmiHome({
|
||||
<Box className={`bmi-page${theme === 'light' ? ' bmi-page--light' : ''}`} data-theme={theme}>
|
||||
<Box className="bmi-wrap">
|
||||
<Box className="bmi-head">
|
||||
<Txt className="bmi-head-kicker">身体质量指数</Txt>
|
||||
<Txt className="bmi-head-title">算一算你的 BMI</Txt>
|
||||
<Txt className="bmi-head-kicker">Body Mass Index</Txt>
|
||||
<Txt className="bmi-head-title">BMI 指数</Txt>
|
||||
</Box>
|
||||
|
||||
<Box className="bmi-panel">
|
||||
@ -305,7 +305,7 @@ export default function BmiHome({
|
||||
<Box className="bmi-stats">
|
||||
{ideal ? (
|
||||
<Box className="bmi-stat">
|
||||
<Txt className="bmi-stat-k">理想体重</Txt>
|
||||
<Txt className="bmi-stat-k">参考体重</Txt>
|
||||
<Txt className="bmi-stat-v">
|
||||
{ideal.low}–{ideal.high} kg
|
||||
</Txt>
|
||||
@ -313,7 +313,7 @@ export default function BmiHome({
|
||||
) : null}
|
||||
{bmr != null ? (
|
||||
<Box className="bmi-stat">
|
||||
<Txt className="bmi-stat-k">基础代谢</Txt>
|
||||
<Txt className="bmi-stat-k">估算消耗</Txt>
|
||||
<Txt className="bmi-stat-v">{bmr} kcal</Txt>
|
||||
</Box>
|
||||
) : null}
|
||||
@ -327,7 +327,7 @@ export default function BmiHome({
|
||||
</Box>
|
||||
|
||||
<Box className="bmi-section">
|
||||
<Txt className="bmi-section-h">参考标准 · 中国成人</Txt>
|
||||
<Txt className="bmi-section-h">参考区间</Txt>
|
||||
<Box className="bmi-legend">
|
||||
{LEVELS.map((l) => (
|
||||
<Box key={l.key} className={`bmi-legend-row${level?.key === l.key ? ' is-on' : ''}`}>
|
||||
@ -369,7 +369,7 @@ export default function BmiHome({
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Txt className="bmi-foot">仅供健康参考,不能替代医疗诊断。数据只存在本机。</Txt>
|
||||
<Txt className="bmi-foot">计算结果仅供参考,数据只存在本机。</Txt>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* BMI — 干净健康工具,不套 hub 壳 */
|
||||
/* BMI index — clean tool UI, no hub chrome */
|
||||
|
||||
.bmi-page {
|
||||
--bmi-bg: #0b0f14;
|
||||
@ -38,15 +38,15 @@
|
||||
|
||||
.bmi-head-kicker {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
color: var(--bmi-muted);
|
||||
letter-spacing: 0.06em;
|
||||
margin-bottom: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.bmi-head-title {
|
||||
display: block;
|
||||
font-size: 28px;
|
||||
font-size: 34px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.2;
|
||||
@ -73,12 +73,12 @@
|
||||
|
||||
.bmi-seg-item {
|
||||
flex: 1;
|
||||
height: 40px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
font-size: 15px;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
color: var(--bmi-muted);
|
||||
}
|
||||
@ -105,12 +105,12 @@
|
||||
}
|
||||
|
||||
.bmi-row-label {
|
||||
font-size: 15px;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bmi-row-unit {
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--bmi-muted);
|
||||
}
|
||||
|
||||
@ -121,13 +121,13 @@
|
||||
}
|
||||
|
||||
.bmi-step {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-size: 22px;
|
||||
color: var(--bmi-text);
|
||||
background: rgba(128, 128, 128, 0.12);
|
||||
border: 1px solid var(--bmi-line);
|
||||
@ -140,10 +140,10 @@
|
||||
}
|
||||
|
||||
.bmi-input {
|
||||
width: 72px;
|
||||
height: 40px;
|
||||
width: 80px;
|
||||
height: 44px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: var(--bmi-text);
|
||||
background: transparent;
|
||||
@ -161,15 +161,15 @@
|
||||
|
||||
.bmi-result-k {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--bmi-muted);
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 2px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.bmi-result-v {
|
||||
display: block;
|
||||
font-size: 56px;
|
||||
font-size: 64px;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.04em;
|
||||
@ -177,9 +177,9 @@
|
||||
}
|
||||
|
||||
.bmi-result-badge {
|
||||
padding: 6px 12px;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@ -251,32 +251,32 @@
|
||||
|
||||
.bmi-stat-k {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--bmi-muted);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.bmi-stat-v {
|
||||
display: block;
|
||||
font-size: 15px;
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.bmi-tip {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
line-height: 1.55;
|
||||
color: var(--bmi-muted);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.bmi-btn {
|
||||
height: 48px;
|
||||
height: 52px;
|
||||
border-radius: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 15px;
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
color: #042f2e;
|
||||
background: var(--bmi-accent);
|
||||
@ -301,7 +301,7 @@
|
||||
|
||||
.bmi-section-h {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@ -311,7 +311,7 @@
|
||||
}
|
||||
|
||||
.bmi-clear {
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
color: #f87171;
|
||||
padding: 4px 2px;
|
||||
}
|
||||
@ -343,19 +343,19 @@
|
||||
|
||||
.bmi-legend-name {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bmi-legend-range {
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
color: var(--bmi-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.bmi-empty {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-size: 15px;
|
||||
color: var(--bmi-muted);
|
||||
padding-top: 4px;
|
||||
}
|
||||
@ -381,26 +381,26 @@
|
||||
}
|
||||
|
||||
.bmi-history-bmi {
|
||||
font-size: 18px;
|
||||
font-size: 20px;
|
||||
font-weight: 800;
|
||||
color: var(--bmi-accent);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.bmi-history-meta {
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--bmi-muted);
|
||||
}
|
||||
|
||||
.bmi-history-time {
|
||||
font-size: 11px;
|
||||
font-size: 13px;
|
||||
color: var(--bmi-muted);
|
||||
}
|
||||
|
||||
.bmi-foot {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--bmi-muted);
|
||||
padding: 12px 4px 8px;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: 'BMI健康管理',
|
||||
navigationBarTitleText: 'BMI指数',
|
||||
navigationBarBackgroundColor: '#0b0f14',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0b0f14',
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
/**
|
||||
* Douyin launch: default BMI (audit); homeVariant=hub jumps to portal hub.
|
||||
* Force-refresh remote config on every onShow so admin A/B applies near-realtime.
|
||||
* Douyin launch: default BMI; homeVariant=hub jumps to portal hub.
|
||||
* Subscribe remote config so admin A/B applies without leaving the page.
|
||||
*/
|
||||
import { useEffect, useState } from 'react'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import {
|
||||
getCachedRemoteConfig,
|
||||
loadRemoteConfig,
|
||||
subscribeRemoteConfig,
|
||||
} from '@/services/remoteConfig'
|
||||
import {
|
||||
resolveTtHomeVariantFromConfig,
|
||||
@ -22,10 +23,9 @@ export default function IndexPage() {
|
||||
const [ready, setReady] = useState(false)
|
||||
const theme = useNomadroTheme()
|
||||
|
||||
async function syncVariant(force = false) {
|
||||
const r = await loadRemoteConfig(force)
|
||||
setConfig(r.config)
|
||||
if (resolveTtHomeVariantFromConfig(r.config) === 'hub') {
|
||||
function applyConfig(next: NomadroRemoteConfig): boolean {
|
||||
setConfig(next)
|
||||
if (resolveTtHomeVariantFromConfig(next) === 'hub') {
|
||||
Taro.reLaunch({ url: HUB_PATH })
|
||||
return false
|
||||
}
|
||||
@ -33,8 +33,17 @@ export default function IndexPage() {
|
||||
return true
|
||||
}
|
||||
|
||||
async function syncVariant(force = false) {
|
||||
const r = await loadRemoteConfig(force)
|
||||
return applyConfig(r.config)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
const unsub = subscribeRemoteConfig((r) => {
|
||||
if (cancelled) return
|
||||
applyConfig(r.config)
|
||||
})
|
||||
syncVariant(true).then((ok) => {
|
||||
if (cancelled || !ok) return
|
||||
})
|
||||
@ -43,6 +52,7 @@ export default function IndexPage() {
|
||||
}
|
||||
return () => {
|
||||
cancelled = true
|
||||
unsub()
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
const STORAGE_KEY = 'nomadro_remote_config_v2'
|
||||
const CACHE_TTL_MS = 1000 * 60 * 30
|
||||
/** 抖音无 EventSource:meta 近实时轮询 */
|
||||
const META_POLL_MS = 8000
|
||||
const META_POLL_MS = 3000
|
||||
const TT_FORCE_FREE = process.env.TARO_ENV === 'tt'
|
||||
|
||||
type LoadResult = {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 3,
|
||||
"version": 4,
|
||||
"updatedAt": "2026-03-30T12:00:00.000Z",
|
||||
"modules": {
|
||||
"home": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user