沈斌
2017-12-15 f9b157566af34b8dc28ba10b34d025ac04f3168b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { getFakeList } from '../../../../../../_mock/api.service';
 
@Component({
    selector: 'pro-list-search',
    templateUrl: './search.component.html',
    styleUrls: ['./search.component.less']
})
export class ProSearchComponent implements OnInit {
    q: any = {
        ps: 5,
        categories: [],
        owners: [ 'zxx' ]
    };
 
    list: any[] = [];
    loading = false;
 
    // region: cateogry
    categories = [
        { id: 0, text: '全部', value: false },
        { id: 1, text: '类目一', value: false },
        { id: 2, text: '类目二', value: false },
        { id: 3, text: '类目三', value: false },
        { id: 4, text: '类目四', value: false },
        { id: 5, text: '类目五', value: false },
        { id: 6, text: '类目六', value: false },
        { id: 7, text: '类目七', value: false },
        { id: 8, text: '类目八', value: false },
        { id: 9, text: '类目九', value: false },
        { id: 10, text: '类目十', value: false },
        { id: 11, text: '类目十一', value: false },
        { id: 12, text: '类目十二', value: false }
    ];
 
    changeCategory(status: boolean, idx: number) {
        if (idx === 0) {
            this.categories.map(i => i.value = status);
        } else {
            this.categories[idx].value = status;
        }
    }
    // endregion
 
    // region: owners
    owners = [
        {
            id: 'wzj',
            name: '我自己',
        },
        {
            id: 'wjh',
            name: '吴家豪',
        },
        {
            id: 'zxx',
            name: '周星星',
        },
        {
            id: 'zly',
            name: '赵丽颖',
        },
        {
            id: 'ym',
            name: '姚明',
        }
    ];
 
    setOwner() {
        this.q.owners = [`wzj`];
    }
    // endregion
 
    ngOnInit() {
        this.getData();
    }
 
    getData() {
        this.loading = true;
        setTimeout(() => {
            this.list = this.list.concat(getFakeList(this.q.ps));
            this.loading = false;
        }, 500);
    }
}