fix
Helius
2021-02-20 45fb4b11ad51bb38306765b11a6747402e382cee
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
    <!-- 当前客户 -->
    <view class="container">
        <view class="list">
            <scroll-view class="list-left" scroll-y="true">
                <view class="list-left-row" 
                    v-for="item in typeList" 
                    :class="item.id==typeId?'active':''"
                    @click="changeType(item.id)">
                        <text>{{item.articleTypeName}}</text>
                </view>
            </scroll-view>
            <scroll-view class="list-right" scroll-y="true" @scrolltolower="scrolltolower()">
                <navigator :url="'./knowledgeDetail?id='+item.id" hover-class="none" v-for="item in list">
                    <view class="list-right-row">
                        <image class="product-img" :src="item.image?item.image:'../../static/images/no-img.png'"></image>
                        <view class="flex-1">
                            <text class="font-13">{{item.title}}</text>
                            <view class="desc">
                                <text>{{item.articleTypeName}}</text>
                            </view>
                        </view>
                    </view>
                </navigator>
                <no-record :isShow="!list.length"></no-record>
                <view v-if="list.length">
                    <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
                </view>
            </scroll-view>
        </view>
    </view>
</template>
 
<script>
    import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
    export default {
        components: {
            uniLoadMore
        },
        data(){
            return{
                typeList: [], 
                list: [],
                typeId: '',
                loadStatus: 'more',
                pageNum: 1
            }
        },
        onLoad(options) {
            this.loadTypeList()
        },
        onPullDownRefresh(){
            this.reloadData();
            let timer = setTimeout(function () {
                uni.stopPullDownRefresh();
                clearTimeout(timer);
                timer = null;
            }, 800);
        },
        methods:{
            reloadData(){
                this.list = [];
                this.pageNum = 1;
                this.loadStatus = 'more';
                this.loadList();
            },
            scrolltolower(){
                this.loadList()
            },
            loadTypeList(){
                this.$httpUtils.request('/api/know/findKnowledgeType').then((res) => {
                    if(res.status == 200){
                        let result = res.rows;
                        this.typeList = result;
                        if(result.length){
                            this.typeId = result[0].id;
                            this.loadList()
                        }
                    }
                })
            },
            loadList(){
                if(this.loadStatus!=='more'){
                    return;
                }
                this.$httpUtils.request('/api/know/findArticleList', {
                    pageNum: this.pageNum,
                    pageSize: 10,
                    typeId: this.typeId
                }, 'POST').then((res) => {
                    if(res.status == 200){
                        let result = res.rows;
                        if(result.length < 10){
                            this.loadStatus = 'noMore';
                        } else {
                            this.pageNum ++ ;
                            this.loadStatus = 'more';
                        }
                        this.list = this.list.concat(result);
                    }
                })
            },
            changeType(id){
                this.typeId = id;
                this.reloadData()
            }
        }
    }
</script>
 
<style>
    page{
        height: 100%;
    }
    .container{
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 10px 0 0;
        box-sizing: border-box;
    }
    .list{
        flex: 1;
        display: flex;
        overflow: hidden;
    }
    .list-left{
        width: 170rpx;
        flex: 0 0 170rpx;
        background: #F6F6F8;
        border-radius: 4px;
    }
    .list-right{
        flex: 1;
    }
    .list-left-row{
        padding: 10px;
        color: #8c9fad;
        font-size: 13px;
    }
    .list-left-row.active{
        background: #FFFFFF;
        color: #000000;
    }
    .list-right-row{
        display: flex;
        padding: 10px;
        margin: 0 10px 10px;
        border: 1px solid #EDEAF4;
        box-shadow:0 6px 6px rgba(237,234,244,0.5);
        border-radius: 4px;
        font-size: 12px;
    }
    .list-right-row .product-img{
        width: 62px;
        height: 62px;
        margin-right: 10px;
    }
    .desc{
        margin-top: 8px;
        color: #a5abaf;
        word-break: break-all;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }
</style>