├── .angular-cli.json ├── .editorconfig ├── .gitignore ├── README.md ├── admin ├── 0.3bee521803d87da72f39.chunk.js ├── 3rdpartylicenses.txt ├── favicon.ico ├── fontawesome-webfont.674f50d287a8c48dc19b.eot ├── fontawesome-webfont.912ec66d7572ff821749.svg ├── fontawesome-webfont.af7ae505a9eed503f8b8.woff2 ├── fontawesome-webfont.b06871f281fee6b241d6.ttf ├── fontawesome-webfont.fee66e712a8a08eef580.woff ├── index.html ├── inline.f872fb0338ede8ac737a.bundle.js ├── main.cb31f787f7b56b8f8e67.bundle.js ├── polyfills.dc3d31200f1987f6f645.bundle.js ├── scripts.0a2e9ada79a75097b726.bundle.js └── styles.c49148885c37c2b998c3.bundle.css ├── e2e ├── app.e2e-spec.ts ├── app.po.ts └── tsconfig.e2e.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── protractor.conf.js ├── snapshot └── blog_admin.png ├── src ├── app │ ├── admin │ │ ├── admin-article │ │ │ ├── admin-article.component.css │ │ │ ├── admin-article.component.html │ │ │ ├── admin-article.component.ts │ │ │ └── admin-article.module.ts │ │ ├── admin-category │ │ │ ├── admin-category.component.css │ │ │ ├── admin-category.component.html │ │ │ ├── admin-category.component.ts │ │ │ └── admin-category.module.ts │ │ ├── admin-info │ │ │ ├── admin-info.component.css │ │ │ ├── admin-info.component.html │ │ │ ├── admin-info.component.ts │ │ │ └── admin-info.module.ts │ │ ├── admin-link │ │ │ ├── admin-link.component.css │ │ │ ├── admin-link.component.html │ │ │ ├── admin-link.component.ts │ │ │ └── admin-link.module.ts │ │ ├── admin-publish │ │ │ ├── admin-publish.component.css │ │ │ ├── admin-publish.component.html │ │ │ ├── admin-publish.component.ts │ │ │ └── admin-publish.module.ts │ │ ├── admin-result │ │ │ ├── admin-result.component.css │ │ │ ├── admin-result.component.html │ │ │ ├── admin-result.component.ts │ │ │ └── admin-result.module.ts │ │ ├── admin-user │ │ │ ├── admin-user.component.css │ │ │ ├── admin-user.component.html │ │ │ ├── admin-user.component.ts │ │ │ └── admin-user.module.ts │ │ ├── admin-util │ │ │ ├── admin-util.component.css │ │ │ ├── admin-util.component.html │ │ │ ├── admin-util.component.ts │ │ │ └── admin-util.module.ts │ │ ├── admin.component.css │ │ ├── admin.component.html │ │ ├── admin.component.ts │ │ └── admin.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.ts │ ├── app.module.ts │ ├── guard │ │ └── auth.guard.ts │ ├── login │ │ ├── login.component.css │ │ ├── login.component.html │ │ ├── login.component.ts │ │ └── login.module.ts │ ├── regist │ │ ├── regist.component.css │ │ ├── regist.component.html │ │ ├── regist.component.ts │ │ └── regist.module.ts │ ├── routing │ │ ├── admin.routing.module.ts │ │ └── app.routing.module.ts │ └── service │ │ ├── article.service.ts │ │ ├── base.service.ts │ │ ├── category.service.ts │ │ ├── extend.service.ts │ │ ├── link.service.ts │ │ └── user.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── html.html ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json └── typings.d.ts ├── tsconfig.json └── tslint.json /.angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "name": "test-ueditor" 5 | }, 6 | "apps": [ 7 | { 8 | "root": "src", 9 | "outDir": "dist", 10 | "assets": [ 11 | "assets", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "main.ts", 16 | "polyfills": "polyfills.ts", 17 | "test": "test.ts", 18 | "tsconfig": "tsconfig.app.json", 19 | "testTsconfig": "tsconfig.spec.json", 20 | "prefix": "app", 21 | "styles": [ 22 | "styles.css", 23 | "../node_modules/froala-editor/css/froala_editor.pkgd.min.css", 24 | "../node_modules/froala-editor/css/froala_style.min.css", 25 | "../node_modules/font-awesome/css/font-awesome.css", 26 | "../node_modules/ng-zorro-antd/src/ng-zorro-antd.less" 27 | ], 28 | "scripts": [ 29 | "../node_modules/jquery/dist/jquery.min.js", 30 | "../node_modules/froala-editor/js/froala_editor.pkgd.min.js", 31 | "../node_modules/froala-editor/js/plugins/code_view.min.js", 32 | "../node_modules/froala-editor/js/languages/zh_cn.js" 33 | ], 34 | "environmentSource": "environments/environment.ts", 35 | "environments": { 36 | "dev": "environments/environment.ts", 37 | "prod": "environments/environment.prod.ts" 38 | } 39 | } 40 | ], 41 | "e2e": { 42 | "protractor": { 43 | "config": "./protractor.conf.js" 44 | } 45 | }, 46 | "lint": [ 47 | { 48 | "project": "src/tsconfig.app.json", 49 | "exclude": "**/node_modules/**" 50 | }, 51 | { 52 | "project": "src/tsconfig.spec.json", 53 | "exclude": "**/node_modules/**" 54 | }, 55 | { 56 | "project": "e2e/tsconfig.e2e.json", 57 | "exclude": "**/node_modules/**" 58 | } 59 | ], 60 | "test": { 61 | "karma": { 62 | "config": "./karma.conf.js" 63 | } 64 | }, 65 | "defaults": { 66 | "styleExt": "css", 67 | "component": {} 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /dist-server 6 | /tmp 7 | /out-tsc 8 | 9 | # dependencies 10 | /node_modules 11 | 12 | # IDEs and editors 13 | /.idea 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | *.sublime-workspace 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | yarn-error.log 35 | testem.log 36 | /typings 37 | 38 | # e2e 39 | /e2e/*.js 40 | /e2e/*.map 41 | 42 | # System Files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##Angular5-Blog-Admin 2 | ![blog](./snapshot/blog_admin.png) 3 | 4 | Angular5+Ant Design编写的简易版博客后台管理系统 5 | 预览地址[博客后台管理系统](http://admin.yinguiw.com) 6 | 测试账号密码 guest 7 | 8 | + 项目创建基于 [Angular CLI](https://github.com/angular/angular-cli) version 1.7.2. 9 | + 当前项目目录下, 使用 `npm install` 安装依赖 10 | + 测试环境使用`ng serve` 打开 `http://localhost:4200/` 11 | + 正式环境使用 `ng build --aot --prod` 编译打包位于`dist/`目录下 12 | 13 | ## 项目依赖 14 | * [Ant Design](https://ng.ant.design/docs/introduce/zh) 15 | 16 | ## 其他项目 17 | * [BlogFront博客客户端](https://github.com/lyw1995/Angular5-Blog-Front) 18 | * [BlogServrer博客服务端](https://github.com/lyw1995/Golang-Blog-Server) 19 | -------------------------------------------------------------------------------- /admin/3rdpartylicenses.txt: -------------------------------------------------------------------------------- 1 | @angular/core@5.2.11 2 | MIT 3 | MIT 4 | 5 | @angular/common@5.2.11 6 | MIT 7 | MIT 8 | 9 | @angular/router@5.2.11 10 | MIT 11 | MIT 12 | 13 | ng-zorro-antd@0.7.1 14 | MIT 15 | MIT 16 | 17 | angular-froala-wysiwyg@2.8.1 18 | MIT 19 | MIT 20 | 21 | cache-loader@1.2.2 22 | MIT 23 | Copyright JS Foundation and other contributors 24 | 25 | Permission is hereby granted, free of charge, to any person obtaining 26 | a copy of this software and associated documentation files (the 27 | 'Software'), to deal in the Software without restriction, including 28 | without limitation the rights to use, copy, modify, merge, publish, 29 | distribute, sublicense, and/or sell copies of the Software, and to 30 | permit persons to whom the Software is furnished to do so, subject to 31 | the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be 34 | included in all copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 37 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 38 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 39 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 40 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 41 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 42 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | @angular-devkit/build-optimizer@0.3.2 45 | MIT 46 | The MIT License 47 | 48 | Copyright (c) 2017 Google, Inc. 49 | 50 | Permission is hereby granted, free of charge, to any person obtaining a copy 51 | of this software and associated documentation files (the "Software"), to deal 52 | in the Software without restriction, including without limitation the rights 53 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 54 | copies of the Software, and to permit persons to whom the Software is 55 | furnished to do so, subject to the following conditions: 56 | 57 | The above copyright notice and this permission notice shall be included in all 58 | copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 61 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 62 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 63 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 64 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 65 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 66 | SOFTWARE. 67 | 68 | @angular/forms@5.2.11 69 | MIT 70 | MIT 71 | 72 | @angular/platform-browser@5.2.11 73 | MIT 74 | MIT 75 | 76 | @angular/cdk@5.2.5 77 | MIT 78 | The MIT License 79 | 80 | Copyright (c) 2018 Google LLC. 81 | 82 | Permission is hereby granted, free of charge, to any person obtaining a copy 83 | of this software and associated documentation files (the "Software"), to deal 84 | in the Software without restriction, including without limitation the rights 85 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 86 | copies of the Software, and to permit persons to whom the Software is 87 | furnished to do so, subject to the following conditions: 88 | 89 | The above copyright notice and this permission notice shall be included in 90 | all copies or substantial portions of the Software. 91 | 92 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 93 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 94 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 95 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 96 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 97 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 98 | THE SOFTWARE. 99 | 100 | angular2-jwt@0.2.3 101 | MIT 102 | The MIT License (MIT) 103 | 104 | Copyright (c) 2016 Auth0, Inc. (http://auth0.com) 105 | 106 | Permission is hereby granted, free of charge, to any person obtaining a copy 107 | of this software and associated documentation files (the "Software"), to deal 108 | in the Software without restriction, including without limitation the rights 109 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 110 | copies of the Software, and to permit persons to whom the Software is 111 | furnished to do so, subject to the following conditions: 112 | 113 | The above copyright notice and this permission notice shall be included in all 114 | copies or substantial portions of the Software. 115 | 116 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 117 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 118 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 119 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 120 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 121 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 122 | SOFTWARE. 123 | 124 | date-fns@1.29.0 125 | MIT 126 | # License 127 | 128 | date-fns is licensed under the [MIT license](http://kossnocorp.mit-license.org). 129 | Read more about MIT at [TLDRLegal](https://tldrlegal.com/license/mit-license). 130 | 131 | webpack@3.11.0 132 | MIT 133 | Copyright JS Foundation and other contributors 134 | 135 | Permission is hereby granted, free of charge, to any person obtaining 136 | a copy of this software and associated documentation files (the 137 | 'Software'), to deal in the Software without restriction, including 138 | without limitation the rights to use, copy, modify, merge, publish, 139 | distribute, sublicense, and/or sell copies of the Software, and to 140 | permit persons to whom the Software is furnished to do so, subject to 141 | the following conditions: 142 | 143 | The above copyright notice and this permission notice shall be 144 | included in all copies or substantial portions of the Software. 145 | 146 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 147 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 148 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 149 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 150 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 151 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 152 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 153 | 154 | @angular/http@5.2.11 155 | MIT 156 | MIT 157 | 158 | @angular/animations@5.2.11 159 | MIT 160 | MIT 161 | 162 | @angular/platform-browser-dynamic@5.2.11 163 | MIT 164 | MIT 165 | 166 | @types/jquery@3.3.5 167 | MIT 168 | MIT License 169 | 170 | Copyright (c) Microsoft Corporation. All rights reserved. 171 | 172 | Permission is hereby granted, free of charge, to any person obtaining a copy 173 | of this software and associated documentation files (the "Software"), to deal 174 | in the Software without restriction, including without limitation the rights 175 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 176 | copies of the Software, and to permit persons to whom the Software is 177 | furnished to do so, subject to the following conditions: 178 | 179 | The above copyright notice and this permission notice shall be included in all 180 | copies or substantial portions of the Software. 181 | 182 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 183 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 184 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 185 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 186 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 187 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 188 | SOFTWARE 189 | 190 | core-js@2.5.7 191 | MIT 192 | Copyright (c) 2014-2018 Denis Pushkarev 193 | 194 | Permission is hereby granted, free of charge, to any person obtaining a copy 195 | of this software and associated documentation files (the "Software"), to deal 196 | in the Software without restriction, including without limitation the rights 197 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 198 | copies of the Software, and to permit persons to whom the Software is 199 | furnished to do so, subject to the following conditions: 200 | 201 | The above copyright notice and this permission notice shall be included in 202 | all copies or substantial portions of the Software. 203 | 204 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 205 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 206 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 207 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 208 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 209 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 210 | THE SOFTWARE. 211 | 212 | zone.js@0.8.26 213 | MIT 214 | The MIT License 215 | 216 | Copyright (c) 2016-2018 Google, Inc. 217 | 218 | Permission is hereby granted, free of charge, to any person obtaining a copy 219 | of this software and associated documentation files (the "Software"), to deal 220 | in the Software without restriction, including without limitation the rights 221 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 222 | copies of the Software, and to permit persons to whom the Software is 223 | furnished to do so, subject to the following conditions: 224 | 225 | The above copyright notice and this permission notice shall be included in 226 | all copies or substantial portions of the Software. 227 | 228 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 229 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 230 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 231 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 232 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 233 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 234 | THE SOFTWARE. -------------------------------------------------------------------------------- /admin/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/admin/favicon.ico -------------------------------------------------------------------------------- /admin/fontawesome-webfont.674f50d287a8c48dc19b.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/admin/fontawesome-webfont.674f50d287a8c48dc19b.eot -------------------------------------------------------------------------------- /admin/fontawesome-webfont.af7ae505a9eed503f8b8.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/admin/fontawesome-webfont.af7ae505a9eed503f8b8.woff2 -------------------------------------------------------------------------------- /admin/fontawesome-webfont.b06871f281fee6b241d6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/admin/fontawesome-webfont.b06871f281fee6b241d6.ttf -------------------------------------------------------------------------------- /admin/fontawesome-webfont.fee66e712a8a08eef580.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/admin/fontawesome-webfont.fee66e712a8a08eef580.woff -------------------------------------------------------------------------------- /admin/index.html: -------------------------------------------------------------------------------- 1 | 博客后台管理系统 -------------------------------------------------------------------------------- /admin/inline.f872fb0338ede8ac737a.bundle.js: -------------------------------------------------------------------------------- 1 | !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,u){for(var a,i,f,l=0,s=[];ldocument.F=Object<\/script>"),t.close(),c=t.F;r--;)delete c.prototype[i[r]];return c()};t.exports=Object.create||function(t,e){var n;return null!==t?(u.prototype=r(t),n=new u,u.prototype=null,n[a]=t):n=c(),void 0===e?n:o(n,e)}},"8WbS":function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=n("KOrd"),a=r.has,u=r.key,c=function(t,e,n){if(a(t,e,n))return!0;var r=i(e);return null!==r&&c(t,r,n)};r.exp({hasMetadata:function(t,e){return c(t,o(e),arguments.length<3?void 0:u(arguments[2]))}})},"9GpA":function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},"9vb1":function(t,e,n){var r=n("bN1p"),o=n("kkCw")("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},A16L:function(t,e,n){var r=n("R3AP");t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},BbyF:function(t,e,n){var r=n("oeih"),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},CEne:function(t,e,n){"use strict";var r=n("OzIq"),o=n("lDLk"),i=n("bUqO"),a=n("kkCw")("species");t.exports=function(t){var e=r[t];i&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},ChGr:function(t,e,n){n("yJ2x"),n("3q4u"),n("NHaJ"),n("v3hU"),n("zZHq"),n("vsh6"),n("8WbS"),n("yOtE"),n("EZ+5"),t.exports=n("7gX0").Reflect},DIVP:function(t,e,n){var r=n("UKM+");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},Dgii:function(t,e,n){"use strict";var r=n("lDLk").f,o=n("7ylX"),i=n("A16L"),a=n("rFzY"),u=n("9GpA"),c=n("vmSO"),s=n("uc2A"),l=n("KB1o"),f=n("CEne"),p=n("bUqO"),h=n("1aA0").fastKey,v=n("zq/X"),d=p?"_s":"size",g=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,s){var l=t(function(t,r){u(t,l,e,"_i"),t._t=e,t._i=o(null),t._f=void 0,t._l=void 0,t[d]=0,void 0!=r&&c(r,n,t[s],t)});return i(l.prototype,{clear:function(){for(var t=v(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[d]=0},delete:function(t){var n=v(this,e),r=g(n,t);if(r){var o=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),n._f==r&&(n._f=o),n._l==r&&(n._l=i),n[d]--}return!!r},forEach:function(t){v(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(v(this,e),t)}}),p&&r(l.prototype,"size",{get:function(){return v(this,e)[d]}}),l},def:function(t,e,n){var r,o,i=g(t,e);return i?i.v=n:(t._l=i={i:o=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[d]++,"F"!==o&&(t._i[o]=i)),t},getEntry:g,setStrong:function(t,e,n){s(t,e,function(t,n){this._t=v(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?l(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,l(1))},n?"entries":"values",!n,!0),f(e)}}},Ds5P:function(t,e,n){var r=n("OzIq"),o=n("7gX0"),i=n("2p1q"),a=n("R3AP"),u=n("rFzY"),c=function(t,e,n){var s,l,f,p,h=t&c.F,v=t&c.G,d=t&c.P,g=t&c.B,y=v?r:t&c.S?r[e]||(r[e]={}):(r[e]||{}).prototype,k=v?o:o[e]||(o[e]={}),_=k.prototype||(k.prototype={});for(s in v&&(n=e),n)f=((l=!h&&y&&void 0!==y[s])?y:n)[s],p=g&&l?u(f,r):d&&"function"==typeof f?u(Function.call,f):f,y&&a(y,s,f,t&c.U),k[s]!=f&&i(k,s,p),d&&_[s]!=f&&(_[s]=f)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},DuR2:function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"EZ+5":function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=n("XSOZ"),a=r.key,u=r.set;r.exp({metadata:function(t,e){return function(n,r){u(t,e,(void 0!==r?o:i)(n),a(r))}}})},FryR:function(t,e,n){var r=n("/whu");t.exports=function(t){return Object(r(t))}},IRJ3:function(t,e,n){"use strict";var r=n("7ylX"),o=n("fU25"),i=n("yYvK"),a={};n("2p1q")(a,n("kkCw")("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:o(1,n)}),i(t,e+" Iterator")}},KB1o:function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},KOrd:function(t,e,n){var r=n("WBcL"),o=n("FryR"),i=n("mZON")("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},LhTa:function(t,e,n){var r=n("rFzY"),o=n("Q6Nf"),i=n("FryR"),a=n("BbyF"),u=n("plSV");t.exports=function(t,e){var n=1==t,c=2==t,s=3==t,l=4==t,f=6==t,p=5==t||f,h=e||u;return function(e,u,v){for(var d,g,y=i(e),k=o(y),_=r(u,v,3),m=a(k.length),b=0,w=n?h(e,m):c?h(e,0):void 0;m>b;b++)if((p||b in k)&&(g=_(d=k[b],b,y),t))if(n)w[b]=g;else if(g)switch(t){case 3:return!0;case 5:return d;case 6:return b;case 2:w.push(d)}else if(l)return!1;return f?-1:s||l?l:w}}},MsuQ:function(t,e,n){"use strict";var r=n("Dgii"),o=n("zq/X");t.exports=n("0Rih")("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(o(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(o(this,"Map"),0===t?0:t,e)}},r,!0)},NHaJ:function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=n("KOrd"),a=r.has,u=r.get,c=r.key,s=function(t,e,n){if(a(t,e,n))return u(t,e,n);var r=i(e);return null!==r?s(t,r,n):void 0};r.exp({getMetadata:function(t,e){return s(t,o(e),arguments.length<3?void 0:c(arguments[2]))}})},OzIq:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},PHqh:function(t,e,n){var r=n("Q6Nf"),o=n("/whu");t.exports=function(t){return r(o(t))}},Q6Nf:function(t,e,n){var r=n("ydD5");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},QG7u:function(t,e,n){var r=n("vmSO");t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},QKXm:function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},Qh14:function(t,e,n){var r=n("ReGu"),o=n("QKXm");t.exports=Object.keys||function(t){return r(t,o)}},R3AP:function(t,e,n){var r=n("OzIq"),o=n("2p1q"),i=n("WBcL"),a=n("ulTY")("src"),u=Function.toString,c=(""+u).split("toString");n("7gX0").inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,u){var s="function"==typeof n;s&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(s&&(i(n,a)||o(n,a,t[e]?""+t[e]:c.join(String(e)))),t===r?t[e]=n:u?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||u.call(this)})},ReGu:function(t,e,n){var r=n("WBcL"),o=n("PHqh"),i=n("ot5s")(!1),a=n("mZON")("IE_PROTO");t.exports=function(t,e){var n,u=o(t),c=0,s=[];for(n in u)n!=a&&r(u,n)&&s.push(n);for(;e.length>c;)r(u,n=e[c++])&&(~i(s,n)||s.push(n));return s}},SHe9:function(t,e,n){var r=n("wC1N"),o=n("kkCw")("iterator"),i=n("bN1p");t.exports=n("7gX0").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},"UKM+":function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},"V3l/":function(t,e){t.exports=!1},VWgF:function(t,e,n){var r=n("7gX0"),o=n("OzIq"),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n("V3l/")?"pure":"global",copyright:"\xa9 2018 Denis Pushkarev (zloirock.ru)"})},WBcL:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},XO1R:function(t,e,n){var r=n("ydD5");t.exports=Array.isArray||function(t){return"Array"==r(t)}},XS25:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("ChGr"),o=(n.n(r),n("ZSR1"));n.n(o)},XSOZ:function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},XvUs:function(t,e,n){var r=n("DIVP");t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},Y1N3:function(t,e){e.f=Object.getOwnPropertySymbols},Y1aA:function(t,e){e.f={}.propertyIsEnumerable},ZDXm:function(t,e,n){"use strict";var r,o=n("LhTa")(0),i=n("R3AP"),a=n("1aA0"),u=n("oYd7"),c=n("fJSx"),s=n("UKM+"),l=n("zgIt"),f=n("zq/X"),p=a.getWeak,h=Object.isExtensible,v=c.ufstore,d={},g=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},y={get:function(t){if(s(t)){var e=p(t);return!0===e?v(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return c.def(f(this,"WeakMap"),t,e)}},k=t.exports=n("0Rih")("WeakMap",g,y,c,!0,!0);l(function(){return 7!=(new k).set((Object.freeze||Object)(d),7).get(d)})&&(u((r=c.getConstructor(g,"WeakMap")).prototype,y),a.NEED=!0,o(["delete","has","get","set"],function(t){var e=k.prototype,n=e[t];i(e,t,function(e,o){if(s(e)&&!h(e)){this._f||(this._f=new r);var i=this._f[t](e,o);return"set"==t?this:i}return n.call(this,e,o)})}))},ZSR1:function(t,e,n){(function(t){!function(){"use strict";!function(t){var e=t.performance;function n(t){e&&e.mark&&e.mark(t)}function r(t,n){e&&e.measure&&e.measure(t,n)}if(n("Zone"),t.Zone)throw new Error("Zone already loaded.");var o,i=function(){function e(t,e){this._properties=null,this._parent=t,this._name=e?e.name||"unnamed":"",this._properties=e&&e.properties||{},this._zoneDelegate=new u(this,this._parent&&this._parent._zoneDelegate,e)}return e.assertZonePatched=function(){if(t.Promise!==S.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(e,"root",{get:function(){for(var t=e.current;t.parent;)t=t.parent;return t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"current",{get:function(){return x.zone},enumerable:!0,configurable:!0}),Object.defineProperty(e,"currentTask",{get:function(){return P},enumerable:!0,configurable:!0}),e.__load_patch=function(o,i){if(S.hasOwnProperty(o))throw Error("Already loaded patch: "+o);if(!t["__Zone_disable_"+o]){var a="Zone:"+o;n(a),S[o]=i(t,e,D),r(a,a)}},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.get=function(t){var e=this.getZoneWith(t);if(e)return e._properties[t]},e.prototype.getZoneWith=function(t){for(var e=this;e;){if(e._properties.hasOwnProperty(t))return e;e=e._parent}return null},e.prototype.fork=function(t){if(!t)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,t)},e.prototype.wrap=function(t,e){if("function"!=typeof t)throw new Error("Expecting function got: "+t);var n=this._zoneDelegate.intercept(this,t,e),r=this;return function(){return r.runGuarded(n,this,arguments,e)}},e.prototype.run=function(t,e,n,r){void 0===e&&(e=void 0),void 0===n&&(n=null),void 0===r&&(r=null),x={parent:x,zone:this};try{return this._zoneDelegate.invoke(this,t,e,n,r)}finally{x=x.parent}},e.prototype.runGuarded=function(t,e,n,r){void 0===e&&(e=null),void 0===n&&(n=null),void 0===r&&(r=null),x={parent:x,zone:this};try{try{return this._zoneDelegate.invoke(this,t,e,n,r)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{x=x.parent}},e.prototype.runTask=function(t,e,n){if(t.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(t.zone||g).name+"; Execution: "+this.name+")");if(t.state!==y||t.type!==O){var r=t.state!=m;r&&t._transitionTo(m,_),t.runCount++;var o=P;P=t,x={parent:x,zone:this};try{t.type==E&&t.data&&!t.data.isPeriodic&&(t.cancelFn=null);try{return this._zoneDelegate.invokeTask(this,t,e,n)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{t.state!==y&&t.state!==w&&(t.type==O||t.data&&t.data.isPeriodic?r&&t._transitionTo(_,m):(t.runCount=0,this._updateTaskCount(t,-1),r&&t._transitionTo(y,m,y))),x=x.parent,P=o}}},e.prototype.scheduleTask=function(t){if(t.zone&&t.zone!==this)for(var e=this;e;){if(e===t.zone)throw Error("can not reschedule task to "+this.name+" which is descendants of the original zone "+t.zone.name);e=e.parent}t._transitionTo(k,y);var n=[];t._zoneDelegates=n,t._zone=this;try{t=this._zoneDelegate.scheduleTask(this,t)}catch(e){throw t._transitionTo(w,k,y),this._zoneDelegate.handleError(this,e),e}return t._zoneDelegates===n&&this._updateTaskCount(t,1),t.state==k&&t._transitionTo(_,k),t},e.prototype.scheduleMicroTask=function(t,e,n,r){return this.scheduleTask(new c(T,t,e,n,r,null))},e.prototype.scheduleMacroTask=function(t,e,n,r,o){return this.scheduleTask(new c(E,t,e,n,r,o))},e.prototype.scheduleEventTask=function(t,e,n,r,o){return this.scheduleTask(new c(O,t,e,n,r,o))},e.prototype.cancelTask=function(t){if(t.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(t.zone||g).name+"; Execution: "+this.name+")");t._transitionTo(b,_,m);try{this._zoneDelegate.cancelTask(this,t)}catch(e){throw t._transitionTo(w,b),this._zoneDelegate.handleError(this,e),e}return this._updateTaskCount(t,-1),t._transitionTo(y,b),t.runCount=0,t},e.prototype._updateTaskCount=function(t,e){var n=t._zoneDelegates;-1==e&&(t._zoneDelegates=null);for(var r=0;r0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:t})},t}(),c=function(){function e(n,r,o,i,a,u){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=i,this.scheduleFn=a,this.cancelFn=u,this.callback=o;var c=this;this.invoke=n===O&&i&&i.useG?e.invokeTask:function(){return e.invokeTask.call(t,c,this,arguments)}}return e.invokeTask=function(t,e,n){t||(t=this),z++;try{return t.runCount++,t.zone.runTask(t,e,n)}finally{1==z&&d(),z--}},Object.defineProperty(e.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),e.prototype.cancelScheduleRequest=function(){this._transitionTo(y,k)},e.prototype._transitionTo=function(t,e,n){if(this._state!==e&&this._state!==n)throw new Error(this.type+" '"+this.source+"': can not transition to '"+t+"', expecting state '"+e+"'"+(n?" or '"+n+"'":"")+", was '"+this._state+"'.");this._state=t,t==y&&(this._zoneDelegates=null)},e.prototype.toString=function(){return this.data&&"undefined"!=typeof this.data.handleId?this.data.handleId:Object.prototype.toString.call(this)},e.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}},e}(),s=j("setTimeout"),l=j("Promise"),f=j("then"),p=[],h=!1;function v(e){0===z&&0===p.length&&(o||t[l]&&(o=t[l].resolve(0)),o?o[f](d):t[s](d,0)),e&&p.push(e)}function d(){if(!h){for(h=!0;p.length;){var t=p;p=[];for(var e=0;e=0;n--)"function"==typeof t[n]&&(t[n]=h(t[n],e+"_"+n));return t}function w(t){return!t||!1!==t.writable&&!("function"==typeof t.get&&"undefined"==typeof t.set)}var T="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,E=!("nw"in k)&&"undefined"!=typeof k.process&&"[object process]"==={}.toString.call(k.process),O=!E&&!T&&!(!g||!y.HTMLElement),S="undefined"!=typeof k.process&&"[object process]"==={}.toString.call(k.process)&&!T&&!(!g||!y.HTMLElement),D={},x=function(t){if(t=t||k.event){var e=D[t.type];e||(e=D[t.type]=d("ON_PROPERTY"+t.type));var n=(this||t.target||k)[e],r=n&&n.apply(this,arguments);return void 0==r||r||t.preventDefault(),r}};function P(t,r,o){var i=e(t,r);if(!i&&o&&e(o,r)&&(i={enumerable:!0,configurable:!0}),i&&i.configurable){delete i.writable,delete i.value;var a=i.get,u=i.set,c=r.substr(2),s=D[c];s||(s=D[c]=d("ON_PROPERTY"+c)),i.set=function(e){var n=this;n||t!==k||(n=k),n&&(n[s]&&n.removeEventListener(c,x),u&&u.apply(n,m),"function"==typeof e?(n[s]=e,n.addEventListener(c,x,!1)):n[s]=null)},i.get=function(){var e=this;if(e||t!==k||(e=k),!e)return null;var n=e[s];if(n)return n;if(a){var o=a&&a.call(this);if(o)return i.set.call(this,o),"function"==typeof e[_]&&e.removeAttribute(r),o}return null},n(t,r,i)}}function z(t,e,n){if(e)for(var r=0;r1?new r(t,n):new r(t),f=e(l,"onmessage");return f&&!1===f.configurable?(c=o(l),s=l,[a,u,"send","close"].forEach(function(t){c[t]=function(){var e=i.call(arguments);if(t===a||t===u){var n=e.length>0?e[0]:void 0;if(n){var r=Zone.__symbol__("ON_PROPERTY"+n);l[r]=c[r]}}return l[t].apply(l,e)}})):c=l,z(c,["close","error","message","open"],s),c};var c=n.WebSocket;for(var s in r)c[s]=r[s]}(0,c)}}var pt=d("unbound");Zone.__load_patch("util",function(t,e,n){n.patchOnProperties=z,n.patchMethod=I,n.bindArguments=b}),Zone.__load_patch("timers",function(t){W(t,"set","clear","Timeout"),W(t,"set","clear","Interval"),W(t,"set","clear","Immediate")}),Zone.__load_patch("requestAnimationFrame",function(t){W(t,"request","cancel","AnimationFrame"),W(t,"mozRequest","mozCancel","AnimationFrame"),W(t,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",function(t,e){for(var n=["alert","prompt","confirm"],r=0;r=0&&"function"==typeof n[r.cbIdx]?v(r.name,n[r.cbIdx],r,i,null):t.apply(e,n)}})}()}),Zone.__load_patch("XHR",function(t,e){!function(e){var u=XMLHttpRequest.prototype,l=u[c],f=u[s];if(!l){var p=t.XMLHttpRequestEventTarget;if(p){var h=p.prototype;l=h[c],f=h[s]}}var d="readystatechange",g="scheduled";function y(t){XMLHttpRequest[i]=!1;var e=t.data,r=e.target,a=r[o];l||(l=r[c],f=r[s]),a&&f.call(r,d,a);var u=r[o]=function(){r.readyState===r.DONE&&!e.aborted&&XMLHttpRequest[i]&&t.state===g&&t.invoke()};return l.call(r,d,u),r[n]||(r[n]=t),b.apply(r,e.args),XMLHttpRequest[i]=!0,t}function k(){}function _(t){var e=t.data;return e.aborted=!0,w.apply(e.target,e.args)}var m=I(u,"open",function(){return function(t,e){return t[r]=0==e[2],t[a]=e[1],m.apply(t,e)}}),b=I(u,"send",function(){return function(t,e){return t[r]?b.apply(t,e):v("XMLHttpRequest.send",k,{target:t,url:t[a],isPeriodic:!1,delay:null,args:e,aborted:!1},y,_)}}),w=I(u,"abort",function(){return function(t){var e=t[n];if(e&&"string"==typeof e.type){if(null==e.cancelFn||e.data&&e.data.aborted)return;e.zone.cancelTask(e)}}})}();var n=d("xhrTask"),r=d("xhrSync"),o=d("xhrListener"),i=d("xhrScheduled"),a=d("xhrURL")}),Zone.__load_patch("geolocation",function(t){t.navigator&&t.navigator.geolocation&&function(t,n){for(var r=t.constructor.name,o=function(o){var i=n[o],a=t[i];if(a){if(!w(e(t,i)))return"continue";t[i]=function(t){var e=function(){return t.apply(this,b(arguments,r+"."+i))};return C(e,t),e}(a)}},i=0;i0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)},fJSx:function(t,e,n){"use strict";var r=n("A16L"),o=n("1aA0").getWeak,i=n("DIVP"),a=n("UKM+"),u=n("9GpA"),c=n("vmSO"),s=n("LhTa"),l=n("WBcL"),f=n("zq/X"),p=s(5),h=s(6),v=0,d=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},y=function(t,e){return p(t.a,function(t){return t[0]===e})};g.prototype={get:function(t){var e=y(this,t);if(e)return e[1]},has:function(t){return!!y(this,t)},set:function(t,e){var n=y(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=h(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,i){var s=t(function(t,r){u(t,s,e,"_i"),t._t=e,t._i=v++,t._l=void 0,void 0!=r&&c(r,n,t[i],t)});return r(s.prototype,{delete:function(t){if(!a(t))return!1;var n=o(t);return!0===n?d(f(this,e)).delete(t):n&&l(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=o(t);return!0===n?d(f(this,e)).has(t):n&&l(n,this._i)}}),s},def:function(t,e,n){var r=o(i(e),!0);return!0===r?d(t).set(e,n):r[t._i]=n,t},ufstore:d}},fU25:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},gvDt:function(t,e,n){var r=n("UKM+"),o=n("DIVP"),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n("rFzY")(Function.call,n("x9zv").f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},jhxf:function(t,e,n){var r=n("UKM+"),o=n("OzIq").document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},kic5:function(t,e,n){var r=n("UKM+"),o=n("gvDt").set;t.exports=function(t,e,n){var i,a=e.constructor;return a!==n&&"function"==typeof a&&(i=a.prototype)!==n.prototype&&r(i)&&o&&o(t,i),t}},kkCw:function(t,e,n){var r=n("VWgF")("wks"),o=n("ulTY"),i=n("OzIq").Symbol,a="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=r},lDLk:function(t,e,n){var r=n("DIVP"),o=n("xZa+"),i=n("s4j0"),a=Object.defineProperty;e.f=n("bUqO")?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},mZON:function(t,e,n){var r=n("VWgF")("keys"),o=n("ulTY");t.exports=function(t){return r[t]||(r[t]=o(t))}},oYd7:function(t,e,n){"use strict";var r=n("Qh14"),o=n("Y1N3"),i=n("Y1aA"),a=n("FryR"),u=n("Q6Nf"),c=Object.assign;t.exports=!c||n("zgIt")(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r})?function(t,e){for(var n=a(t),c=arguments.length,s=1,l=o.f,f=i.f;c>s;)for(var p,h=u(arguments[s++]),v=l?r(h).concat(l(h)):r(h),d=v.length,g=0;d>g;)f.call(h,p=v[g++])&&(n[p]=h[p]);return n}:c},oeih:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},ot5s:function(t,e,n){var r=n("PHqh"),o=n("BbyF"),i=n("zo/l");t.exports=function(t){return function(e,n,a){var u,c=r(e),s=o(c.length),l=i(a,s);if(t&&n!=n){for(;s>l;)if((u=c[l++])!=u)return!0}else for(;s>l;l++)if((t||l in c)&&c[l]===n)return t||l||0;return!t&&-1}}},plSV:function(t,e,n){var r=n("boo2");t.exports=function(t,e){return new(r(t))(e)}},qkyc:function(t,e,n){var r=n("kkCw")("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},t(i)}catch(t){}return n}},rFzY:function(t,e,n){var r=n("XSOZ");t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},s4j0:function(t,e,n){var r=n("UKM+");t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},twxM:function(t,e,n){var r=n("lDLk"),o=n("DIVP"),i=n("Qh14");t.exports=n("bUqO")?Object.defineProperties:function(t,e){o(t);for(var n,a=i(e),u=a.length,c=0;u>c;)r.f(t,n=a[c++],e[n]);return t}},uc2A:function(t,e,n){"use strict";var r=n("V3l/"),o=n("Ds5P"),i=n("R3AP"),a=n("2p1q"),u=n("bN1p"),c=n("IRJ3"),s=n("yYvK"),l=n("KOrd"),f=n("kkCw")("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,v,d,g,y){c(n,e,v);var k,_,m,b=function(t){if(!p&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},w=e+" Iterator",T="values"==d,E=!1,O=t.prototype,S=O[f]||O["@@iterator"]||d&&O[d],D=S||b(d),x=d?T?b("entries"):D:void 0,P="Array"==e&&O.entries||S;if(P&&(m=l(P.call(new t)))!==Object.prototype&&m.next&&(s(m,w,!0),r||"function"==typeof m[f]||a(m,f,h)),T&&S&&"values"!==S.name&&(E=!0,D=function(){return S.call(this)}),r&&!y||!p&&!E&&O[f]||a(O,f,D),u[e]=D,u[w]=h,d)if(k={values:T?D:b("values"),keys:g?D:b("keys"),entries:x},y)for(_ in k)_ in O||i(O,_,k[_]);else o(o.P+o.F*(p||E),e,k);return k}},ulTY:function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},v3hU:function(t,e,n){var r=n("dSUw"),o=n("QG7u"),i=n("wCso"),a=n("DIVP"),u=n("KOrd"),c=i.keys,s=i.key,l=function(t,e){var n=c(t,e),i=u(t);if(null===i)return n;var a=l(i,e);return a.length?n.length?o(new r(n.concat(a))):a:n};i.exp({getMetadataKeys:function(t){return l(a(t),arguments.length<2?void 0:s(arguments[1]))}})},vmSO:function(t,e,n){var r=n("rFzY"),o=n("XvUs"),i=n("9vb1"),a=n("DIVP"),u=n("BbyF"),c=n("SHe9"),s={},l={};(e=t.exports=function(t,e,n,f,p){var h,v,d,g,y=p?function(){return t}:c(t),k=r(n,f,e?2:1),_=0;if("function"!=typeof y)throw TypeError(t+" is not iterable!");if(i(y)){for(h=u(t.length);h>_;_++)if((g=e?k(a(v=t[_])[0],v[1]):k(t[_]))===s||g===l)return g}else for(d=y.call(t);!(v=d.next()).done;)if((g=o(d,k,v.value,e))===s||g===l)return g}).BREAK=s,e.RETURN=l},vsh6:function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(t){return i(o(t),arguments.length<2?void 0:a(arguments[1]))}})},wC1N:function(t,e,n){var r=n("ydD5"),o=n("kkCw")("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:i?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},wCso:function(t,e,n){var r=n("MsuQ"),o=n("Ds5P"),i=n("VWgF")("metadata"),a=i.store||(i.store=new(n("ZDXm"))),u=function(t,e,n){var o=a.get(t);if(!o){if(!n)return;a.set(t,o=new r)}var i=o.get(e);if(!i){if(!n)return;o.set(e,i=new r)}return i};t.exports={store:a,map:u,has:function(t,e,n){var r=u(e,n,!1);return void 0!==r&&r.has(t)},get:function(t,e,n){var r=u(e,n,!1);return void 0===r?void 0:r.get(t)},set:function(t,e,n,r){u(n,r,!0).set(t,e)},keys:function(t,e){var n=u(t,e,!1),r=[];return n&&n.forEach(function(t,e){r.push(e)}),r},key:function(t){return void 0===t||"symbol"==typeof t?t:String(t)},exp:function(t){o(o.S,"Reflect",t)}}},x9zv:function(t,e,n){var r=n("Y1aA"),o=n("fU25"),i=n("PHqh"),a=n("s4j0"),u=n("WBcL"),c=n("xZa+"),s=Object.getOwnPropertyDescriptor;e.f=n("bUqO")?s:function(t,e){if(t=i(t),e=a(e,!0),c)try{return s(t,e)}catch(t){}if(u(t,e))return o(!r.f.call(t,e),t[e])}},"xZa+":function(t,e,n){t.exports=!n("bUqO")&&!n("zgIt")(function(){return 7!=Object.defineProperty(n("jhxf")("div"),"a",{get:function(){return 7}}).a})},yJ2x:function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=r.key,a=r.set;r.exp({defineMetadata:function(t,e,n,r){a(t,e,o(n),i(r))}})},yOtE:function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=r.has,a=r.key;r.exp({hasOwnMetadata:function(t,e){return i(t,o(e),arguments.length<3?void 0:a(arguments[2]))}})},yYvK:function(t,e,n){var r=n("lDLk").f,o=n("WBcL"),i=n("kkCw")("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},ydD5:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},zZHq:function(t,e,n){var r=n("wCso"),o=n("DIVP"),i=r.get,a=r.key;r.exp({getOwnMetadata:function(t,e){return i(t,o(e),arguments.length<3?void 0:a(arguments[2]))}})},zgIt:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},"zo/l":function(t,e,n){var r=n("oeih"),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},"zq/X":function(t,e,n){var r=n("UKM+");t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}}},[1]); -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('test-ueditor App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-ueditor", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve", 8 | "build": "ng build --prod", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "e2e": "ng e2e" 12 | }, 13 | "private": true, 14 | "dependencies": { 15 | "@angular/animations": "^5.2.0", 16 | "@angular/common": "^5.2.0", 17 | "@angular/compiler": "^5.2.0", 18 | "@angular/core": "^5.2.0", 19 | "@angular/forms": "^5.2.0", 20 | "@angular/http": "^5.2.0", 21 | "@angular/platform-browser": "^5.2.0", 22 | "@angular/platform-browser-dynamic": "^5.2.0", 23 | "@angular/router": "^5.2.0", 24 | "angular-froala-wysiwyg": "2.8.1", 25 | "angular2-jwt": "^0.2.3", 26 | "core-js": "^2.4.1", 27 | "ng-zorro-antd": "^0.7.0", 28 | "rxjs": "^5.5.6", 29 | "zone.js": "^0.8.19" 30 | }, 31 | "devDependencies": { 32 | "@angular/cli": "~1.7.2", 33 | "@angular/compiler-cli": "^5.2.0", 34 | "@angular/language-service": "^5.2.0", 35 | "@types/jasmine": "~2.8.3", 36 | "@types/jasminewd2": "~2.0.2", 37 | "@types/jquery": "^3.3.5", 38 | "@types/node": "~6.0.60", 39 | "codelyzer": "^4.0.1", 40 | "jasmine-core": "~2.8.0", 41 | "jasmine-spec-reporter": "~4.2.1", 42 | "karma": "~2.0.0", 43 | "karma-chrome-launcher": "~2.2.0", 44 | "karma-coverage-istanbul-reporter": "^1.2.1", 45 | "karma-jasmine": "~1.1.0", 46 | "karma-jasmine-html-reporter": "^0.2.2", 47 | "protractor": "~5.1.2", 48 | "ts-node": "~4.1.0", 49 | "tslint": "~5.9.1", 50 | "typescript": "~2.5.3" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /snapshot/blog_admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/snapshot/blog_admin.png -------------------------------------------------------------------------------- /src/app/admin/admin-article/admin-article.component.css: -------------------------------------------------------------------------------- 1 | .article-type { 2 | margin-right: 8px; 3 | margin-top: 0; 4 | vertical-align: 2px; 5 | display: inline-block; 6 | width: 26px; 7 | height: 26px; 8 | line-height: 26px; 9 | text-align: center; 10 | font-size: 12px; 11 | border-radius: 50%; 12 | } 13 | .type-2 { 14 | color: #86ca5e; 15 | border: 1px solid #e7f4df; 16 | } 17 | 18 | .type-1 { 19 | color: #ca0c16; 20 | border: 1px solid #f4ced0; 21 | } 22 | .category-type { 23 | margin-right: 8px; 24 | margin-top: 0; 25 | vertical-align: 2px; 26 | display: inline-block; 27 | line-height: 26px; 28 | text-align: center; 29 | font-size: 12px; 30 | color: #1890ff; 31 | padding-left: 5px; 32 | padding-right: 5px; 33 | border: 1px solid #1890ff; 34 | } 35 | -------------------------------------------------------------------------------- /src/app/admin/admin-article/admin-article.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 | 6 | {{ tab.name }} 7 | 8 | 16 | 17 | 18 | 文章ID 19 | 创建时间 20 | 文章标题 21 | 文章类型 22 | 文章分类 23 | 24 | 阅读量 25 | 操作 26 | 27 | 28 | 29 | 30 | 31 |
32 | {{item['aid']}} 33 |
34 | 35 | 36 |
37 | {{item['create_time'] | date:'yyyy-MM-dd HH:mm:ss'}} 38 |
39 | 40 | 41 |
42 | {{item['title']}} 43 |
44 | 45 | 46 | 51 | 52 | 53 |
54 | {{findCategoryByCid(item['cid'])}} 56 |
57 | 58 | 59 |
60 | {{item['views']}} 61 |
62 | 63 | 64 |
65 | 66 | 修改 67 | 69 | 删除 70 | 71 | 72 | 73 | 编辑 74 | 76 | 删除 77 | 78 | 79 |
80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
94 |
95 |
96 |
97 | -------------------------------------------------------------------------------- /src/app/admin/admin-article/admin-article.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {NzMessageService} from 'ng-zorro-antd'; 3 | import {ArticleService} from '../../service/article.service'; 4 | import {CategoryService} from '../../service/category.service'; 5 | import {Router} from '@angular/router'; 6 | 7 | @Component({ 8 | selector: 'app-admin-article', 9 | templateUrl: './admin-article.component.html', 10 | styleUrls: ['./admin-article.component.css'] 11 | }) 12 | export class AdminArticleComponent implements OnInit { 13 | selectIndex = 0; 14 | isDraft = false; 15 | tabs = [ 16 | { 17 | active: true, 18 | name: '发布列表', 19 | icon: 'anticon anticon-profile' 20 | }, 21 | { 22 | active: false, 23 | name: '草稿箱', 24 | icon: 'anticon anticon-delete' 25 | } 26 | ]; 27 | isAdmin: Boolean = false; 28 | dataSet = Array<{ 29 | aid: number, 30 | cid: number, 31 | create_time: Date, 32 | origin: number, 33 | title: string, 34 | views: number, 35 | }>(); 36 | showTotal = 0; 37 | nzPageIndex = 1; 38 | categorys = Array<{ 39 | cid: number, 40 | create_time: Date, 41 | cname: string, 42 | size: number, 43 | }>(); 44 | sortValue = 'descend'; 45 | pvSort = 'descend'; 46 | 47 | constructor(private ms: NzMessageService, 48 | private as: ArticleService, 49 | private cs: CategoryService, 50 | private router: Router) { 51 | this.isAdmin = as.isAdmin(); 52 | } 53 | 54 | sortByCreateTime() { 55 | if (this.sortValue === 'descend') { 56 | this.sortValue = 'ascend'; 57 | } else if (this.sortValue === 'ascend') { 58 | this.sortValue = 'descend'; 59 | } 60 | if (!this.isDraft) { 61 | this.as.getArticlesPublished((this.nzPageIndex - 1) + '', this.getSortValue(), value => { 62 | this.dataSet = value['data']['articles']; 63 | this.showTotal = value['data']['count']; 64 | }); 65 | } else { 66 | this.as.getArticlesDrafted((this.nzPageIndex - 1) + '', this.getSortValue(), value => { 67 | this.dataSet = value['data']['articles']; 68 | this.showTotal = value['data']['count']; 69 | }); 70 | } 71 | } 72 | 73 | getSortValue(): string { 74 | if (this.sortValue === 'descend') { 75 | return 'create_time,desc'; 76 | } 77 | { 78 | return 'create_time,asc'; 79 | } 80 | } 81 | 82 | ngOnInit() { 83 | this.initCategorys(); 84 | this.initArticles(); 85 | } 86 | 87 | initCategorys() { 88 | this.cs.getCategorys(value => { 89 | this.categorys = value['data']; 90 | }); 91 | } 92 | 93 | findCategoryByCid(cid: number): string { 94 | let name = '未知分类'; 95 | this.categorys.forEach(value => { 96 | if (value['cid'] === cid) { 97 | name = value['cname']; 98 | } 99 | }); 100 | return name; 101 | } 102 | 103 | initArticles() { 104 | this.nzPageIndex = 1; 105 | if (!this.isDraft) { 106 | this.as.getArticlesPublished((this.nzPageIndex - 1) + '', this.getSortValue(), value => { 107 | this.dataSet = value['data']['articles']; 108 | this.showTotal = value['data']['count']; 109 | }); 110 | } else { 111 | this.as.getArticlesDrafted((this.nzPageIndex - 1) + '', this.getSortValue(), value => { 112 | this.dataSet = value['data']['articles']; 113 | this.showTotal = value['data']['count']; 114 | }); 115 | } 116 | } 117 | 118 | tabSelect(args: any[]) { 119 | this.isDraft = this.selectIndex !== 0; 120 | this.initArticles(); 121 | } 122 | 123 | changePage(args: number) { 124 | if (!this.isDraft) { 125 | this.as.getArticlesPublished((args - 1) + '', this.getSortValue(), value => { 126 | this.dataSet = value['data']['articles']; 127 | this.showTotal = value['data']['count']; 128 | }); 129 | } else { 130 | this.as.getArticlesDrafted((args - 1) + '', this.getSortValue(), value => { 131 | this.dataSet = value['data']['articles']; 132 | this.showTotal = value['data']['count']; 133 | }); 134 | } 135 | } 136 | 137 | didEdit(args: any) { 138 | this.router.navigate(['/admin/publish'], { 139 | queryParams: { 140 | aid: args['aid'], 141 | refer: 'draft' 142 | } 143 | }); 144 | } 145 | 146 | didUpdate(args: any) { 147 | this.router.navigate(['/admin/publish'], { 148 | queryParams: { 149 | aid: args['aid'], 150 | refer: 'publish' 151 | } 152 | }); 153 | } 154 | 155 | delPublishArticle(cid: string, aid: string) { 156 | this.as.delPublishArticleByAid(cid, aid, value => { 157 | this.ms.success('删除文章成功!'); 158 | this.initArticles(); 159 | }); 160 | } 161 | 162 | delPublishDraft(cid: string, aid: string) { 163 | this.as.delDraftArticleByAid(cid, aid, value => { 164 | this.ms.success('删除草稿成功!'); 165 | this.initArticles(); 166 | }); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /src/app/admin/admin-article/admin-article.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminArticleComponent} from './admin-article.component'; 4 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 5 | import {ArticleService} from '../../service/article.service'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | CommonModule, 10 | NgZorroAntdModule, 11 | ], 12 | providers:[ArticleService], 13 | declarations: [AdminArticleComponent] 14 | }) 15 | export class AdminArticleModule { } 16 | -------------------------------------------------------------------------------- /src/app/admin/admin-category/admin-category.component.css: -------------------------------------------------------------------------------- 1 | .cell { 2 | position: relative; 3 | } 4 | .link-btn { 5 | margin-right: 20px; 6 | margin-bottom: 20px; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/admin/admin-category/admin-category.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 分类ID 16 | 分类名称 17 | 创建时间 18 | 条目数 19 | 操作 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | {{item['cid']}} 28 |
29 |
30 | 31 | 32 |
33 | {{item['cname']}} 34 |
35 | 36 | 37 |
38 | {{item['create_time'] | date:'yyyy-MM-dd HH:mm:ss'}} 39 |
40 | 41 | 42 |
43 | {{item['size']}} 44 |
45 | 46 | 47 |
48 | 编辑 49 | 51 | 删除 52 | 53 | 54 |
55 | 56 | 57 | 58 |
59 | 61 |
62 | 63 | 分类名称 64 | 65 | 66 | 67 | 请输入分类名称! 68 | 69 | 70 | 71 |
72 |
73 |
74 | -------------------------------------------------------------------------------- /src/app/admin/admin-category/admin-category.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {FormBuilder, FormGroup, Validators} from '@angular/forms'; 3 | import {NzMessageService} from 'ng-zorro-antd'; 4 | import {CategoryService} from '../../service/category.service'; 5 | 6 | @Component({ 7 | selector: 'app-admin-category', 8 | templateUrl: './admin-category.component.html', 9 | styleUrls: ['./admin-category.component.css'] 10 | }) 11 | export class AdminCategoryComponent implements OnInit { 12 | 13 | loading = true; 14 | dataSet = Array<{ 15 | cid: number, 16 | create_time: Date, 17 | cname: string, 18 | size: number, 19 | }>(); 20 | isVisible = false; 21 | isEdit: Boolean = false; 22 | validateForm: FormGroup; 23 | tempItem = null; 24 | isAdmin: Boolean = false; 25 | 26 | submitForm(): void { 27 | for (const i in this.validateForm.controls) { 28 | this.validateForm.controls[i].markAsDirty(); 29 | this.validateForm.controls[i].updateValueAndValidity(); 30 | } 31 | if (this.validateForm.valid) { 32 | const cname = this.validateForm.value['cname']; 33 | if (!this.isEdit) { 34 | // 新增 35 | this.cs.createCategory({ 36 | 'name': encodeURIComponent(cname), 37 | } 38 | , value => { 39 | this.ms.success('新增分类成功!'); 40 | this.handleCancel(); 41 | this.initCategorys(); 42 | }); 43 | } else { 44 | // 修改 45 | this.cs.updateCategoryByCid(this.tempItem['cid'], { 46 | 'name': encodeURIComponent(cname), 47 | } 48 | , value => { 49 | this.ms.success('修改分类成功!'); 50 | this.handleCancel(); 51 | this.initCategorys(); 52 | }); 53 | } 54 | } 55 | } 56 | 57 | 58 | handleOk(): void { 59 | this.submitForm(); 60 | // this.isVisible = false; 61 | } 62 | 63 | handleCancel(): void { 64 | this.isVisible = false; 65 | this.tempItem = null; 66 | this.validateForm.reset(); 67 | } 68 | 69 | constructor(private cs: CategoryService, private fb: FormBuilder, private ms: NzMessageService) { 70 | this.isAdmin = cs.isAdmin(); 71 | } 72 | 73 | ngOnInit() { 74 | this.validateForm = this.fb.group({ 75 | cname: [null, [Validators.required]], 76 | }); 77 | this.initCategorys(); 78 | } 79 | 80 | initCategorys() { 81 | this.cs.getCategorys(value => { 82 | this.dataSet = value['data']; 83 | this.loading = false; 84 | }); 85 | } 86 | 87 | showModal(flag: Boolean, item: any) { 88 | this.tempItem = item; 89 | this.isEdit = flag; 90 | this.isVisible = true; 91 | if (item !== null) { 92 | this.validateForm.get('cname').setValue(this.tempItem['cname']); 93 | } 94 | } 95 | 96 | delAllCategorys() { 97 | this.cs.delAllCategorys(value => { 98 | this.ms.success('清空所有分类成功!'); 99 | this.initCategorys(); 100 | }); 101 | } 102 | 103 | delCategoryByCid(cid: string) { 104 | this.cs.delCategoryByCid(cid, value => { 105 | this.ms.success('删除分类成功!'); 106 | this.initCategorys(); 107 | }); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/app/admin/admin-category/admin-category.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminCategoryComponent} from './admin-category.component'; 4 | import {ReactiveFormsModule} from '@angular/forms'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {CategoryService} from '../../service/category.service'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | CommonModule, 11 | ReactiveFormsModule, 12 | NgZorroAntdModule, 13 | ], 14 | providers: [CategoryService], 15 | declarations: [AdminCategoryComponent] 16 | }) 17 | export class AdminCategoryModule { 18 | } 19 | -------------------------------------------------------------------------------- /src/app/admin/admin-info/admin-info.component.css: -------------------------------------------------------------------------------- 1 | :host ::ng-deep .ant-avatar-lg { 2 | width: 120px; 3 | height: 120px; 4 | border-radius: 120px; 5 | margin-bottom: 10px; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/app/admin/admin-info/admin-info.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 |
4 | 6 |
7 |

新的账户密码:

8 | 9 |
10 |
11 | 12 |
13 |
14 |

昵称:

15 | 16 |
17 |

18 |
19 |

个人简介:

20 | 21 | 22 |
23 |

24 |
25 |

邮箱:

26 | 27 | 28 |
29 |

30 |
31 |

住址:

32 | 33 | 34 |
35 |

36 |

安全设置

37 |
38 |

39 | 账户密码: 40 | 43 |

44 | 45 |
46 |
47 |
48 |
49 |

用户头像

50 | 52 | 53 |
54 | 57 | 60 | 61 |
62 | 63 |
64 |
65 |
66 | 67 | -------------------------------------------------------------------------------- /src/app/admin/admin-info/admin-info.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, NgZone, OnInit} from '@angular/core'; 2 | import {UserService} from '../../service/user.service'; 3 | import {Subscription} from 'rxjs/Subscription'; 4 | import {NzMessageService} from 'ng-zorro-antd'; 5 | import {environment} from '../../../environments/environment'; 6 | import {Router} from '@angular/router'; 7 | 8 | @Component({ 9 | selector: 'app-admin-info', 10 | templateUrl: './admin-info.component.html', 11 | styleUrls: ['./admin-info.component.css'] 12 | }) 13 | export class AdminInfoComponent implements OnInit { 14 | loading = true; 15 | userData = null; 16 | nick_name = ''; 17 | user_desc = ''; 18 | user_email = ''; 19 | user_addr = ''; 20 | password = ''; 21 | isVisible = false; 22 | isOkLoading = false; 23 | isAdmin: Boolean = false; 24 | 25 | handleOk(): void { 26 | if (this.password.length <= 0) { 27 | this.ms.error('新的账户密码必填!'); 28 | return; 29 | } 30 | this.isOkLoading = true; 31 | this.us.updateUserInfo({ 32 | 'password': this.password, 33 | }, value => { 34 | this.isVisible = false; 35 | this.isOkLoading = false; 36 | this.us.userLogout(_ => { 37 | this.ms.success('修改用户信息成功!'); 38 | this.router.navigate(['/login']); 39 | }); 40 | }, error => { 41 | this.isOkLoading = false; 42 | }); 43 | } 44 | 45 | handleCancel(): void { 46 | this.isVisible = false; 47 | } 48 | 49 | constructor(private us: UserService, private ms: NzMessageService, private router: Router) { 50 | this.isAdmin = us.isAdmin(); 51 | } 52 | 53 | ngOnInit() { 54 | this.getUserInfo(); 55 | } 56 | 57 | // 获取用户信息 58 | getUserInfo() { 59 | this.us.getUserInfo(value => { 60 | this.loading = false; 61 | this.userData = value; 62 | }); 63 | } 64 | 65 | // 自定义上传 66 | uploadRequest = (item): Subscription => { 67 | const file = item['file']; 68 | const isJPG = file.type === 'image/jpeg'; 69 | const isPng = file.type === 'image/png'; 70 | if (!isJPG && !isPng) { 71 | this.ms.error('头像上传仅支持jpg,png格式!'); 72 | } 73 | return this.us.uploadAvator(file, value => { 74 | this.uploadAvator(environment.baseUrl + value['data']); 75 | }); 76 | }; 77 | 78 | // 修改头像 79 | uploadAvator(file: string) { 80 | this.us.updateUserInfo({ 81 | 'avator': file, 82 | }, value => { 83 | this.userData['data']['user_avator'] = file; 84 | this.ms.success('修改用户头像成功!'); 85 | }); 86 | } 87 | 88 | // 修改个人信息 89 | submit() { 90 | // 懒得写数据约束了.. 只要传就改 91 | let data = {}; 92 | if (this.nick_name.length > 0) { 93 | data['nickname'] = this.nick_name; 94 | } 95 | if (this.user_desc.length > 0) { 96 | data['desc'] = this.user_desc; 97 | } 98 | if (this.user_email.length > 0) { 99 | data['email'] = this.user_email; 100 | } 101 | if (this.user_addr.length > 0) { 102 | data['addr'] = this.user_addr; 103 | } 104 | if (Object.keys(data).length <= 0) { 105 | this.ms.error('用户信息参数必填一个!'); 106 | return; 107 | } 108 | this.us.updateUserInfo(data, value => { 109 | if (data.hasOwnProperty('nickname')) { 110 | this.userData['data']['nick_name'] = data['nickname']; 111 | } 112 | 113 | if (data.hasOwnProperty('addr')) { 114 | this.userData['data']['user_addr'] = data['addr']; 115 | } 116 | 117 | if (data.hasOwnProperty('email')) { 118 | this.userData['data']['user_email'] = data['email']; 119 | } 120 | 121 | if (data.hasOwnProperty('desc')) { 122 | this.userData['data']['user_desc'] = data['desc']; 123 | } 124 | this.ms.success('修改用户信息成功!'); 125 | }); 126 | } 127 | 128 | // 修改密码 129 | updatePassword() { 130 | this.isVisible = true; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/app/admin/admin-info/admin-info.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminInfoComponent} from './admin-info.component'; 4 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 5 | import {UserService} from '../../service/user.service'; 6 | import {FormsModule} from '@angular/forms'; 7 | import {RouterModule} from '@angular/router'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | CommonModule, 12 | RouterModule, 13 | NgZorroAntdModule, 14 | FormsModule 15 | ], 16 | providers: [UserService], 17 | declarations: [AdminInfoComponent] 18 | }) 19 | export class AdminInfoModule { 20 | } 21 | -------------------------------------------------------------------------------- /src/app/admin/admin-link/admin-link.component.css: -------------------------------------------------------------------------------- 1 | .cell { 2 | position: relative; 3 | } 4 | .link-btn { 5 | margin-right: 20px; 6 | margin-bottom: 20px; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/admin/admin-link/admin-link.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 序列号 16 | 友链名称 17 | 友链头像 18 | 友链地址 19 | 创建时间 20 | 操作 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | {{item['link_id']}} 29 |
30 |
31 | 32 | 33 |
34 | {{item['link_name']}} 35 |
36 | 37 | 38 |
39 | 41 | 42 |
43 | 44 | 45 | 48 | 49 | 50 |
51 | {{item['create_time'] | date:'yyyy-MM-dd HH:mm:ss'}} 52 |
53 | 54 | 55 |
56 | 编辑 57 | 58 | 删除 59 | 60 | 61 |
62 | 63 | 64 | 65 |
66 | 68 |
69 | 70 | 友链名称 71 | 72 | 73 | 74 | 请输入友链名称! 75 | 76 | 77 | 78 | 79 | 友链链接 80 | 81 | 82 | 83 | 请输入友链链接! 84 | 85 | 86 | 87 | 88 | 友链图片 89 | 90 | 91 | 92 | 请输入友链图片! 93 | 94 | 95 | 96 |
97 |
98 |
99 | -------------------------------------------------------------------------------- /src/app/admin/admin-link/admin-link.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {LinkService} from '../../service/link.service'; 3 | import {FormBuilder, FormGroup, Validators} from '@angular/forms'; 4 | import {NzMessageService} from 'ng-zorro-antd'; 5 | import {DomSanitizer} from '@angular/platform-browser'; 6 | 7 | @Component({ 8 | selector: 'app-admin-link', 9 | templateUrl: './admin-link.component.html', 10 | styleUrls: ['./admin-link.component.css'] 11 | }) 12 | export class AdminLinkComponent implements OnInit { 13 | loading = true; 14 | dataSet = Array<{ 15 | link_id: number, 16 | create_time: Date, 17 | link_icon: string, 18 | link_name: string, 19 | link_url: string, 20 | }>(); 21 | isVisible = false; 22 | isEdit: Boolean = false; 23 | validateForm: FormGroup; 24 | tempItem = null; 25 | isAdmin: Boolean = false; 26 | 27 | submitForm(): void { 28 | for (const i in this.validateForm.controls) { 29 | this.validateForm.controls[i].markAsDirty(); 30 | this.validateForm.controls[i].updateValueAndValidity(); 31 | } 32 | if (this.validateForm.valid) { 33 | const linkname = this.validateForm.value['linkname']; 34 | const linkurl = this.validateForm.value['linkurl']; 35 | const linkicon = this.validateForm.value['linkicon']; 36 | if (!this.isEdit) { 37 | // 新增 38 | this.ls.createLink({ 39 | 'avator': linkicon, 40 | 'name': linkname, 41 | 'url': linkurl, 42 | } 43 | , value => { 44 | this.ms.success('新增友链成功!'); 45 | this.handleCancel(); 46 | this.initLinks(); 47 | }); 48 | } else { 49 | // 修改 50 | this.ls.updateLinkByLid(this.tempItem['link_id'], { 51 | 'avator': linkicon, 52 | 'name': linkname, 53 | 'url': linkurl, 54 | } 55 | , value => { 56 | this.ms.success('修改友链成功!'); 57 | this.handleCancel(); 58 | this.initLinks(); 59 | }); 60 | } 61 | } 62 | } 63 | 64 | 65 | handleOk(): void { 66 | this.submitForm(); 67 | // this.isVisible = false; 68 | } 69 | 70 | handleCancel(): void { 71 | this.isVisible = false; 72 | this.tempItem = null; 73 | this.validateForm.reset(); 74 | } 75 | 76 | constructor(private ls: LinkService, private fb: FormBuilder, private ms: NzMessageService) { 77 | this.isAdmin = ls.isAdmin(); 78 | } 79 | 80 | ngOnInit() { 81 | this.validateForm = this.fb.group({ 82 | linkname: [null, [Validators.required]], 83 | linkurl: [null, [Validators.required]], 84 | linkicon: [null, [Validators.required]], 85 | }); 86 | this.initLinks(); 87 | } 88 | 89 | initLinks() { 90 | this.ls.getLinks(value => { 91 | this.dataSet = value['data']; 92 | this.loading = false; 93 | }); 94 | } 95 | 96 | showModal(flag: Boolean, item: any) { 97 | this.tempItem = item; 98 | this.isEdit = flag; 99 | this.isVisible = true; 100 | if (item !== null) { 101 | this.validateForm.get('linkname').setValue(this.tempItem['link_name']); 102 | this.validateForm.get('linkurl').setValue(this.tempItem['link_url']); 103 | this.validateForm.get('linkicon').setValue(this.tempItem['link_icon']); 104 | } 105 | } 106 | 107 | delAllLinks() { 108 | this.ls.delLinks(value => { 109 | this.ms.success('清空所有友链成功!'); 110 | this.initLinks(); 111 | }); 112 | } 113 | 114 | delLinkByLid(lid: string) { 115 | this.ls.delLinkByLid(lid, value => { 116 | this.ms.success('删除友链成功!'); 117 | this.initLinks(); 118 | }); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/app/admin/admin-link/admin-link.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminLinkComponent} from './admin-link.component'; 4 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 5 | import {LinkService} from '../../service/link.service'; 6 | import {ReactiveFormsModule} from '@angular/forms'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | CommonModule, 11 | ReactiveFormsModule, 12 | NgZorroAntdModule, 13 | ], 14 | providers: [LinkService], 15 | declarations: [AdminLinkComponent] 16 | }) 17 | export class AdminLinkModule { 18 | } 19 | -------------------------------------------------------------------------------- /src/app/admin/admin-publish/admin-publish.component.css: -------------------------------------------------------------------------------- 1 | a[href="https://froala.com/wysiwyg-editor"], a[href="https://www.froala.com/wysiwyg-editor?k=u"] { 2 | display: none !important; 3 | position: absolute; 4 | top: -99999999px; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/admin/admin-publish/admin-publish.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 |
4 | 文章标题 5 | 6 | 7 | 8 | 编辑内容 9 | 10 |
11 |
12 |
13 | 14 |

 

15 |

16 | 文章类型: 17 | 18 | 19 | 20 | 个人分类: 21 | 22 | 23 | 24 |

25 |

 

26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 |
44 | 45 |
46 | 47 | -------------------------------------------------------------------------------- /src/app/admin/admin-publish/admin-publish.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import 'rxjs/add/observable/range'; 3 | import 'rxjs/add/operator/filter'; 4 | import {CategoryService} from '../../service/category.service'; 5 | import {ArticleService} from '../../service/article.service'; 6 | import {NzMessageService} from 'ng-zorro-antd'; 7 | import {ActivatedRoute, Router} from '@angular/router'; 8 | 9 | @Component({ 10 | selector: 'app-admin-publish', 11 | templateUrl: './admin-publish.component.html', 12 | styleUrls: ['./admin-publish.component.css'] 13 | }) 14 | export class AdminPublishComponent implements OnInit { 15 | isAdmin: Boolean = false; 16 | option: Object; 17 | froalaText = ''; 18 | title = ''; 19 | origin = [{value: -1, label: '请选择'}, {value: 1, label: '原创'}, {value: 0, label: '转载'}]; 20 | categorys = Array<{ 21 | cid: number, 22 | create_time: Date, 23 | cname: string, 24 | size: number, 25 | }>(); 26 | selectedOrigin = -1; 27 | selectedCategory = -1; 28 | refer = ''; 29 | aid = -1; 30 | 31 | constructor(private cs: CategoryService, 32 | private as: ArticleService, 33 | private ms: NzMessageService, 34 | private activatedRoute: ActivatedRoute, 35 | private router: Router) { 36 | this.froalaText = ''; 37 | this.initParams(); 38 | this.isAdmin = as.isAdmin(); 39 | } 40 | 41 | initParams() { 42 | this.activatedRoute.queryParams.subscribe(queryParams => { 43 | if (queryParams.hasOwnProperty('refer')) { 44 | this.refer = queryParams['refer']; 45 | this.aid = queryParams['aid']; 46 | } else { 47 | this.refer = ''; 48 | this.aid = -1; 49 | } 50 | }); 51 | } 52 | 53 | initCategorys() { 54 | this.cs.getCategorys(value => { 55 | this.categorys = value['data']; 56 | this.categorys.unshift({ 57 | cid: -1, 58 | cname: '请选择', 59 | create_time: new Date(), 60 | size: 0, 61 | }); 62 | }); 63 | } 64 | 65 | ngOnInit() { 66 | this.initCategorys(); 67 | 68 | this.option = { 69 | language: 'zh_cn', 70 | placeholderText: '请输入博客内容', 71 | charCounterCount: true, 72 | charCounterMax: -1, 73 | heightMin: 300, 74 | imageUploadParam: 'cover', 75 | imageUploadURL: this.as.getUploadUrl(), 76 | quickInsertButtons: ['image', 'table', 'ol', 'ul'], 77 | toolbarButtons: ['fullscreen', 'bold', 'italic', 'underline', 78 | 'strikeThrough', 'subscript', 'superscript', '|', 'fontFamily', 79 | 'fontSize', 'color', 'inlineStyle', 'paragraphStyle', '|', 80 | 'paragraphFormat', 'align', 'formatOL', 'formatUL', 81 | 'outdent', 'indent', 'quote', '-', 'insertLink', 'insertImage', 'insertTable', 82 | 'specialCharacters', 'insertHR', '|', 'selectAll', 'clearFormatting', 83 | , 'print', 'spellChecker', 'help', 'html', '|', 'undo', 'redo'], 84 | codeBeautifierOptions: { 85 | end_with_newline: true, 86 | indent_inner_html: true, 87 | extra_liners: '[\'p\', \'h1\', \'h2\', \'h3\', \'h4\', \'h5\', \'h6\', \'blockquote\', \'pre\', \'ul\', \'ol\', \'table\', \'dl\']', 88 | brace_style: 'expand', 89 | indent_char: ' ', 90 | indent_size: 4, 91 | wrap_line_length: 0 92 | }, 93 | events: { 94 | 'froalaEditor.keyup': (v, editor) => { 95 | // this.setHighLight(this.froalaText); 96 | } 97 | } 98 | }; 99 | this.initArticle(); 100 | } 101 | 102 | initArticle() { 103 | if (this.refer !== '' && this.aid !== -1) { 104 | this.as.GetArticleWithState(this.aid + '', this.refer, value => { 105 | this.title = value['data']['title']; 106 | this.froalaText = value['data']['content']; 107 | this.selectedOrigin = value['data']['origin']; 108 | this.selectedCategory = value['data']['cid']; 109 | }); 110 | } 111 | } 112 | 113 | publish() { 114 | if (!this.canPublish()) { 115 | return; 116 | } 117 | this.as.publishArticle(this.selectedCategory + '', { 118 | 'origin': this.selectedOrigin + '', 119 | 'title': encodeURIComponent(this.title), 120 | 'content': encodeURIComponent(this.froalaText) 121 | }, value => { 122 | this.ms.success('发布文章成功!'); 123 | this.clearRecord(); 124 | this.router.navigate(['/admin/result'], { 125 | queryParams: { 126 | refer: 'publish' 127 | } 128 | }); 129 | }); 130 | } 131 | 132 | clearRecord() { 133 | this.selectedOrigin = -1; 134 | this.selectedCategory = -1; 135 | this.title = ''; 136 | this.froalaText = ''; 137 | } 138 | 139 | canPublish(): Boolean { 140 | if (this.title.length <= 0) { 141 | this.ms.error('请输入文章标题!'); 142 | return false; 143 | } 144 | if (this.froalaText.length <= 0) { 145 | this.ms.error('请输入文章内容!'); 146 | return false; 147 | } 148 | if (this.selectedOrigin === -1) { 149 | this.ms.error('请选择文章类型!'); 150 | return false; 151 | } 152 | if (this.selectedCategory === -1) { 153 | this.ms.error('请选择个人分类!'); 154 | return false; 155 | } 156 | return true; 157 | } 158 | 159 | draft() { 160 | if (!this.canPublish()) { 161 | return; 162 | } 163 | this.as.drafthArticle(this.selectedCategory + '', { 164 | 'origin': this.selectedOrigin + '', 165 | 'title': encodeURIComponent(this.title), 166 | 'content': encodeURIComponent(this.froalaText) 167 | }, value => { 168 | this.ms.success('保存草稿成功!'); 169 | this.clearRecord(); 170 | this.router.navigate(['/admin/result'], { 171 | queryParams: { 172 | refer: 'draft' 173 | } 174 | }); 175 | }); 176 | } 177 | 178 | goBack() { 179 | window.history.back(); 180 | } 181 | 182 | isShow(): Boolean { 183 | return this.title.length <= 0 && this.froalaText.length <= 0; 184 | } 185 | 186 | saveArticle() { 187 | if (!this.canPublish()) { 188 | return; 189 | } 190 | this.as.saveArticleWithState(this.aid + '', { 191 | 'cid': this.selectedCategory + '', 192 | 'origin': this.selectedOrigin + '', 193 | 'title': encodeURIComponent(this.title), 194 | 'content': encodeURIComponent(this.froalaText) 195 | }, value => { 196 | this.ms.success('保存草稿成功!'); 197 | this.clearRecord(); 198 | this.router.navigate(['/admin/result'], { 199 | queryParams: { 200 | refer: 'draft' 201 | } 202 | }); 203 | }); 204 | } 205 | 206 | publishArticle() { 207 | if (!this.canPublish()) { 208 | return; 209 | } 210 | this.as.publishArticleWithState(this.aid + '', { 211 | 'cid': this.selectedCategory + '', 212 | 'origin': this.selectedOrigin + '', 213 | 'title': encodeURIComponent(this.title), 214 | 'content': encodeURIComponent(this.froalaText) 215 | }, value => { 216 | this.ms.success('发布文章成功!'); 217 | this.clearRecord(); 218 | this.router.navigate(['/admin/result'], { 219 | queryParams: { 220 | refer: 'publish' 221 | } 222 | }); 223 | }); 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /src/app/admin/admin-publish/admin-publish.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminPublishComponent} from './admin-publish.component'; 4 | import {FormsModule, ReactiveFormsModule} from '@angular/forms'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {FroalaEditorModule, FroalaViewModule} from 'angular-froala-wysiwyg'; 7 | import {ArticleService} from '../../service/article.service'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | CommonModule, 12 | NgZorroAntdModule, 13 | FormsModule, 14 | FroalaEditorModule.forRoot(), 15 | FroalaViewModule.forRoot() 16 | ], 17 | providers: [ArticleService], 18 | declarations: [AdminPublishComponent] 19 | }) 20 | export class AdminPublishModule { 21 | } 22 | -------------------------------------------------------------------------------- /src/app/admin/admin-result/admin-result.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/src/app/admin/admin-result/admin-result.component.css -------------------------------------------------------------------------------- /src/app/admin/admin-result/admin-result.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 |
4 | 5 | 6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /src/app/admin/admin-result/admin-result.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {ActivatedRoute, Router} from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-admin-result', 6 | templateUrl: './admin-result.component.html', 7 | styleUrls: ['./admin-result.component.css'] 8 | }) 9 | export class AdminResultComponent implements OnInit { 10 | refer = 'publish'; 11 | 12 | constructor(private router: Router, private activatedRoute: ActivatedRoute) { 13 | } 14 | 15 | ngOnInit() { 16 | this.initParams(); 17 | } 18 | 19 | initParams() { 20 | this.activatedRoute.queryParams.subscribe(queryParams => { 21 | this.refer = queryParams['refer']; 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/admin/admin-result/admin-result.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { AdminResultComponent } from './admin-result.component'; 4 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 5 | import {RouterModule} from '@angular/router'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | CommonModule, 10 | RouterModule, 11 | NgZorroAntdModule 12 | ], 13 | declarations: [AdminResultComponent] 14 | }) 15 | export class AdminResultModule { } 16 | -------------------------------------------------------------------------------- /src/app/admin/admin-user/admin-user.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/src/app/admin/admin-user/admin-user.component.css -------------------------------------------------------------------------------- /src/app/admin/admin-user/admin-user.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 用户ID 15 | 用户名 16 | 用户昵称 17 | 登录时间|登录IP 18 | 用户头像 19 | 用户简介 20 | 状态 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | {{item['ID']}} 29 |
30 |
31 | 32 | 33 |
34 | {{item['UserName']}} 35 |
36 | 37 | 38 |
39 | {{item['UserInfo']['NickName']}} 40 |
41 | 42 | 43 |
44 | {{item['LoginTime'] | date:'yyyy-MM-dd HH:mm:ss'}}|{{item['LoginIP']['String']}} 45 |
46 | 47 | 48 |
49 | 51 | 52 |
53 | 54 | 55 |
56 | {{item['UserInfo']['UserDesc']}} 57 |
58 | 59 | 60 |
61 | {{item['IsActive'] == 0?'活动':'禁用'}} 62 |
63 | 64 | 65 | 66 |
67 |
68 | -------------------------------------------------------------------------------- /src/app/admin/admin-user/admin-user.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {UserService} from '../../service/user.service'; 3 | 4 | @Component({ 5 | selector: 'app-admin-user', 6 | templateUrl: './admin-user.component.html', 7 | styleUrls: ['./admin-user.component.css'] 8 | }) 9 | export class AdminUserComponent implements OnInit { 10 | dataSet = []; 11 | 12 | constructor(private us: UserService) { 13 | } 14 | 15 | ngOnInit() { 16 | this.us.getAllUsers( (value => { 17 | this.dataSet = value['data']; 18 | })); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/admin/admin-user/admin-user.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminUserComponent} from './admin-user.component'; 4 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 5 | import {UserService} from '../../service/user.service'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | CommonModule, 10 | NgZorroAntdModule, 11 | ], 12 | providers: [UserService], 13 | declarations: [AdminUserComponent] 14 | }) 15 | export class AdminUserModule { 16 | } 17 | -------------------------------------------------------------------------------- /src/app/admin/admin-util/admin-util.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/src/app/admin/admin-util/admin-util.component.css -------------------------------------------------------------------------------- /src/app/admin/admin-util/admin-util.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 |
4 |
5 |
6 | 7 |

{{extendData['total_ip_count']}}

8 |
9 |
10 |
11 | 12 |

{{extendData['today_ip_count']}}

13 |
14 |
15 |
16 | 17 |

{{extendData['articles_count']}}

18 |
19 |
20 |
21 | 22 |

{{extendData['total_pv']}}

23 |
24 |
25 |
26 |

27 |
28 |
29 | 30 | 31 |

32 | 文章类型: 33 | 34 | 35 | 36 | 个人分类: 37 | 38 | 39 | 40 |

41 | 43 | 44 |
45 |
46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /src/app/admin/admin-util/admin-util.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {NzMessageService} from 'ng-zorro-antd'; 3 | import {ArticleService} from '../../service/article.service'; 4 | import {CategoryService} from '../../service/category.service'; 5 | import {ExtendService} from '../../service/extend.service'; 6 | 7 | @Component({ 8 | selector: 'app-admin-util', 9 | templateUrl: './admin-util.component.html', 10 | styleUrls: ['./admin-util.component.css'] 11 | }) 12 | export class AdminUtilComponent implements OnInit { 13 | origin = [{value: -1, label: '请选择'}, {value: 1, label: '原创'}, {value: 0, label: '转载'}]; 14 | categorys = Array<{ 15 | cid: number, 16 | create_time: Date, 17 | cname: string, 18 | size: number, 19 | }>(); 20 | selectedOrigin = -1; 21 | selectedCategory = -1; 22 | csdnUrl = ''; 23 | extendData = null; 24 | isAdmin: Boolean = false; 25 | 26 | constructor(private ms: NzMessageService, private es: ExtendService, private cs: CategoryService) { 27 | this.isAdmin = es.isAdmin(); 28 | } 29 | 30 | ngOnInit() { 31 | this.initExtends(); 32 | this.initCategorys(); 33 | } 34 | 35 | initCategorys() { 36 | this.cs.getCategorys(value => { 37 | this.categorys = value['data']; 38 | this.categorys.unshift({ 39 | cid: -1, 40 | cname: '请选择', 41 | create_time: new Date(), 42 | size: 0, 43 | }); 44 | }); 45 | } 46 | 47 | CreateOfCsdn(act: string) { 48 | if (this.csdnUrl.length <= 0) { 49 | this.ms.error('请输入csdn博客文章链接!'); 50 | return false; 51 | } 52 | if (!this.csdnUrl.startsWith('https://blog.csdn.net', 0)) { 53 | this.ms.error('请输入csdn博客文章链接!'); 54 | return false; 55 | } 56 | if (this.selectedOrigin === -1) { 57 | this.ms.error('请选择文章类型!'); 58 | return false; 59 | } 60 | if (this.selectedCategory === -1) { 61 | this.ms.error('请选择个人分类!'); 62 | return false; 63 | } 64 | this.es.collectByCsdn({ 65 | cid: this.selectedCategory, 66 | origin: this.selectedOrigin, 67 | refer: 'csdn', 68 | uid: localStorage.getItem('user_id'), 69 | url: this.csdnUrl, 70 | action: act, 71 | }, value => { 72 | this.ms.success(value['msg']); 73 | }); 74 | } 75 | 76 | private initExtends() { 77 | this.es.getAll(value => { 78 | this.extendData = value['data']; 79 | }); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/app/admin/admin-util/admin-util.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminUtilComponent} from './admin-util.component'; 4 | import {RouterModule} from '@angular/router'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {FormsModule} from '@angular/forms'; 7 | import {ExtendService} from '../../service/extend.service'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | CommonModule, 12 | RouterModule, 13 | FormsModule, 14 | NgZorroAntdModule 15 | ], 16 | providers: [ExtendService], 17 | declarations: [AdminUtilComponent] 18 | }) 19 | export class AdminUtilModule { 20 | } 21 | -------------------------------------------------------------------------------- /src/app/admin/admin.component.css: -------------------------------------------------------------------------------- 1 | :host ::ng-deep .trigger { 2 | font-size: 18px; 3 | line-height: 64px; 4 | padding: 0 24px; 5 | cursor: pointer; 6 | transition: color .3s; 7 | } 8 | 9 | :host ::ng-deep .trigger:hover { 10 | color: #1890ff; 11 | } 12 | 13 | :host ::ng-deep .logo .ant-avatar-image{ 14 | height: 40px; 15 | /*background: rgba(255, 255, 255, .2);*/ 16 | margin: 16px; 17 | background: #F8F8F5; 18 | } 19 | .username-text{ 20 | display: inline-block; 21 | line-height: 40px; 22 | color: #F8F8F5; 23 | margin: 15px 0; 24 | } 25 | -------------------------------------------------------------------------------- /src/app/admin/admin.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 |
    10 |
  • 发布文章
  • 12 |
  • 用户管理 13 |
  • 14 |
  • 文章管理
  • 16 |
  • 分类管理 17 |
  • 18 |
  • 友链管理 19 |
  • 20 |
  • 小小工具 21 |
  • 22 |
  • 退出登录 23 |
  • 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | Ant Design ©2017 Implement By Angular 42 | 43 |
44 | 45 | 46 | 47 | 49 |

您确定要退出登录吗?

50 |
51 | -------------------------------------------------------------------------------- /src/app/admin/admin.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit, ViewChild, TemplateRef} from '@angular/core'; 2 | import {Router} from '@angular/router'; 3 | import {UserService} from '../service/user.service'; 4 | import {NzMessageService} from 'ng-zorro-antd'; 5 | 6 | @Component({ 7 | selector: 'app-admin', 8 | templateUrl: './admin.component.html', 9 | styleUrls: ['./admin.component.css'] 10 | }) 11 | export class AdminComponent implements OnInit { 12 | user_name = ''; 13 | user_avator = ''; 14 | isCollapsed = false; 15 | triggerTemplate = null; 16 | isVisible = false; 17 | isOkLoading = false; 18 | @ViewChild('trigger') customTrigger: TemplateRef; 19 | 20 | /** custom trigger can be TemplateRef **/ 21 | changeTrigger(): void { 22 | this.triggerTemplate = this.customTrigger; 23 | } 24 | 25 | constructor(private route: Router, private us: UserService, private ms: NzMessageService) { 26 | this.user_name = localStorage.getItem('user_name'); 27 | this.user_avator = localStorage.getItem('user_avator'); 28 | } 29 | 30 | ngOnInit() { 31 | } 32 | 33 | logout() { 34 | this.isVisible = true; 35 | } 36 | 37 | handleCancel() { 38 | this.isVisible = false; 39 | } 40 | 41 | handleOk(): void { 42 | this.isOkLoading = true; 43 | window.setTimeout(() => { 44 | this.isVisible = false; 45 | this.isOkLoading = false; 46 | this.us.userLogout(_ => { 47 | this.ms.success('退出登录成功!'); 48 | this.route.navigate(['/login']); 49 | }); 50 | }, 1000); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/app/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {AdminComponent} from './admin.component'; 4 | import {RouterModule} from '@angular/router'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {AdminRoutingModule} from '../routing/admin.routing.module'; 7 | import {AdminPublishModule} from './admin-publish/admin-publish.module'; 8 | import {AdminUserModule} from './admin-user/admin-user.module'; 9 | import {AdminLinkModule} from './admin-link/admin-link.module'; 10 | import {AdminCategoryModule} from './admin-category/admin-category.module'; 11 | import {AdminArticleModule} from './admin-article/admin-article.module'; 12 | import {AdminInfoModule} from './admin-info/admin-info.module'; 13 | import {UserService} from '../service/user.service'; 14 | import {AdminResultModule} from './admin-result/admin-result.module'; 15 | import {AdminUtilModule} from './admin-util/admin-util.module'; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | RouterModule, 21 | NgZorroAntdModule, 22 | AdminRoutingModule, 23 | AdminPublishModule, 24 | AdminUserModule, 25 | AdminLinkModule, 26 | AdminCategoryModule, 27 | AdminArticleModule, 28 | AdminInfoModule, 29 | AdminResultModule, 30 | AdminUtilModule, 31 | ], 32 | providers: [UserService], 33 | declarations: [AdminComponent] 34 | }) 35 | export class AdminModule { 36 | } 37 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- 1 | h1 { margin-top:20px;text-align:center;width:100%; display:block; line-height:1.5em; overflow:visible; font-size:30px; text-shadow:#f3f3f3 1px 1px 0px, #b2b2b2 1px 2px 0} 2 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

{{title}}

2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent implements OnInit { 10 | title = '博客后台管理系统'; 11 | ngOnInit(): void { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import {BrowserModule} from '@angular/platform-browser'; 2 | import {NgModule} from '@angular/core'; 3 | import {AppComponent} from './app.component'; 4 | import {AppRoutingModule} from './routing/app.routing.module'; 5 | import {LoginModule} from './login/login.module'; 6 | import {RegistModule} from './regist/regist.module'; 7 | import {NgZorroAntdModule, NZ_I18N, zh_CN} from 'ng-zorro-antd'; 8 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; 9 | import {HttpClientModule} from '@angular/common/http'; 10 | 11 | 12 | @NgModule({ 13 | declarations: [ 14 | AppComponent 15 | ], 16 | imports: [ 17 | BrowserModule, 18 | AppRoutingModule, 19 | LoginModule, 20 | RegistModule, 21 | HttpClientModule, 22 | NgZorroAntdModule.forRoot(), 23 | BrowserAnimationsModule, 24 | ], 25 | providers: [{provide: NZ_I18N, useValue: zh_CN}], 26 | bootstrap: [AppComponent] 27 | }) 28 | 29 | export class AppModule { 30 | } 31 | -------------------------------------------------------------------------------- /src/app/guard/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild, Router, CanLoad, Route} from '@angular/router'; 3 | import {Observable} from 'rxjs/Observable'; 4 | import {JwtHelper} from 'angular2-jwt'; 5 | 6 | @Injectable() 7 | export class AuthGuard implements CanActivate, CanActivateChild, CanLoad { 8 | jwtHelper: JwtHelper = new JwtHelper(); 9 | 10 | constructor(private router: Router) { 11 | } 12 | 13 | useJwtHelper(): boolean { 14 | const token = localStorage.getItem('token'); 15 | if (token === null || this.jwtHelper.isTokenExpired(token)) { 16 | this.router.navigate(['/login']); 17 | return false; 18 | } 19 | return true; 20 | } 21 | 22 | canActivate( 23 | next: ActivatedRouteSnapshot, 24 | state: RouterStateSnapshot): Observable | Promise | boolean { 25 | return this.useJwtHelper(); 26 | } 27 | 28 | canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean { 29 | return this.canActivate(childRoute, state); 30 | } 31 | 32 | canLoad(route: Route): Observable | Promise | boolean { 33 | return this.useJwtHelper(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/app/login/login.component.css: -------------------------------------------------------------------------------- 1 | .login-form-container{ 2 | margin: 8%; 3 | } 4 | .login-form { 5 | max-width: 300px; 6 | margin: 0 auto; 7 | } 8 | 9 | .login-form-forgot { 10 | float: right; 11 | } 12 | 13 | .login-form-button { 14 | width: 100%; 15 | } 16 | -------------------------------------------------------------------------------- /src/app/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 41 | -------------------------------------------------------------------------------- /src/app/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {AbstractControl, FormBuilder, FormGroup, Validators} from '@angular/forms'; 3 | import {UserService} from '../service/user.service'; 4 | import {Router} from '@angular/router'; 5 | import {NzMessageService} from 'ng-zorro-antd'; 6 | 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.component.html', 10 | styleUrls: ['./login.component.css'] 11 | }) 12 | export class LoginComponent implements OnInit { 13 | 14 | validateForm: FormGroup; 15 | 16 | submitForm(): void { 17 | for (const i in this.validateForm.controls) { 18 | this.validateForm.controls[i].markAsDirty(); 19 | this.validateForm.controls[i].updateValueAndValidity(); 20 | } 21 | // 提交数据 22 | if (this.validateForm.valid) { 23 | const username = this.validateForm.value['userName']; 24 | const password = this.validateForm.value['password']; 25 | const remember = this.validateForm.value['remember']; 26 | if (remember) { 27 | console.log('记住密码'); 28 | } 29 | this.us.userLogin(username, password, (value => { 30 | // 登录成功 跳转 31 | localStorage.setItem('is_admin', username); 32 | this.router.navigate(['/admin']); 33 | })); 34 | } 35 | } 36 | 37 | constructor(private fb: FormBuilder, private us: UserService, private router: Router, private ms: NzMessageService) { 38 | } 39 | 40 | ngOnInit(): void { 41 | this.validateForm = this.fb.group({ 42 | userName: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(12), Validators.pattern('^[A-Za-z]+\\w+$')]], 43 | password: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(16), Validators.pattern('^[A-Za-z]+\\w+$')]], 44 | remember: [true] 45 | }); 46 | } 47 | 48 | forgetPassword() { 49 | this.ms.create('warning', '尚未开放!'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/app/login/login.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {LoginComponent} from './login.component'; 4 | import {RouterModule} from '@angular/router'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {ReactiveFormsModule} from '@angular/forms'; 7 | import {UserService} from '../service/user.service'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | CommonModule, 12 | RouterModule, 13 | ReactiveFormsModule, 14 | NgZorroAntdModule, 15 | ], 16 | providers: [UserService], 17 | declarations: [LoginComponent] 18 | }) 19 | export class LoginModule { 20 | } 21 | -------------------------------------------------------------------------------- /src/app/regist/regist.component.css: -------------------------------------------------------------------------------- 1 | [nz-form] { 2 | max-width: 600px; 3 | margin: 0 auto; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/regist/regist.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 用户名 4 | 5 | 6 | 7 | 请输入5-12位字母开头的用户名! 8 | 9 | 10 | 11 | 12 | 用户昵称 13 | 14 | 15 | 请输入5-12用户昵称! 16 | 17 | 18 | 19 | 20 | 账户密码 21 | 22 | 24 | 25 | 请输入5-12位字母开头账户密码! 26 | 27 | 28 | 29 | 30 | 确认密码 31 | 32 | 33 | 34 | 35 | 请输入5-16位字母开头的确认密码! 36 | 37 | 38 | 两次密码输入不一致! 39 | 40 | 41 | 42 | 43 | 44 | 个人简介 45 | 46 | 47 | 请输入个人简介! 48 | 49 | 50 | 51 | 52 | 邮箱 53 | 54 | 55 | 请输入个人邮箱! 56 | 57 | 58 | 59 | 60 | 居住地 61 | 62 | 63 | 请输入当前居住地! 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
73 | -------------------------------------------------------------------------------- /src/app/regist/regist.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import { 3 | FormBuilder, 4 | FormControl, 5 | FormGroup, 6 | Validators 7 | } from '@angular/forms'; 8 | import {UserService} from '../service/user.service'; 9 | import {NzMessageService} from 'ng-zorro-antd'; 10 | import {Router} from '@angular/router'; 11 | 12 | @Component({ 13 | selector: 'app-regist', 14 | templateUrl: './regist.component.html', 15 | styleUrls: ['./regist.component.css'] 16 | }) 17 | export class RegistComponent implements OnInit { 18 | validateForm: FormGroup; 19 | emailIn = ''; 20 | 21 | submitForm(): void { 22 | if (this.emailIn.length > 0) { 23 | this.validateForm.get('email').setValidators(Validators.email); 24 | this.validateForm.get('email').markAsDirty(); 25 | this.validateForm.get('email').updateValueAndValidity(); 26 | } else { 27 | this.validateForm.get('email').clearValidators(); 28 | this.validateForm.get('email').markAsPristine(); 29 | this.validateForm.get('email').updateValueAndValidity(); 30 | } 31 | for (const i in this.validateForm.controls) { 32 | this.validateForm.controls[i].markAsDirty(); 33 | this.validateForm.controls[i].updateValueAndValidity(); 34 | } 35 | if (this.validateForm.valid) { 36 | this.didRegist(); 37 | } 38 | } 39 | 40 | updateConfirmValidator(): void { 41 | /** wait for refresh value */ 42 | Promise.resolve().then(() => this.validateForm.controls.checkPassword.updateValueAndValidity()); 43 | } 44 | 45 | confirmationValidator = (control: FormControl): { [s: string]: boolean } => { 46 | if (!control.value) { 47 | return {required: true}; 48 | } else if (control.value !== this.validateForm.controls.password.value) { 49 | return {confirm: true, error: true}; 50 | } 51 | }; 52 | 53 | constructor(private fb: FormBuilder, private us: UserService, private ms: NzMessageService, private router: Router) { 54 | } 55 | 56 | ngOnInit(): void { 57 | this.validateForm = this.fb.group({ 58 | username: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(12), Validators.pattern('^[A-Za-z]+\\w+$')]], 59 | nickname: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(12)]], 60 | password: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(16), Validators.pattern('^[A-Za-z]+\\w+$')]], 61 | checkPassword: ['', [Validators.required, this.confirmationValidator]], 62 | desc: ['', [Validators.maxLength(150)]], 63 | email: [''], 64 | addr: ['', [Validators.maxLength(50)]] 65 | }); 66 | } 67 | 68 | didRegist() { 69 | const username = this.validateForm.value['username']; 70 | const nickname = this.validateForm.value['nickname']; 71 | const password = this.validateForm.value['password']; 72 | const desc = this.validateForm.value['desc']; 73 | const email = this.validateForm.value['email']; 74 | const addr = this.validateForm.value['addr']; 75 | this.us.userRegist({ 76 | 'username': username, 77 | 'password': password, 78 | 'nickname': nickname, 79 | 'desc': desc, 80 | 'addr': addr, 81 | 'email': email 82 | }, (value => { 83 | this.ms.success('注册成功!'); 84 | this.router.navigate(['/login']); 85 | })); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/app/regist/regist.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {RegistComponent} from './regist.component'; 4 | import {ReactiveFormsModule} from '@angular/forms'; 5 | import {NgZorroAntdModule} from 'ng-zorro-antd'; 6 | import {UserService} from '../service/user.service'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | CommonModule, 11 | ReactiveFormsModule, 12 | NgZorroAntdModule, 13 | ], 14 | providers: [UserService], 15 | declarations: [RegistComponent] 16 | }) 17 | export class RegistModule { 18 | } 19 | -------------------------------------------------------------------------------- /src/app/routing/admin.routing.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {RouterModule, Routes} from '@angular/router'; 3 | import {LoginComponent} from '../login/login.component'; 4 | import {RegistComponent} from '../regist/regist.component'; 5 | import {AdminComponent} from '../admin/admin.component'; 6 | import {AuthGuard} from '../guard/auth.guard'; 7 | import {AdminPublishModule} from '../admin/admin-publish/admin-publish.module'; 8 | import {AdminPublishComponent} from '../admin/admin-publish/admin-publish.component'; 9 | import {AdminArticleModule} from '../admin/admin-article/admin-article.module'; 10 | import {AdminArticleComponent} from '../admin/admin-article/admin-article.component'; 11 | import {AdminLinkComponent} from '../admin/admin-link/admin-link.component'; 12 | import {AdminUserComponent} from '../admin/admin-user/admin-user.component'; 13 | import {AdminCategoryComponent} from '../admin/admin-category/admin-category.component'; 14 | import {AdminInfoComponent} from '../admin/admin-info/admin-info.component'; 15 | import {AdminResultComponent} from '../admin/admin-result/admin-result.component'; 16 | import {AdminUtilComponent} from '../admin/admin-util/admin-util.component'; 17 | 18 | const routers: Routes = [ 19 | { 20 | path: '', 21 | canActivate: [AuthGuard], 22 | component: AdminComponent, 23 | children: [ 24 | { 25 | path: '', 26 | canActivateChild: [AuthGuard], 27 | children: [ 28 | { 29 | path: '', 30 | component: AdminInfoComponent 31 | }, 32 | { 33 | path: 'publish', 34 | component: AdminPublishComponent 35 | }, 36 | { 37 | path: 'article', 38 | component: AdminArticleComponent 39 | }, 40 | { 41 | path: 'link', 42 | component: AdminLinkComponent 43 | }, 44 | { 45 | path: 'user', 46 | component: AdminUserComponent 47 | }, 48 | { 49 | path: 'category', 50 | component: AdminCategoryComponent 51 | }, 52 | { 53 | path: 'result', 54 | component: AdminResultComponent 55 | }, 56 | { 57 | path: 'util', 58 | component: AdminUtilComponent 59 | } 60 | ] 61 | } 62 | ] 63 | } 64 | ]; 65 | 66 | @NgModule({ 67 | imports: [RouterModule.forChild(routers)], 68 | providers: [AuthGuard], 69 | exports: [RouterModule] 70 | }) 71 | export class AdminRoutingModule { 72 | } 73 | -------------------------------------------------------------------------------- /src/app/routing/app.routing.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {RouterModule, Routes} from '@angular/router'; 3 | import {LoginComponent} from '../login/login.component'; 4 | import {RegistComponent} from '../regist/regist.component'; 5 | import {AuthGuard} from '../guard/auth.guard'; 6 | 7 | const routes: Routes = [ 8 | { 9 | path: '', 10 | redirectTo: '/login', 11 | pathMatch: 'full' 12 | }, 13 | { 14 | path: 'login', 15 | component: LoginComponent 16 | }, 17 | { 18 | path: 'register', 19 | component: RegistComponent 20 | }, { 21 | path: 'admin', 22 | loadChildren: '../admin/admin.module#AdminModule', 23 | canLoad: [AuthGuard] 24 | }, 25 | { 26 | path: '**', 27 | redirectTo: '/login', 28 | pathMatch: 'full' 29 | }, 30 | ]; 31 | 32 | @NgModule({ 33 | imports: [RouterModule.forRoot(routes)], 34 | providers: [AuthGuard], 35 | exports: [RouterModule] 36 | }) 37 | export class AppRoutingModule { 38 | } 39 | -------------------------------------------------------------------------------- /src/app/service/article.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {BaseService} from './base.service'; 3 | import {environment} from '../../environments/environment'; 4 | import {HttpErrorResponse} from '@angular/common/http'; 5 | import {Subscription} from 'rxjs/Subscription'; 6 | 7 | 8 | const userUrl = environment.baseUrl + 'api/admin/users'; 9 | const articleUrl = '/articles'; 10 | const categoryUrl = '/categorys'; 11 | const uploadUrl = environment.baseUrl + 'api/admin/sessions/upload'; 12 | 13 | @Injectable() 14 | export class ArticleService extends BaseService { 15 | getUploadUrl() { 16 | return uploadUrl; 17 | } 18 | 19 | getArticleUrl(cid: string) { 20 | return userUrl + '/' + localStorage.getItem('user_id') + categoryUrl + '/' + cid + articleUrl; 21 | } 22 | 23 | // 获取发布列表 24 | getArticlesPublished(page: string, sort: string, next?: (value: any) => void) { 25 | const url = userUrl + '/' + localStorage.getItem('user_id') + articleUrl + '?page=' + page + '&published=true&sort=' + sort; 26 | this.get(url, {}, next); 27 | } 28 | 29 | // 获取草稿箱列表 30 | getArticlesDrafted(page: string, sort: string, next?: (value: any) => void) { 31 | const url = userUrl + '/' + localStorage.getItem('user_id') + articleUrl + '?page=' + page + '&published=false&sort=' + sort; 32 | this.get(url, {}, next); 33 | } 34 | 35 | GetArticleWithState(aid: string, refer: string, next?: (value: any) => void) { 36 | const url = userUrl + '/' + localStorage.getItem('user_id') + articleUrl + '/' + aid + '?state=' + refer; 37 | this.get(url, {}, next); 38 | } 39 | 40 | saveArticleWithState(aid: string, data: any, next?: (value: any) => void) { 41 | const url = userUrl + '/' + localStorage.getItem('user_id') + articleUrl + '/' + aid + '?state=draft'; 42 | this.put(url, data, next); 43 | } 44 | 45 | publishArticleWithState(aid: string, data: any, next?: (value: any) => void) { 46 | const url = userUrl + '/' + localStorage.getItem('user_id') + articleUrl + '/' + aid + '?state=publish'; 47 | this.put(url, data, next); 48 | } 49 | 50 | // 发布文章 51 | publishArticle(cid: string, data: any, next?: (value: any) => void) { 52 | const url = this.getArticleUrl(cid) + '?publish=true'; 53 | this.post(url, data, next, (error: any) => { 54 | if (error instanceof HttpErrorResponse) { 55 | this.ms.error('获取数据异常: ' + error.statusText); 56 | } else { 57 | this.ms.error('获取数据异常!'); 58 | } 59 | }); 60 | } 61 | 62 | // 保存草稿 63 | drafthArticle(cid: string, data: any, next?: (value: any) => void) { 64 | const url = this.getArticleUrl(cid) + '?publish=false'; 65 | this.post(url, data, next, (error: any) => { 66 | if (error instanceof HttpErrorResponse) { 67 | this.ms.error('获取数据异常: ' + error.statusText); 68 | } else { 69 | this.ms.error('获取数据异常!'); 70 | } 71 | }); 72 | } 73 | 74 | delPublishArticleByAid(cid: string, aid: string, next?: (value: any) => void) { 75 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl + '/' + cid + articleUrl + '/' + aid + '?state=publish'; 76 | this.delete(url, {}, next, (error: any) => { 77 | if (error instanceof HttpErrorResponse) { 78 | this.ms.error('获取数据异常: ' + error.statusText); 79 | } else { 80 | this.ms.error('获取数据异常!'); 81 | } 82 | }); 83 | } 84 | 85 | delDraftArticleByAid(cid: string, aid: string, next?: (value: any) => void) { 86 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl + '/' + cid + articleUrl + '/' + aid + '?state=draft'; 87 | this.delete(url, {}, next, (error: any) => { 88 | if (error instanceof HttpErrorResponse) { 89 | this.ms.error('获取数据异常: ' + error.statusText); 90 | } else { 91 | this.ms.error('获取数据异常!'); 92 | } 93 | }); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/app/service/base.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http'; 3 | import {NzMessageService} from 'ng-zorro-antd'; 4 | 5 | @Injectable() 6 | export class BaseService { 7 | 8 | constructor(protected http: HttpClient, protected ms: NzMessageService) { 9 | } 10 | 11 | isAdmin(): Boolean { 12 | const a = localStorage.getItem('is_admin'); 13 | return a === 'Admin' || a === 'Track' || a === 'admin' || a === 'track'; 14 | } 15 | 16 | // 只要不包含sessions 都加入auth 头 17 | injectToken(url: string): HttpHeaders { 18 | if (url.indexOf('sessions') === -1) { 19 | return new HttpHeaders({ 20 | 'Authorization': 'Bearer ' + localStorage.getItem('token'), 21 | 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' 22 | }); 23 | } else { 24 | return new HttpHeaders({ 25 | 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' 26 | }); 27 | } 28 | } 29 | 30 | // 统一post 请求 响应返回 31 | post(url: string, body: { 32 | [param: string]: string | string[]; 33 | }, next?: (value: any) => void, error?: (error: any) => void, complete?: () => void) { 34 | const headers = this.injectToken(url); 35 | return this.http.post(url, new HttpParams({ 36 | fromObject: body 37 | }), {headers: headers}).subscribe( 38 | next, error, complete 39 | ); 40 | } 41 | 42 | // 统一put 请求 响应返回 43 | put(url: string, body: { 44 | [param: string]: string | string[]; 45 | }, next?: (value: any) => void, error?: (error: any) => void, complete?: () => void) { 46 | const headers = this.injectToken(url); 47 | return this.http.put(url, new HttpParams({ 48 | fromObject: body 49 | }), {headers: headers}).subscribe( 50 | next, error, complete 51 | ); 52 | } 53 | 54 | // 统一Get 请求 响应返回 55 | get(url: string, body: { 56 | [param: string]: string | string[]; 57 | }, next?: (value: any) => void, error?: (error: any) => void, complete?: () => void) { 58 | const headers = this.injectToken(url); 59 | return this.http.get(url, { 60 | headers: headers, params: new HttpParams({ 61 | fromObject: body 62 | }), 63 | }).subscribe( 64 | next, error, complete 65 | ); 66 | } 67 | 68 | // 统一Delete 请求 响应返回 69 | delete(url: string, body: { 70 | [param: string]: string | string[]; 71 | }, next?: (value: any) => void, error?: (error: any) => void, complete?: () => void) { 72 | const headers = this.injectToken(url); 73 | return this.http.delete(url, { 74 | headers: headers, params: new HttpParams({ 75 | fromObject: body 76 | }), 77 | }).subscribe( 78 | next, error, complete 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/app/service/category.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {BaseService} from './base.service'; 3 | import {environment} from '../../environments/environment'; 4 | import {HttpErrorResponse} from '@angular/common/http'; 5 | import {Subscription} from 'rxjs/Subscription'; 6 | 7 | 8 | const userUrl = environment.baseUrl + 'api/admin/users'; 9 | const categoryUrl = '/categorys'; 10 | 11 | @Injectable() 12 | export class CategoryService extends BaseService { 13 | 14 | getCategorys(next?: (value: any) => void) { 15 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl; 16 | this.get(url, {}, next); 17 | } 18 | 19 | createCategory(data: any, next?: (value: any) => void) { 20 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl; 21 | this.post(url, data, next, (error: any) => { 22 | if (error instanceof HttpErrorResponse) { 23 | this.ms.error('获取数据异常: ' + error.statusText); 24 | } else { 25 | this.ms.error('获取数据异常!'); 26 | } 27 | }); 28 | } 29 | 30 | delAllCategorys(next?: (value: any) => void) { 31 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl; 32 | this.delete(url, {}, next, (error: any) => { 33 | if (error instanceof HttpErrorResponse) { 34 | this.ms.error('获取数据异常: ' + error.statusText); 35 | } else { 36 | this.ms.error('获取数据异常!'); 37 | } 38 | }); 39 | } 40 | 41 | delCategoryByCid(cid: string, next?: (value: any) => void) { 42 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl + '/' + cid; 43 | this.delete(url, {}, next, (error: any) => { 44 | if (error instanceof HttpErrorResponse) { 45 | this.ms.error('获取数据异常: ' + error.statusText); 46 | } else { 47 | this.ms.error('获取数据异常!'); 48 | } 49 | }); 50 | } 51 | 52 | updateCategoryByCid(cid: string, data: any, next?: (value: any) => void) { 53 | const url = userUrl + '/' + localStorage.getItem('user_id') + categoryUrl + '/' + cid; 54 | this.put(url, data, next, (error: any) => { 55 | if (error instanceof HttpErrorResponse) { 56 | this.ms.error('获取数据异常: ' + error.statusText); 57 | } else { 58 | this.ms.error('获取数据异常!'); 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/service/extend.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {BaseService} from './base.service'; 3 | import {environment} from '../../environments/environment'; 4 | import {HttpErrorResponse} from '@angular/common/http'; 5 | import {Subscription} from 'rxjs/Subscription'; 6 | 7 | 8 | const extendsUrl = environment.baseUrl + 'api/admin/extends'; 9 | 10 | @Injectable() 11 | export class ExtendService extends BaseService { 12 | 13 | getAll(next?: (value: any) => void) { 14 | const url = extendsUrl + '?op=all&uid=' + localStorage.getItem('user_id'); 15 | this.get(url, {}, next); 16 | } 17 | 18 | collectByCsdn(data: any, next?: (value: any) => void) { 19 | this.post(extendsUrl, data, next, error1 => { 20 | this.ms.error('采集文章失败!'); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/app/service/link.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {BaseService} from './base.service'; 3 | import {environment} from '../../environments/environment'; 4 | import {HttpErrorResponse} from '@angular/common/http'; 5 | import {Subscription} from 'rxjs/Subscription'; 6 | 7 | 8 | const userUrl = environment.baseUrl + 'api/admin/users'; 9 | const linkUrl = '/links'; 10 | 11 | @Injectable() 12 | export class LinkService extends BaseService { 13 | 14 | getLinks(next?: (value: any) => void) { 15 | const url = userUrl + '/' + localStorage.getItem('user_id') + linkUrl; 16 | this.get(url, {}, next); 17 | } 18 | 19 | createLink(data: any, next?: (value: any) => void) { 20 | const url = userUrl + '/' + localStorage.getItem('user_id') + linkUrl; 21 | this.post(url, data, next, (error: any) => { 22 | if (error instanceof HttpErrorResponse) { 23 | this.ms.error('获取数据异常: ' + error.statusText); 24 | } else { 25 | this.ms.error('获取数据异常!'); 26 | } 27 | }); 28 | } 29 | 30 | delLinks(next?: (value: any) => void) { 31 | const url = userUrl + '/' + localStorage.getItem('user_id') + linkUrl; 32 | this.delete(url, {}, next, (error: any) => { 33 | if (error instanceof HttpErrorResponse) { 34 | this.ms.error('获取数据异常: ' + error.statusText); 35 | } else { 36 | this.ms.error('获取数据异常!'); 37 | } 38 | }); 39 | } 40 | 41 | delLinkByLid(lid: string, next?: (value: any) => void) { 42 | const url = userUrl + '/' + localStorage.getItem('user_id') + linkUrl + '/' + lid; 43 | this.delete(url, {}, next, (error: any) => { 44 | if (error instanceof HttpErrorResponse) { 45 | this.ms.error('获取数据异常: ' + error.statusText); 46 | } else { 47 | this.ms.error('获取数据异常!'); 48 | } 49 | }); 50 | } 51 | 52 | updateLinkByLid(lid: string, data: any, next?: (value: any) => void) { 53 | const url = userUrl + '/' + localStorage.getItem('user_id') + linkUrl + '/' + lid; 54 | this.put(url, data, next, (error: any) => { 55 | if (error instanceof HttpErrorResponse) { 56 | this.ms.error('获取数据异常: ' + error.statusText); 57 | } else { 58 | this.ms.error('获取数据异常!'); 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/service/user.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {BaseService} from './base.service'; 3 | import {environment} from '../../environments/environment'; 4 | import {HttpErrorResponse} from '@angular/common/http'; 5 | import {Subscription} from 'rxjs/Subscription'; 6 | 7 | const sessionUrl = environment.baseUrl + 'api/admin/sessions'; 8 | const userUrl = environment.baseUrl + 'api/admin/users'; 9 | const uploadUrl = environment.baseUrl + 'api/admin/sessions/upload'; 10 | 11 | @Injectable() 12 | export class UserService extends BaseService { 13 | 14 | // 用户登录 15 | userLogin(username: string, password: string, next?: (value: any) => void) { 16 | const data = { 17 | 'username': username, 18 | 'password': password 19 | }; 20 | this.post(sessionUrl, data, 21 | (value: any) => { 22 | localStorage.setItem('user_id', value['data']['user_id']); 23 | localStorage.setItem('token', value['data']['token']); 24 | localStorage.setItem('user_name', value['data']['user_name']); 25 | localStorage.setItem('user_avator', value['data']['user_avator']); 26 | this.ms.success('登录成功!'); 27 | next(value); 28 | }, (error: any) => { 29 | if (error instanceof HttpErrorResponse) { 30 | this.ms.error('获取数据异常: ' + error.statusText); 31 | } else { 32 | this.ms.error('获取数据异常!'); 33 | } 34 | }); 35 | } 36 | 37 | // 用户注册 38 | userRegist(data: any, next?: (value: any) => void) { 39 | this.post(userUrl, data, 40 | (value: any) => { 41 | next(value); 42 | }, (error: any) => { 43 | if (error instanceof HttpErrorResponse) { 44 | this.ms.error('获取数据异常: ' + error.statusText); 45 | } else { 46 | this.ms.error('获取数据异常!'); 47 | } 48 | }); 49 | } 50 | 51 | // 用户登出 清除缓存 52 | userLogout(next?: (value: any) => void) { 53 | localStorage.removeItem('user_id'); 54 | localStorage.removeItem('token'); 55 | localStorage.removeItem('user_name'); 56 | localStorage.removeItem('user_avator'); 57 | next(true); 58 | } 59 | 60 | // 获取用户列表 61 | getAllUsers(next?: (value: any) => void) { 62 | this.get(userUrl, {}, next); 63 | } 64 | 65 | getUserInfo(next?: (value: any) => void) { 66 | const url = userUrl + '/' + localStorage.getItem('user_id'); 67 | this.get(url, {}, next); 68 | } 69 | 70 | uploadAvator(file: File, next?: (value: any) => void): Subscription { 71 | const formData = new FormData(); 72 | formData.append('avator', 73 | file, file.name) 74 | ; 75 | return this.http.post(uploadUrl, formData) 76 | .subscribe(next, _ => { 77 | this.ms.error('上传头像失败,请重试!'); 78 | }); 79 | } 80 | 81 | // 修改用户信息 82 | updateUserInfo(data: any, next?: (value: any) => void, error?: (error: any) => void) { 83 | const url = userUrl + '/' + localStorage.getItem('user_id'); 84 | this.put(url, data, 85 | (value: any) => { 86 | next(value); 87 | }, (err: any) => { 88 | error(err); 89 | if (err instanceof HttpErrorResponse) { 90 | this.ms.error('获取数据异常: ' + err.statusText); 91 | } else { 92 | this.ms.error('获取数据异常!'); 93 | } 94 | }); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | baseUrl: '/' 4 | }; 5 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | baseUrl: 'http://127.0.0.1:8888/' 9 | }; 10 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyw1995/Angular5-Blog-Admin/4394bdc1024bc9d7592335c18ae27dee184c326f/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 博客后台管理系统 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | import * as $ from 'jquery'; 8 | 9 | 10 | if (environment.production) { 11 | enableProdMode(); 12 | } 13 | 14 | platformBrowserDynamic().bootstrapModule(AppModule) 15 | .catch(err => console.log(err)); 16 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Required to support Web Animations `@angular/platform-browser/animations`. 51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 52 | **/ 53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 54 | 55 | /** 56 | * By default, zone.js will patch all possible macroTask and DomEvents 57 | * user can disable parts of macroTask/DomEvents patch by setting following flags 58 | */ 59 | 60 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 61 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 62 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 63 | 64 | /* 65 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 66 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 67 | */ 68 | // (window as any).__Zone_enable_cross_context_check = true; 69 | 70 | /*************************************************************************************************** 71 | * Zone JS is required by default for Angular itself. 72 | */ 73 | import 'zone.js/dist/zone'; // Included with Angular CLI. 74 | 75 | 76 | 77 | /*************************************************************************************************** 78 | * APPLICATION IMPORTS 79 | */ 80 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | }, 12 | "files": [ 13 | "test.ts" 14 | ], 15 | "include": [ 16 | "**/*.spec.ts", 17 | "**/*.d.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs", 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": [ 26 | true, 27 | "spaces" 28 | ], 29 | "interface-over-type-literal": true, 30 | "label-position": true, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-access": false, 36 | "member-ordering": [ 37 | true, 38 | { 39 | "order": [ 40 | "static-field", 41 | "instance-field", 42 | "static-method", 43 | "instance-method" 44 | ] 45 | } 46 | ], 47 | "no-arg": true, 48 | "no-bitwise": true, 49 | "no-console": [ 50 | true, 51 | "debug", 52 | "info", 53 | "time", 54 | "timeEnd", 55 | "trace" 56 | ], 57 | "no-construct": true, 58 | "no-debugger": true, 59 | "no-duplicate-super": true, 60 | "no-empty": false, 61 | "no-empty-interface": true, 62 | "no-eval": true, 63 | "no-inferrable-types": [ 64 | true, 65 | "ignore-params" 66 | ], 67 | "no-misused-new": true, 68 | "no-non-null-assertion": true, 69 | "no-shadowed-variable": true, 70 | "no-string-literal": false, 71 | "no-string-throw": true, 72 | "no-switch-case-fall-through": true, 73 | "no-trailing-whitespace": true, 74 | "no-unnecessary-initializer": true, 75 | "no-unused-expression": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "prefer-const": true, 87 | "quotemark": [ 88 | true, 89 | "single" 90 | ], 91 | "radix": true, 92 | "semicolon": [ 93 | true, 94 | "always" 95 | ], 96 | "triple-equals": [ 97 | true, 98 | "allow-null-check" 99 | ], 100 | "typedef-whitespace": [ 101 | true, 102 | { 103 | "call-signature": "nospace", 104 | "index-signature": "nospace", 105 | "parameter": "nospace", 106 | "property-declaration": "nospace", 107 | "variable-declaration": "nospace" 108 | } 109 | ], 110 | "unified-signatures": true, 111 | "variable-name": false, 112 | "whitespace": [ 113 | true, 114 | "check-branch", 115 | "check-decl", 116 | "check-operator", 117 | "check-separator", 118 | "check-type" 119 | ], 120 | "directive-selector": [ 121 | true, 122 | "attribute", 123 | "app", 124 | "camelCase" 125 | ], 126 | "component-selector": [ 127 | true, 128 | "element", 129 | "app", 130 | "kebab-case" 131 | ], 132 | "no-output-on-prefix": true, 133 | "use-input-property-decorator": true, 134 | "use-output-property-decorator": true, 135 | "use-host-property-decorator": true, 136 | "no-input-rename": true, 137 | "no-output-rename": true, 138 | "use-life-cycle-interface": true, 139 | "use-pipe-transform-interface": true, 140 | "component-class-suffix": true, 141 | "directive-class-suffix": true 142 | } 143 | } 144 | --------------------------------------------------------------------------------