wangtengyu
2018-11-09 41fc80adb208e8bbf0bd0a65d9c3051b78fd4501
“重新提交”
8 files added
8 files modified
9 files deleted
415 ■■■■■ changed files
src/app/app.module.ts 1 ●●●● patch | view | raw | blame | history
src/assets/json/data.json 1 ●●●● patch | view | raw | blame | history
src/kl/core/services/httpclient.ts 9 ●●●●● patch | view | raw | blame | history
src/pages/access/components/checkbox/checkbox.html 4 ●●●● patch | view | raw | blame | history
src/pages/access/components/checkbox/checkbox.sass patch | view | raw | blame | history
src/pages/access/components/checkbox/checkbox.ts 31 ●●●●● patch | view | raw | blame | history
src/pages/access/components/components.module.ts 24 ●●●●● patch | view | raw | blame | history
src/pages/access/components/input/input.html 20 ●●●●● patch | view | raw | blame | history
src/pages/access/components/input/input.module.ts 15 ●●●●● patch | view | raw | blame | history
src/pages/access/components/input/input.ts 45 ●●●● patch | view | raw | blame | history
src/pages/access/components/login/login.html 31 ●●●●● patch | view | raw | blame | history
src/pages/access/components/login/login.module.ts 15 ●●●●● patch | view | raw | blame | history
src/pages/access/components/login/login.scss 3 ●●●●● patch | view | raw | blame | history
src/pages/access/components/login/login.ts 27 ●●●●● patch | view | raw | blame | history
src/pages/access/components/register/register.html 12 ●●●●● patch | view | raw | blame | history
src/pages/access/components/register/register.module.ts 15 ●●●●● patch | view | raw | blame | history
src/pages/access/components/register/register.scss 3 ●●●●● patch | view | raw | blame | history
src/pages/access/components/register/register.ts 25 ●●●●● patch | view | raw | blame | history
src/pages/access/components/select/select.html 8 ●●●●● patch | view | raw | blame | history
src/pages/access/components/select/select.scss patch | view | raw | blame | history
src/pages/access/components/select/select.ts 46 ●●●●● patch | view | raw | blame | history
src/pages/tabs/home/home.html 70 ●●●● patch | view | raw | blame | history
src/pages/tabs/home/home.module.ts 3 ●●●● patch | view | raw | blame | history
src/pages/tabs/home/home.ts 4 ●●● patch | view | raw | blame | history
src/pages/tabs/tabs.module.ts 3 ●●●●● patch | view | raw | blame | history
src/app/app.module.ts
@@ -9,6 +9,7 @@
import { SplashScreen } from '@ionic-native/splash-screen';
import { KlCoreModule } from 'kl/core';
@NgModule({
  declarations: [
    MyApp
src/assets/json/data.json
New file
@@ -0,0 +1 @@
{"1":{"dataType":"1","id":"1","name":"name1"},"2":{"dataType":"2","id":"2","name":"name2"},"3":{"dataType":"3","id":"3","name":"name3","dataList":[{"id":"1","vel":"v1"},{"id":"2","vel":"v2"},{"id":"3","vel":"v3"},{"id":"4","vel":"v4"}]},"4":{"dataType":"4","id":"4","name":"name4"}}
src/kl/core/services/httpclient.ts
@@ -4,6 +4,8 @@
import { LoadingService } from './loading.service';
import { ApiResult } from 'kl/model';
@Injectable()
export class HttpClient {
@@ -17,6 +19,13 @@
    this.getResponse(this.http.post(api, params), fun);
  }
  getData(id: string, fun: Function) {
    return this.http.get('assets/json/data.json').map((res: Response) => res.json()).subscribe(data => {
      fun(data[id]);
    });
  }
  xhrPost(api, data, fun) {
    let xhr = new XMLHttpRequest();
    xhr.open('POST', api, false);
src/pages/access/components/checkbox/checkbox.html
New file
@@ -0,0 +1,4 @@
<ion-item>
  <ion-label>多选2</ion-label>
  <ion-checkbox ></ion-checkbox>
</ion-item>
src/pages/access/components/checkbox/checkbox.sass
src/pages/access/components/checkbox/checkbox.ts
New file
@@ -0,0 +1,31 @@
import { Component, Input } from '@angular/core';
import { HttpClient } from 'kl/core/services/httpclient';
@Component({
  selector: 'test-checkbox',
  templateUrl: 'checkbox.html'
})
export class CheckboxComponent {
  @Input()
  id = '';
  @Input()
  data = {
    id: '0',
    name: 'err',
    type: 1,
    max: '',
    minx: ''
  };
  constructor(private http: HttpClient) {}
  getData() {
    this.http.getData(this.id, res => this.data = res);
  }
  ngOnInit(): void {
    this.getData();
  }
}
src/pages/access/components/components.module.ts
New file
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { InputComponent } from './input/input';
import { IonicPageModule } from 'ionic-angular';
import { SelectComponent } from './select/select';
import { CheckboxComponent } from './checkbox/checkbox';
@NgModule({
  declarations: [
    InputComponent,
    SelectComponent,
    CheckboxComponent
  ],
  imports: [
    IonicPageModule.forChild(InputComponent),
    IonicPageModule.forChild(SelectComponent),
    IonicPageModule.forChild(CheckboxComponent)
  ],
  exports: [
    InputComponent,
    SelectComponent,
    CheckboxComponent
  ]
})
export class ComponentsModule {}
src/pages/access/components/input/input.html
@@ -1,14 +1,6 @@
<!-- Generated template for the InputComponent component -->
<ion-header>
  <ion-navbar>
    <ion-title>input</ion-title>
  </ion-navbar>
</ion-header>
<ion-content padding>
  <ion-list col text-center>
  </ion-list>
</ion-content>
<ion-row>
  <ion-item *ngIf = 'data !== undefined'>
      <ion-label fixed>{{data.name}}</ion-label>
      <ion-input [type]="inputType" value=""></ion-input>
  </ion-item>
</ion-row>
src/pages/access/components/input/input.module.ts
File was deleted
src/pages/access/components/input/input.ts
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { IonicPage } from 'ionic-angular';
import { Component, Input } from '@angular/core';
import { HttpClient } from 'kl/core';
/**
 * Generated class for the InputComponent component.
@@ -7,19 +7,40 @@
 * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
 * for more info on Angular Components.
 */
@IonicPage({
  name: 'access-input'
})
@Component({
  selector: 'page-input',
  templateUrl: 'input.html',
  selector: 'test-input',
  templateUrl: 'input.html'
})
export class InputPage {
export class InputComponent {
  text: string;
  @Input()
  id = '';
  @Input()
  data = {
    id: '0',
    name: 'err',
    type: 1,
    max: '',
    minx: ''
  };
  constructor() {}
  inputType = 'text';
  constructor(private http: HttpClient) {}
  getData() {
    this.http.getData(this.id, res => {
      this.data = res;
      if (this.data.type === 1) {
        this.inputType = 'text';
      } else {
        this.inputType = 'number';
      }
    });
  }
  ngOnInit(): void {
    this.getData();
  }
}
src/pages/access/components/login/login.html
File was deleted
src/pages/access/components/login/login.module.ts
File was deleted
src/pages/access/components/login/login.scss
File was deleted
src/pages/access/components/login/login.ts
File was deleted
src/pages/access/components/register/register.html
File was deleted
src/pages/access/components/register/register.module.ts
File was deleted
src/pages/access/components/register/register.scss
File was deleted
src/pages/access/components/register/register.ts
File was deleted
src/pages/access/components/select/select.html
New file
@@ -0,0 +1,8 @@
<ion-item *ngIf = 'data !== undefined'>
    <ion-label>{{data.name}}</ion-label>
    <ion-select *ngIf="data.dataList !== undefined" multiple="true" cancelText="取消" okText="确定">
      <ng-container *ngFor="let item of data.dataList">
        <ion-option  value="item.id"  >{{item.vel}}</ion-option>
      </ng-container>
    </ion-select>
  </ion-item>
src/pages/access/components/select/select.scss
src/pages/access/components/select/select.ts
New file
@@ -0,0 +1,46 @@
import { Component, Input } from '@angular/core';
import { HttpClient } from 'kl/core/services/httpclient';
/**
 * Generated class for the InputComponent component.
 *
 * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
 * for more info on Angular Components.
 */
@Component({
  selector: 'test-select',
  templateUrl: 'select.html'
})
export class SelectComponent {
  @Input()
  id = '';
  data: any = {
    id: '0',
    name: 'err',
    type: 1,
    max: '',
    minx: '',
    dataList: [
      {id: '1', vel: 'err'},
      {id: '1', vel: 'err'},
      {id: '1', vel: 'err'}
    ]
  };
  constructor(private http: HttpClient) {}
  getData() {
    this.http.getData(this.id, res => {
      this.data = res;
      console.log(this.data);
    });
  }
  ngOnInit(): void {
    this.getData();
  }
}
src/pages/tabs/home/home.html
@@ -1,73 +1,17 @@
<ion-header>
  <ion-navbar>
    <ion-title>login</ion-title>
    <ion-title>home</ion-title>
  </ion-navbar>
</ion-header>
<ion-content padding>
  <ion-grid>
    <ion-row>
      <ion-item>
        <ion-input type="number" max="1" placeholder="单行文本1"></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label fixed>单行文本2:</ion-label>
        <ion-input type="text" value=""></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-label fixed>搜索:</ion-label>
      <ion-searchbar ></ion-searchbar>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label>多选1</ion-label>
        <ion-checkbox color="dark" checked="true"></ion-checkbox>
      </ion-item>
      <ion-item>
        <ion-label>多选2</ion-label>
        <ion-checkbox ></ion-checkbox>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label>时间</ion-label>
        <ion-datetime displayFormat="YYYY/MM/DD" ></ion-datetime>
      </ion-item>
    </ion-row>
    <ion-list>
    <button ion-item  (click)="go()">
      row1
    </button>
  <ion-list>
     <test-input [id]='1'></test-input>
     <test-input [id]='2'></test-input>
     <test-select [id]='3'></test-select>
     <test-checkbox [id]='4'></test-checkbox>
  </ion-list>
    <ion-item>
      <ion-label>下拉(多选)1</ion-label>
      <ion-select multiple="true" cancelText="Nah" okText="Okay!">
        <ion-option value="bacon" selected="true">Bacon</ion-option>
        <ion-option value="olives">Black Olives</ion-option>
        <ion-option value="xcheese" selected="true">Extra Cheese</ion-option>
        <ion-option value="peppers">Green Peppers</ion-option>
        <ion-option value="mushrooms">Mushrooms</ion-option>
        <ion-option value="onions">Onions</ion-option>
        <ion-option value="pepperoni">Pepperoni</ion-option>
        <ion-option value="pineapple">Pineapple</ion-option>
        <ion-option value="sausage">Sausage</ion-option>
        <ion-option value="Spinach">Spinach</ion-option>
      </ion-select>
    </ion-item>
    <ion-row>
      <ion-item>
        <ion-label>多行文本</ion-label>
        <ion-textarea autoresize="100"></ion-textarea>
      </ion-item>
    </ion-row>
  </ion-grid>
</ion-content>
</ion-content>
src/pages/tabs/home/home.module.ts
@@ -1,12 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { HomePage } from './home';
import { ComponentsModule } from '../../access/components/components.module';
@NgModule({
  declarations: [
    HomePage,
  ],
  imports: [
    ComponentsModule,
    IonicPageModule.forChild(HomePage),
  ],
})
src/pages/tabs/home/home.ts
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage({
  name: 'home'
})
@@ -11,8 +10,7 @@
})
export class HomePage {
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }
  constructor(public navCtrl: NavController, public navParams: NavParams) {}
  ionViewDidLoad() {
src/pages/tabs/tabs.module.ts
@@ -2,6 +2,8 @@
import { IonicPageModule } from 'ionic-angular';
import { TabsPage } from './tabs';
@NgModule({
  declarations: [
    TabsPage,
@@ -9,5 +11,6 @@
  imports: [
    IonicPageModule.forChild(TabsPage),
  ],
  exports: []
})
export class TabsPageModule { }