<template>
	<view class="catsstyle2">
		<view class="item" v-for="(x, index) in d" :key="index" @click="clickHandler(x)" :data-url='x.page_url'>
			<view class="left">{{x.Name}}</view>
			<view class="right">
				<image :src="getIconLink(x.IconPath)" style="width:100%;height:100%" mode="aspectFit" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ["d"],
		methods: {
			goUrl(e) {
				uni.navigateTo({
					url: e.mp.currentTarget.dataset.url
				})
			},
			clickHandler(item) {
				let IsEducation = uni.getStorageSync('basedata') ?
					(uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall.setting.mallStyle
						.IsEducation : 0) :
					0;
				if (IsEducation == 1) {
					uni.navigateTo({
						url: '/pages/school/courseList?CategoryIds=' + item.Id
					});
				} else {
					uni.navigateTo({
						url: '/pages/goods/list?CategoryIds=' + item.Id
					});
				}
			},
		},
	};
</script>

<style>
	.catsstyle2 {
		padding: 12px 12px 0 12px;
	}

	.catsstyle2 .item {
		height: 80px;
		display: flex;
		background: #f5f5f5;
		margin-bottom: 12px;
	}

	.catsstyle2 .item .left {
		padding: 15px;
		font-size: 18px;
		font-weight: 600;
		color: #666;
		flex: 1;
		width: 1px;
	}

	.catsstyle2 .item .right {
		margin-top: 16px;
		width: 80px;
		height: 64px;
		text-align: right;
		margin-right: 0px;
	}

	.catsstyle2 .item .right img {
		width: 80px;
		height: 64px;
	}
</style>
