Convert tslint to eslint #86
@@ -21,13 +21,13 @@
|
|||||||
"plugin:@angular-eslint/template/process-inline-templates"
|
"plugin:@angular-eslint/template/process-inline-templates"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/naming-convention": [
|
// "@typescript-eslint/naming-convention": [
|
||||||
"off"
|
// "off"
|
||||||
],
|
// ],
|
||||||
"prefer-arrow/prefer-arrow-functions": [
|
"prefer-arrow/prefer-arrow-functions": [
|
||||||
"off"
|
"off"
|
||||||
],
|
],
|
||||||
// "@typescript-eslint/member-ordering": [
|
// "@typescript-eslint/member-ordering": [svn
|
||||||
// "on"
|
// "on"
|
||||||
// ],
|
// ],
|
||||||
"@typescript-eslint/ban-types": [
|
"@typescript-eslint/ban-types": [
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class ApiService {
|
|||||||
|
|
||||||
createArticle(article: ArticleReq) {
|
createArticle(article: ArticleReq) {
|
||||||
article.id = null;
|
article.id = null;
|
||||||
return this.httpService.Service<Article>({
|
return this.httpService.service<Article>({
|
||||||
path: '/admin/article/create',
|
path: '/admin/article/create',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -29,7 +29,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteArticle(id: number) {
|
deleteArticle(id: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: '/admin/article/del',
|
path: '/admin/article/del',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
queryParam: {articleID: id}
|
queryParam: {articleID: id}
|
||||||
@@ -37,7 +37,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
articles(pageNumber: number = 1, pageSize: number = 5) {
|
articles(pageNumber: number = 1, pageSize: number = 5) {
|
||||||
return this.httpService.Service<PageList<Article>>({
|
return this.httpService.service<PageList<Article>>({
|
||||||
path: '/articles',
|
path: '/articles',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -48,7 +48,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
adminArticles(pageNumber: number = 1, pageSize: number = 10) {
|
adminArticles(pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Article>>({
|
return this.httpService.service<PageList<Article>>({
|
||||||
path: '/admin/articles',
|
path: '/admin/articles',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -59,7 +59,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateArticle(article: ArticleReq) {
|
updateArticle(article: ArticleReq) {
|
||||||
return this.httpService.Service<Article>({
|
return this.httpService.service<Article>({
|
||||||
path: '/admin/article/update',
|
path: '/admin/article/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -68,7 +68,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getArticle(articleId: number, is4Update: boolean = false) {
|
getArticle(articleId: number, is4Update: boolean = false) {
|
||||||
return this.httpService.Service<Article>({
|
return this.httpService.service<Article>({
|
||||||
path: `/article/articleID/${articleId}`,
|
path: `/article/articleID/${articleId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {update: is4Update},
|
queryParam: {update: is4Update},
|
||||||
@@ -76,7 +76,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
articlesByCategory(category: string, pageNumber: number = 1, pageSize: number = 10) {
|
articlesByCategory(category: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Article>>({
|
return this.httpService.service<PageList<Article>>({
|
||||||
path: `/articles/category/${category}`,
|
path: `/articles/category/${category}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -87,7 +87,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
articlesByTag(tag: string, pageNumber: number = 1, pageSize: number = 10) {
|
articlesByTag(tag: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Article>>({
|
return this.httpService.service<PageList<Article>>({
|
||||||
path: `/articles/tag/${tag}`,
|
path: `/articles/tag/${tag}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -98,14 +98,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
categories() {
|
categories() {
|
||||||
return this.httpService.Service<PageList<Category>>({
|
return this.httpService.service<PageList<Category>>({
|
||||||
path: '/categories',
|
path: '/categories',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createCategory(nameStr: string) {
|
createCategory(nameStr: string) {
|
||||||
return this.httpService.Service<Category>({
|
return this.httpService.service<Category>({
|
||||||
path: '/admin/category/create',
|
path: '/admin/category/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {name: nameStr}
|
queryParam: {name: nameStr}
|
||||||
@@ -113,7 +113,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteCategory(categoryId: number) {
|
deleteCategory(categoryId: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: '/admin/category/del',
|
path: '/admin/category/del',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
queryParam: {id: categoryId}
|
queryParam: {id: categoryId}
|
||||||
@@ -121,7 +121,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateCategory(categoryId: number, nameStr: string) {
|
updateCategory(categoryId: number, nameStr: string) {
|
||||||
return this.httpService.Service<Category>({
|
return this.httpService.service<Category>({
|
||||||
path: '/admin/category/update',
|
path: '/admin/category/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
queryParam: {id: categoryId, name: nameStr}
|
queryParam: {id: categoryId, name: nameStr}
|
||||||
@@ -129,7 +129,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tags(pageNumber: number = 1, pageSize: number = 10) {
|
tags(pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Tag>>({
|
return this.httpService.service<PageList<Tag>>({
|
||||||
path: '/tags',
|
path: '/tags',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -140,38 +140,38 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagsNac() {
|
tagsNac() {
|
||||||
return this.httpService.Service<{ name: string; size: number }[]>({
|
return this.httpService.service<{ name: string; size: number }[]>({
|
||||||
path: '/tags/nac',
|
path: '/tags/nac',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createTag(nameStr: string) {
|
createTag(nameStr: string) {
|
||||||
return this.httpService.Service<Tag>({
|
return this.httpService.service<Tag>({
|
||||||
path: '/admin/tag/create',
|
path: '/admin/tag/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {name: nameStr}
|
queryParam: {name: nameStr}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTag(TagId: number) {
|
deleteTag(tagId: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: '/admin/tag/del',
|
path: '/admin/tag/del',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
queryParam: {id: TagId}
|
queryParam: {id: tagId}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTag(TagId: number, nameStr: string) {
|
updateTag(tagId: number, nameStr: string) {
|
||||||
return this.httpService.Service<Tag>({
|
return this.httpService.service<Tag>({
|
||||||
path: '/admin/tag/update',
|
path: '/admin/tag/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
queryParam: {id: TagId, name: nameStr}
|
queryParam: {id: tagId, name: nameStr}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommentByTypeForAdmin(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
getCommentByTypeForAdmin(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Comment>>({
|
return this.httpService.service<PageList<Comment>>({
|
||||||
path: `/admin/comment/pagePath/${pagePath}`,
|
path: `/admin/comment/pagePath/${pagePath}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -182,7 +182,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCommentByTypeForUser(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
getCommentByTypeForUser(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||||
return this.httpService.Service<PageList<Comment>>({
|
return this.httpService.service<PageList<Comment>>({
|
||||||
path: `/user/comment/pagePath/${pagePath}`,
|
path: `/user/comment/pagePath/${pagePath}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -193,7 +193,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteComment(idNumer: number) {
|
deleteComment(idNumer: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: `/user/comment/del`,
|
path: `/user/comment/del`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
queryParam: {id: idNumer}
|
queryParam: {id: idNumer}
|
||||||
@@ -201,7 +201,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateComment(commentReq: CommentReq) {
|
updateComment(commentReq: CommentReq) {
|
||||||
return this.httpService.Service<Comment>({
|
return this.httpService.service<Comment>({
|
||||||
path: `/user/comment/update`,
|
path: `/user/comment/update`,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: commentReq,
|
data: commentReq,
|
||||||
@@ -210,7 +210,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
comments(pagePath: string, pageSize: number = 10, pageNumber: number = 1) {
|
comments(pagePath: string, pageSize: number = 10, pageNumber: number = 1) {
|
||||||
return this.httpService.Service<PageList<Comment>>({
|
return this.httpService.service<PageList<Comment>>({
|
||||||
path: `/comment/pagePath/${pagePath}`,
|
path: `/comment/pagePath/${pagePath}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -221,7 +221,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createComment(commentReq: CommentReq) {
|
createComment(commentReq: CommentReq) {
|
||||||
return this.httpService.Service<Comment>({
|
return this.httpService.service<Comment>({
|
||||||
path: '/user/comment/create',
|
path: '/user/comment/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -231,7 +231,7 @@ export class ApiService {
|
|||||||
|
|
||||||
|
|
||||||
counts() {
|
counts() {
|
||||||
return this.httpService.Service<{
|
return this.httpService.service<{
|
||||||
articleCount: number;
|
articleCount: number;
|
||||||
visitorCount: number;
|
visitorCount: number;
|
||||||
categoryCount: number;
|
categoryCount: number;
|
||||||
@@ -244,7 +244,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
adminLinks(pageSize: number = 10, pageNumber: number = 1) {
|
adminLinks(pageSize: number = 10, pageNumber: number = 1) {
|
||||||
return this.httpService.Service<PageList<Link>>({
|
return this.httpService.service<PageList<Link>>({
|
||||||
path: '/admin/links',
|
path: '/admin/links',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -255,7 +255,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createLink(linkReq: Link) {
|
createLink(linkReq: Link) {
|
||||||
return this.httpService.Service<Link>({
|
return this.httpService.service<Link>({
|
||||||
path: '/admin/links/create',
|
path: '/admin/links/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: linkReq,
|
data: linkReq,
|
||||||
@@ -264,14 +264,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteLink(idNumber: number) {
|
deleteLink(idNumber: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: `/admin/links/del/${idNumber}`,
|
path: `/admin/links/del/${idNumber}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLink(linkReq: Link) {
|
updateLink(linkReq: Link) {
|
||||||
return this.httpService.Service<Link>({
|
return this.httpService.service<Link>({
|
||||||
path: '/admin/links/update',
|
path: '/admin/links/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: linkReq,
|
data: linkReq,
|
||||||
@@ -280,7 +280,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyLink(link: ApplyLinkReq) {
|
applyLink(link: ApplyLinkReq) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/apply',
|
path: '/apply',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: link,
|
data: link,
|
||||||
@@ -289,7 +289,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reapplyLink(keyStr: string) {
|
reapplyLink(keyStr: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/reapply',
|
path: '/reapply',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -299,14 +299,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
links() {
|
links() {
|
||||||
return this.httpService.Service<Link[]>({
|
return this.httpService.service<Link[]>({
|
||||||
path: '/links',
|
path: '/links',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyImgCode(codeStr: string) {
|
verifyImgCode(codeStr: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/verCode',
|
path: '/verCode',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {code: codeStr}
|
queryParam: {code: codeStr}
|
||||||
@@ -315,7 +315,7 @@ export class ApiService {
|
|||||||
|
|
||||||
|
|
||||||
login(loginReq: LoginReq) {
|
login(loginReq: LoginReq) {
|
||||||
return this.httpService.Service<User>({
|
return this.httpService.service<User>({
|
||||||
path: '/login',
|
path: '/login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -324,14 +324,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/logout',
|
path: '/logout',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
registration(emailStr: string, pwd: string) {
|
registration(emailStr: string, pwd: string) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: '/registration',
|
path: '/registration',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -342,7 +342,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resetPwd(idStr: string, emailStr: string, pwdStr: string) {
|
resetPwd(idStr: string, emailStr: string, pwdStr: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/resetPwd',
|
path: '/resetPwd',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -354,7 +354,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emailVerify(idStr: string, emailStr: string) {
|
emailVerify(idStr: string, emailStr: string) {
|
||||||
return this.httpService.Service<void>({
|
return this.httpService.service<void>({
|
||||||
path: '/emailVerify',
|
path: '/emailVerify',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -366,7 +366,7 @@ export class ApiService {
|
|||||||
|
|
||||||
|
|
||||||
sendResetPwdEmail(emailStr: string) {
|
sendResetPwdEmail(emailStr: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/sendResetPwdEmail',
|
path: '/sendResetPwdEmail',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {email: emailStr}
|
queryParam: {email: emailStr}
|
||||||
@@ -374,7 +374,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendVerifyEmail(emailStr: string) {
|
sendVerifyEmail(emailStr: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/sendVerifyEmail',
|
path: '/sendVerifyEmail',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {email: emailStr}
|
queryParam: {email: emailStr}
|
||||||
@@ -382,14 +382,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userInfo() {
|
userInfo() {
|
||||||
return this.httpService.Service<User>({
|
return this.httpService.service<User>({
|
||||||
path: '/user/userInfo',
|
path: '/user/userInfo',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
adminUpdateUser(user: User) {
|
adminUpdateUser(user: User) {
|
||||||
return this.httpService.Service<User>({
|
return this.httpService.service<User>({
|
||||||
path: '/admin/user',
|
path: '/admin/user',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: user,
|
data: user,
|
||||||
@@ -398,14 +398,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteUser(id: number) {
|
deleteUser(id: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: `/admin/user/delete/${id}`,
|
path: `/admin/user/delete/${id}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
multipleDeleteUser(idArray: number[]) {
|
multipleDeleteUser(idArray: number[]) {
|
||||||
return this.httpService.Service<{ id: number; msg: string; status: boolean }[]>({
|
return this.httpService.service<{ id: number; msg: string; status: boolean }[]>({
|
||||||
path: `/admin/user/delete`,
|
path: `/admin/user/delete`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
data: idArray,
|
data: idArray,
|
||||||
@@ -415,14 +415,14 @@ export class ApiService {
|
|||||||
|
|
||||||
// 获取邮件是否已注册
|
// 获取邮件是否已注册
|
||||||
emailStatus(email: string) {
|
emailStatus(email: string) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: `/emailStatus/${email}`,
|
path: `/emailStatus/${email}`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUserInfo(descStr: string, disPlayNameStr: string) {
|
updateUserInfo(descStr: string, disPlayNameStr: string) {
|
||||||
return this.httpService.Service<User>({
|
return this.httpService.service<User>({
|
||||||
path: '/user/userInfo/update',
|
path: '/user/userInfo/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -433,7 +433,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
adminUsers(pageSize: number = 10, pageNumber: number = 1) {
|
adminUsers(pageSize: number = 10, pageNumber: number = 1) {
|
||||||
return this.httpService.Service<PageList<User>>({
|
return this.httpService.service<PageList<User>>({
|
||||||
path: '/admin/users',
|
path: '/admin/users',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -444,14 +444,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
visit() {
|
visit() {
|
||||||
return this.httpService.Service<Visitor>({
|
return this.httpService.service<Visitor>({
|
||||||
path: '/visit',
|
path: '/visit',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
adminVisitors(location: boolean = false, pageSize: number = 10, pageNumber: number = 1) {
|
adminVisitors(location: boolean = false, pageSize: number = 10, pageNumber: number = 1) {
|
||||||
return this.httpService.Service<PageList<Visitor>>({
|
return this.httpService.service<PageList<Visitor>>({
|
||||||
path: '/admin/visitor/page',
|
path: '/admin/visitor/page',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -463,42 +463,42 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dayVisitCount() {
|
dayVisitCount() {
|
||||||
return this.httpService.Service<number>({
|
return this.httpService.service<number>({
|
||||||
path: '/dayVisitCount',
|
path: '/dayVisitCount',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocalIp() {
|
getLocalIp() {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/ip',
|
path: '/ip',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getIpLocation(ip: string) {
|
getIpLocation(ip: string) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: `/ip/${ip}`,
|
path: `/ip/${ip}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
visitorCount() {
|
visitorCount() {
|
||||||
return this.httpService.Service<number>({
|
return this.httpService.service<number>({
|
||||||
path: `/visitor/count`,
|
path: `/visitor/count`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
webUpdate() {
|
webUpdate() {
|
||||||
return this.httpService.Service<{ id: number; info: string; time: string }[]>({
|
return this.httpService.service<{ id: number; info: string; time: string }[]>({
|
||||||
path: '/webUpdate',
|
path: '/webUpdate',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
webUpdatePage(pageSize: number = 10, pageNumber: number = 1) {
|
webUpdatePage(pageSize: number = 10, pageNumber: number = 1) {
|
||||||
return this.httpService.Service<PageList<{ id: number; info: string; time: string }>>({
|
return this.httpService.service<PageList<{ id: number; info: string; time: string }>>({
|
||||||
path: '/webUpdate/pages',
|
path: '/webUpdate/pages',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
@@ -509,7 +509,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastestUpdate() {
|
lastestUpdate() {
|
||||||
return this.httpService.Service<{
|
return this.httpService.service<{
|
||||||
lastUpdateTime: string;
|
lastUpdateTime: string;
|
||||||
lastUpdateInfo: string;
|
lastUpdateInfo: string;
|
||||||
lastCommit: string;
|
lastCommit: string;
|
||||||
@@ -523,7 +523,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createWebUpdateInfo(infoStr: string) {
|
createWebUpdateInfo(infoStr: string) {
|
||||||
return this.httpService.Service<UpdateInfo>({
|
return this.httpService.service<UpdateInfo>({
|
||||||
path: '/admin/webUpdate/create',
|
path: '/admin/webUpdate/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {info: infoStr}
|
queryParam: {info: infoStr}
|
||||||
@@ -531,14 +531,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteWebUpdateInfo(idNumber: number) {
|
deleteWebUpdateInfo(idNumber: number) {
|
||||||
return this.httpService.Service<boolean>({
|
return this.httpService.service<boolean>({
|
||||||
path: `/admin/webUpdate/del/${idNumber}`,
|
path: `/admin/webUpdate/del/${idNumber}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWebUpdateInfo(idNumber: number, infoStr: string) {
|
updateWebUpdateInfo(idNumber: number, infoStr: string) {
|
||||||
return this.httpService.Service<UpdateInfo>({
|
return this.httpService.service<UpdateInfo>({
|
||||||
path: '/admin/webUpdate/update',
|
path: '/admin/webUpdate/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
queryParam: {id: idNumber, info: infoStr}
|
queryParam: {id: idNumber, info: infoStr}
|
||||||
@@ -546,14 +546,14 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bingPic() {
|
bingPic() {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/bingPic',
|
path: '/bingPic',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setPwd(pwdStr: string, newPwdStr: string, confirmPwdStr: string,) {
|
setPwd(pwdStr: string, newPwdStr: string, confirmPwdStr: string,) {
|
||||||
return this.httpService.Service<string>({
|
return this.httpService.service<string>({
|
||||||
path: '/user/setPwd',
|
path: '/user/setPwd',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ export class HttpService {
|
|||||||
|
|
||||||
public getSubscriptionQueue = () => this.subscriptionQueue;
|
public getSubscriptionQueue = () => this.subscriptionQueue;
|
||||||
|
|
||||||
Service<T>(request: RequestObj) {
|
service<T>(request: RequestObj) {
|
||||||
const errorService = this.injector.get(ErrorService);
|
const errorService = this.injector.get(ErrorService);
|
||||||
request.url = null;
|
request.url = null;
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
request.contentType = request.contentType == null ? 'application/x-www-form-urlencoded' : request.contentType;
|
request.contentType = request.contentType == null ? 'application/x-www-form-urlencoded' : request.contentType;
|
||||||
request.header = {
|
request.header = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'Content-Type': request.contentType
|
'Content-Type': request.contentType
|
||||||
};
|
};
|
||||||
const token = this.localStorageService.getToken();
|
const token = this.localStorageService.getToken();
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import {LocalStorageService} from './local-storage.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ErrorService {
|
export class ErrorService {
|
||||||
private static HTTP_ERROR_COUNT: number = 0;
|
private static httpErrorCount: number = 0;
|
||||||
private readonly MAINTAIN_PAGE_PREFIX = '/maintain';
|
private readonly maintainPagePrefix = '/maintain';
|
||||||
private readonly ADMIN_PAGE_PREFIX = '/admin';
|
private readonly adminPagePrefix = '/admin';
|
||||||
|
|
||||||
constructor(/*private httpService: HttpService,*/
|
constructor(/*private httpService: HttpService,*/
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -27,7 +27,7 @@ export class ErrorService {
|
|||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
console.log('error=>', err, request);
|
console.log('error=>', err, request);
|
||||||
}
|
}
|
||||||
ErrorService.HTTP_ERROR_COUNT++;
|
ErrorService.httpErrorCount++;
|
||||||
// this.httpService.getSubscriptionQueue().map(a => a.unsubscribe())
|
// this.httpService.getSubscriptionQueue().map(a => a.unsubscribe())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export class ErrorService {
|
|||||||
if (response.code === -1 && response.msg === '重复请求') {
|
if (response.code === -1 && response.msg === '重复请求') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.componentStateService.currentPath === this.ADMIN_PAGE_PREFIX) {
|
if (this.componentStateService.currentPath === this.adminPagePrefix) {
|
||||||
this.notification.create('error', `请求失败<${response.code}>`, `${response.msg}`);
|
this.notification.create('error', `请求失败<${response.code}>`, `${response.msg}`);
|
||||||
}
|
}
|
||||||
/***
|
/***
|
||||||
@@ -59,7 +59,7 @@ export class ErrorService {
|
|||||||
|
|
||||||
public checkConnection() {
|
public checkConnection() {
|
||||||
// The HTTP_ERROR_COUNT is start with 1 in this function
|
// The HTTP_ERROR_COUNT is start with 1 in this function
|
||||||
if (ErrorService.HTTP_ERROR_COUNT === 1) {
|
if (ErrorService.httpErrorCount === 1) {
|
||||||
const req: RequestObj = {
|
const req: RequestObj = {
|
||||||
path: '/headerInfo',
|
path: '/headerInfo',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -68,10 +68,10 @@ export class ErrorService {
|
|||||||
this.injector.get(HttpService).get(req).subscribe({
|
this.injector.get(HttpService).get(req).subscribe({
|
||||||
next: () => null,
|
next: () => null,
|
||||||
error: () => {
|
error: () => {
|
||||||
if (this.componentStateService.currentPath !== this.MAINTAIN_PAGE_PREFIX) {
|
if (this.componentStateService.currentPath !== this.maintainPagePrefix) {
|
||||||
this.router.navigateByUrl(this.MAINTAIN_PAGE_PREFIX);
|
this.router.navigateByUrl(this.maintainPagePrefix);
|
||||||
}
|
}
|
||||||
ErrorService.HTTP_ERROR_COUNT = 0;
|
ErrorService.httpErrorCount = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export class Color {
|
|||||||
fontColor: string;
|
fontColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ColorList: Color[] = [
|
export const COLOR_LIST: Color[] = [
|
||||||
{bgColor: '#7bcfa6', fontColor: '#000000'}, // 石青
|
{bgColor: '#7bcfa6', fontColor: '#000000'}, // 石青
|
||||||
{bgColor: '#bce672', fontColor: '#000000'}, // 松花色
|
{bgColor: '#bce672', fontColor: '#000000'}, // 松花色
|
||||||
{bgColor: '#ff8936', fontColor: '#000000'}, // 橘黄
|
{bgColor: '#ff8936', fontColor: '#000000'}, // 橘黄
|
||||||
@@ -13,16 +13,16 @@ export const ColorList: Color[] = [
|
|||||||
{bgColor: '#177cb0', fontColor: '#ffffff'}, // 靛青
|
{bgColor: '#177cb0', fontColor: '#ffffff'}, // 靛青
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ColorListLength = ColorList.length;
|
export const COLOR_LIST_LENGTH = COLOR_LIST.length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取一组随机颜色
|
* 获取一组随机颜色
|
||||||
*
|
*
|
||||||
* @param count 数量
|
* @param count 数量
|
||||||
*/
|
*/
|
||||||
export function RandomColor(count: number = 1): Color[] {
|
export function randomColor(count: number = 1): Color[] {
|
||||||
const map = new Map<number, number>();
|
const map = new Map<number, number>();
|
||||||
ColorList.forEach((color, index) => map.set(index, 0));
|
COLOR_LIST.forEach((color, index) => map.set(index, 0));
|
||||||
const colorArray: Color[] = [];
|
const colorArray: Color[] = [];
|
||||||
const oneRandomColor = () => {
|
const oneRandomColor = () => {
|
||||||
const minValue = Math.min.apply(null, Array.from(map.values()));
|
const minValue = Math.min.apply(null, Array.from(map.values()));
|
||||||
@@ -30,7 +30,7 @@ export function RandomColor(count: number = 1): Color[] {
|
|||||||
const keyIndex = Math.floor(Math.random() * keys.length);
|
const keyIndex = Math.floor(Math.random() * keys.length);
|
||||||
const index = keys[keyIndex];
|
const index = keys[keyIndex];
|
||||||
map.set(index, minValue + 1);
|
map.set(index, minValue + 1);
|
||||||
return ColorList[index];
|
return COLOR_LIST[index];
|
||||||
};
|
};
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
colorArray.push(oneRandomColor());
|
colorArray.push(oneRandomColor());
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export class AdminComponent implements OnInit {
|
|||||||
const newPwd = this.resetPwdFormGroup && this.resetPwdFormGroup.value.newPwd;
|
const newPwd = this.resetPwdFormGroup && this.resetPwdFormGroup.value.newPwd;
|
||||||
return control.value !== newPwd ? {pwdNotSame: true} : null;
|
return control.value !== newPwd ? {pwdNotSame: true} : null;
|
||||||
};
|
};
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
uploadHeader = (file: NzUploadFile): any | Observable<{}> => ({Authorization: this.localStorageService.getToken()});
|
uploadHeader = (file: NzUploadFile): any | Observable<{}> => ({Authorization: this.localStorageService.getToken()});
|
||||||
|
|
||||||
showEditInfoModal() {
|
showEditInfoModal() {
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ export class WriteComponent implements OnInit, OnDestroy {
|
|||||||
.forEach(value => result.data.errFiles.push(value.originalFilename));
|
.forEach(value => result.data.errFiles.push(value.originalFilename));
|
||||||
return JSON.stringify(result);
|
return JSON.stringify(result);
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
setHeaders: () => ({Authorization: this.localStorageService.getToken()})
|
setHeaders: () => ({Authorization: this.localStorageService.getToken()})
|
||||||
},
|
},
|
||||||
after: () => {
|
after: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user