<template>
	<view class="main">
		<view class="indexswiper" style="margin-top: 10rpx;">
			<u-swiper :list="configInfo.banners" mode="none"></u-swiper>
		</view>
		<view class="tltleStyle">
			推荐文章
		</view>
		<u-card :show-head="false" :show-foot="false" :border="false">
			<view class="" slot="body" v-for="(item,index) in list" :key="index" @click="bookinfo(item.id,item.title)">
				<view class="u-border-bottom padding-bottom-sm">
					<view class="u-body-item u-flex u-col-between u-p-t-0">
						<view class="u-body-item-title u-line-2">{{item.title}}</view>
						<image :src="item.banner_url"></image>
					</view>
					<!-- <u-tag text="情感咨询" size="mini" shape="circle" mode="dark" type="info" /> -->
				</view>
			</view>
		</u-card>
		<view class="margin-tb padding-tb-xs">
			<u-loadmore :status="nomore" :icon-type="flower" />
		</view>
		<u-no-network></u-no-network>
	</view>
</template>

<script>
	var user = require('../../common/user.js');
	export default {
		onLoad(options) {

		},
		onShow() {
			this.getbook()
			this.getconfigLsit()
		},
		mounted() {
			
		},
		data() {
			return {
				list: [],
				lunbolist: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				configInfo: {}
			}
		},
		methods: {
			getbook: async function() {
				let res = await this.$request.post("/api/v1/article/articleList")
				let status = user.islogin(res)
				if (status) {
					this.list = res.data.data
				}
			},
			bookinfo(id, title) {
				uni.navigateTo({
					url: "../common_tools/collection/collection_details?id=" + id + "&title=" + title
				})
			},
			getconfigLsit: async function() {
				let res = await this.$request.post("/api/v1/common/configList")
				console.log(res)
				if (res.status == 0) {
					this.configInfo = res.data
				}
			}
		}
	};
</script>

<style scoped lang="scss">
	.main {
		padding-top: 10rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}

	.tltleStyle {
		padding: 30rpx 30rpx 15rpx 15rpx;
		font-weight: bold;
		font-size: 40rpx;
		background-color: #fff;
	}

	.u-card-wrap {
		background-color: $u-bg-color;
		padding: 1px;
	}

	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}

	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
</style>
