<template>
	<view class="content addFood">
		<!-- 封面 -->
		<view class="topimg">
			<image :src="info.FMimg" mode="aspectFill"></image>
		</view>
		<!-- 信息 -->
		<view class="title">
			<view class="table">{{info.title}}</view>
			<!-- <view class="user">
				<view class="left">
					<image :src="info.create_user_head_pic"></image>
					<text>{{info.create_user_nickname}}</text>
				</view>
			</view> -->
		</view>
		<!-- 食材 -->
		<view class="food">
			<view class="desc">
				{{info.description}}
			</view>
			<view class="h4">
				所需食材
			</view>
			<view class="foodlist">
				<view class="item" v-for="(ite,ind) in info.food_list" :key="ind" v-if="info.food_list.length">
					<view class="name">{{ite.name}}</view>
					<view class="weight">
						{{ite.weight}}
					</view>
				</view>
			</view>
		</view>
		<!-- 步骤 -->
		<view class="step">
			<view class="stepList" v-for="(ite,ind) in info.step_list" :key="ind" v-if="info.step_list.length">
				<view class="top">
					<text>步骤{{ind +1}}</text>
				</view>
				<view class="right">
					<view class="desc">
						{{ite.description}}
					</view>
					<view class="image" v-for="(it,id) in ite.pic_img">
						<image :src="it" mode="aspectFill" class="mt-10"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		data() {
			return {
				info: {},
			}
		},
		onLoad(options) {
			let that = this
			let info = {}
			info = JSON.parse(options.info)
			that.info = info
		},
		methods: {}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 0 15px;
	}

	.topimg {
		width: 100%;
		height: 320px;
		background: #fff;
		border-radius: 10px;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;
		flex-direction: column;
		margin-bottom: 10px;
		overflow: hidden;
		position: relative;

		.iconfont {
			font-size: 30px;
			color: $maincolor;
		}

		text {
			display: inline-block;
			width: 100%;
			text-align: center;
			font-size: 12px;
			color: #999;
		}

		.text {
			font-size: 16px;
			color: #666;
			margin-bottom: 3px;
		}

		image {
			width: 100%;
			height: inherit;
		}
	}

	.step {
		.image {
			height: 320px;
			margin: auto;
			background: #f7f7f7;
			border-radius: 10px;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;
			flex-direction: column;
			overflow: hidden;

			image {
				width: 100%;
				height: inherit;
				display: inline-table;
			}

			icon {
				font-size: 30px;
				color: #ff4c4f;
				margin-bottom: 5px;
			}
		}
	}

	.title {
		padding: 10px;

		.table {
			font-size: 16px;
			font-weight: bold;
		}

		.user {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 15px;

			.left {
				display: flex;
				align-items: center;

				image {
					width: 25px;
					height: 25px;
					margin-right: 5px;
					border-radius: 50%;
				}
			}

			.right {
				display: flex;
			}
		}
	}

	.desc {
		width: 100%;
		line-height: 25px;
		margin-bottom: 10px;
	}

	.h4 {
		margin: 10px 0;
		padding-top: 10px;
		border-top: 1px solid #f7f7f7;

		.close {
			color: #fff;
			width: 100px;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 10px;
			background-color: $maincolor;

			image {
				width: 25px;
				height: 25px;
			}
		}
	}

	.step {
		margin-bottom: 60px;
	}

	.foodlist {
		border-radius: 10px;
		background: #fff;

		.item {
			margin-top: 0 !important;
			border-radius: 0px !important;
			border-bottom: 1px solid #f7f7f7;
		}

		.name {
			border-right: none !important;
		}
	}

	.foot {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #fff;
		display: flex;
		justify-content: space-between;
		padding: 5px 0px;
		border-radius: 10px 10px 0 0;
		box-shadow: 0px 1px 5px 2px #dfe2e1fc;

		.item {
			width: 25%;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;

			icon {
				font-size: 21px;
			}

			text {
				display: inline-block;
				text-align: center;
				width: 100%;
			}
		}
	}
</style>