/* * Copyright (c) 2020. bmy */ module.exports = { pageConfig: (name) => { return ` import "@pageLess/${ name }.less"; import { Component, Vue } from 'vue-property-decorator'; import { ${ name }Logic } from "@logic/page/${ name }.logic"; import { Route, RawLocation } from 'vue-router'; import { BaseLayout, RouterMeta } from "@layout/base.layout"; @Component export default class ${ name } extends BaseLayout { private service: ${ name }Logic = new ${ name }Logic(this); private RouterMeta: RouterMeta = { title: '${ name }', showNav: true, isLogin: true }; public async created() { await this.service.StartUp(); }; // 路由拦截器 beforeRouteEnter(to: Route, from: Route, next: (to?: RawLocation | false | ((vm: Vue) => void)) => void) { next(); } protected render() { return (
${ name }
) } } ` }, logicConfig: (name) => { return ` import { BaseLogic, VueType, Methods } from "@logic/Base.logic"; import { Inject } from "@ann/Ioc.annotation"; import { UserServiceImpl } from "@impl/User.service.impl"; export class ${ name }Logic extends BaseLogic implements Methods { @Inject() public readonly UserServiceImpl!: UserServiceImpl; constructor(point: any) { super(); this.VueApp = point; } public async StartUp(): Promise { } } ` }, serviceConfig: (name) => { return ` export interface ${ name }Service { IndexClass(params: object): Promise; } ` }, implPathConfig: (name) => { return ` import { ${ name }Service } from "@service/${ name }.service"; import { Injectable } from "@ann/Ioc.annotation"; import { GET } from "@ann/Http.annotation"; @Injectable() export class ${ name }ServiceImpl implements ${ name }Service { @GET({ useHandle: false }) public async IndexClass(params: object): Promise { } } ` }, lessConfig: (name) => { return ` @import "../color/index"; @import "../mixin/index"; .${ name } { } ` } }