<template>
	<view class="content">
		<block v-if="detail">
			<!-- 顶部图片 -->
			<image class="top" :src="detail.img" mode="widthFix"></image>
			<view class="box">
				<!-- 标题 -->
				<view class="title" v-if="detail.title">{{detail.title}}</view>
				<!-- 客户 -->
				<view class="client" v-if="detail.client">客户:<span>{{detail.client}}</span></view>
				<!-- 详细介绍 -->
				<view class="intro" v-if="detail.intro">
					<u-parse :content="detail.intro"></u-parse>
				</view>
				<!-- 效果 -->
				<view class="title t2" v-if="detail.effect">效果</view>
				<view class="intro" v-if="detail.effect">
					<u-parse :content="detail.effect"></u-parse>
				</view>
				<!-- 横隔线(1) -->
				<image src="../../static/imgs/line.png" class="line" v-if="detail.line1"></image>
				<!-- 改造方案 -->
				<view v-if="detail.gzfa">
					<view class="title" v-if="detail.gzfa.title">{{detail.gzfa.title}}</view>
					<view class="intro" v-if="detail.gzfa.content">
						<u-parse :content="detail.gzfa.content"></u-parse>
					</view>
				</view>
				<!-- 横隔线(2) -->
				<image src="../../static/imgs/line.png" class="line" v-if="detail.line2"></image>
				<!-- 功能列表(function) -->
				<view v-if="detail.function">
					<view class="title" v-if="detail.function.title">{{detail.function.title}}</view>
					<block v-if="detail.function.list&&detail.function.list.length">
						<uFunction :showTitle="false" :title="item.title" :list="item.list" v-for="(item,index) in detail.function.list" :key="index"></uFunction>
					</block>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import { data } from '../plan/data.js'
	export default {
		data(){
			return {
				detail:null
			}
		},
		created() {
			uni.setNavigationBarTitle({
				title:'案例'
			})
		},
		onLoad(option) {
			if(option.id&&option.key){
				this.getDetails(option.id,option.key);
			}
		},
		methods:{
			getDetails(id,key){
				let temp = data[key];
				if(temp.length){ 
					this.detail = temp.find(t=>t.id == id).details || null;
				}
			}
		}
	}
</script>

<style scoped lang="less">
	.content{
		overflow-x: hidden;
		padding-bottom: 50rpx;
		
		.top{
			width: 100%;
		}
		
		.box{
			width: 100%;
			padding: 0 30rpx 30rpx;
			box-sizing: border-box;
			
			.title{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #111111;
				line-height: 45rpx;
				margin-top: 36rpx;
				&.t2{
					margin-top: 48rpx;
				}
			}
			
			.client{
				font-family: PingFangSC, PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
				line-height: 45rpx;
				margin-top: 21rpx;
				span{
					font-size: 30rpx;
					line-height: 42rpx;
					color: #134F99;
				}
			}
			
			.intro{
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				line-height: 48rpx;
				letter-spacing: 2rpx;
				margin-top: 21rpx;
			}
			
			.effect{
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				line-height: 40rpx;
				margin-top: 6rpx;
			}
		
			.line{
				width: calc(100% + 60rpx);
				height: 10rpx;
				margin-top: 48rpx;
				position: relative;
				left: -30rpx;
			}
		}
	}
</style>