45 lines
1.0 KiB
TypeScript
45 lines
1.0 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',
|
|
},
|
|
];
|
|
|
|
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 });
|
|
},
|
|
});
|