fix(wechat): simplify subscribe welcome page creation guide
Memind CI / Test, build, and release guards (push) Has been cancelled

This commit is contained in:
john
2026-11-26 11:25:26 +08:00
parent ad5b8cd9fa
commit 46f6262bf2
2 changed files with 25 additions and 31 deletions
+18 -23
View File
@@ -16,22 +16,22 @@ const SUBSCRIBE_EXAMPLE_ORIGIN =
export const DEFAULT_SUBSCRIBE_WELCOME_EXAMPLES = Object.freeze([
{
prompt: '生成页面:某产品调研分析报告,含用户痛点、竞品对比和结论',
label: '产品调研 · 竞品地图',
label: '📊 产品调研',
url: `${SUBSCRIBE_EXAMPLE_ORIGIN}/chenkeming-map.html`,
},
{
prompt: '生成页面:季度数据分析报告,用图表讲清变化',
label: '分析报告 · 数据仪表盘',
label: '📈 分析报告',
url: `${SUBSCRIBE_EXAMPLE_ORIGIN}/zhixing-data-dashboard.html`,
},
{
prompt: '生成页面:苏州一日游攻略,含路线和美食',
label: '旅行攻略 · 新疆亲子游',
label: '✈️ 旅行攻略',
url: `${SUBSCRIBE_EXAMPLE_ORIGIN}/xinjiang-travel.html`,
},
{
prompt: '生成页面:周末市集活动页,含时间、地点和报名',
label: '活动页面 · 餐厅招牌',
label: '🍜 餐厅推广',
url: `${SUBSCRIBE_EXAMPLE_ORIGIN}/changsha-restaurant-promo.html`,
},
]);
@@ -88,32 +88,27 @@ export function buildSubscribeWelcomeText({
} = {}) {
const normalizedBindUrl = String(bindUrl ?? '').trim();
const lines = [
'欢迎关注 TKMind 智趣 👋',
'欢迎关注 tkmind 智趣 👋',
'',
'你想做的页面,直接说给我。',
'带上「生成页面」,我做好后回你链接,马上就能分享。',
'把想法和资料,变成可以分享的页面。',
'',
'例如:',
'直接发一句试试:',
'「生成页面:咖啡店介绍」',
'「生成页面:周末徒步活动邀请」',
'「生成页面:把以下资料整理成个人介绍」',
];
const picks = Array.isArray(examples) ? examples : DEFAULT_SUBSCRIBE_WELCOME_EXAMPLES;
const visible = [];
for (const example of picks) {
const prompt = String(example?.prompt ?? '').trim();
const url = String(example?.url ?? '').trim();
const label = String(example?.label ?? '').trim();
if (!prompt.includes('生成页面')) continue;
lines.push(`· 「${prompt}」`);
if (url && label) visible.push({ url, label });
}
if (visible.length) {
lines.push('', '点开看看做好的页面:');
for (const pick of visible) {
lines.push(`· ${buildWechatTextLink(pick.url, pick.label)}`);
const links = picks
.filter((example) => String(example?.url ?? '').trim() && String(example?.label ?? '').trim())
.map((example) => buildWechatTextLink(example.url, example.label));
if (links.length) {
lines.push('', '✨ 案例查看:');
for (let i = 0; i < links.length; i += 2) {
lines.push(links.slice(i, i + 2).join(' · '));
}
}
lines.push('', '链接转给朋友,对方点开就能看。');
if (normalizedBindUrl) {
lines.push('', `👉 先${buildWechatTextLink(normalizedBindUrl, '点我绑定')},再发一句「生成页面:…」`);
lines.push('', `👉 ${buildWechatTextLink(normalizedBindUrl, '点我绑定,开始制作')}`);
}
return lines.join('\n');
}
+7 -8
View File
@@ -20,19 +20,18 @@ test('buildWechatTextLink renders WeChat anchor without exposing raw url', () =>
test('buildSubscribeWelcomeText asks for a page and a shareable link', () => {
const text = buildSubscribeWelcomeText({ bindUrl: DEFAULT_PRODUCTION_BIND_URL });
assert.match(text, /欢迎关注 TKMind 智趣/);
assert.match(text, /你想做的页面/);
assert.match(text, /马上就能分享/);
assert.match(text, /对方点开就能看/);
assert.match(text, /点开看看做好的页面/);
assert.match(text, /欢迎关注 tkmind 智趣/);
assert.match(text, /把想法和资料,变成可以分享的页面。/);
for (const prompt of ['咖啡店介绍', '周末徒步活动邀请', '把以下资料整理成个人介绍']) {
assert.ok(text.includes(`「生成页面:${prompt}」`));
}
assert.match(text, /✨ 案例查看:/);
for (const example of DEFAULT_SUBSCRIBE_WELCOME_EXAMPLES) {
assert.ok(example.prompt.includes('生成页面'));
assert.ok(text.includes(`「${example.prompt}」`));
assert.ok(text.includes(`<a href="${example.url}">${example.label}</a>`));
}
assert.match(
text,
/<a href="[^"]*auth\/wechat\/authorize\?intent=login">点我绑定<\/a>/,
/<a href="[^" ]*auth\/wechat\/authorize\?intent=login">点我绑定,开始制作<\/a>/,
);
assert.doesNotMatch(text, /\nhttps:\/\/m\.tkmind\.cn/);
assert.doesNotMatch(text, /每日推送订阅/);