From ad436224f903ac390302b3fd5ca6d4d35ba91438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Thu, 11 Oct 2018 13:58:56 +0800 Subject: [PATCH] feat(module:theme): add page loading styles (#207) --- .../files/src/app/core/startup/startup.service.ts | 14 +++++++++++++- packages/theme/styles/app/utils/other.less | 12 ++++++++++++ scripts/ci/build-schematics.sh | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/schematics/application/files/src/app/core/startup/startup.service.ts b/packages/schematics/application/files/src/app/core/startup/startup.service.ts index 53947d43f..8537e92d5 100644 --- a/packages/schematics/application/files/src/app/core/startup/startup.service.ts +++ b/packages/schematics/application/files/src/app/core/startup/startup.service.ts @@ -61,6 +61,17 @@ export class StartupService { }); } + private viaMockI18n(resolve: any, reject: any) { + this.httpClient + .get(`assets/tmp/i18n/${this.i18n.defaultLang}.json`) + .subscribe(langData => { + this.translate.setTranslation(this.i18n.defaultLang, langData); + this.translate.setDefaultLang(this.i18n.defaultLang); + + this.viaMock(resolve, reject); + }); + } + private viaMock(resolve: any, reject: any) { // const tokenData = this.tokenService.get(); // if (!tokenData.token) { @@ -117,7 +128,8 @@ export class StartupService { // http // this.viaHttp(resolve, reject); // mock:请勿在生产环境中这么使用,viaMock 单纯只是为了模拟一些数据使脚手架一开始能正常运行 - this.viaMock(resolve, reject); + <% if (i18n) { %>this.viaMockI18n(resolve, reject);<% } else { %>this.viaMock(resolve, reject);<% } %> + }); } } diff --git a/packages/theme/styles/app/utils/other.less b/packages/theme/styles/app/utils/other.less index 92cfebfbd..02a09950c 100644 --- a/packages/theme/styles/app/utils/other.less +++ b/packages/theme/styles/app/utils/other.less @@ -17,3 +17,15 @@ background-position: center center; background-size: cover; } + +.page-loading { + background: @background-color-base; + z-index: 10000; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding-top: 200px; + text-align: center; +} diff --git a/scripts/ci/build-schematics.sh b/scripts/ci/build-schematics.sh index a9787d132..55324d6e9 100644 --- a/scripts/ci/build-schematics.sh +++ b/scripts/ci/build-schematics.sh @@ -137,10 +137,10 @@ if [[ ${BUILD} == true ]]; then if [[ ${COPY} == true ]]; then if [[ ${TRAVIS} == true ]]; then - echo "== copy ng-alain files via travis mode" + echo "== copy delon/ng-alain files via travis mode" copyFiles 'ng-alain/' ${DIST}/ else - echo "== copy ng-alain files via dev mode" + echo "== copy work/ng-alain files via dev mode" copyFiles '../ng-alain/' ${DIST}/ fi else