first commit
This commit is contained in:
96
王凯私活/TsxVueClassApi/bin/config/index.js
Normal file
96
王凯私活/TsxVueClassApi/bin/config/index.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2024. bmy
|
||||
* Email:2271608011@qq.com
|
||||
* Github:https://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 } {
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user