diff --git a/angular.json b/angular.json index 50bfc60..498af5e 100644 --- a/angular.json +++ b/angular.json @@ -22,7 +22,7 @@ "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", - "aot": false, + "aot": true, "assets": [ "src/favicon.ico", "src/assets" @@ -30,7 +30,8 @@ "styles": [ "src/styles.scss" ], - "scripts": [] + "scripts": [ + ] }, "configurations": { "production": { @@ -95,7 +96,8 @@ "styles": [ "src/styles.scss" ], - "scripts": [] + "scripts": [ + ] } }, "lint": { @@ -126,4 +128,4 @@ } }}, "defaultProject": "angular-admin" -} \ No newline at end of file +} diff --git a/package.json b/package.json index 68681e5..aa78bd7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "scripts": { "ng": "ng", "dev": "ng serve --proxy-config proxy.conf.json --hmr", - "build": "ng build --prod --aot=false --build-optimizer=false", + "build": "ng build --prod --aot --build-optimizer=false", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b1e466e..f8c2968 100755 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -21,7 +21,7 @@ type TMenuCollapsedState = boolean; @Component({ selector: 'app-admin', encapsulation: ViewEncapsulation.None, - styles: [require('./styles/app.scss')], + styleUrls: ['./styles/app.scss'], template: `
@@ -34,10 +34,10 @@ type TMenuCollapsedState = boolean; }) export class AppComponent implements AfterViewInit, OnInit { - private isMenuCollapsed: TMenuCollapsedState = false; + public isMenuCollapsed: TMenuCollapsedState = false; // 通知配置 - private notificationsOptions = { + public notificationsOptions = { position: ['top', 'right'], timeOut: 300, lastOnBottom: true, diff --git a/src/app/components/saCard/saCard.component.html b/src/app/components/saCard/saCard.component.html index 9f56383..ba35426 100755 --- a/src/app/components/saCard/saCard.component.html +++ b/src/app/components/saCard/saCard.component.html @@ -1,4 +1,4 @@ -
+

{{ title }}

diff --git a/src/app/components/saCheckbox/saCheckbox.component.ts b/src/app/components/saCheckbox/saCheckbox.component.ts index 01a29d3..e4a24ef 100755 --- a/src/app/components/saCheckbox/saCheckbox.component.ts +++ b/src/app/components/saCheckbox/saCheckbox.component.ts @@ -10,6 +10,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms'; @Component({ selector: 'sa-checkbox[ngModel]', styleUrls: ['./saCheckbox.component.scss'], + providers: [NgModel], templateUrl: './saCheckbox.component.html' }) export class SaCheckboxComponent implements ControlValueAccessor { diff --git a/src/app/components/saMarkdownEditor/markdownEditor.component.scss b/src/app/components/saMarkdownEditor/markdownEditor.component.scss index 4e3744e..86333eb 100755 --- a/src/app/components/saMarkdownEditor/markdownEditor.component.scss +++ b/src/app/components/saMarkdownEditor/markdownEditor.component.scss @@ -1,5 +1,10 @@ @import '~app/styles/base/init'; +@import '~highlight.js/styles/ocean.css'; +@import '~codemirror/lib/codemirror.css'; +@import '~codemirror/theme/base16-dark.css'; +@import '~codemirror/addon/fold/foldgutter.css'; + .markdown-editor { &.fullscreen { @@ -219,4 +224,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/app/components/saMarkdownEditor/markdownEditor.component.ts b/src/app/components/saMarkdownEditor/markdownEditor.component.ts index 669bbdf..ac06fcb 100755 --- a/src/app/components/saMarkdownEditor/markdownEditor.component.ts +++ b/src/app/components/saMarkdownEditor/markdownEditor.component.ts @@ -93,12 +93,8 @@ marked.setOptions({ @Component({ selector: 'sa-markdown-editor', templateUrl: './markdownEditor.component.html', - styles: [ - require('./markdownEditor.component.scss'), - require('highlight.js/styles/ocean.css'), - require('codemirror/lib/codemirror.css'), - require('codemirror/theme/base16-dark.css'), - require('codemirror/addon/fold/foldgutter.css') + styleUrls: [ + './markdownEditor.component.scss' ], providers: [{ provide: NG_VALUE_ACCESSOR, diff --git a/src/app/components/saMenu/components/saMenuItem/saMenuItem.component.html b/src/app/components/saMenu/components/saMenuItem/saMenuItem.component.html index af24a1c..4fe3b4e 100755 --- a/src/app/components/saMenu/components/saMenuItem/saMenuItem.component.html +++ b/src/app/components/saMenu/components/saMenuItem/saMenuItem.component.html @@ -11,7 +11,7 @@ > @@ -20,7 +20,7 @@ diff --git a/src/app/components/saMenu/saMenu.component.ts b/src/app/components/saMenu/saMenu.component.ts index 9a3bf1a..c699af3 100755 --- a/src/app/components/saMenu/saMenu.component.ts +++ b/src/app/components/saMenu/saMenu.component.ts @@ -37,7 +37,7 @@ export class SaMenuComponent implements OnInit, OnDestroy { private router: Router, private service: SaMenuService, private state: GlobalState, - private appState: AppState + readonly appState: AppState ) { this.onRouteChange = this.router.events.subscribe(event => { if (event instanceof NavigationEnd) { diff --git a/src/app/components/saMultiCheckbox/saMultiCheckbox.component.ts b/src/app/components/saMultiCheckbox/saMultiCheckbox.component.ts index 6c9e8bc..b58184e 100755 --- a/src/app/components/saMultiCheckbox/saMultiCheckbox.component.ts +++ b/src/app/components/saMultiCheckbox/saMultiCheckbox.component.ts @@ -10,6 +10,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms'; @Component({ selector: 'sa-multi-checkbox[ngModel]', templateUrl: './saMultiCheckbox.component.html', + providers: [NgModel] }) export class SaMultiCheckboxComponent implements ControlValueAccessor { diff --git a/src/app/components/saPageHeader/saPageHeader.component.ts b/src/app/components/saPageHeader/saPageHeader.component.ts index 84eeb6e..9e21469 100755 --- a/src/app/components/saPageHeader/saPageHeader.component.ts +++ b/src/app/components/saPageHeader/saPageHeader.component.ts @@ -21,7 +21,7 @@ type TCollapsedState = boolean; }) export class SaPageHeaderComponent { - private APP_TITLE = APP_TITLE; + public APP_TITLE = APP_TITLE; public isScrolled: TCollapsedState = false; public isMenuCollapsed: TCollapsedState = false; @@ -29,7 +29,7 @@ export class SaPageHeaderComponent { constructor( private router: Router, private state: GlobalState, - private appState: AppState + readonly appState: AppState ) { this.state.subscribe('menu.isCollapsed', isCollapsed => { this.isMenuCollapsed = isCollapsed; diff --git a/src/app/components/saSidebar/saSidebar.component.html b/src/app/components/saSidebar/saSidebar.component.html index 46f35af..ac92f1f 100755 --- a/src/app/components/saSidebar/saSidebar.component.html +++ b/src/app/components/saSidebar/saSidebar.component.html @@ -1,4 +1,4 @@ -
diff --git a/src/app/pages/demo/ui/ui.module.ts b/src/app/pages/demo/ui/ui.module.ts index 509d82f..3e034e2 100755 --- a/src/app/pages/demo/ui/ui.module.ts +++ b/src/app/pages/demo/ui/ui.module.ts @@ -62,4 +62,4 @@ import { IconsService } from './components/icons/icons.service'; IconsService ] }) -export default class UiModule {} +export class UiModule {} diff --git a/src/app/pages/linux/linux.module.ts b/src/app/pages/linux/linux.module.ts index 9e1c39c..de68ddf 100755 --- a/src/app/pages/linux/linux.module.ts +++ b/src/app/pages/linux/linux.module.ts @@ -20,4 +20,4 @@ import { LinuxComponent } from './linux.component'; LinuxComponent ] }) -export default class LinuxModule {} +export class LinuxModule {} diff --git a/src/app/pages/options/options.component.html b/src/app/pages/options/options.component.html index e161e8a..f59e249 100755 --- a/src/app/pages/options/options.component.html +++ b/src/app/pages/options/options.component.html @@ -5,7 +5,7 @@
@@ -151,7 +151,7 @@
diff --git a/src/app/pages/options/options.component.ts b/src/app/pages/options/options.component.ts index 4ab7220..a0e4532 100755 --- a/src/app/pages/options/options.component.ts +++ b/src/app/pages/options/options.component.ts @@ -64,11 +64,11 @@ enum ELoading { }) export class OptionsComponent implements OnInit { - private Loading = ELoading; - private controlStateClass = formControlStateClass; + public Loading = ELoading; + public controlStateClass = formControlStateClass; private authApiPath: TApiPath = API_PATH.ADMIN_INFO; private optionApiPath: TApiPath = API_PATH.OPTION; - private fetching: IFetching = { + public fetching: IFetching = { [ELoading.Auth]: false, [ELoading.Option]: false, [ELoading.MusicCache]: false, @@ -79,26 +79,26 @@ export class OptionsComponent implements OnInit { }; // authForm - private authForm: FormGroup; - private name: AbstractControl; - private slogan: AbstractControl; - private gravatar: AbstractControl; - private password: AbstractControl; - private new_password: AbstractControl; - private rel_new_password: AbstractControl; + public authForm: FormGroup; + public name: AbstractControl; + public slogan: AbstractControl; + public gravatar: AbstractControl; + public password: AbstractControl; + public new_password: AbstractControl; + public rel_new_password: AbstractControl; // optionForm - private optionForm: FormGroup; - private title: AbstractControl; - private sub_title: AbstractControl; - private keywords: AbstractControl; - private description: AbstractControl; - private site_url: AbstractControl; - private site_email: AbstractControl; - private site_icp: AbstractControl; - private blacklist_ips: AbstractControl; - private blacklist_mails: AbstractControl; - private blacklist_keywords: AbstractControl; + public optionForm: FormGroup; + public title: AbstractControl; + public sub_title: AbstractControl; + public keywords: AbstractControl; + public description: AbstractControl; + public site_url: AbstractControl; + public site_email: AbstractControl; + public site_icp: AbstractControl; + public blacklist_ips: AbstractControl; + public blacklist_mails: AbstractControl; + public blacklist_keywords: AbstractControl; constructor( private router: Router, @@ -167,22 +167,22 @@ export class OptionsComponent implements OnInit { } // 黑名单 ip 解析处理 - private handleCommentBlacklistIpsChange(event) { + public handleCommentBlacklistIpsChange(event) { this.blacklist_ips.setValue(this.formatLongString(event.target.value)); } // 黑名单邮箱解析处理 - private handleCommentBlacklistMailsChange(event) { + public handleCommentBlacklistMailsChange(event) { this.blacklist_mails.setValue(this.formatLongString(event.target.value)); } // 黑名单关键词解析处理 - private handleCommentBlacklistKeywordsChange(event) { + public handleCommentBlacklistKeywordsChange(event) { this.blacklist_keywords.setValue(this.formatLongString(event.target.value)); } // 关键词计息处理 - private handleKeywordsChange(event) { + public handleKeywordsChange(event) { const newWords = event.target.value .split('\n') .map(keyword => lodash.trim(keyword)) diff --git a/src/app/pages/options/options.module.ts b/src/app/pages/options/options.module.ts index c2d9704..a036e8c 100755 --- a/src/app/pages/options/options.module.ts +++ b/src/app/pages/options/options.module.ts @@ -24,4 +24,4 @@ import { RoutingModule } from './options.routing'; OptionsComponent ] }) -export default class OptionsModule {} +export class OptionsModule {} diff --git a/src/app/pages/pages.routing.ts b/src/app/pages/pages.routing.ts index cb1da42..8ea16da 100755 --- a/src/app/pages/pages.routing.ts +++ b/src/app/pages/pages.routing.ts @@ -8,23 +8,23 @@ import { Routes, RouterModule } from '@angular/router'; import { PagesComponent } from './pages.component'; const routes: Routes = [ - { path: 'auth', loadChildren: './auth/auth.module' }, + { path: 'auth', loadChildren: () => import('./auth/auth.module').then(mod => mod.AuthModule) }, { path: '', component: PagesComponent, children: [ { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, - { path: 'dashboard', loadChildren: './dashboard/dashboard.module' }, - { path: 'announcement', loadChildren: './announcement/announcement.module' }, - { path: 'article', loadChildren: './article/article.module' }, - { path: 'comment', loadChildren: './comment/comment.module' }, - { path: 'options', loadChildren: './options/options.module' }, - { path: 'linux', loadChildren: './linux/linux.module' }, - { path: 'auth', loadChildren: './auth/auth.module' }, + { path: 'dashboard', loadChildren: () => import('./dashboard/dashboard.module').then(mod => mod.DashboardModule) }, + { path: 'announcement', loadChildren: () => import('./announcement/announcement.module').then(mod => mod.AnnouncementModule) }, + { path: 'article', loadChildren: () => import('./article/article.module').then(mod => mod.ArticleModule) }, + { path: 'comment', loadChildren: () => import('./comment/comment.module').then(mod => mod.CommentModule) }, + { path: 'options', loadChildren: () => import('./options/options.module').then(mod => mod.OptionsModule) }, + { path: 'linux', loadChildren: () => import('./linux/linux.module').then(mod => mod.LinuxModule) }, + { path: 'auth', loadChildren: () => import('./auth/auth.module').then(mod => mod.AuthModule) }, { path: 'demo', children: [ - { path: 'ui', loadChildren: './demo/ui/ui.module' }, - { path: 'forms', loadChildren: './demo/forms/forms.module' }, - { path: 'tables', loadChildren: './demo/tables/tables.module' } + { path: 'ui', loadChildren: () => import('./demo/ui/ui.module').then(mod => mod.UiModule) }, + { path: 'forms', loadChildren: () => import('./demo/forms/forms.module').then(mod => mod.FormsModule) }, + { path: 'tables', loadChildren: () => import('./demo/tables/tables.module').then(mod => mod.TablesModule) } ] } ] diff --git a/src/app/services/saHttpLoading/index.ts b/src/app/services/saHttpLoading/index.ts index 4dfa4c7..e695b5b 100755 --- a/src/app/services/saHttpLoading/index.ts +++ b/src/app/services/saHttpLoading/index.ts @@ -1 +1 @@ -export * from './saHttpLoading.service'; +// export * from './saHttpLoading.service'; diff --git a/src/app/services/saHttpLoading/saHttpLoading.service.ts b/src/app/services/saHttpLoading/saHttpLoading.service.ts index 05e39fc..af3bdc5 100755 --- a/src/app/services/saHttpLoading/saHttpLoading.service.ts +++ b/src/app/services/saHttpLoading/saHttpLoading.service.ts @@ -1,74 +1,74 @@ -/** - * @file Http loading service - * @desc app/http-loading - * @author Surmon - */ +// /** +// * @file Http loading service +// * @desc app/http-loading +// * @author Surmon +// */ -import { Injectable } from '@angular/core'; +// import { Injectable } from '@angular/core'; -function replaceMethod(replacer) { - return (target, propertyKey, descriptor) => { - descriptor.value = replacer(descriptor.value); - return descriptor; - }; -} +// function replaceMethod(replacer) { +// return (target, propertyKey, descriptor) => { +// descriptor.value = replacer(descriptor.value); +// return descriptor; +// }; +// } -export type TLoading = boolean; -export type TLoadingName = string | number; +// export type TLoading = boolean; +// export type TLoadingName = string | number; -@Injectable() -export class SaHttpLoadingService { +// @Injectable() +// export class SaHttpLoadingService { - private loadings: Map = new Map(); +// private loadings: Map = new Map(); - constructor(...names: TLoadingName[]) { - names.forEach(name => this.add(name)); - } +// constructor(...names: TLoadingName[]) { +// names.forEach(name => this.add(name)); +// } - get names(): IterableIterator { - return this.loadings.keys(); - } +// get names(): IterableIterator { +// return this.loadings.keys(); +// } - add(name: TLoadingName): void { - if (!this.loadings.has(name)) { - this.loadings.set(name, false); - } - } +// add(name: TLoadingName): void { +// if (!this.loadings.has(name)) { +// this.loadings.set(name, false); +// } +// } - start(name: TLoadingName): void { - this.loadings.set(name, true); - } +// start(name: TLoadingName): void { +// this.loadings.set(name, true); +// } - stop(name: TLoadingName): void { - this.loadings.set(name, false); - } +// stop(name: TLoadingName): void { +// this.loadings.set(name, false); +// } - isLoading(name: TLoadingName): boolean { - return !!(this.loadings.has(name) && this.loadings.get(name)); - } +// isLoading(name: TLoadingName): boolean { +// return !!(this.loadings.has(name) && this.loadings.get(name)); +// } - isFinished(name: TLoadingName): boolean { - return !this.isLoading(name); - } +// isFinished(name: TLoadingName): boolean { +// return !this.isLoading(name); +// } - isAllFinished(): boolean { - const values = []; - this.loadings.forEach(value => values.push(value)); - return values.every(Boolean); - } +// isAllFinished(): boolean { +// const values = []; +// this.loadings.forEach(value => values.push(value)); +// return values.every(Boolean); +// } - promise(name: TLoadingName, promise: Promise): Promise { - this.start(name); - const stopLoading = () => this.stop(name); - promise.then(stopLoading, stopLoading); - return promise; - } +// promise(name: TLoadingName, promise: Promise): Promise { +// this.start(name); +// const stopLoading = () => this.stop(name); +// promise.then(stopLoading, stopLoading); +// return promise; +// } - handle(name: string) { - const loadings = this; - return replaceMethod((origin) => function(...args) { - const promise = origin.apply(this, args); - return loadings.promise(name, promise); - }); - } -} +// handle(name: string) { +// const loadings = this; +// return replaceMethod((origin) => function(...args) { +// const promise = origin.apply(this, args); +// return loadings.promise(name, promise); +// }); +// } +// }