<template>
	<view>
		<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="false" backgroundColor="#FFFFFF">
			<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-between">
				<view class="tn-flex tn-flex-col-center tn-flex-row-left">
					<view style="padding-left: 15rpx;" @click="goBack()">
						<text class="tn-icon-left" style="font-size: 40rpx;"></text>
					</view>
					<view class="tn-margin-top"
						style="text-shadow:  1rpx 0 0 #FFF, 0 1rpx 0 #FFF, -1rpx 0 0 #FFF , 0 -1rpx 0 #FFF;">
						<tn-tabs :list="[{name:'惠企政策分类'}]" :current="topCurrent" activeColor="#000" :bold="false"
							:fontSize="36"></tn-tabs>
					</view>
				</view>
			</view>
		</tn-nav-bar>
		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}" style="padding-bottom: 60rpx;">
			<tn-list-view :card="true" unlined="all">
				<block v-for="(item, index) in list" :key="index">
					<tn-list-cell padding="36rpx" :arrow="true"
						@click="openUrl('/pages/index/policy_list?id='+item.id)">{{item.name}}</tn-list-cell>
				</block>
			</tn-list-view>
		</view>
	</view>
</template>

<script>
	import {
		getArticlePolicy
	} from "@/util/api";
	import store from "@/store";
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.getArticlePolicyList();
		},
		methods: {
			getArticlePolicyList() {
				getArticlePolicy()
					.then(res => {
						console.log(res);
						if (res.code == 1) {
							this.list = res.data;
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none',
								duration: 2000
							});
						}
					})
					.catch(error => {
						uni.showToast({
							title: error,
							icon: 'none',
							duration: 2000
						});
					})
			},
			openUrl(url) {
				uni.navigateTo({
					url: url
				})
			},
			goBack() {
				if (getCurrentPages().length > 1) {
					uni.navigateBack()
				} else {
					uni.redirectTo({
						url: '/pages/index/index'
					})

				}
			},
		}
	}
</script>

<style>

</style>