瀏覽代碼

ratings class added, trying new rate method, will delete

rjsmall90 6 年之前
父節點
當前提交
89f0bd6060
共有 4 個檔案被更改,包括 47 行新增7 行删除
  1. 11
    0
      src/pages/ratings/ratings.html
  2. 11
    0
      src/pages/ratings/ratings.scss
  3. 24
    0
      src/pages/ratings/ratings.ts
  4. 1
    7
      src/pages/search/search.ts

+ 11
- 0
src/pages/ratings/ratings.html 查看文件

@@ -0,0 +1,11 @@
1
+<div class="crop"
2
+     [style.width.px]="starWidth"
3
+     [title]="rating">
4
+  <div style="width: 86px" id="star">
5
+    <span class="glyphicon glyphicon-star-empty"></span>
6
+    <span class="glyphicon glyphicon-star-empty"></span>
7
+    <span class="glyphicon glyphicon-star-empty"></span>
8
+    <span class="glyphicon glyphicon-star-empty"></span>
9
+    <span class="glyphicon glyphicon-star-empty"></span>
10
+  </div>
11
+</div>

+ 11
- 0
src/pages/ratings/ratings.scss 查看文件

@@ -0,0 +1,11 @@
1
+.crop {
2
+  overflow: hidden;
3
+}
4
+#star {
5
+  color: gold;
6
+  width: 100px;
7
+  white-space: nowrap;
8
+}
9
+td:not(.star-ratings) {
10
+  font-family: Tahoma;
11
+}

+ 24
- 0
src/pages/ratings/ratings.ts 查看文件

@@ -0,0 +1,24 @@
1
+import { Component,  OnChanges, Input } from '@angular/core';
2
+import { NavController } from 'ionic-angular';
3
+
4
+
5
+  @Component({
6
+    selector: 'page-rating',
7
+    templateUrl: 'rating.html',
8
+    styleUrls: 'rating.scss'
9
+  })
10
+  
11
+  export class Ratings implements OnChanges {
12
+    @Input() rating: number;
13
+
14
+    starWidth: number;
15
+    constructor() {
16
+      console.log("star has been created");
17
+    }
18
+
19
+    ngOnChanges() {
20
+      console.log("star dynamically added");
21
+      this.starWidth = this.rating * (86 / 5);
22
+    }
23
+
24
+  }

+ 1
- 7
src/pages/search/search.ts 查看文件

@@ -41,15 +41,9 @@ export class SearchPage {
41 41
 
42 42
     }
43 43
     
44
-    postSchool(event: any) {
45
-        this.dist.post("schools/post", this.school).subscribe(
46
-            data => console.log(data)
47
-          );
48
-    }
49
-    
50 44
     goToSchoolPage(school: School){
51 45
     
52
-        this.dist.post("schools/post", school).subscribe(
46
+    this.dist.post("schools/post", school).subscribe(
53 47
             data => console.log(data)
54 48
           )
55 49
     this.navCtrl.push(SchoolPage, {