<template>
    <view class="waper">
        <u-navbar :autoBack="true" bgColor="#fff">
        	<view slot='center' class="navbar_title">{{channelName}}</view>
        </u-navbar>
        <mescroll-body @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption" :top="paddingTop + 'px'">
            <view class="list_waper">
                <navigator hover-class="none" class="list" v-for="(item, index) in list" :url="'/pages/strategy/detail?id=' + item.id" :key="index">
                    <view class="img">
                        <image :src="$utils.setImgUrl(item.image)" mode=""></image>
                    </view>
                	<view class="info">
                		<view class="title">{{item.title}}</view>
                		<view class="msg">{{item.description || ''}}</view>
                		<view class="from">
                			<view class="left">{{$utils.formatDate('Y-M-D', item.publishtime * 1000)}}</view>
                			<view class="right">
                				<u-icon name="eye" size="28rpx" color="rgba(0, 0, 0, 0.45)" top="2rpx"></u-icon>
                				<view class="num">{{item.views}}</view>
                			</view>
                		</view>
                	</view>
                </navigator>
            </view>
        </mescroll-body>
    </view>
</template>

<script>
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
export default {
    mixins: [MescrollMixin],
    data() {
        return {
            downOption: { auto: false },
            paddingTop: 0,
            list: [],
            channelId: '',
            channelName: ''
        }
    },
    onLoad (options) {
        this.channelName = options.name;
        this.channelId = options.id;
        this.paddingTop = this.$paddingTop;
        this.mescroll && this.mescroll.resetUpScroll();
    },
    methods: {
        async upCallback (page) {
            let obj = { pageNum: page.num, pageSize: page.size, channelId: this.channelId };
            let info = await this.$http.archivesList(obj);
            if (page.num == 1) this.list = [];
            this.list = this.list.concat(info.rows)
            this.mescroll.endBySize(info.rows.length, info.total);
        }
    }
}
</script>

<style lang="scss">

.menu{
    width: 100%; height: 110rpx; background: #fff; box-sizing: border-box; padding: 0 154rpx; display: flex; justify-content: space-between; align-items: center; position: fixed; left: 0; z-index: 11;
    view{
        color: #333; height: 46rpx; line-height: 46rpx; font-size: 32rpx; font-weight: 500;
        &.active{
            color: #00BE69; font-weight: bold; position: relative;
            &::after{ content: ""; width: 30rpx; height: 8rpx; background: #00BE69; border-radius: 12rpx; position: absolute; left: 50%; transform: translateX(-50%); bottom: -12rpx; }
        }
    }
}
.list_waper{
    width: 100%; box-sizing: border-box; padding: 32rpx;
    .list{
        width: 100%; box-sizing: border-box; margin-bottom: 20rpx; padding: 20rpx; padding-left: 288rpx; position: relative; height: 222rpx; border-radius: 10rpx; background: #fff;
        &:last-child{ margin-bottom: 0; }
        .img{
            width: 243rpx; height: 182rpx; position: absolute; left: 20rpx; top: 20rpx;
            image{ border-radius: 10rpx; }
        }
        .info{
            width: 100%; height: 100%; box-sizing: border-box; padding-top: 4rpx;
            .title{ line-height: 48rpx; color: rgba(0, 0, 0, 0.85); font-size: 32rpx; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            .msg{ margin-top: 8rpx; line-height: 42rpx; color: rgba(0, 0, 0, 0.65); font-size: 28rpx; height: 84rpx; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
        }
        .from{
            width: 100%; margin-top: 0; height: 36rpx; display: flex; justify-content: space-between; align-items: center;
            .left{ color: rgba(0, 0, 0, 0.45); font-size: 24rpx; }
            .right{
                display: flex; align-items: center;
                .num{ color: rgba(0, 0, 0, 0.45); font-size: 24rpx; margin-left: 4rpx; }
            }
        }
    }
}
</style>