Skip to content

Commit 72e1f93

Browse files
committed
refactor: 项目结构调整
1 parent 9977676 commit 72e1f93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+185
-166
lines changed
File renamed without changes.
File renamed without changes.

src/app/app.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Component} from "@angular/core";
2+
3+
@Component({
4+
selector: "contact-app",
5+
templateUrl: "app/app.component.html",
6+
styleUrls: ["app/app.component.css"]
7+
})
8+
9+
export class AppComponent {
10+
constructor() {}
11+
}

src/app/app.module.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import {NgModule} from '@angular/core'
2+
import {RouterModule} from "@angular/router";
3+
import {FormsModule} from "@angular/forms";
4+
import {BrowserModule} from "@angular/platform-browser";
5+
import {HttpModule} from "@angular/http";
6+
7+
import {rootRouterConfig} from "./app.routes";
8+
import {AppComponent} from "./app.component";
9+
10+
import {CollectionComponent} from './collection/collection.component';
11+
import {ListComponent, ItemComponent} from './list';
12+
import {DetailComponent, AnotationComponent} from './detail';
13+
import {EditComponent} from './edit/edit.component';
14+
15+
import {ContactService} from "./shared/contact.service";
16+
import {FooterComponent} from './shared/footer.component';
17+
import {DateReformPipe} from './shared/date-reform.pipe';
18+
import {BtnClickDirective} from './shared/btn-click.directive';
19+
import {UtilService} from './shared/util.service';
20+
21+
22+
@NgModule({
23+
declarations: [
24+
AppComponent,
25+
ListComponent,
26+
DetailComponent,
27+
AnotationComponent,
28+
CollectionComponent,
29+
EditComponent,
30+
FooterComponent,
31+
ItemComponent,
32+
DateReformPipe,
33+
BtnClickDirective
34+
],
35+
imports : [BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(rootRouterConfig)],
36+
providers : [ContactService, UtilService],
37+
bootstrap : [AppComponent]
38+
})
39+
export class AppModule {
40+
41+
}

src/app/app.routes.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import {Routes} from "@angular/router";
2+
3+
import {CollectionComponent} from './collection/collection.component';
4+
import {ListComponent, ItemComponent} from './list';
5+
import {DetailComponent, AnotationComponent} from './detail';
6+
import {EditComponent} from './edit/edit.component';
7+
8+
9+
export const rootRouterConfig: Routes = [
10+
{
11+
path: "",
12+
redirectTo: "list",
13+
pathMatch: 'full'
14+
},
15+
{
16+
path: "list",
17+
component: ListComponent
18+
},
19+
{
20+
path: "list/:id",
21+
component: DetailComponent,
22+
children: [
23+
{
24+
path: "",
25+
component: AnotationComponent
26+
}
27+
]
28+
},
29+
{
30+
path: "edit",
31+
component: EditComponent
32+
},
33+
{
34+
path: "edit/:id",
35+
component: EditComponent
36+
},
37+
{
38+
path: "collection",
39+
component: CollectionComponent
40+
}
41+
];

src/app/components/collection/collection.html renamed to src/app/collection/collection.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ <h3 class="collection-header">我的收藏</h3>
22
<h3 *ngIf="coll_length == 0" class="no-collection">没有收藏</h3>
33
<ul class="my-collection">
44
<li *ngFor="let collection of collections">
5-
<a [routerLink]="['/contact-detail', collection.id]">
5+
<a [routerLink]="['/list', collection.id]">
66
<label>{{ collection.name }}</label><span>{{ collection.telNum }}</span>
77
</a>
88
</li>

src/app/components/collection/collection.ts renamed to src/app/collection/collection.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import {Component, OnInit} from '@angular/core';
2-
import {Footer} from '../../widget/footer';
3-
import {ContactService} from '../../services/contact-service';
2+
import {ContactService} from 'shared/contact.service';
43

54
@Component({
65
selector: 'call-record',
7-
templateUrl: 'app/components/collection/collection.html',
8-
styleUrls: ['app/components/collection/collection.css']
6+
templateUrl: 'app/collection/collection.component.html',
7+
styleUrls: ['app/collection/collection.component.css']
98
})
10-
export class Collection implements OnInit {
9+
export class CollectionComponent implements OnInit {
1110
collections:any = [];
1211
contacts:any = {};
1312

src/app/components/contact-app.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/app/components/contact-detail/anotation.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)