66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
type DebugEntry = {
|
|
id: string;
|
|
title: string;
|
|
subtitle: string;
|
|
icon: string;
|
|
path: string;
|
|
};
|
|
|
|
const DEBUG_ENTRIES: DebugEntry[] = [
|
|
{
|
|
id: 'category-manage',
|
|
title: '分类管理',
|
|
subtitle: '对比本地与云端分类数据,执行新增或更新。',
|
|
icon: '🗂️',
|
|
path: '/supportPages/categoryManage/categoryManage',
|
|
},
|
|
{
|
|
id: 'worksheet-sync',
|
|
title: 'Worksheet 同步',
|
|
subtitle: '按本地配置批量同步年龄/标签,并重建 home+category 配置。',
|
|
icon: '🔄',
|
|
path: '/supportPages/worksheetSync/worksheetSync',
|
|
},
|
|
{
|
|
id: 'category-content',
|
|
title: '分类页内容管理',
|
|
subtitle: '管理各分类下 worksheet 状态,生成分类页数据。',
|
|
icon: '📋',
|
|
path: '/supportPages/categoryContentManage/categoryContentManage',
|
|
},
|
|
{
|
|
id: 'home-content',
|
|
title: '首页内容管理',
|
|
subtitle: '编排首页推荐位、热门推荐和分类分区内容。',
|
|
icon: '🏠',
|
|
path: '/supportPages/homeContentManage/homeContentManage',
|
|
},
|
|
];
|
|
|
|
Page({
|
|
data: {
|
|
entries: DEBUG_ENTRIES,
|
|
isDevEnv: true,
|
|
},
|
|
|
|
onLoad() {
|
|
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion;
|
|
const isDevEnv = envVersion === 'develop';
|
|
this.setData({ isDevEnv });
|
|
|
|
if (!isDevEnv) {
|
|
wx.showToast({
|
|
title: '仅开发版可用',
|
|
icon: 'none',
|
|
});
|
|
}
|
|
},
|
|
|
|
onTapEntry(e: WechatMiniprogram.TouchEvent) {
|
|
if (!this.data.isDevEnv) return;
|
|
const path = e.currentTarget.dataset.path as string;
|
|
if (!path) return;
|
|
wx.navigateTo({ url: path });
|
|
},
|
|
});
|