zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
    <view>
        <view>
            <view class="search-block" style="height: 35px">
                <view class="search-ico-wapper">
                    <image src="../../../static/images/search/search.png" class="search-ico" mode=""></image>
                </view>
                <input type="text" v-on:input="getKeyword" v-model="keyword" placeholder="搜索" class="search-text"
                    maxlength="10" focus />
            </view>
        </view>
        <scroll-view id="articleBox" :style="{ height: swiperHeight + 'px' }" class="article-content" scroll-y
            style="width: 100%; margin-top: 15rpx;">
            <view v-for="(i, index) in data" class="advisory-model">
                <u-cell-group :title="i.company">
                    <u-cell-item icon="order" @click="goDetail(index)" :title="i.policy"
                        :label="i.time.substring(0,11)"></u-cell-item>
                </u-cell-group>
            </view>
        </scroll-view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                data: [],
                swiperHeight: 0,
                keyword: '',
            }
        },
        onLoad() {
            //行业数据
            this.getData();
        },
        methods: {
            goDetail(index) {
                uni.navigateTo({
                    url: './industry_detail?data=' + this.data[index].id
                })
            },
            onReady() {
                let that = this;
                uni.getSystemInfo({
                    success(e) {
                        console.log(e);
                        let {
                            windowWidth,
                            windowHeight,
                            safeArea
                        } = e;
                        const query = uni.createSelectorQuery().in(that);
                        query
                            .select('#articleBox')
                            .boundingClientRect(data => {
 
                                that.swiperHeight = (safeArea.bottom - data.top - 50);
 
                            })
                            .exec();
                    }
                });
            },
            getData() {
                var that = this;
                uni.request({
                    url: that.$store.state.piAPI + 'policy/page',
                    method: 'GET',
                    success: (res) => {
                        that.data = res.data.data.records;
                    }
                });
            },
            //on input 通过 keyword 关键字查询
            getKeyword() {
                this.getIndutry();
            },
            getIndutry() {
                var that = this;
                uni.request({
                    url: that.$store.state.piAPI + 'policy/page',
                    method: 'GET',
                    data: {
                        policy: this.keyword,
                    },
                    success: (res) => {
                        that.data = res.data.data.records;
                    }
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    /* 搜索框 */
    .search-ico,
    .search-ico-1 {
        width: 40upx;
        height: 40upx;
    }
 
    .search-block {
        width: 94%;
        margin: 0 auto;
        // background-color: #007AFF;
        display: flex;
        flex-direction: row;
        position: relative;
        top: 0.55rem;
 
        .search-ico-wapper {
            background-color: #F1F1F1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 0upx 0upx 0upx 15upx;
            border-bottom-left-radius: 7px;
            border-top-left-radius: 7px;
        }
 
        .search-text {
            font-size: 14px;
            background-color: #F1F1F1;
            height: 70upx;
            width: 100%;
            padding-left: 0.5rem;
        }
 
        .search-ico-wapper1 {
            background-color: #F1F1F1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 0upx 15upx 0upx 0upx;
            border-bottom-right-radius: 7px;
            border-top-right-radius: 7px;
        }
    }
 
    .u-cell_title {
        width: 250rpx;
        float: left;
        letter-spacing: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        // background-color:#0078A8;
    }
</style>