调整class文件,合并部分class到一个文件中
This commit is contained in:
@@ -17,3 +17,19 @@ export class Article {
|
||||
readingNumber?: number;
|
||||
open?: string;
|
||||
}
|
||||
|
||||
|
||||
export class ArticleReq {
|
||||
category: string;
|
||||
id?: number;
|
||||
mdContent: string;
|
||||
open: boolean;
|
||||
tags: string;
|
||||
title: string;
|
||||
type: boolean;
|
||||
url?: string;
|
||||
|
||||
constructor() {
|
||||
this.type = true;
|
||||
}
|
||||
}
|
||||
@@ -10,3 +10,23 @@ export class Comment {
|
||||
comment: boolean;
|
||||
respComment: Comment[];
|
||||
}
|
||||
|
||||
|
||||
export class CommentReq {
|
||||
id?: number;
|
||||
comment: boolean;
|
||||
content: string;
|
||||
pid: number;
|
||||
articleID: number;
|
||||
responseId: string;
|
||||
|
||||
constructor(comment: boolean) {
|
||||
this.comment = comment;
|
||||
this.responseId = '';
|
||||
if (!comment) {
|
||||
this.articleID = -1;
|
||||
}
|
||||
this.pid = -1;
|
||||
this.id = null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {RequestObj} from './Request';
|
||||
import {RequestObj} from './HttpReqAndResp';
|
||||
|
||||
export interface ErrDispatch {
|
||||
errHandler(code: number, msg: string, request?: RequestObj): void;
|
||||
|
||||
45
index/src/app/class/HttpReqAndResp.ts
Normal file
45
index/src/app/class/HttpReqAndResp.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import {HttpHeaders} from '@angular/common/http';
|
||||
|
||||
export class RequestObj {
|
||||
path: string;
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||
data?: {};
|
||||
contentType?: 'application/json' | 'application/x-www-form-urlencoded';
|
||||
queryParam?: {};
|
||||
header?: HttpHeaders | {
|
||||
[header: string]: string | string[];
|
||||
};
|
||||
}
|
||||
|
||||
export class Response<T> {
|
||||
code: number;
|
||||
msg: string;
|
||||
result: T;
|
||||
date: number;
|
||||
|
||||
constructor(t: T) {
|
||||
this.code = 0;
|
||||
this.result = t;
|
||||
}
|
||||
}
|
||||
|
||||
export class PageList<T> {
|
||||
total: number;
|
||||
list: T[];
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
size: number;
|
||||
startRow: number;
|
||||
endRow: number;
|
||||
pages: number;
|
||||
prePage: number;
|
||||
nextPage: number;
|
||||
isFirstPage: boolean;
|
||||
isLastPage: boolean;
|
||||
hasPreviousPage: boolean;
|
||||
hasNextPage: boolean;
|
||||
navigatePages: number;
|
||||
navigatepageNums: number[];
|
||||
navigateFirstPage: number;
|
||||
navigateLastPage: number;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import {HttpHeaders} from '@angular/common/http';
|
||||
|
||||
export class RequestObj {
|
||||
path: string;
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||
data?: {};
|
||||
contentType?: 'application/json' | 'application/x-www-form-urlencoded';
|
||||
queryParam?: {};
|
||||
header?: HttpHeaders | {
|
||||
[header: string]: string | string[];
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
export class Response<T> {
|
||||
code: number;
|
||||
msg: string;
|
||||
result: T;
|
||||
date: number;
|
||||
|
||||
constructor(t: T) {
|
||||
this.code = 0;
|
||||
this.result = t;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
export class Category {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
}
|
||||
export class Category {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
}
|
||||
|
||||
|
||||
export class Tag {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
}
|
||||
@@ -1,3 +1,14 @@
|
||||
export class User {
|
||||
id: number;
|
||||
email: string;
|
||||
displayName: string;
|
||||
emailStatus: boolean;
|
||||
avatarImgUrl: string;
|
||||
desc: string;
|
||||
role: string;
|
||||
token?: string;
|
||||
}
|
||||
|
||||
export class LoginReq {
|
||||
email: string;
|
||||
isRememberMe: boolean;
|
||||
@@ -1,14 +0,0 @@
|
||||
export class ArticleReq {
|
||||
category: string;
|
||||
id?: number;
|
||||
mdContent: string;
|
||||
open: boolean;
|
||||
tags: string;
|
||||
title: string;
|
||||
type: boolean;
|
||||
url?: string;
|
||||
|
||||
constructor() {
|
||||
this.type = true;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
export class CommentReq {
|
||||
id?: number;
|
||||
comment: boolean;
|
||||
content: string;
|
||||
pid: number;
|
||||
articleID: number;
|
||||
responseId: string;
|
||||
|
||||
constructor(comment: boolean) {
|
||||
this.comment = comment;
|
||||
this.responseId = '';
|
||||
if (!comment) {
|
||||
this.articleID = -1;
|
||||
}
|
||||
this.pid = -1;
|
||||
this.id = null;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
export class PageList<T> {
|
||||
total: number;
|
||||
list: T[];
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
size: number;
|
||||
startRow: number;
|
||||
endRow: number;
|
||||
pages: number;
|
||||
prePage: number;
|
||||
nextPage: number;
|
||||
isFirstPage: boolean;
|
||||
isLastPage: boolean;
|
||||
hasPreviousPage: boolean;
|
||||
hasNextPage: boolean;
|
||||
navigatePages: number;
|
||||
navigatepageNums: number[];
|
||||
navigateFirstPage: number;
|
||||
navigateLastPage: number;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export class Tag {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export class User {
|
||||
id: number;
|
||||
email: string;
|
||||
displayName: string;
|
||||
emailStatus: boolean;
|
||||
avatarImgUrl: string;
|
||||
desc: string;
|
||||
role: string;
|
||||
token?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user