Files
PrivateProject/王凯私活/TsxVueClassApi/bin/config/index.js
2024-09-27 01:28:38 +08:00

97 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (c) 2024. bmy
* Email2271608011@qq.com
* Githubhttps://github.com/helpcode
*/
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 { VueCustomize, RouterMeta } from "@logic/base.type";
import { Autowired } from "@ann/ioc.annotation";
@Component
export default class ${ name } extends VueCustomize {
private logic: ${name}Logic<${name}> = new ${name}Logic(this);
private RouterMeta: RouterMeta = {
title: '${ name }',
showNav: true,
isLogin: true
};
public async created() {
await this.logic.StartUp();
};
// 路由拦截器
beforeRouteEnter(to: Route, from: Route, next: (to?: RawLocation | false | ((vm: Vue) => void)) => void) {
next();
}
protected render() {
return (
<div class="${ name }">
${ name }
</div>
)
}
}
`
},
logicConfig: (name) => {
return `
import { Autowired } from "@ann/ioc.annotation";
import { UserServiceImpl, ResponseType } from "@impl/user.service.impl";
import { BaseLogic } from "@logic/base.logic";
import { Methods, VueCustomize } from "@logic/base.type";
export class ${name}Logic<T extends ${name}> extends BaseLogic<T> implements Methods {
@Autowired()
public readonly UserServiceImpl!: UserServiceImpl;
constructor(_: T) {
super();
this._ = _;
}
public async StartUp(): Promise<void> {
}
}
`
},
serviceConfig: (name) => {
return `
export interface ${ name }Service {
IndexClass(params: object): Promise<any>;
}
`
},
implPathConfig: (name) => {
return `
import { ${ name }Service } from "@service/${ name }.service";
import { Autowired } from "@ann/Ioc.annotation";
import { GET } from "@ann/Http.annotation";
export class ${ name }ServiceImpl implements ${ name }Service {
@GET({ useHandle: false })
public async IndexClass(params: object): Promise<any> { }
}
`
},
lessConfig: (name) => {
return `
@import "../mixin/_";
.${ name } {
}
`
}
}