Files
doodle-mini/miniprogram/supportPages/debug/debug.ts
T

59 lines
1.5 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: '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 });
},
});