<template>
	<view class="uni-flex uni-column" style="align-items: center;" @click="valueChange(value)">
		<view class="content" :class="checked?'checked':''">
			<image :src="'/static/layer-'+icon+'.png'" :class="icon==='cd'?'icon2':'icon'"></image>
			<uni-icons v-if="checked" type="checkbox-filled" class="check-icon" color="#fff"></uni-icons>
		</view>
		<view style="text-align: center;width: 64px;" :class="checked?'checked':''">{{label}}</view>
	</view>
</template>

<script>
	export default {
		name: "layer-checkbox",
		props: {
			label: String,
			value: String,
			change: Function,
			icon: String,
			checked: Boolean
		},
		data() {
			return {
			};
		},
		methods: {
			valueChange(value) {
				this.$emit('change', value);
			}
		}
	}
</script>

<style scoped>
	.checked {
		border-color: #ff0 !important;
		color: #01D393 !important;
	}

	.icon2 {
		position: absolute;
		width: 60px;
		height: 60px;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
	}

	.icon {
		width: 72px;
		height: 72px;
		position: absolute;
		left: -6px;
		right: -6px;
		top: -6px;
		bottom: -6px;
	}

	.check-icon {
		position: absolute;
		top: 0;
		right: 0;
	}

	.content {
		width: 60px;
		height: 60px;
		border: 1px solid #ddd;
		border-radius: 12px;
		margin-bottom: 8px;
		position: relative;
		overflow: hidden;
	}
</style>