Skip to content

Commit

Permalink
feat(异常模块): 新增异常模块下公共布局封装组件
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayisheji committed Dec 4, 2017
1 parent 38527a1 commit 9da8f89
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/app/feature/exception/exception/exception.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="g-exception" fxLayout="row" fxLayoutAlign="center center">
<div class="img-box" fxFlex="62.5%">
<div class="img" [style.backgroundImage]="_image"></div>
</div>
<section class="content" fxFlex="auto">
<h2 class="title">
<ng-content select="[title]"></ng-content>
</h2>
<p class="description">
<ng-content select="[description]"></ng-content>
</p>
<a routerLink="/" sim-button [color]="'primary'">返回首页</a>
</section>
</div>
30 changes: 30 additions & 0 deletions src/app/feature/exception/exception/exception.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.g-exception {
min-height: 500px;
height: 80%;
.img-box {
padding-right: 152px;
text-align: right;
}
.img {
display: inline-block;
height: 360px;
width: 100%;
max-width: 430px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
}
.title {
color: #434e59;
font-size: 72px;
font-weight: 600;
line-height: 72px;
margin-bottom: 24px;
}
.description {
color: rgba(0, 0, 0, 0.45);
font-size: 20px;
line-height: 28px;
margin-bottom: 16px;
}
}
25 changes: 25 additions & 0 deletions src/app/feature/exception/exception/exception.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ExceptionComponent } from './exception.component';

describe('ExceptionComponent', () => {
let component: ExceptionComponent;
let fixture: ComponentFixture<ExceptionComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ExceptionComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ExceptionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
25 changes: 25 additions & 0 deletions src/app/feature/exception/exception/exception.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, OnInit, Input } from '@angular/core';

@Component({
selector: 'app-exception',
templateUrl: './exception.component.html',
styleUrls: ['./exception.component.scss']
})
export class ExceptionComponent implements OnInit {
_image: string;
@Input()
get image(): string {
return this._image;
}
set image(value: string) {
if (value) {
this._image = `url(${value})`;
}

}
constructor() { }

ngOnInit() {
}

}

0 comments on commit 9da8f89

Please sign in to comment.