<template>
	<view class="">
		<no-none v-if="list.length<=0"></no-none>
		<block v-else>
			<view class="itemContent" v-for="(item,index) of list" @click="onNavigateTo(item.id)" :key='index' >
				<view class="">
					{{item.title}}
				</view>
				<view class="box-pack-between">
					<view class="">
					</view>
					<view class="itemContentTime">
						{{item.create_time}}
					</view>
				</view>

			</view>			
			
			<loading :is_load="is_load" :is_load_more='is_load_more'></loading>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				store_id: "",
				is_load: false,
				is_load_more: false,
			}
		},
		onLoad(e) {			
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: this.$store.state.color,
			})
			this.http();
		},
		onReachBottom() {
			if (!this.is_load) {
				this.page = this.page + 1;
				this.http();
			}
		},
		methods: {
			onNavigateTo(id){
				uni.navigateTo({
					url:`/shop/richText/index?id=${id}`
				})
			},
			http() {
				let store_id = uni.getStorageSync('store_id');
				this.$http.request('yy/article_list', {
					store_id,
					page:this.page,
					limit:30
				}).then(res => {
					if (res.code == "200") {
						if (res.data.length == 0) {
							    this.is_load = true,
								this.is_load_more = true,
								setTimeout(() => {
									this.is_load_more = false
								}, 1e3);
							return
						}
						this.is_load = false;
						this.list = this.list.concat(res.data);
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			}
		},
	}
</script>

<style>
	page{
		background: #FFFFFF;
	}
	.itemContent{
		padding: 20rpx;
		border-bottom: 1rpx solid #F1F1F1;
	}
	.itemContentTime{
		font-size: 26rpx;
		color: #999;
		padding-top: 20rpx;
	}
	
</style>
