<template>
	<view class="theme">
		<view class="title">请先选定一个主题进行追踪</view>
		<view class="content">
			<view class="item" 
				v-for="(item, index) in themeList" 
				@click="checkedHandle(item)"
				:key="index">
				<view class="left">
					<image :src="`../../static/theme${item.id}.png`"></image>
				</view>
				<view class="right">
					<text>{{item.title}}</text>
					<text>{{item.des}}</text>
				</view>
				<image v-if="theme.id === item.id" src="../../../static/theme.png"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex";
	import {themeList} from "./utils.js";
	
	export default {
		data() {
			return {
				themeList
			}
		},
		computed: {
			...mapState({
				theme: state => state.creatingSituations.theme
			})
		},
		methods: {
			checkedHandle: function(item) {
				this.myCommit('theme', item);
				this.myCommit('needReload', true);
				this.myCommit('stepActive', 1);
			},
			myCommit: function(key, data) {
				this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
			}
		}
	}
</script>

<style lang="less">
	.theme {
		overflow: hidden;
		width: 100%;
		height: 100%;
		.content {
			display: flex;
			flex-direction: column;
			align-items: center;
			.item {
				position: relative;
				display: flex;
				flex-direction: row;
				margin: 62.5rpx 0;
				border-radius: 15rpx;
				padding: 37.5rpx 50rpx;
				width: 625rpx;
				height: 187.5rpx;
				background: linear-gradient(270deg, #6697FE 0%, #4980F2 100%);
				box-shadow: 0 12.5rpx 12.5rpx 0 rgba(73, 128, 242, 0.2);
				>image {
					position: absolute;
					top: 10rpx;
					right: 10rpx;
					width: 46.87rpx;
					height: 46.87rpx;
				}
				.left {
					margin-right: 25rpx;
					image {
						width: 112.5rpx;
						height: 112.5rpx;
					}
				}
				.right {
					display: flex;
					flex-direction: column;
					text {
						font-size: 17.5rpx;
						line-height: 25rpx;
						color: #fff;
						&:first-child {
							margin-bottom: 5rpx;
							font-size: 30rpx;
							font-weight: bold;
							line-height: 45rpx;
						}
					}
				}
				&:first-child {
					margin-top: 125rpx;
					background: linear-gradient(270deg, #00CCBB 0%, #00CCAA 100%);
					box-shadow: 0 12.5rpx 12.5rpx 0 rgba(0, 204, 170, 0.2);
				}
			}
		}
	}
</style>
