// 批量创建页面脚本 - Node.js版本
const fs = require('fs');
const path = require('path');
const modules = [
{path:'dynamic', name:'动态管理', component:'DynamicManage'},
{path:'blacklist', name:'黑名单管理', component:'BlacklistManage'},
{path:'certification', name:'认证管理', component:'CertificationManage'},
{path:'charm', name:'魅力值管理', component:'CharmManage'},
{path:'member', name:'会员管理', component:'MemberManage'},
{path:'withdraw', name:'提现管理', component:'WithdrawManage'},
{path:'appeal', name:'申诉管理', component:'AppealManage'},
{path:'banner', name:'轮播图管理', component:'BannerManage'},
{path:'comment', name:'评论管理', component:'CommentManage'},
{path:'newtask', name:'新手任务管理', component:'NewTaskManage'},
{path:'sensitive', name:'敏感词管理', component:'SensitiveManage'},
{path:'fans', name:'粉丝团管理', component:'FansManage'},
{path:'session', name:'会话管理', component:'SessionManage'},
{path:'detail', name:'明细管理', component:'DetailManage'},
{path:'mountpurchase', name:'购买坐骑管理', component:'MountPurchaseManage'},
{path:'version', name:'客户端版本管理', component:'VersionManage'},
{path:'giftreward', name:'礼物打赏管理', component:'GiftRewardManage'},
{path:'follow', name:'关注管理', component:'FollowManage'},
{path:'exchange', name:'兑换管理', component:'ExchangeManage'},
{path:'sysconfig', name:'配置管理', component:'SysConfigManage'}
];
const templateVue = (module) => `
搜索
重置
新增
{{ scope.row.status ? '启用' : '禁用' }}
编辑
删除
`;
const baseDir = path.join(__dirname, 'src', 'views');
modules.forEach(module => {
const dirPath = path.join(baseDir, module.path);
const filePath = path.join(dirPath, 'index.vue');
// 创建目录
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true });
console.log(`✓ 创建目录: ${module.path}`);
}
// 创建Vue文件
fs.writeFileSync(filePath, templateVue(module), 'utf8');
console.log(`✓ 创建文件: ${module.path}/index.vue`);
});
console.log(`\n✅ 共创建 ${modules.length} 个模块页面!`);